Skip to content

fix: cap mcp dependency below 2.0 and use instructions kwarg (adopted from #326) - #331

Open
K4bain wants to merge 1 commit into
tadata-org:mainfrom
K4bain:fix/mcp-1-12-compat
Open

fix: cap mcp dependency below 2.0 and use instructions kwarg (adopted from #326)#331
K4bain wants to merge 1 commit into
tadata-org:mainfrom
K4bain:fix/mcp-1-12-compat

Conversation

@K4bain

@K4bain K4bain commented Aug 27, 2026

Copy link
Copy Markdown

Adopted from #326 (original patch by @Daniyal0100101) — rebased onto current main and verified.

Why this is needed

pyproject.toml declares mcp>=1.12.0 with no upper bound. mcp 2.x is now out, and under 2.x this package fails at import/collection time (the lowlevel Server API was redesigned — the list_tools/call_tool decorator registration no longer exists). Every fresh pip install fastapi-mcp currently resolves to mcp 2.x and is broken out of the box.

This PR:

  1. Caps the dependency at mcp>=1.12.0,<2.0.0 so installs resolve to a known-good mcp 1.x.
  2. Passes the server description via the instructions= kwarg instead of the removed positional description argument (forward-compatible with mcp 1.x).

Verification

  • Full unit suite: 69 passed against mcp 1.29.1 (latest 1.x).
  • Without this cap, on mcp 2.1.1 the test suite fails during collection (ImportError from mcp.shared.memory).

Proper mcp 2.x support (adapting setup_server() to the new handler-registration API) is follow-up work; this PR stops the bleeding for new installs.

Adopted from tadata-org#326 (original patch by @Daniyal0100101), rebased and verified against mcp 1.29.1.

Copy link
Copy Markdown

I’ve closed #326 now that this PR supersedes it. The CI run here is also blocked on the same fork approval gate, and I only have read access to the repo. @itay-tadata, could you approve the workflow when you get a chance?

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.

2 participants