{"id":"CVE-2026-116685","kind":"vulnerability","aliases":["CVE-2026-116685","GHSA-5h93-6whr-6q8j"],"related":[],"title":"Model Context Protocol Python SDK: HTTP client transports followed cross-origin redirects carrying custom headers and bodies","description":"### Summary\nIn 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:\n\n- custom headers set on the client (for example an `X-API-Key` credential) were sent to that origin, and\n- on a `307` or `308` redirect the request body was re-sent there too.\n\nThe SDK's OAuth client providers followed redirects on their own discovery, registration and token requests in the same way.\n\nA lone `Authorization` bearer header was not exposed; the HTTP library already drops it on cross-origin redirects.\n\nAnyone 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.\n\n### Am I affected?\nYes, if your code uses the SDK as an MCP client over HTTP through any of:\n\n- `streamable_http_client` (on 2.x also `Client` given an `http://` or `https://` URL)\n- `streamablehttp_client` or `sse_client`\n- `ClientSessionGroup` with HTTP server parameters\n- the internal `create_mcp_http_client` helper\n\nThis includes an HTTP client you passed in yourself with `follow_redirects=True`.\n\nAffected versions: 1.8.0 through 1.29.1, and 2.0.0 through 2.1.1.\n\nNot affected:\n\n- MCP servers\n- stdio clients\n- a client you supplied with `follow_redirects` left at its default of `False`\n\n### Fix\nUpgrade to `mcp` 1.30.0 (1.x) or 2.2.0 (2.x) or later; no code changes are needed.\n\nThe 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.\n\nIf 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.\n\nUntil 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.\n\n<details>\n<summary>If you genuinely need the old behaviour (unsupported)</summary>\n\nThis 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:\n\n```python\nimport httpx2  # on 1.x: import httpx and subclass httpx.AsyncClient instead\n\nclass FollowRedirectsAnyway(httpx2.AsyncClient):\n    \"\"\"Follows redirects to ANY origin. Deliberately gives up the SDK's same-origin protection.\"\"\"\n\n    async def send(self, request, *, follow_redirects=False, **kwargs):\n        return await super().send(request, follow_redirects=True, **kwargs)\n\nhttp_client = FollowRedirectsAnyway(timeout=httpx2.Timeout(30, read=300))\n# streamable_http_client(url, http_client=http_client)\n\n# sse_client / streamablehttp_client take a factory instead:\ndef client_factory(headers=None, timeout=None, auth=None):\n    return FollowRedirectsAnyway(headers=headers, auth=auth,\n                                 timeout=timeout if timeout is not None else httpx2.Timeout(30, read=300))\n# sse_client(url, httpx_client_factory=client_factory)\n```\n\nThe 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.\n\n</details>\n\n---","summary":"The official Model Context Protocol Python SDK's HTTP and SSE clients follow redirects to a different origin and forward caller-supplied credential headers, and for 307 or 308 responses the request body. An attacker who can change a trusted endpoint's redirect target can collect those credentials and data.","severity":"medium","cvss":5.9,"epss":null,"exploited":false,"exploited_at":null,"products":[{"name":"mcp","fixed":["2.2.0"],"affected":">= 2.0.0, < 2.2.0","ecosystem":"pypi"},{"name":"mcp","fixed":["1.30.0"],"affected":">= 1.8.0, < 1.30.0","ecosystem":"pypi"}],"ecosystems":["pypi"],"tags":["ai-agents","ai-tooling","cwe-200","mcp","python"],"not_affected_if":["no-custom-credential-headers","stdio-transport-only"],"how_to_check":"- Check the installed SDK version with `pip show mcp` and compare it to the fixed versions.\n- Look for use of `streamablehttp_client`, `streamable_http_client`, `sse_client`, `ClientSessionGroup`, or `create_mcp_http_client` in your code that passes custom auth headers.","fix":"- Upgrade the `mcp` Python package to `1.30.0` (1.x line) or `2.2.0` (2.x line).","status":"open","published_at":"2026-10-27T20:17:13+00:00","first_seen_at":"2026-10-27T20:33:27+00:00","triaged_at":"2026-10-27T20:35:34+00:00","updated_at":"2026-10-27T21:09:20+00:00","category":"ai-tooling","confidence":0.7,"triage":{"at":"2026-10-27T20:35:34Z","model":"claude-haiku-5-5","output":{"fix":"- Upgrade the `mcp` Python package to `1.30.0` (1.x line) or `2.2.0` (2.x line).","reach":"network","title":"MCP Python SDK: client redirects forward credentials and request bodies to other origins","impact":"medium","summary":"The official Model Context Protocol Python SDK's HTTP and SSE clients follow redirects to a different origin and forward caller-supplied credential headers, and for 307 or 308 responses the request body. An attacker who can change a trusted endpoint's redirect target can collect those credentials and data.","category":"ai-tooling","nicknames":[],"who_cares":["python","mcp","ai-agents"],"confidence":0.7,"needs_auth":"unknown","worst_case":"Attacker receives custom credential headers and request bodies sent to redirected host.","analyst_note":"","how_to_check":"- Check the installed SDK version with `pip show mcp` and compare it to the fixed versions.\n- Look for use of `streamablehttp_client`, `streamable_http_client`, `sse_client`, `ClientSessionGroup`, or `create_mcp_http_client` in your code that passes custom auth headers.","needs_analyst":false,"not_affected_if":["stdio-transport-only","no-custom-credential-headers"],"who_is_affected":"Teams whose Python code uses the MCP client paths (streamable HTTP, SSE, OAuth, ClientSessionGroup) against remote MCP servers while sending custom credential headers or request bodies. Exposure also needs a trusted endpoint that can be made to redirect to a host the attacker controls. Teams that only run MCP servers, or use the SDK over stdio, are not in the described path.","user_interaction":"no","needs_special_setup":"unknown","severity_if_unknown":"medium"},"cost_usd":0.000654,"input_tokens":3433,"output_tokens":621,"severity_before":"medium"},"analyst_status":null,"analyst_note":null,"search":"'-116685':21A,29A '-200':39B '-2026':20A,28A '1':340C,416C,618C '1.29.1':311C '1.30.0':339C '1.8.0':309C '2':269C,344C,412C '2.0.0':313C '2.1.1':315C '2.2.0':343C '30':667C '300':669C '307':69B,147C,567C '308':71B,149C,568C '5h93':24A '6q8j':26A '6whr':25A 'abl':200C 'accept':591C 'advisori':552C 'affect':95C,248C,307C,317C 'agent':34B 'ai':33B,36B 'ai-ag':32B 'ai-tool':35B 'alreadi':191C,241C,523C 'also':271C 'anoth':459C 'answer':117C 'anyon':199C 'api':136C 'ask':612C 'async':644C 'attack':77B,223C 'auth':693C,699C,700C 'author':182C 'await':654C 'bearer':183C 'behaviour':546C 'bodi':18A,75B,153C,571C 'call':439C 'caller':63B 'caller-suppli':62B 'cannot':588C 'captur':227C 'carri':14A,539C,561C 'chang':80B,350C 'class':626C 'client':7A,53B,104C,130C,164C,259C,267C,272C,278C,281C,292C,298C,321C,323C,420C,429C,450C,492C,500C,504C,506C,510C,513C,521C,603C,663C,672C,675C,677C,679C,681C,687C 'clientsessiongroup':282C,514C 'code':252C,349C,438C 'collect':88B 'configur':114C 'connect':471C 'context':2A,45B 'control':534C 'could':226C 'creat':289C,426C 'credenti':65B,90B,138C,467C,537C,593C 'cross':11A,196C 'cross-origin':10A,195C 'current':451C 'custom':15A,125C,563C 'cve':19A,27A 'cwe':38B 'data':92B 'def':645C,686C 'default':332C 'deliber':634C 'differ':58B,123C 'direct':245C,441C 'discoveri':171C 'domain':215C 'drop':192C 'elsewher':208C 'endpoint':83B,116C,204C,371C,477C,579C 'error':406C 'exampl':132C 'expos':187C 'factori':507C,684C,688C 'fail':403C 'fals':334C,498C,651C 'fix':335C,553C 'follow':9A,54B,106C,166C,304C,327C,362C,399C,435C,494C,525C,559C,605C,629C,649C,658C 'followredirectsanyway':627C,664C,696C 'forward':61B,592C 'gain':236C 'genuin':542C 'ghsa':23A 'ghsa-5h93-6whr-6q8j':22A 'give':598C,635C 'given':273C 'header':16A,66B,126C,184C,564C,689C,697C,698C 'helper':293C,430C 'host':111C,376C,388C,460C,530C,557C 'http':6A,50B,101C,107C,189C,261C,266C,284C,291C,297C,381C,419C,428C,491C,499C,503C,602C,662C,671C,674C,676C 'https':383C 'httpx':505C,621C 'httpx.asyncclient':624C 'httpx.httpstatuserror':414C 'httpx2':616C 'httpx2.asyncclient':628C 'httpx2.timeout':666C 'import':615C,620C 'includ':295C,461C,575C 'influenc':225C 'instead':447C,625C,685C 'intern':288C,425C 'keep':390C 'key':137C 'kwarg':652C,661C 'laps':214C 'later':347C 'left':329C,496C 'librari':190C 'logic':221C 'lone':181C 'longer':432C 'make':202C 'malici':235C 'materi':229C 'may':522C 'mcp':30A,31A,40B,115C,258C,290C,318C,338C,427C 'mcperror':410C 'method':393C 'misrout':217C 'model':1A,44B 'name':407C 'need':352C,465C,543C 'none':690C,692C,694C 'noth':237C 'oauth':163C,357C,572C 'offici':43B 'old':545C 'origin':12A,59B,124C,143C,197C,373C,633C,642C 'paramet':286C,518C 'pass':300C 'port':378C 'prefer':576C 'protect':643C 'protocol':3A,46B 'provid':165C,358C 'proxi':218C 'python':4A,41B,47B,614C 're':156C 're-sent':155C 'reach':452C 'read':668C 'receiv':242C,443C 'redirect':13A,55B,85B,108C,120C,150C,167C,198C,207C,211C,220C,305C,328C,364C,396C,434C,445C,457C,481C,495C,527C,554C,583C,596C,606C,630C,650C,659C 'regardless':607C 'registr':172C 'request':74B,152C,175C,244C,360C,392C,402C,570C,574C,648C,657C 'respons':72B,446C 'restor':549C 'return':653C,695C 'rotat':535C 'rule':219C 'same-origin':640C 'scheme':375C 'sdk':5A,48B,98C,161C,255C,611C,638C 'self':647C 'send':646C,656C 'sent':140C,157C 'server':231C,285C,319C,454C,463C 'set':127C,475C,577C 'sse':52B,103C,280C,509C,678C 'stale':210C 'stay':368C 'stdio':320C 'stop':470C 'streamabl':100C,265C,502C,670C 'streamablehttp':277C,512C,680C 'subclass':623C 'summari':93C 'super':655C 'suppli':64B,325C,488C 'take':682C 'target':86B,409C,483C,585C,597C 'timeou':702C 'timeout':665C,691C,701C 'token':174C,573C 'tool':37B 'transport':8A,105C,354C,422C,600C 'true':306C,660C 'trust':82B,206C 'turn':433C 'unsupport':547C 'upgrad':336C,384C,474C,487C 'url':276C,478C,580C,673C 'use':253C,423C 'version':96C,308C 'way':179C,239C 'whichev':418C 'x':135C,270C,341C,345C,413C,417C,619C 'x-api-key':134C 'yes':249C","nicknames":[],"mitigations":[],"who_affected":"Teams whose Python code uses the MCP client paths (streamable HTTP, SSE, OAuth, ClientSessionGroup) against remote MCP servers while sending custom credential headers or request bodies. Exposure also needs a trusted endpoint that can be made to redirect to a host the attacker controls. Teams that only run MCP servers, or use the SDK over stdio, are not in the described path.","tier":"B","verified":{},"analyst_revisit_at":null,"first_public_at":"2026-10-27T20:17:13+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"nvd","external_id":"CVE-2026-116685","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-116685","severity":null,"published_at":"2026-10-27T20:17:13+00:00","modified_at":"2026-10-27T20:17:13+00:00","first_seen_at":"2026-10-27T20:33:27+00:00","fetched_at":"2026-10-27T20:33:27+00:00","note":null},{"source":"ghsa","external_id":"GHSA-5h93-6whr-6q8j","url":"https://github.com/advisories/GHSA-5h93-6whr-6q8j","severity":"medium","published_at":"2026-10-27T21:05:34+00:00","modified_at":"2026-10-27T21:05:36+00:00","first_seen_at":"2026-10-27T21:09:20+00:00","fetched_at":"2026-10-27T21:09:20+00:00","note":null}],"documents":[],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}