fix(time): cap mcp dependency below 2.0 - #4572
Open
KarlLeen wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4570
mcp2.0.0 renamedMcpErrortoMCPError, soserver.pyraisesImportErrorat module import and the process exits before any MCP handshake.src/time/pyproject.tomldeclaredmcp>=1.23.0with no upper bound, so unpinned launchers likeuvxstarted resolving 2.0.0 as soon as it shipped.This caps the dependency at
mcp>=1.23.0,<2and regeneratesuv.lock. Resolution stays on the 1.x line (fresh install resolvesmcp==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.tomland asserts the declaredmcpspecifier admits 1.23.0 / 1.29.0 but not 2.0.0.packagingalready comes in with pytest;tomllib/tomlihandles.python-version3.10.Motivation and Context
Unpinned
uvx mcp-server-timeis 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?
McpError→MCPErrorImportError withmcp==2.0.0uv run pytestinsrc/time— 39 passeduv run ruff checkanduv run pyrightclean;uv lock --checkcleanmcp==1.29.0, import succeeds, and a real stdioinitialize+list_toolsreturnsget_current_time/convert_timeThis patch does not make time work on mcp 2.x — it only stops 2.x from being selected.
Server Details
Breaking Changes
None. Users stay on mcp 1.x, which is what the published server was built against.
Types of changes
Checklist