@@ -150,27 +150,15 @@ def _check_server_object(server_object: Any, object_name: str):
150150 Returns:
151151 True if it's supported.
152152 """
153- try :
154- from fastmcp import FastMCP as ExternalFastMCP
155- except ImportError :
156- ExternalFastMCP = None
157-
158- valid_types = [FastMCP ]
159- if ExternalFastMCP :
160- valid_types .append (ExternalFastMCP )
161153
162- if not isinstance (server_object , tuple (valid_types )):
163- logger .error (f"The server object { object_name } is of type { type (server_object )} (expecting one of { valid_types } )." )
154+ if not isinstance (server_object , FastMCP ):
155+ logger .error (
156+ f"The server object { object_name } is of type { type (server_object )} (expecting { FastMCP } )."
157+ )
164158 if isinstance (server_object , LowLevelServer ):
165159 logger .warning (
166160 "Note that only FastMCP server (from ) is supported. Low level Server class is not yet supported."
167161 )
168- else :
169- logger .warning (
170- "Tip: Supported FastMCP classes come from either "
171- "`mcp.server.fastmcp.FastMCP` (SDK built-in) "
172- "or `fastmcp.FastMCP` (PyPI package)."
173- )
174162 return False
175163 return True
176164
@@ -324,7 +312,7 @@ def run(
324312 str | None ,
325313 typer .Argument (
326314 help = "Python file to run, optionally with :object suffix (omit when using --from)" ,
327- )
315+ ),
328316 ] = None ,
329317 transport : Annotated [
330318 str | None ,
@@ -339,7 +327,7 @@ def run(
339327 typer .Option (
340328 "--from-github" ,
341329 help = "Run a remote MCP server directly from a Github URL (raw Github file or Github repo URL)" ,
342- )
330+ ),
343331 ] = None ,
344332) -> None :
345333 """Run a MCP server.
@@ -360,7 +348,6 @@ def run(
360348 typer .echo ("Error: You cannot specify both a file path and --from URL" )
361349 raise typer .Exit (code = 1 )
362350
363-
364351 if not file_spec and from_url :
365352 from urllib .parse import urlparse
366353
@@ -374,11 +361,12 @@ def run(
374361 if parsed .netloc == "github.com" :
375362 from_url = from_url .replace ("github.com" , "raw.githubusercontent.com" ).replace ("/blob/" , "/" )
376363 logger .info (f"Converted GitHub URL to raw: { from_url } " )
377-
364+
378365 logger .info (f"Fetching MCP server from { from_url } " )
379366
380367 try :
381368 import requests
369+
382370 with requests .get (from_url , stream = True , timeout = 10 ) as res :
383371 res .raise_for_status ()
384372 temp_dir = tempfile .mkdtemp (prefix = "mcp_from_" )
@@ -395,7 +383,7 @@ def run(
395383
396384 assert file_spec is not None
397385 file , server_object = _parse_file_path (file_spec )
398-
386+
399387 logger .debug (
400388 "Running server" ,
401389 extra = {
@@ -551,4 +539,4 @@ def install(
551539 logger .info (f"Successfully installed { name } in Claude app" )
552540 else :
553541 logger .error (f"Failed to install { name } in Claude app" )
554- sys .exit (1 )
542+ sys .exit (1 )
0 commit comments