Repository navigation
fix(mcp): support fastmcp 3 and 4, parse adapter requests - #291
Merged
Merged
Conversation
The adapter converted each fastmcp tool to the MCP protocol Tool and read inputSchema/outputSchema. MCP SDK 2, pulled in by fastmcp 4, renamed those fields to snake_case, so mypy fails and every listing warns. fastmcp's own Tool exposes parameters and output_schema unchanged across both majors, so read them directly and widen the extra to fastmcp>=3,<5. The adapter subscriptions never passed data_type, so handlers received raw dicts and crashed on the first attribute access. Declare the request models on both subscriptions and add an end-to-end test over the in-memory transport covering tool listing, a successful call and an error call. Supersedes #288.
Contributor
QualOps Code Quality AnalysisStatus: Summary
🟠 High Issues (1)
🟡 Medium Issues (1)
📊 Full ReportPowered by QualOps |
Collaborator
Author
|
On the QualOps high and medium findings ( Both attributes are declared fields on fastmcp's own Evidence:
|
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.
Supersedes #288.
Why
fastmcp 4 depends on MCP SDK 2, which renamed the protocol Tool fields
inputSchema/outputSchemato snake_case. The adapter read the camelCase names, so with extras installed in CI (#290) the lint job fails on #288 with two mypy errors, and every tool listing emits aFastMCPDeprecationWarning. On MCP SDK 1 the snake_case names do not exist, so no single read satisfies the>=3,<5range Dependabot proposed.What
name,description,parametersandoutput_schemafrom fastmcp's ownTool, which is identical on 3.x and 4.x. The conversion to the protocol Tool is gone.mcpextra constraint isfastmcp>=3,<5; lock resolves to fastmcp 4.0.5. Not a breaking change: projects pinned to fastmcp 3 keep resolving.data_type, so handlers received raw dicts and crashed onmessage.data. This predates the fastmcp bump. Both subscriptions now declare their request model.tests/test_mcp.pyruns the adapter over the in-memory transport and covers tool listing, a successful call and an error call. It fails on the unmodified adapter with'dict' object has no attribute 'data'.Verification
tests/test_mcp.pywith-W erroron fastmcp 4.0.5, 4.0.3 and 3.4.7 (Python 3.10): passed.