Repository navigation
fix(mcp): keep MCPClient importable when mcp import fails - #25
Open
tonycoder-hub wants to merge 1 commit into
Open
tonycoder-hub wants to merge 1 commit into
tonycoder-hub wants to merge 1 commit into
Conversation
Cap mcp at <2 (2.x renamed streamablehttp_client) and bind annotation placeholders in the ImportError path so class body evaluation cannot raise NameError before model_post_init's ImportError guard. Fixes mozilla-ai#22 Signed-off-by: Tony Coder <407243179@qq.com>
This branch has not been deployed
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.
Description
mcp2.x renamedstreamablehttp_clienttostreamable_http_client. A fresh install ofmozilla-ai-tinyagentresolvesmcp>=2, the import inmcp_client.pyfails, and class-body annotations then raiseNameError: name 'MCPTool' is not definedbeforemodel_post_initcan raise the intendedImportError.This PR:
mcp>=1.5.0,<2so installs stay on the API this package uses.except ImportErrorbranch so a missing/incompatiblemcpdegrades to the existingImportErrorguard instead of aNameError.PR Type
Relevant issues
Fixes #22
Checklist
AI Usage Information
AI Model used: gemini-3.8-flash-high (via local CPA)
AI Developer Tool used: Cursor / F.R.I.D.A.Y. agent assist
Any other info you'd like to share: Fix direction matches the issue report (cap mcp<2 + ImportError placeholders). Verified import with mcp 2.2.0 raises ImportError instead of NameError, and with mcp 1.x the module loads cleanly.
I am an AI Agent filling out this form (check box if true).