Migrate to the MCP Python SDK 2.x - #50
Open
mpasternak wants to merge 1 commit into
Open
mpasternak wants to merge 1 commit into
mpasternak wants to merge 1 commit into
Conversation
The server was built on `mcp.server.fastmcp.FastMCP`, which is part of the
1.x line of the MCP Python SDK. This moves it to `mcp.server.MCPServer`
from SDK 2.0.
Changes:
- `FastMCP("freshdesk-mcp")` -> `MCPServer("freshdesk-mcp", version=...)`.
The tool/prompt decorators are unchanged, so all 59 tools and both
prompts are registered exactly as before.
- Pin `mcp==2.0.0`, raise the pydantic floor to `>=2.12,<3` (required by
SDK 2.x) and drop `build` from the runtime dependencies - it is a build
backend tool, not something the server imports at runtime.
- `__version__` now lives in `freshdesk_mcp/__init__.py` only and is read
by `server.py`, so `MCPServer(version=...)` does not become a third
place to bump on every release.
- Bump 1.2.0 -> 1.3.0.
- Add `tests/test_mcp_v2.py`: an in-process check of the registered tools
plus an end-to-end stdio round trip (initialize -> tools/list ->
prompts/list) against a real subprocess of the server.
- Add a CI workflow running those tests plus `uv build` on Python 3.10,
3.12 and 3.14.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ytwHf2AcXX4ZzN4Zd6c6i
7 tasks
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.
Problem
The server is built on
mcp.server.fastmcp.FastMCP, which belongs to the 1.x line of the MCP Python SDK. Withmcp[cli]>=1.3.0unbounded inpyproject.toml, a freshuvx freshdesk-mcpresolves to the 2.x SDK, wheremcp.server.fastmcpis gone — the server fails at import.What this does
Moves the server onto
mcp.server.MCPServerfrom SDK 2.0.FastMCP("freshdesk-mcp")→MCPServer("freshdesk-mcp", version=__version__). The tool and prompt decorators are unchanged — all 59@mcp.tool()functions and both prompts register exactly as before, so this is not a rewrite of the tool surface.mcp==2.0.0, raise the pydantic floor to>=2.12,<3(required by SDK 2.x), and dropbuildfrom the runtime dependencies — it's a build-backend tool the server never imports.uv.lockregenerated accordingly.MCPServertakes the server version explicitly. Rather than adding a third place to bump on every release,__version__stays defined only infreshdesk_mcp/__init__.pyandserver.pyreads it.Tests
New
tests/test_mcp_v2.py:MCPServerand exposes the expected tools;initialize→tools/list→prompts/list— which is what actually catches an SDK API break.Tool/prompt counts are asserted as
>=on purpose, so the open PRs that add tools won't break this on merge.New
.github/workflows/ci.ymlruns those tests plustests/test_company_functions.py::TestParseHeaderFunctionanduv buildon Python 3.10, 3.12 and 3.14. Green on my fork; locally6 passed.tests/test-fd-mcp.pyand the rest oftest_company_functions.pyare not in the CI selection — they need live Freshdesk credentials.Notes for maintainers
mcp==2.0.0is an exact pin, deliberately conservative for an SDK that just went through a major. Happy to relax it tomcp>=2,<3if you prefer.uvx freshdesk-mcp --env FRESHDESK_API_KEY=...) doesn't work —uvxhas no--envflag and the server reads plain environment variables. Left it alone here to keep this PR to the SDK migration.🤖 Generated with Claude Code
https://claude.ai/code/session_012ytwHf2AcXX4ZzN4Zd6c6i