CVE-2026-116685: Model Context Protocol Python SDK: HTTP client transports followed cross-origin redirects carrying custom headers and bodies
The MCP Python SDK's HTTP client transports followed redirects to any host. If your MCP endpoint redirected to another origin, custom headers such as an X-API-Key were sent there, and on a 307 or 308 redirect the request body went too. Affects mcp 1.8.0 through 1.29.1 and 2.0.0 through 2.1.1. Fixed in 1.30.0 and 2.2.0.
Published Oct 27, 2026 · Analysis Oct 28, 2026
What an attacker can do
The Streamable HTTP and SSE client transports used an HTTP client that followed redirects blindly. The OAuth providers did the same on their discovery, registration and token requests. When the configured endpoint answered with a redirect to a different origin, the client re-sent its custom headers to the new host. A 307 or 308 also replayed the request body, which can carry tool arguments or OAuth token request fields.
A lone Authorization bearer header was not leaked, because the HTTP library already drops it across origins.
The attacker cannot act alone. They need a way to make an endpoint you trust redirect elsewhere: a stale redirect to a lapsed domain they can register, a misrouted proxy rule, or redirect logic they can influence. A malicious MCP server gains nothing new, since it already receives your requests. The loss is confidentiality only. Teams that put API keys in custom headers on MCP client connections are the ones to worry about, for example agents that connect to remote MCP servers through a gateway.
MCP servers, stdio clients and clients given an HTTP client with follow_redirects left at False are not affected.
Who is affected
Affected: mcp 1.8.0 through 1.29.1, and 2.0.0 through 2.1.1. It applies to code that uses the SDK as an HTTP client through streamable_http_client (on 2.x also Client with an http or https URL), streamablehttp_client, sse_client, ClientSessionGroup with HTTP server parameters, or the internal create_mcp_http_client helper. It also applies when you pass your own HTTP client with follow_redirects=True.
Check the version:
pip show mcpmcp
- Ecosystem
- PyPI
- Affected
- >= 2.0.0, < 2.2.0
- Fixed in
- 2.2.0
- Check
pip show mcp
mcp
- Ecosystem
- PyPI
- Affected
- >= 1.8.0, < 1.30.0
- Fixed in
- 1.30.0
- Check
pip show mcp
How to fix it
Upgrade to mcp 1.30.0 (1.x) or 2.2.0 (2.x) or later. No code changes are needed:
pip install --upgrade "mcp>=1.30.0"The transports and the OAuth providers now follow a redirect only if it stays on the endpoint's origin (same scheme, host and port, or an http to https upgrade on the same host) and keeps the request method. Other redirects fail with an error naming the target: MCPError on 2.x, httpx.HTTPStatusError on 1.x. If your client reaches its server through a redirect to another host, it will stop connecting; set the endpoint URL to the redirect target.
Before upgrading, pass your own HTTP client with follow_redirects left at False (http_client= on streamable_http_client; httpx_client_factory= on sse_client and streamablehttp_client). If a client may have followed a redirect to a host you do not control, rotate the credentials it carried.
How to tell if you were hit
Review proxy and server logs for MCP client requests that hit a 301, 302, 307 or 308 response from your MCP endpoint, then a follow-up request to a different host. Check DNS and redirect rules for the endpoint's domain for entries that point at lapsed or foreign domains.
After upgrading, a cross-origin redirect now raises an error naming the target host. Search client logs for MCPError or httpx.HTTPStatusError mentioning a redirect, which shows redirects that used to be followed silently.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
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-Keycredential) were sent to that origin, and - on a
307or308redirect the request body was re-sent there too.
The SDK's OAuth client providers followed redirects on their own discovery, registration and token requests in the same way.
A lone Authorization bearer header was not exposed; the HTTP library already drops it on cross-origin redirects.
Anyone able to make an endpoint you trust redirect elsewhere (a stale redirect to a lapsed domain, a misrouted proxy rule, redirect logic an attacker can influence) could capture that material. A server that is itself malicious gains nothing this way; it already receives your requests directly.
Am I affected?
Yes, if your code uses the SDK as an MCP client over HTTP through any of:
streamable_http_client(on 2.x alsoClientgiven anhttp://orhttps://URL)streamablehttp_clientorsse_clientClientSessionGroupwith HTTP server parameters- the internal
create_mcp_http_clienthelper
This includes an HTTP client you passed in yourself with follow_redirects=True.
Affected versions: 1.8.0 through 1.29.1, and 2.0.0 through 2.1.1.
Not affected:
- MCP servers
- stdio clients
- a client you supplied with
follow_redirectsleft at its default ofFalse
Fix
Upgrade to mcp 1.30.0 (1.x) or 2.2.0 (2.x) or later; no code changes are needed.
The transports, and the OAuth providers' own requests, now follow a redirect only when it stays on the endpoint's origin (same scheme, host and port, or an http to https upgrade on the same host) and keeps the request method. Any other redirect is not followed and the request fails with an error naming the target (MCPError on 2.x, httpx.HTTPStatusError on 1.x), whichever HTTP client the transport uses. The internal create_mcp_http_client helper no longer turns redirect following on, so code calling it directly now receives the redirect response instead.
If your client currently reaches its server through a redirect to another host, including a server that needs no credentials, it will stop connecting after the upgrade: set the endpoint URL to the redirect's target.
Until you can upgrade, supply your own HTTP client with follow_redirects left at False (http_client= on streamable_http_client; httpx_client_factory= on sse_client and streamablehttp_client; ClientSessionGroup has no such parameter). If a client may already have followed a redirect to a host you do not control, rotate the credentials it carried.
If you genuinely need the old behaviour (unsupported)
This restores what this advisory fixes: redirects to any host are followed again, carrying your custom headers and, on 307/308, the request body, OAuth token requests included. Prefer setting the endpoint URL to the redirect's target. If you cannot, and you accept forwarding credentials to the redirect target, give the transport an HTTP client that follows redirects regardless of what the SDK asks for:
import httpx2 # on 1.x: import httpx and subclass httpx.AsyncClient instead
class FollowRedirectsAnyway(httpx2.AsyncClient):
"""Follows redirects to ANY origin. Deliberately gives up the SDK's same-origin protection."""
async def send(self, request, *, follow_redirects=False, **kwargs):
return await super().send(request, follow_redirects=True, **kwargs)
http_client = FollowRedirectsAnyway(timeout=httpx2.Timeout(30, read=300))
# streamable_http_client(url, http_client=http_client)
# sse_client / streamablehttp_client take a factory instead:
def client_factory(headers=None, timeout=None, auth=None):
return FollowRedirectsAnyway(headers=headers, auth=auth,
timeout=timeout if timeout is not None else httpx2.Timeout(30, read=300))
# sse_client(url, httpx_client_factory=client_factory)The redirect handling is then the HTTP library's own, as before the fix: a lone Authorization header is still dropped on cross-origin hops and 301/302/303 become GET. It is not something the SDK supports or tests.
---
Credited to dodge1218, nickelsec, sloemo01.
Questions
- Was my Authorization bearer token leaked by this?
Not by this flaw alone. The advisory says a lone Authorization header was not exposed because the HTTP library drops it on cross-origin redirects. Custom headers such as X-API-Key and, on 307 or 308, the request body were exposed.
- Are MCP servers built with the Python SDK affected?
No. Only the client side is affected. MCP servers and stdio clients are not.
- Why does my client fail to connect after upgrading?
It likely depends on a redirect to another host. Cross-origin redirects are no longer followed. Set the endpoint URL to the redirect's target.
- Is this exploited in the wild?
No source reports exploitation, and it is not in CISA's KEV catalog.
References
Read for this analysis:
- https://github.com/advisories/GHSA-5h93-6whr-6q8j
- https://github.com/modelcontextprotocol/python-sdk/releases/tag/v1.30.0
- https://github.com/modelcontextprotocol/python-sdk/security/advisories/GHSA-5h93-6whr-6q8j
- https://github.com/modelcontextprotocol/python-sdk/pull/3397
- https://github.com/modelcontextprotocol/python-sdk/pull/3448
- https://github.com/modelcontextprotocol/python-sdk/commit/2106335745563b2321b8c73fef2c12903d00aa6e
- https://github.com/modelcontextprotocol/python-sdk/commit/c6762e821c527925f0b617db216d00fbd1d0bf99
- https://github.com/modelcontextprotocol/python-sdk/releases/tag/v2.2.0
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
Coverage on the Beam blog
More MCP Python SDK vulnerabilities
All MCP Python SDK entriesCVE-2026-115563
Model Context Protocol Python SDK: OAuth client could send credentials to an authorization server chosen by the MCP server
high7.5Nov 19, 2026CVE-2026-116684
Model Context Protocol Python SDK: Server bearer-token authentication accepts tokens issued for a different resource server
medium6.8Oct 27, 2026CVE-2026-116686
Model Context Protocol Python SDK: Client fetched server-chosen $ref URLs while validating tool results against output schemas
medium6.5Oct 27, 2026CVE-2026-59951
MCP Python SDK: Unbounded Session Accumulation in StreamableHTTP Transport Enables Resource Exhaustion
medium7.5Oct 15, 2026CVE-2026-52869
MCP Python SDK: HTTP transports serve session requests without verifying the authenticated principal
high7.1Jul 16, 2026CVE-2026-52870
MCP Python SDK: Experimental task handlers allow any client to access and cancel other clients' tasks
high7.6Jul 16, 2026
