Skip to content

fix: compatibility with mcp>=2 / fastmcp>=3 (fixes #25) - #27

Open
LelouchOTR wants to merge 1 commit into
MiniMax-AI:mainfrom
LelouchOTR:main
Open

fix: compatibility with mcp>=2 / fastmcp>=3 (fixes #25)#27
LelouchOTR wants to merge 1 commit into
MiniMax-AI:mainfrom
LelouchOTR:main

Conversation

@LelouchOTR

@LelouchOTR LelouchOTR commented Aug 6, 2026

Copy link
Copy Markdown

What

Fixes #25 — the package crashes on startup with
ModuleNotFoundError: No module named 'mcp.server.fastmcp' when installed
via uvx against mcp>=2.0.0 (released 2026-07-28).

Why

mcp==2.0.0 removed the mcp.server.fastmcp submodule. The high-level
FastMCP decorator API (@mcp.tool(...)) was extracted out of mcp and
into the standalone fastmcp PyPI
package as of fastmcp 2.x. The repo's pyproject.toml accidentally
listed fastmcp as a dev extra only, so the runtime import had no
fallback on mcp>=2 — that is the actual root cause, not just a missing
upper bound.

Diff

minimax_mcp/server.py

-from mcp.server.fastmcp import FastMCP
+from fastmcp import FastMCP
@@
-fastmcp_log_level = os.getenv(ENV_FASTMCP_LOG_LEVEL) or "WARNING"
@@
-mcp = FastMCP("Minimax", log_level=fastmcp_log_level)
+mcp = FastMCP("Minimax")

pyproject.toml

 dependencies = [
-    "mcp[cli]>=1.6.0",
+    "mcp>=1.6.0",
+    "fastmcp>=3.0",
     "python-dotenv>=1.0.1",
     "requests>=2.31.0",
 ]

minimax_mcp/__init__.py bumps __version__ to 0.1.0.

Total: +6 / -7 across 3 files.

Verification

End-to-end against the live MiniMax API with a fresh uvx-resolved env:

  • MCP initializeserver='Minimax' version='3.4.6' protocol='2025-11-25'
  • tools/list['understand_image', 'web_search']
  • web_search('MiniMax M3 model release date') → 9 organic results, base_resp.status_code=0
  • understand_image('https://httpbin.org/image/png') → correctly described as "round, pink cartoon pig face"

Resolved env: mcp==1.29.0, fastmcp==3.4.6.

Pinning note

Pinning fastmcp>=3.0 raises the effective floor above what 0.0.4
required (fastmcp was a dev-only extra so effectively zero). This is
intentional: the alternative — keeping from mcp.server.fastmcp import FastMCP — is literally impossible, since that module was deleted in
mcp==2.0.0. If you'd prefer a lower floor, I can target
fastmcp>=2,<3 instead; that line still accepts the legacy
log_level= constructor kwarg, so server.py becomes a single-line
change and the dropped-kwarg part of the diff goes away.

Version bump is 0.0.4 → 0.1.0; happy to mark it 0.0.5 if you'd
prefer semver-strict.


Reported-by: @LelouchOTR
Tested-by: @LelouchOTR
Refs: #25


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Upstream issue MiniMax-AI#25
breaks the package on mcp>=2.0.0 because that release removed the
`mcp.server.fastmcp` module.

Changes:
* Replace the broken `from mcp.server.fastmcp import FastMCP` import with
  `from fastmcp import FastMCP` (the high-level API was extracted into
  the standalone fastmcp PyPI package as of fastmcp 2.0).
* Add `fastmcp>=3.0` as a runtime dependency (it was previously only in
  the optional dev extras, which is the actual root cause).
* Drop the `log_level=` kwarg from the `FastMCP` constructor (removed in
  fastmcp>=3; the `FASTMCP_LOG_LEVEL` env var is still honoured by
  fastmcp directly).
* Drop the now-unused `fastmcp_log_level` local.
* Bump `[project] version` and `__version__` to 0.1.0.

Diff vs upstream is +6/-7 across 3 files. End-to-end verified:
`web_search` returns organic results, `understand_image` describes a
real test image, MCP `initialize` and `tools/list` succeed without
timeout.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broken after mcp 2.0.0: ModuleNotFoundError: No module named 'mcp.server.fastmcp'

1 participant