Solution skill
fetch MCP: ImportError cannot import name 'McpError' from 'mcp.shared.exceptions'
Complete solution
Fixes the fetch MCP server failing to start with an ImportError about McpError after the mcp SDK 2.0 release. Use when uvx mcp-server-fetch exits immediately with cannot import name 'McpError'. Not for 404 package errors or for fetch tool failures on specific URLs.
Fix fetch MCP ImportError: cannot import name 'McpError' from 'mcp.shared.exceptions'
TL;DR
Pin the SDK below 2.0: run uvx --with "mcp<2" mcp-server-fetch. The mcp 2.0.0 release renamed McpError to MCPError, and the fetch server (released before 2.0) imports the old name, so every fresh unpinned install crashes on startup.
The exact error:
ImportError: cannot import name 'McpError' from 'mcp.shared.exceptions'. Did you mean: 'MCPError'?Steps
1. Confirm the SDK version mismatch
Run the server by hand:
uvx mcp-server-fetchSuccess check: the traceback mentions mcp_server_fetch/server.py importing McpError and suggests MCPError. That confirms this exact problem.
2. Pin mcp below 2.0
Change your MCP config to inject the pinned dependency:
{
"mcpServers": {
"fetch": {
"command": "uvx",
"args": ["--with", "mcp<2", "mcp-server-fetch"]
}
}
}Success check: restarting the client, the fetch server connects and fetch appears in the tool list.
3. Verify the handshake manually (optional)
uvx --with "mcp<2" mcp-server-fetchthen send an initialize frame over stdin. Success check: the server answers instead of exiting with code 1.
When this applies
uvx mcp-server-fetchexits immediately with theMcpErrorImportError.- Fresh installs broke around or after the mcp 2.0.0 release; older cached environments still work.
- Also affects
mcp-server-timeandmcp-server-git(same ImportError / missing attributes); the same--with "mcp<2"fix applies.
When it does not apply
404 Not Foundfrom the npm registry for@modelcontextprotocol/server-fetch. That package never existed on npm; the reference fetch server is the PyPI packagemcp-server-fetchrun throughuvx.- The server starts but a specific URL fails to fetch. That is a per-URL problem (robots, auth, JS rendering), not the startup crash.
Tool compatibility
- mcp-server-fetch (PyPI), releases before the mcp<2 cap (e.g. 2026.7.10)
- mcp Python SDK 2.0.0+
- uv / uvx launcher
- Claude Desktop, Claude Code, Cursor
Why it happens
The fetch server's pyproject.toml declared mcp>=1.1.3 with no upper bound. When mcp 2.0.0 shipped and renamed the exception class McpError to MCPError (plus replacing the low-level Server decorators), every fresh dependency resolution pulled 2.0.0 and the old import broke. uvx does not pin, so all new installs were affected from 2026-07-28 until the upstream cap landed.
Edge cases
- If you already have a working cached environment, do not "fix" it; the pin only matters for fresh resolves.
- Long term, the servers are being ported to the 2.x API; once your installed fetch release declares
mcp>=2support, drop the--withoverride. - On Windows the same crash appears; the fix is identical.
Evidence
A modelcontextprotocol/servers issue reports that mcp-server-fetch fails to start with an ImportError when resolved against mcp SDK 2.0.0 (released 2026-07-28): the traceback ends with ImportError: cannot import name 'McpError' from 'mcp.shared.exceptions'. Did you mean: 'MCPError'?. The root cause: mcp 2.0.0 renamed McpError to MCPError, and the fetch server declared mcp with no upper bound, so every fresh uvx install pulled 2.0.0. The verified workaround from the thread: uvx --with "mcp<2" mcp-server-fetch, with initialize and tools/list confirmed working. Fixed upstream by capping mcp below 2 in PR #4663. Source: https://github.com/modelcontextprotocol/servers/issues/4560
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_KIvlIdBtgYv6aDmC-Dj0ew" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">fetch MCP: ImportError cannot import name 'McpError' from 'mcp.shared.exceptions' <span>— Vectle</span></a>