@@ -132,6 +132,7 @@ def init(
132132 mode : Union [tools .ToolType , List [tools .ToolType ]] = None ,
133133 transport : Transports = Transports .stdio ,
134134 port : int = None ,
135+ host : str = "127.0.0.1" ,
135136 support_project_id_endpoints : bool = False ,
136137) -> FastMCP :
137138 mcp_cls = FastMCP if transport == Transports .stdio else FastMCPServerWithAuthToken
@@ -141,6 +142,8 @@ def init(
141142 opts = {"log_level" : "DEBUG" , "debug" : True }
142143 if port is not None :
143144 opts ["port" ] = port
145+ if host is not None :
146+ opts ["host" ] = host
144147 mcp = mcp_cls ("Dremio" , ** opts )
145148 if transport == Transports .streamable_http and support_project_id_endpoints :
146149 mcp .support_project_id_endpoints = support_project_id_endpoints
@@ -224,6 +227,12 @@ def main(
224227 ),
225228 ] = "INFO" ,
226229 port : Annotated [Optional [int ], Option (help = "The port to listen on" )] = None ,
230+ host : Annotated [
231+ Optional [str ],
232+ Option (
233+ help = "Where uvicorn listens for requests"
234+ ),
235+ ] = "127.0.0.1" ,
227236):
228237 log .configure (enable_json_logging = enable_json_logging , to_file = log_to_file )
229238 log .set_level (log_level )
@@ -246,6 +255,7 @@ def main(
246255 mode = cfg .tools .server_mode ,
247256 transport = transport ,
248257 port = port ,
258+ host = host ,
249259 support_project_id_endpoints = True ,
250260 )
251261 app .run (transport = transport .value )
0 commit comments