Skip to content

fix: pin mcp to <2 (2.0.0 removed mcp.server.fastmcp) - #164

Merged
vchomakov merged 1 commit into
redis:mainfrom
cyb3ralbert:pin-mcp-v1
Jul 31, 2026
Merged

vchomakov merged 1 commit into
redis:mainfrom
cyb3ralbert:pin-mcp-v1

Conversation

@cyb3ralbert

@cyb3ralbert cyb3ralbert commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #163.

mcp 2.0.0 (released 28 July 2026) removed the mcp.server.fastmcp package — the FastMCP server now lives under mcp.server.mcpserver. Since pyproject.toml declares mcp[cli]>=1.26.0 with no upper bound, any fresh resolution picks up 2.0.0 and the server fails to start:

File ".../site-packages/src/common/server.py", line 3, in <module>
    from mcp.server.fastmcp import FastMCP
ModuleNotFoundError: No module named 'mcp.server.fastmcp'

This affects both installation paths documented in the README (pip install redis-mcp-server and uvx --from redis-mcp-server@latest), and it is what has been turning the nightly build-test job red since 29 July — the ⚙️ Test package installation step is the only one that installs the built wheel without uv.lock, so it is the only job that sees what users actually get.

This PR adds the upper bound, and updates the matching requires-dist entry in uv.lock so the lockfile stays consistent (uv lock --check passes; the resolved version is unchanged at 1.28.1).

Verified locally by reproducing the failing CI step against the wheel built from this branch:

$ uv build --sdist --wheel
$ python3 -m venv verify-venv && ./verify-venv/bin/pip install dist/*.whl
$ ./verify-venv/bin/pip show mcp | head -2
Name: mcp
Version: 1.29.0
$ ./verify-venv/bin/redis-mcp-server --help
Usage: redis-mcp-server [OPTIONS]
  Redis MCP Server - Model Context Protocol server for Redis.

Two things this PR deliberately does not do, both noted in #163:

  • It does not fix the already-published 0.5.0. That wheel is on PyPI with mcp[cli]>=1.9.4 and will keep resolving to 2.0.0 until a patch release goes out.
  • It does not migrate to mcp 2.x. src/common/server.py constructs FastMCP directly and tests/test_server.py asserts on the mcp.server.fastmcp.server.FastMCP type in several places, so that migration is a larger change and a separate decision. Pinning <2 is the minimal fix that restores installs today.

Note

Low Risk
Only tightens the declared dependency range and lock metadata; no runtime logic changes.

Overview
Pins mcp[cli] to >=1.26.0,<2 in pyproject.toml and mirrors the same specifier in uv.lock so fresh installs no longer resolve mcp 2.x, which removed mcp.server.fastmcp and breaks server startup (ModuleNotFoundError on FastMCP).

This is a dependency-only fix; no application or test code changes. The lockfile’s resolved mcp version stays on the 1.x line.

Reviewed by Cursor Bugbot for commit faeb09f. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.20%. Comparing base (7484ecc) to head (faeb09f).
⚠️ Report is 87 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #164      +/-   ##
==========================================
+ Coverage   86.32%   88.20%   +1.88%     
==========================================
  Files          18       19       +1     
  Lines         848     1060     +212     
==========================================
+ Hits          732      935     +203     
- Misses        116      125       +9     
Flag Coverage Δ
unittests 88.20% <ø> (+1.88%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vchomakov vchomakov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cyb3ralbert for the excellent report and fix — the diagnosis, the scoping, and the notes on what this deliberately doesn't cover are all spot on.

Verified independently on our side:

  • Reproduced the failure in a clean venv: pip install redis-mcp-server resolves mcp 2.0.0 and redis-mcp-server --help fails with the reported ModuleNotFoundError: No module named 'mcp.server.fastmcp'.
  • With this pin, a wheel built from this change installs cleanly in a fresh venv (mcp resolves to 1.29.0) and the CLI starts fine.
  • Full CI matrix is green on this PR, including the previously failing build-test job.

The <2 bound also matches upstream's own guidance — the mcp SDK migration guide explicitly recommends keeping an upper bound until migrating to the 2.x MCPServer API, and the 1.x line stays maintained with critical/security fixes.

Follow-ups on our side after merging: a 0.5.1 patch release so the fix actually reaches PyPI users (0.5.0's metadata is immutable), and a separate issue for the mcp 2.x migration.

@vchomakov
vchomakov merged commit 5a79c13 into redis:main Jul 31, 2026
20 checks passed
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.

redis-mcp-server from PyPI fails to start: mcp 2.0.0 removed mcp.server.fastmcp

3 participants