time: ImportError on startup with mcp SDK 2.0.0 (McpError renamed to MCPError)
Describe the bug
mcp-server-time fails to start with an ImportError when resolved against mcp SDK 2.0.0 (released 2026-07-28). Same class of failure as #4560 for fetch.
The process exits before any MCP handshake, so clients just report the server as unavailable.
To Reproduce Steps to reproduce the behavior:
- Run
uvx mcp-server-time(unpinned; resolvesmcp==2.0.0today) - Or against current
main(d31124c):
uv venv /tmp/mcp2-time --python 3.12 uv pip install --python /tmp/mcp2-time/bin/python -e src/time 'mcp==2.0.0' /tmp/mcp2-time/bin/python -c 'from mcp_server_time.server import serve'
Expected behavior The server should import and start successfully (or at least refuse with a clear dependency error), instead of crashing on import of a renamed SDK symbol.
Logs Traceback (most recent call last): ... File ".../mcp_server_time/init.py", line 1, in from .server import serve File ".../mcp_server_time/server.py", line 12, in from mcp.shared.exceptions import McpError ImportError: cannot import name 'McpError' from 'mcp.shared.exceptions'. Did you mean: 'MCPError'?
Additional context
- Root cause:
mcp2.0.0 renamedMcpError→MCPError.src/time/pyproject.tomldeclaresmcp>=1.23.0with no upper bound, so unpinned launchers (uvx) now pullmcp==2.0.0and break. - Verified:
uv pip compile <<< mcp-server-timeresolvesmcp-server-time==2026.7.10+mcp==2.0.0. - Control: with
mcp==1.29.0,from mcp_server_time.server import servesucceeds. - A rename-only patch is not enough for a full 2.x port:
MCPErrornow takescode/message(notErrorData), and@server.list_tools()/@server.call_tool()were removed in favor of constructor callbacks (same shape as fetch/git). - Suggested fix: short term
mcp>=1.23.0,<2; longer term migratesrc/timeto MCP Python SDK v2 (alongside fetch #4565 / git #4564). - Workaround:
uvx --with "mcp<2" mcp-server-time - Environment: macOS (darwin 25), uv 0.11.12, Python 3.12.13, src @ d31124c / mcp 2.0.0
- Happy to send a PR for the short-term cap (and/or a v2 port).
I'll take the PR.
I'd like to work on this. My plan: add a version cap in as the short-term fix to prevent Provide a command to run with uvx <command>.
See uvx --help for more information. from resolving to 2.0.0 and breaking the import. Will submit a PR shortly.
Following up on my earlier claim: PR is up at #4572 (cap + uv.lock + regression test, matching #4563).
Noting #4571 as well — that one changes only pyproject.toml. Happy for maintainers to compare and take whichever they prefer; no hard feelings either way @cyforkk.
The short-term cap is covered by #4572 / #4577, but src/time is the only one of the three Python servers with no SDK v2 port yet (fetch has #4565, git has #4564). @KarlLeen — you mentioned possibly doing a v2 port; are you working on it? If not, I'll take it: same shape as #4564/#4565 (decorator handlers → on_list_tools/on_call_tool constructor callbacks, MCPError(code=..., message=...), mcp>=2,<3, uv.lock regen, tests updated), targeting main unless maintainers prefer v2/main. Will have a PR up within a few days if unclaimed.
@l3onlau Thanks for checking — I'll take the src/time SDK v2 port.
Plan (same shape as #4565 / #4564):
- decorator handlers →
on_list_tools/on_call_toolconstructor callbacks McpError(ErrorData(...))→MCPError(code=..., message=...)- bump to
mcp>=2,<3, regenuv.lock, update tests - targeting
mainunless maintainers prefer otherwise
Short-term cap remains #4572 / #4577; this is the follow-up port. PR coming shortly.
Workaround in the meantime: use the --with "mcp<2" arguments when calling, e.g. this works form me:
"time": {
"command": "uvx",
"args": [
"--with",
"mcp<2",
"mcp-server-time"
]
},
To make it even more robust, use a fixed version of the library too:
...
"time": {
"command": "uvx",
"args": [
"--with",
"mcp<2",
"[email protected]"
]
},
...
This seems to work for me well. Of course when the fix is in, remove that extra parameter lines, and update the version number if used.
See more in the uvx docs.
@imrehg Thanks, confirmed this is a good user-side workaround until a release ships. Package-side: short-term cap in #4572/#4577, SDK v2 port in #4602 (prefer the latter so mcp>=2 works without --with).
Status across the three Python servers, since all the ports are now open and green:
git: #4564 (@Jiafi), CI greenfetch: #4565 (mine), CI greentime: #4602 (@KarlLeen), CI green
All three follow the same shape: decorator handlers to on_list_tools / on_call_tool constructor callbacks, McpError(ErrorData(...)) to MCPError(code=..., message=...), mcp>=2,<3, regenerated uv.lock.
Worth stating plainly that #4577's cap and these ports are not alternatives. The cap unblocks users today; the ports are what let mcp>=2 resolve without --with. Both are wanted, in that order.
The only thing left is review. All three have been green with no maintainer pass. Would it help to stack them onto a single branch so they can be reviewed and landed as one unit? Happy to do that work.