Skip to content

MCP extra floor mcp>=1.17.0 admits versions that cannot import with current pydantic #95

Closed

Description

@clementine-oaklight

pyproject.toml declares mcp>=1.17.0,<2 for the MCP extra, but the lower end of that range cannot be imported with the pydantic that resolves today, so the extra resolves to something broken for anyone who pins a version inside it (or whose resolver lands there for another reason).

Reproduction, Python 3.11.2, pydantic==2.14.1, in a clean venv:

pip install 'mcp==1.17.0'
python -c "import mcp.server.lowlevel"

ImportError: cannot import name 'eval_type_backport' from 'pydantic._internal._typing_extra'
  at mcp/server/fastmcp/utilities/func_metadata.py:17

Same for mcp==1.20.0. 1.22.0 imports and runs the adapter suite (64 passed), and so do 1.26.0 and 1.30.0.

mcp import with pydantic 2.14.1
1.17.0 ImportError
1.20.0 ImportError
1.22.0 ok
1.26.0 ok
1.30.0 ok

It is upstream (mcp's fastmcp module imports a pydantic internal that was removed), so the options are:

  1. Raise the floor to mcp>=1.22.0,<2 — one line, makes the declaration honest, and matches what the test-mcp-v1 CI job can actually verify.
  2. Keep >=1.17.0 and add a pydantic<2.12 pin for that range — more coupling than the compatibility is worth.

Context: found while reviewing #85, whose _compat.py comment claims the v1 interception is "stable across the v1 range we support". The mechanism itself is fine — request_handlers[CallToolRequest] interception passes on 1.22.0, 1.26.0 and 1.30.0 — but the range statement in pyproject.toml is wider than the range that installs. Nothing in CI notices because mcp>=1.17,<2 always resolves to the newest 1.x.

No action needed for #85; this is the packaging side of the same question.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions