Skip to content

fix(time): cap mcp dependency below 2.0 - #4572

Open
KarlLeen wants to merge 1 commit into
modelcontextprotocol:mainfrom
KarlLeen:fix/time-cap-mcp-lt-2
Open

fix(time): cap mcp dependency below 2.0#4572
KarlLeen wants to merge 1 commit into
modelcontextprotocol:mainfrom
KarlLeen:fix/time-cap-mcp-lt-2

Conversation

@KarlLeen

@KarlLeen KarlLeen commented Jul 29, 2026

Copy link
Copy Markdown

Fixes #4570

mcp 2.0.0 renamed McpError to MCPError, so server.py raises ImportError at module import and the process exits before any MCP handshake. src/time/pyproject.toml declared mcp>=1.23.0 with no upper bound, so unpinned launchers like uvx started resolving 2.0.0 as soon as it shipped.

This caps the dependency at mcp>=1.23.0,<2 and regenerates uv.lock. Resolution stays on the 1.x line (fresh install resolves mcp==1.29.0); only the recorded specifier moves.

I deliberately did not add an alias import. In 2.0.0 the constructor changed too (MCPError(ErrorData(...))MCPError(code, message, data=None)), and the @server.list_tools() / @server.call_tool() decorator API was removed. An alias would import cleanly and then fail later. The real 2.x migration is a separate job (same shape as fetch #4565 / git #4564).

Also adds a regression test that parses pyproject.toml and asserts the declared mcp specifier admits 1.23.0 / 1.29.0 but not 2.0.0. packaging already comes in with pytest; tomllib/tomli handles .python-version 3.10.

Motivation and Context

Unpinned uvx mcp-server-time is broken for every user as of the SDK 2.0.0 release. Same class of failure as #4560 / #4563 for fetch.

How Has This Been Tested?

  • Reproduced the exact McpErrorMCPError ImportError with mcp==2.0.0
  • Confirmed the new test fails before the cap and passes after
  • uv run pytest in src/time — 39 passed
  • uv run ruff check and uv run pyright clean; uv lock --check clean
  • Fresh unpinned install of the patched package resolves mcp==1.29.0, import succeeds, and a real stdio initialize + list_tools returns get_current_time / convert_time

This patch does not make time work on mcp 2.x — it only stops 2.x from being selected.

Server Details

  • Server: time
  • Changes to: dependency bound + lockfile + regression test

Breaking Changes

None. Users stay on mcp 1.x, which is what the published server was built against.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have tested this with an LLM client (stdio initialize / list_tools smoke)
  • My code follows the repository's style guidelines
  • New and existing tests pass locally

Fixes modelcontextprotocol#4570. mcp 2.0.0 renamed McpError to MCPError, so unpinned
resolvers crash on import. Cap at mcp>=1.23.0,<2 (no alias — the
constructor changed too) and add a regression test, matching modelcontextprotocol#4563.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant