Repository navigation
fix: support MCP Python SDK 2.x (FastMCP renamed to MCPServer) - #10
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 and README.md - Add offline in-process initialize-handshake regression test (tests/test_mcp_handshake.py) - Run the handshake regression test in CI before the pytest suite - Bump version to 1.3.2 and add CHANGELOG entry 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
pyproject.tomldeclaredmcp>=1.0.0with no upper bound. The current MCP Python SDK 2.x renamedFastMCPtoMCPServer(from mcp.server.mcpserver import MCPServer), so every fresh install (uvx gemini-bridge) resolved to mcp 2.x and crashed at startup with:PyPI latest published (1.3.1) has
requires_dist ['mcp>=1.0.0'], so the published package is broken for every new install right now.Fix
Mirrors the codex-bridge fix (eLyiN/codex-bridge#6, released as 1.2.4):
src/mcp_server.py:from mcp.server.mcpserver import MCPServerandmcp = MCPServer("gemini-assistant")— nothing else touched in that file.mcp>=2,<3inpyproject.tomland the README dependency mention. CI installs the built wheel, so the bound flows through transitive resolution; no workflow pins the old range.tests/test_mcp_handshake.py: completes a real MCPinitializehandshake against the server object and asserts the tool list is exactlyconsult_gemini,consult_gemini_with_files,web_search. No network, ~0.01s. Also runs as a CI step before pytest.pyproject.toml,src/__init__.py) with a CHANGELOG entry dated 2026-09-30.Verification (clean venv, real run)
Created a clean venv with
/opt/homebrew/bin/python3.11 -m venv,pip install'd the repo into it (resolved mcp 2.2.0), then drove the installedgemini-bridgeconsole script over stdio with JSON-RPCinitialize+tools/list. Literal output:In-process regression test in the same venv:
Existing suite:
38 passed in 0.35s.Release gating
The PyPI release (tag +
v1.3.2publish via the release workflow) is intentionally left to a human. This PR only fixes the code.