Skip to content

Commit 1ee9ca8

Browse files
committed
fix(fetch): cap mcp dependency below 2.0
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.
1 parent 76d64c8 commit 1ee9ca8

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

src/fetch/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ classifiers = [
1818
dependencies = [
1919
"httpx>=0.27",
2020
"markdownify>=0.13.1",
21-
"mcp>=1.1.3",
21+
"mcp>=1.1.3,<2",
2222
"protego>=0.3.1",
2323
"pydantic>=2.0.0",
2424
"readabilipy>=0.2.0",
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"""Tests for the fetch MCP server's declared dependencies."""
2+
3+
import tomllib
4+
from pathlib import Path
5+
6+
from packaging.requirements import Requirement
7+
from packaging.version import Version
8+
9+
PYPROJECT = Path(__file__).parent.parent / "pyproject.toml"
10+
11+
12+
def test_mcp_requirement_excludes_2_x():
13+
"""The server uses the mcp 1.x low-level API, which mcp 2.0 removed.
14+
15+
Without an upper bound, `uvx mcp-server-fetch` resolves mcp 2.x and the
16+
server dies on import.
17+
"""
18+
dependencies = tomllib.loads(PYPROJECT.read_text())["project"]["dependencies"]
19+
mcp = next(r for r in map(Requirement, dependencies) if r.name == "mcp")
20+
assert not mcp.specifier.contains(Version("2.0.0"))

src/fetch/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)