feat!: upgrade fastmcp dependency from v2 to v3#34
Conversation
- Bump fastmcp version pin from >=2.2.7,<3.0 to >=3.0,<4.0 - Replace private _tool_manager API usage in _middleware.py with public async app.get_tool() method (v3 removed _tool_manager) - Update test assertion for built-in middleware added by FastMCP v3 (DereferenceRefsMiddleware)
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
🎉 Thanks for opening this pull request! Your contribution is appreciated. Here are some helpful commands you can use: Quick Commands
Available Poe TasksYou can run any of these tasks using the slash command: Core Tasks
Quick Fixes
Build & Install
Other Commands
The CI will automatically run tests when you push commits. Happy coding! 🚀 |
5111898
into
main
There was a problem hiding this comment.
Pull request overview
Upgrades this library to FastMCP v3 as a breaking change by replacing usage of FastMCP v2 private tool-manager internals with the v3 public app.get_tool(name) API, and adjusts tests to accommodate new built-in middleware behavior in FastMCP v3.
Changes:
- Bump dependency requirement to
fastmcp>=3.0,<4.0(dropping v2 support). - Update
ToolFilterMiddlewaretool lookup to useawait app.get_tool(name)via a now-async_get_tool_by_name. - Relax a server test assertion to account for FastMCP v3’s built-in middleware.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
pyproject.toml |
Updates FastMCP dependency constraint to v3. |
src/fastmcp_extensions/_middleware.py |
Switches tool lookup from removed private internals to the public async get_tool API. |
tests/test_server.py |
Updates middleware assertions to remain stable with FastMCP v3 defaults. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ] | ||
| requires-python = ">=3.10" | ||
| dependencies = [ | ||
| "fastmcp>=2.2.7,<3.0", | ||
| "fastmcp>=3.0,<4.0", | ||
| ] |
There was a problem hiding this comment.
[project].description still says this is an extension library for “FastMCP 2.0”, but this PR bumps the dependency to fastmcp>=3.0,<4.0 and drops v2 support. Please update the project metadata description (and any other version-specific wording in this file) to avoid publishing confusing package metadata on PyPI.
Summary
Breaking change: drops fastmcp v2 support. This library now requires
fastmcp>=3.0,<4.0and should be released as v1.0.0.The main code change is in
_middleware.py: the_get_tool_by_namemethod previously accessed FastMCP's private_tool_managerattribute and its internal_toolsdict to do synchronous tool lookup. These private APIs were removed in v3. The method is nowasyncand uses the publicapp.get_tool(name)API instead.One test assertion was updated because FastMCP v3 adds a built-in
DereferenceRefsMiddlewareto every server — the test now checks that noToolFilterMiddlewareis present rather than asserting zero total middleware.Review & Testing Checklist for Human
app.get_tool(name)in FastMCP v3 returns aFastToolobject with a.to_mcp_tool()method (the code assumes this), and returnsNonefor nonexistent tools rather than raising. Confirmed during dev but worth a sanity check against v3 source.uv sync --all-extras && uv run pytest tests/ -vlocally to verify all 55 tests pass with the resolved v3 version.fastmcp-extensions>=1.0.0,<2.0.Notes
airbyte-ops-mcpto FastMCP v3. Companion PRs: PyAirbyte#1009, airbyte-ops-mcp#673.uv.lockdiff is large due to the full dependency tree changing with the major version bump.Link to Devin session: https://app.devin.ai/sessions/2ef138b1326342d492ff7aa066746510
Requested by: Aaron ("AJ") Steers (@aaronsteers)