Adds support for MCP SDK v2, which renamed FastMCP to MCPServer. Closes #33.
This fixes a broken install. The dependency was pinned only as mcp[cli]>=1.8.0, so a fresh install resolved to mcp 2.x, where mcp.server.fastmcp no longer exists. The server fell back to mock objects and exited claiming the SDK was "not installed", when it was, just a version it could not use.
Fixed
- SDK import is now tried v2-first (
from mcp.server.mcpserver import MCPServer, Context), with a fallback to the v1FastMCPpath for environments pinned tomcp<2. (#33) - Host and port were silently dropped on the HTTP transports under v2, which removed them from
mcp.settings. The existinghasattr(mcp, 'settings')guard did not catch it, because.settingsstill exists and only lost those two fields. They now pass asrun()keyword arguments on v2 and set onsettingson v1. requires-pythoncorrected from>=3.7to>=3.10. This was already wrong before v2: every supported SDK, v1 from 1.8.0 onward and all of v2, has required 3.10 or newer.- The startup failure message distinguishes an absent SDK from an unusable one, instead of telling you to install a package you already have.
- The manual test client works on both majors; v2 dropped the
streamablehttp_clientspelling.
Changed
mcp[cli]>=2.0.0is now the declared dependency (was>=1.8.0).compat.MCP_SDK_V2reports which API is live.- The server advertises its own version (
0.5.0) to clients, which v2 defaults to an empty string. compatexportsMCPServer, withFastMCPkept as an alias.- CI runs against both SDK majors and asserts the SDK was actually detected and that all tools registered. The previous job would have passed while the server silently degraded to mocks, which is how this shipped.
Upgrading
pip install --upgrade "mcp[cli]>=2"
No tool or API changes: all 20 MCP tools are unchanged. Verified against mcp 2.1.1, mcp 1.29.1 and no SDK; 148 unit tests pass in each, and the integration suite passes 47/47 over stdio and streamable-http against a live server with a 112,712-event capture.
Full changelog: CHANGELOG.md