servers icon indicating copy to clipboard operation
servers copied to clipboard

fetch: ImportError on startup with mcp SDK 2.0.0 (McpError renamed to MCPError)

Open Jason26214 opened this issue 4 months ago • 3 comments

Describe the bug

mcp-server-fetch fails to start with an ImportError when resolved against mcp SDK 2.0.0 (released 2026-07-28).

To Reproduce

uvx mcp-server-fetch

Actual behavior

Traceback (most recent call last):
  ...
  File ".../mcp_server_fetch/__init__.py", line 1, in <module>
    from .server import serve
  File ".../mcp_server_fetch/server.py", line 6, in <module>
    from mcp.shared.exceptions import McpError
ImportError: cannot import name 'McpError' from 'mcp.shared.exceptions'.
Did you mean: 'MCPError'?

The process exits with code 1 before the initialize handshake, so clients simply report the server as unavailable with no visible cause.

Root cause

mcp 2.0.0 renamed the exception class McpError to MCPError. src/fetch/pyproject.toml declares mcp>=1.1.3 with no upper bound, so any fresh resolution (e.g. uvx, which does not pin) now pulls 2.0.0 and breaks.

The last fetch release (2026.7.10) predates the SDK 2.0.0 release, so every user on an unpinned launcher is affected as of 2026-07-28.

Suggested fix

Short term: cap the dependency, e.g. mcp>=1.1.3,<2. Longer term: migrate to the 2.x API (MCPError), as done for everything in #4551.

Workaround for other users

uvx --with "mcp<2" mcp-server-fetch

Verified: initialize handshake succeeds, serverInfo reports mcp-fetch 1.29.0.

Environment

  • OS: Windows 11
  • Launcher: uv 0.11.8 (uvx, unpinned)
  • mcp-server-fetch 2026.7.10 / mcp 2.0.0

Jason26214 avatar Jul 28 '26 14:07 Jason26214

I worked around it by adding param to uvx command: --with mcp<2

full command looks like: uvx --with mcp<2

IsabellaLi avatar Jul 29 '26 07:07 IsabellaLi

This is a package compatibility and release-integrity failure: the published server permits resolution of an incompatible major SDK version.

The immediate containment is to publish the supported mcp<2 constraint for the current v1 implementation. The durable fix is a tested SDK v2 migration.

The release gate should include a completely clean, unpinned installation and prove:

  • dependency resolution selects a supported SDK;
  • the server imports and starts;
  • capability discovery and tools/list succeed;
  • one representative tool call succeeds;
  • unsupported combinations fail with an explicit compatibility message.

uvx --with "mcp<2" mcp-server-fetch is a practical temporary workaround, but it should not become the normal user requirement.

A small machine-readable compatibility record containing the server version, supported SDK range, Python versions, protocol versions and test timestamp would make this condition detectable before publication.

Ecocitizenz avatar Jul 31 '26 12:07 Ecocitizenz

Thank you @Jason26214 for this fix, and for those who are launching from an mcp.json file, here is the workaround syntax in that format...

      "fetch": {
        "args": [
          "--with",
          "mcp<2",
          "mcp-server-fetch"
        ],
        "command": "uvx",
        "disabled": false,
        "env": {}
      }

digitizdat avatar Aug 06 '26 15:08 digitizdat