Skip to content

feat!: upgrade fastmcp dependency from v2 to v3#34

Merged
Aaron ("AJ") Steers (aaronsteers) merged 1 commit into
mainfrom
devin/1775156374-fastmcp-v3-upgrade
Apr 2, 2026
Merged

feat!: upgrade fastmcp dependency from v2 to v3#34
Aaron ("AJ") Steers (aaronsteers) merged 1 commit into
mainfrom
devin/1775156374-fastmcp-v3-upgrade

Conversation

@aaronsteers

@aaronsteers Aaron ("AJ") Steers (aaronsteers) commented Apr 2, 2026

Copy link
Copy Markdown
Member

Summary

Breaking change: drops fastmcp v2 support. This library now requires fastmcp>=3.0,<4.0 and should be released as v1.0.0.

The main code change is in _middleware.py: the _get_tool_by_name method previously accessed FastMCP's private _tool_manager attribute and its internal _tools dict to do synchronous tool lookup. These private APIs were removed in v3. The method is now async and uses the public app.get_tool(name) API instead.

One test assertion was updated because FastMCP v3 adds a built-in DereferenceRefsMiddleware to every server — the test now checks that no ToolFilterMiddleware is present rather than asserting zero total middleware.

Review & Testing Checklist for Human

  • Verify that app.get_tool(name) in FastMCP v3 returns a FastTool object with a .to_mcp_tool() method (the code assumes this), and returns None for nonexistent tools rather than raising. Confirmed during dev but worth a sanity check against v3 source.
  • Run uv sync --all-extras && uv run pytest tests/ -v locally to verify all 55 tests pass with the resolved v3 version.
  • After merging, publish as v1.0.0 via the releases page, then update downstream pins in PyAirbyte and airbyte-ops-mcp to fastmcp-extensions>=1.0.0,<2.0.

Notes

  • This is a prerequisite for upgrading airbyte-ops-mcp to FastMCP v3. Companion PRs: PyAirbyte#1009, airbyte-ops-mcp#673.
  • The uv.lock diff 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)


Open with Devin

- 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-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions

github-actions Bot commented Apr 2, 2026

Copy link
Copy Markdown

🎉 Thanks for opening this pull request!

Your contribution is appreciated. Here are some helpful commands you can use:

Quick Commands

  • /autofix - Auto-format and fix linting issues (ruff format + ruff check --fix)
  • /lock - Update the uv.lock file with latest dependencies

Available Poe Tasks

You can run any of these tasks using the slash command: /poe <task-name>

Core Tasks

  • /poe test - Run all tests
  • /poe test-fast - Run tests with fast exit on first failure
  • /poe lint - Check code style and quality
  • /poe format - Format code with ruff
  • /poe deps - Check for unused and missing dependencies
  • /poe check - Run format check, linting, dependency check, and tests

Quick Fixes

  • /poe fix - Auto-format and fix linting issues
  • /poe clean - Clean up build artifacts and cache

Build & Install

  • /poe build - Build the package
  • /poe install - Install with development dependencies

Other Commands

  • /poe version - Show package version
  • /poe pre-commit - Run pre-commit style checks

The CI will automatically run tests when you push commits. Happy coding! 🚀

@devin-ai-integration devin-ai-integration Bot changed the title chore: upgrade fastmcp dependency from v2 to v3 feat!: upgrade fastmcp dependency from v2 to v3 Apr 2, 2026
@aaronsteers Aaron ("AJ") Steers (aaronsteers) marked this pull request as ready for review April 2, 2026 22:39
Copilot AI review requested due to automatic review settings April 2, 2026 22:39
@aaronsteers Aaron ("AJ") Steers (aaronsteers) merged commit 5111898 into main Apr 2, 2026
16 of 17 checks passed
@aaronsteers Aaron ("AJ") Steers (aaronsteers) deleted the devin/1775156374-fastmcp-v3-upgrade branch April 2, 2026 22:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ToolFilterMiddleware tool lookup to use await 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.

Comment thread pyproject.toml
Comment on lines 8 to 12
]
requires-python = ">=3.10"
dependencies = [
"fastmcp>=2.2.7,<3.0",
"fastmcp>=3.0,<4.0",
]

Copilot AI Apr 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copilot uses AI. Check for mistakes.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants