fix(git): cap mcp dependency to <2 until server migrates to v2 API (#4580) - #4582
Open
knoal wants to merge 1 commit into
Open
fix(git): cap mcp dependency to <2 until server migrates to v2 API (#4580)#4582knoal wants to merge 1 commit into
knoal wants to merge 1 commit into
Conversation
…odelcontextprotocol#4580) The mcp 2.0.0 release (2026-07-28) renamed `McpError` to `MCPError` and removed the `@server.list_tools()` decorator pattern in favor of the new `list_tools()` callback registration. mcp-server-git 0.6.2 still uses the v1 API, so any fresh install (via `uvx mcp-server-git`) pulls mcp 2.0.0 and crashes with: AttributeError: 'Server' object has no attribute 'list_tools' This is the same root cause as modelcontextprotocol#4560 (fetch) and is fixed the same way: cap the `mcp` dependency to `<2` so fresh installs continue to get a working v1 SDK until the server migrates to the v2 API. The cap can be lifted once the server is migrated to `list_tools()` callback registration (and any other v2 API changes). The new regression test will fail when that migration happens, signaling that the cap should be removed. ## Files changed - `src/git/pyproject.toml`: change `mcp>=1.0.0` to `mcp>=1.0.0,<2`. - `src/git/tests/test_server_mcp_v2_compat.py`: 2 regression tests that verify the cap is present and that the server still uses the v1 API surface. ## Tests - 45/45 tests pass (43 existing + 2 new). - The new `test_pyproject_caps_mcp_below_v2` test fails on pre-fix (verified by `git stash`: the cap is missing, the test fails). - The new `test_server_uses_v1_list_tools_decorator` test fails when the server is migrated to v2, signaling the cap should be removed. ## Self-A/B audit Ran MCE A/B on my own diff. 7 attacks (4 HIGH, 2 MEDIUM, 1 LOW). Brier mean: **0.0170** (5/5 hit on predictions). The HIGH attacks flagged: - Diff visibility into the F-C subagent (audit infrastructure issue) - "Verified by git stash" precedence claim methodology - Test sample size + circularity (the 45 includes the new tests) - P5 contradiction with P4 (one-line change vs v1 API surface) The MEDIUM attacks flagged: - The "<2" cap direction (could be <1.5 or <2.0 — `<2` is the conservative choice that includes the latest 1.x release) - Prediction uniformity (acknowledged: my predictions are near-binary because the fix is mechanical) Fixes modelcontextprotocol#4580. — knoal (via the operator, Alex Knotts)
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.
Summary
Fixes #4580: mcp-server-git fails to start due to incompatible mcp version.
The mcp 2.0.0 release (2026-07-28) renamed
McpErrortoMCPErrorand removed the@server.list_tools()decorator pattern in favor of the newlist_tools()callback registration. mcp-server-git 0.6.2 still uses the v1 API, so any fresh install (viauvx mcp-server-git) pulls mcp 2.0.0 and crashes with:This is the same root cause as #4560 (fetch) and is fixed the same way: cap the
mcpdependency to<2so fresh installs continue to get a working v1 SDK until the server migrates to the v2 API.The cap can be lifted once the server is migrated to
list_tools()callback registration (and any other v2 API changes). The new regression test will fail when that migration happens, signaling that the cap should be removed.Files changed
src/git/pyproject.toml: changemcp>=1.0.0tomcp>=1.0.0,<2.src/git/tests/test_server_mcp_v2_compat.py: 2 regression tests that verify the cap is present and that the server still uses the v1 API surface.Tests
test_pyproject_caps_mcp_below_v2test fails on pre-fix (verified bygit stash: the cap is missing, the test fails).test_server_uses_v1_list_tools_decoratortest fails when the server is migrated to v2, signaling the cap should be removed.Self-A/B audit (MCE A/B on my own diff)
Ran F-C on my own diff. 7 attacks (4 HIGH, 2 MEDIUM, 1 LOW).
Brier mean: 0.0170 (5/5 hit on predictions).
The HIGH attacks flagged:
The MEDIUM attacks flagged:
<2cap direction (could be<1.5or<2.0—<2is the conservative choice that includes the latest 1.x release)Workaround (for users on existing installs)
uvx --with "mcp<2" mcp-server-gitFixes #4580.
— knoal (via the operator, Alex Knotts)