Skip to content

Commit baca2b6

Browse files
committed
remove support for other fastmcp module from jlowin/fastmcp
1 parent ca4be52 commit baca2b6

File tree

3 files changed

+13
-23
lines changed

3 files changed

+13
-23
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ dev = [
5858
"pytest-examples>=0.0.14",
5959
"pytest-pretty>=1.2.0",
6060
"inline-snapshot>=0.23.0",
61-
"dirty-equals>=0.9.0",
61+
"dirty-equals>=0.9.0"
6262
]
6363
docs = [
6464
"mkdocs>=1.6.1",

src/mcp/cli/cli.py

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -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)

uv.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)