Fix FastMCP 2.x compatibility#13
Conversation
- Remove 'version' parameter from FastMCP initialization - FastMCP 3.x+ no longer accepts version as a keyword argument - Fixes TypeError: FastMCP.__init__() got an unexpected keyword argument 'version' - Tested with FastMCP 3.x
WalkthroughRemoved hardcoded "version" from server configuration, added a pinned FastMCP dependency, and updated tests and FastMCP usage to stop passing a version argument when constructing the MCP instance. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Test
participant FastMCP
participant ServerModule as zoho_mcp/server.py
Note over Test,FastMCP: Test constructs MCP without version
Test->>FastMCP: FastMCP(name="test")
FastMCP-->>Test: instance
Note over Test,ServerModule: Test configures server (no version field)
Test->>ServerModule: configure_server(server_config{name})
ServerModule-->>FastMCP: use instance (register prompts / start)
FastMCP-->>ServerModule: started / registered
ServerModule-->>Test: success
opt error path
ServerModule-->>Test: raise / report error
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
zoho_mcp/server.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.py: Use Python 3.9+ with type hints throughout
Follow PEP 8 style guidelines
Maximum line length: 100 characters
Use docstrings for all functions, classes, and modules
Imports: standard library first, then third-party, then local modules
Class naming: PascalCase
Function/variable naming: snake_case
Constants: UPPER_SNAKE_CASE
Error handling: use specific exceptions with contextual messages
Logging: use structured logging with appropriate log levels
Files:
zoho_mcp/server.py
- Remove version= kwarg from all test FastMCP() calls to match production code - Add fastmcp>=2.10,<3.0 to requirements.txt for explicit version constraint - Update comment to correctly reference FastMCP 2.x (not 3.x which doesn't exist) - Align mock configs in tests with actual configure_server() return value This addresses PR feedback and ensures tests pass with current FastMCP 2.x releases installed via uv/uvx, which reject the version= constructor argument.
Problem
Current FastMCP 2.x releases (installed via uv/uvx) reject the
version=constructor argument:This affects multiple MCP servers including AWS SNS/SQS MCP (awslabs/mcp#1072) and this Zoho Books server.
Root Cause
Recent FastMCP 2.x releases (2.10+, 2.11+, 2.12+) removed support for the
version=kwarg that was previously accepted. The server code inzoho_mcp/server.py:115still passes this parameter, causing startup failures.Note: There is no FastMCP 3.x yet. FastMCP is currently on the 2.x release line.
Solution
Remove
version=fromFastMCP()constructor calls throughout the codebase:server.py)test_server.py,test_prompts.py)fastmcp>=2.10,<3.0to requirements.txt for explicit version constraintTesting
Tested with current FastMCP 2.x releases via
uvx:Impact
This is a minimal change that makes the server compatible with current FastMCP 2.x releases while maintaining backward compatibility (the
nameparameter is still required).Context
FastMCP is currently on the 2.x release line (2.10+, 2.11+, 2.12+). There is no 3.x yet. However, recent 2.x releases removed support for the
version=kwarg that older MCP servers were passing. This fix ensures compatibility with current FastMCP releases.References