mcp: Model Context Protocol Python SDK: Client fetched server-chosen $ref URLs while validating tool results against output schemas
What fixes it
- 2.2.0mcp, pipGitHub
- 1.30.0mcp, pipGitHub
- 2.2.0mcp, PyPIOSV
pip install "mcp>=2.2.0" - 1.30.0mcp, PyPIOSV
pip install "mcp>=1.30.0"
A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.
Reports 1
1 outlet mention it. Reports are not confirmation; each links to its source.
Description
Summary
In affected versions, when a connected MCP server declared an outputSchema for a tool, the SDK's client validated each call_tool result with jsonschema's default resolver, which fetches any $ref it cannot resolve locally by opening the URL. A server could therefore put an http://, https:// or file:// reference in a tool's output schema and make the client:
- request that URL, or read that local file, from the client's own network position on every call of the tool (the content was used only as a schema and never sent back to the server), and
- stall: the fetch ran synchronously on the event loop with no timeout, so a target that accepted the connection and then went quiet froze every session in the process for as long as it held the connection.
Am I affected?
Yes, if your application uses the SDK as an MCP client (ClientSession over any transport, ClientSessionGroup, or the 2.x Client) and calls tools on servers you do not fully control. There was no setting that turned the validation off.
Affected versions: 1.10.0 through 1.29.1, and 2.0.0 through 2.1.1.
Not affected: applications that only build servers. If nothing in your code uses ClientSession, ClientSessionGroup or the 2.x Client class, you are not affected.
Fix
Upgrade to mcp 1.30.0 (1.x) or 2.2.0 (2.x) or later. The client now resolves references only within the schema document the server sent (plus the standard JSON Schema metaschemas), so result validation performs no network or file access. A tool whose output schema points outside its own document fails at call time with RuntimeError (Invalid schema for tool ...); in-document references such as #/$defs/... work as before.
Until you can upgrade, call tools only on servers you trust. As a partial stopgap, skip tools whose outputSchema contains an $id, or a $ref / $dynamicRef that does not start with #.
Text from GitHub Advisory Database
Affected versions 46
- mcp, pip>= 2.0.0, < 2.2.0GitHub
- mcp, pip>= 1.10.0, < 1.30.0GitHub
- python-sdkaffected: >= 1.10.0, < 1.30.0CVE List
- python-sdkaffected: >= 2.0.0, < 2.2.0CVE List
- mcp, PyPIfrom 2.0.0, fixed in 2.2.0OSV
- mcp, PyPI2.0.0OSV
- mcp, PyPI2.0.1OSV
- mcp, PyPI2.1.0OSV
- mcp, PyPI2.1.1OSV
- mcp, PyPIfrom 1.10.0, fixed in 1.30.0OSV
- mcp, PyPI1.10.0OSV
- mcp, PyPI1.10.1OSV
- mcp, PyPI1.11.0OSV
- mcp, PyPI1.12.0OSV
- mcp, PyPI1.12.1OSV
- mcp, PyPI1.12.2OSV
- mcp, PyPI1.12.3OSV
- mcp, PyPI1.12.4OSV
- mcp, PyPI1.13.0OSV
- mcp, PyPI1.13.1OSV
- mcp, PyPI1.14.0OSV
- mcp, PyPI1.14.1OSV
- mcp, PyPI1.15.0OSV
- mcp, PyPI1.16.0OSV
- mcp, PyPI1.17.0OSV
- mcp, PyPI1.18.0OSV
- mcp, PyPI1.19.0OSV
- mcp, PyPI1.20.0OSV
- mcp, PyPI1.21.0OSV
- mcp, PyPI1.21.1OSV
- mcp, PyPI1.21.2OSV
- mcp, PyPI1.22.0OSV
- mcp, PyPI1.23.0OSV
- mcp, PyPI1.23.1OSV
- mcp, PyPI1.23.2OSV
- mcp, PyPI1.23.3OSV
- mcp, PyPI1.24.0OSV
- mcp, PyPI1.25.0OSV
- mcp, PyPI1.26.0OSV
- mcp, PyPI1.27.0OSV
- mcp, PyPI1.27.1OSV
- mcp, PyPI1.27.2OSV
- mcp, PyPI1.28.0OSV
- mcp, PyPI1.28.1OSV
- mcp, PyPI1.29.0OSV
- mcp, PyPI1.29.1OSV
References 8
- github.com/modelcontextprotocol/python-sdk/commit/5ebdfed4060d8e5b11b8e2348f86bad4d1fb8836Fixvia CVE List
- github.com/modelcontextprotocol/python-sdk/commit/6705402e246dc4eb1fcdf4d9902b78d3c9c36e1bFixvia CVE List
- github.com/modelcontextprotocol/python-sdk/releases/tag/v1.30.0Fixvia CVE List
- github.com/modelcontextprotocol/python-sdk/releases/tag/v2.2.0Fixvia CVE List
- github.com/modelcontextprotocol/python-sdk/security/advisories/GHSA-rwrf-2pqf-9j8jAdvisoryvia CVE List
- github.com/advisories/GHSA-rwrf-2pqf-9j8jAdvisoryvia GitHub
- github.com/modelcontextprotocol/python-sdk/pull/3394Referencevia CVE List
- github.com/modelcontextprotocol/python-sdk/pull/3396Referencevia CVE List