Upgrade to FastMCP 2.13 and refactor server using declarative best practices#15
Merged
Merged
Conversation
Co-authored-by: jango-blockchained <16127070+jango-blockchained@users.noreply.github.com>
Co-authored-by: jango-blockchained <16127070+jango-blockchained@users.noreply.github.com>
Co-authored-by: jango-blockchained <16127070+jango-blockchained@users.noreply.github.com>
Co-authored-by: jango-blockchained <16127070+jango-blockchained@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update to latest fastmcp version and refactor mcp server
Upgrade to FastMCP 2.13 and refactor server using declarative best practices
Nov 6, 2025
There was a problem hiding this comment.
Pull Request Overview
This PR migrates the MCP-FreeCAD server from the legacy MCP SDK to FastMCP 2.13.0, implementing a modern, declarative approach to MCP server development. The migration simplifies the codebase by replacing manual tool registration with decorator-based patterns.
Key changes:
- Upgraded to FastMCP 2.13.0 and MCP SDK 1.20.0, removing deprecated dependencies
- Refactored
cursor_mcp_server.pyto use@mcp.tool()and@mcp.resource()decorators - Added comprehensive test suite with 17 tests covering all tools and error scenarios
Reviewed Changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| cursor_mcp_server.py | Complete refactor to use FastMCP decorators, reducing complexity and improving maintainability |
| requirements.txt | Updated dependency versions to fastmcp>=2.13.0 and mcp>=1.20.0, removed legacy packages |
| pyproject.toml | Synchronized dependencies with requirements.txt for consistency |
| tests/test_fastmcp_server.py | New comprehensive test suite covering all tools, resources, and error handling |
| run_tests.py | New test runner utility with filtering, verbosity, and coverage options |
| example_fastmcp_usage.py | New example script demonstrating FastMCP server usage patterns |
| docs/FASTMCP_IMPLEMENTATION.md | Detailed documentation of the new implementation approach |
| FASTMCP_MIGRATION.md | Migration guide explaining changes and benefits |
| README.md | Added FastMCP section documenting the new server option |
| cursor_mcp_server_old.py | Preserved old implementation for reference |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Closes: #[issue_number]
Description
Modernized MCP server implementation to FastMCP 2.13.0.2, eliminating legacy patterns and adopting declarative tool registration. The old imperative handler-based approach is replaced with decorator-driven definitions.
Changes
Dependencies
0.4.0→2.13.0.21.0.0→1.20.0modelcontextprotocol,trio,flask(deprecated/unused)Server Implementation
Replaced
cursor_mcp_server.pywith FastMCP decorator pattern:Before:
After:
@mcp.resource("freecad://status")cursor_mcp_server_old.pyTesting
tests/test_fastmcp_server.pywith 17 unit/integration testsrun_tests.pyfor filtered executionDocumentation
docs/FASTMCP_IMPLEMENTATION.md: Implementation patternsFASTMCP_MIGRATION.md: Migration rationale and comparisonexample_fastmcp_usage.py: CLI demo of all toolsREADME.mdwith FastMCP quickstartTradeoffs
Alternatives
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.