Repository navigation
fix: support MCP Python SDK 2.x (FastMCP renamed to MCPServer) - #6
Merged
Merged
Conversation
- Migrate src/mcp_server.py to mcp>=2: from mcp.server.mcpserver import MCPServer - Bound dependency to mcp>=2,<3 in pyproject.toml, ci.yml and release.yml - Add offline in-process initialize-handshake regression test Root cause: the unbounded mcp>=1.0.0 dependency resolved to SDK 2.x, where FastMCP was removed/renamed to MCPServer, so published installs crashed at startup with ModuleNotFoundError: No module named 'mcp.server.fastmcp'.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
Third-party directories and the README tell users to run
uvx codex-bridge. That installresolved the unbounded
mcp>=1.0.0dependency to the 2.x SDK, whereFastMCPno longerexists, so the published package died at startup:
Fix
src/mcp_server.pyto the 2.x SDK:from mcp.server.mcpserver import MCPServer,mcp = MCPServer("codex-assistant").mcp>=2,<3inpyproject.toml,.github/workflows/ci.yml(which installed
mcp>=1.0.0literally) and.github/workflows/release.yml.tests/test_mcp_handshake.py: an offline, in-process MCPinitializehandshake thatlists the tools, so this class of breakage fails CI instead of shipping.
pyproject.tomlandsrc/__init__.py, with a CHANGELOG entry.Verification (real output, not claims)
pip install .on the branch, resolving mcp 2.2.0: console script completes thehandshake and returns
serverInfo.name = codex-assistantwith the three tools(
consult_codex,consult_codex_with_stdin,consult_codex_batch).python tests/test_mcp_handshake.pypasses in 0.01s.above.
Not in this PR
The PyPI release (tag
v1.2.4) is deliberately not pushed. That step needs explicit humanapproval; after merge,
git tag v1.2.4 && git push origin v1.2.4triggers the release workflow.