fix(deps): cap the mcp extra below 2.0 - #186
Open
EfeDurmaz16 wants to merge 1 commit into
Open
Conversation
mcp 2.0.0 renamed McpError to MCPError with no compatibility alias, so mpp/extensions/mcp/errors.py fails to import against it. The extra declared no upper bound, so a fresh `pip install "pympp[mcp]"` resolves 2.0.0 and 6 of the extension's 13 public exports raise ImportError, including both usage paths shown in the module docstring. Lazy loading hides it until first attribute access, so importing the package still appears to succeed. Cap at <2, matching the bound style already used for eth-abi. Supporting 2.x is a separate change. Beyond the rename, raising MCPError from a tool handler now surfaces as a top-level JSON-RPC error instead of CallToolResult(is_error=True), which the payment flow depends on.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Author
|
@brendanjryan flagging this one as time sensitive: mcp 2.0.0 went out today, so this affects anyone installing Reproduced on the published package in a clean venv, not just locally. One line, no code change. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
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.
The problem
mcp2.0.0 was published today and renamedMcpErrortoMCPErrorwith no compatibility alias(modelcontextprotocol/python-sdk#1956).
The
mcpextra declaresmcp>=1.1.0with no upper bound, so a fresh install picks up 2.0.0 andmpp/extensions/mcp/errors.py:15fails to import.Because the extension loads lazily,
import mpp.extensions.mcpstill succeeds. The failure onlyappears on first attribute access, so a smoke test will not catch it.
Reproduction
Clean venv, published package, nothing local:
Both usage paths from the module docstring fail:
6 of the 13 public exports are affected:
pay,verify_or_challenge,create_challenge,PaymentRequiredError,PaymentVerificationError,MalformedCredentialErrorpayment_capabilities,McpClient,McpToolResult,PaymentOutcomeUnknownError,MCPChallenge,MCPCredential,MCPReceiptThat leaves the client side and the data types, but no way to issue a challenge, verify a credential,
or raise a payment error. A paid MCP tool cannot be built on the current release.
A script that reproduces both states is at the bottom.
The change
One line, capping the extra at
<2, matching the bound style already used foreth-abi>=5.0,<6.This is also what the SDK's own migration guide recommends for projects that have not migrated yet.
I kept the
>=1.1.0floor rather than raising it to>=1.28, so nobody currently on an older 1.xgets pushed forward. Happy to raise the floor instead if you prefer.
Testing
On
main,uv sync --all-extrasresolves mcp 2.0.0 andtests/test_mcp.pyfails to collect, with5 further failures in
tests/test_mcp_client.py. With this change it resolves 1.29.0:and all 13 exports import.
Not included
Actual 2.x support is a larger piece of work and I did not attempt it here. The rename and the
flattened
MCPError(code, message, data)constructor are mechanical, but the migration guide alsonotes that raising
MCPErrorfrom a tool handler now surfaces as a top-level JSON-RPC error insteadof
CallToolResult(is_error=True). The payment flow relies on the client readingchallengesout ofthe error, so that needs measuring rather than a shim. Happy to open a tracking issue.
Reproduction script