Advisories for Pypi/Mcp package

2026

Model Context Protocol Python SDK: HTTP client transports followed cross-origin redirects carrying custom headers and bodies

In affected versions, the SDK's Streamable HTTP and SSE client transports followed HTTP redirects to any host. If the configured MCP endpoint answered with a redirect to a different origin: custom headers set on the client (for example an X-API-Key credential) were sent to that origin, and on a 307 or 308 redirect the request body was re-sent there too. The SDK's OAuth client providers followed redirects on their own …

Model Context Protocol Python SDK: Client fetched server-chosen $ref URLs while validating tool results against output schemas

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 …

MCP Python SDK: Unbounded Session Accumulation in StreamableHTTP Transport Enables Resource Exhaustion

In affected versions, a Streamable HTTP server in stateful mode (the default) never reclaimed session state: sessions did not expire; a client DELETE ended the session but left its entry registered; a session whose first request was refused stayed registered with a running task. Each session also kept its parsed initialize parameters, and the number of sessions was unlimited. A client that could reach the endpoint could grow server memory …

MCP Python SDK: WebSocket server transport does not support Host/Origin validation

In affected versions, the deprecated WebSocket server transport (mcp.server.websocket.websocket_server) accepted the WebSocket handshake without applying any Host or Origin header validation. The TransportSecuritySettings mechanism that the SSE and Streamable HTTP transports use for this purpose was not wired into the WebSocket transport, so there was no SDK-level way to restrict which origins could connect.

MCP Python SDK: HTTP transports serve session requests without verifying the authenticated principal

In affected versions, the SSE and Streamable HTTP server transports routed incoming requests to an existing session based only on the session identifier, without verifying that the request was authenticated as the same principal that created the session. Anyone who learned or guessed a session ID could send JSON-RPC messages on that session, regardless of which bearer token the request carried.

2025

Model Context Protocol (MCP) Python SDK does not enable DNS rebinding protection by default

The Model Context Protocol (MCP) Python SDK does not enable DNS rebinding protection by default for HTTP-based servers. When an HTTP-based MCP server is run on localhost without authentication using FastMCP with streamable HTTP or SSE transport, and has not configured TransportSecuritySettings, a malicious website could exploit DNS rebinding to bypass same-origin policy restrictions and send requests to the local MCP server. This could allow an attacker to invoke tools …

MCP Python SDK has Unhandled Exception in Streamable HTTP Transport, Leading to Denial of Service

If a client deliberately triggers an exception after establishing a streamable HTTP session, this can lead to an uncaught ClosedResourceError on the server side, causing the server to crash and requiring a restart to restore service. Impact may vary depending on the deployment conditions, and presence of infrastructure-level resilience measures. Thank you to Rich Harang for reporting this issue.