fix(fetch): cap mcp dependency below 2.0 - #4611
Open
guptaishaan wants to merge 1 commit into
Open
Conversation
mcp>=1.1.3 had no upper bound, so a fresh `uvx mcp-server-fetch` resolved mcp 2.0.0. That release renamed McpError to MCPError and removed the low-level Server decorators, so server.py raised ImportError at line 6 and exited before writing an initialize response. Clients reported "connection closed: initialize response". Cap the requirement at mcp>=1.1.3,<2 and refresh uv.lock to match. The lock already pinned mcp 1.28.1, so CI was unaffected; only fresh resolves broke. Not a port to mcp 2.0: list_tools, list_prompts, call_tool, and get_prompt are all gone from the low-level Server and server.py uses all four. Verified with a real stdio handshake on Python 3.12. The published 2026.7.10 returns no initialize response; a wheel built from this change resolves mcp 1.29.0 and answers tools/list with ['fetch']. tests/test_dependencies.py covers the specifier.
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.
Fixes #4600
mcp>=1.1.3has no upper bound, so a freshuvx mcp-server-fetchnow resolves mcp 2.0.0, which renamedMcpErrortoMCPErrorand dropped the low-levelServerdecorators.server.pydies on the import at line 6 before writing anything to stdout, which the client sees asconnection closed: initialize response.This caps the requirement at
mcp>=1.1.3,<2and updatesuv.lockto match. The lock already pinned mcp 1.28.1, so CI never saw this; only fresh resolves are affected.I did not port fetch to mcp 2.0. It is not just the exception rename:
list_tools,list_prompts,call_tool, andget_promptare all gone from the low-levelServer, andserver.pyuses all four. That is a migration, not a bug fix.Verified on Linux, Python 3.12, uv 0.12.0, with a real JSON-RPC stdio handshake:
mcp-server-fetch==2026.7.10: no initialize response,ImportError: cannot import name 'McpError'mcp==1.29.0,initialize ok: server=mcp-fetch version=1.29.0,tools=['fetch']Added
tests/test_dependencies.py, which fails on the old specifier and passes on the new one.ruff checkandpyrightare clean.tests/test_server.py::test_empty_content_returns_errorfails on my machine both with and without this patch, because there is no Node.js on PATH and readabilipy falls back to pure-Python mode. Unrelated to this change.Not verified: I reproduced with my own stdio client, not with Codex, and the "after" run used a locally built wheel rather than a published one.
Two things for you to decide. First,
src/gitandsrc/timehave the same unbounded range and break the same way under mcp 2.0.0 (mcp-server-timeon the sameMcpErrorimport,mcp-server-giton'Server' object has no attribute 'list_tools'). I left them out to keep this scoped to the reported issue, happy to add the same one-line cap to both. Second, if you would rather port to mcp 2.0 than cap, close this.Thanks to @tking007 for the report, including the correct diagnosis and the
--with "mcp<2"workaround.