How to Fix CVE-2026-115563 in MCP Python SDK OAuth Clients (2026)

Nov 20, 2026 · 10 min · Ajay Kumar

GitHub added GHSA-qx49-fqc8-xw99 (CVE-2026-115563) to its reviewed advisory database on 19 November 2026, so Dependabot alerts for it started arriving this week. It is not new: the Python SDK maintainers published the repository advisory on 28 September and shipped the fix in v2.2.0 and v1.30.0 on 7 September. But GitHub's own documentation says Dependabot only alerts on GitHub-reviewed advisories, so for many teams this is the first notice.

The short version: the SDK's OAuth client let the MCP server you connect to decide which token endpoint received your credentials. The upgrade fixes the interactive flow and the legacy discovery path. For headless agents using ClientCredentialsOAuthProvider or PrivateKeyJWTOAuthProvider, upgrading changes nothing until you also pass issuer=. I reproduced both halves of that locally, and the harness is below so you can run it against your own pinned version.

Step 1: Check whether you are affected

You are in scope if all three hold, per the advisory:

  1. Your code uses the mcp package as a client over HTTP. Servers built with the SDK, stdio clients and clients that set their own Authorization header are not affected.
  2. It passes one of OAuthClientProvider, ClientCredentialsOAuthProvider, PrivateKeyJWTOAuthProvider or the 1.x RFC7523OAuthClientProvider as the transport's auth.
  3. It may connect to an MCP server you do not fully trust while holding credentials for a real authorization server.
pip show mcp | grep -i '^version'
grep -rnE "OAuthClientProvider|ClientCredentialsOAuthProvider|PrivateKeyJWTOAuthProvider|RFC7523OAuthClientProvider" --include='*.py' .
Version What is missing
1.9.1 to 1.29.1 No issuer check and no credential binding on any path
2.0.0 to 2.1.1 Both missing when the server publishes no protected resource metadata, or answers 403 insufficient_scope
Any version before the fix ClientCredentialsOAuthProvider and PrivateKeyJWTOAuthProvider had no way to say which authorization server their credentials belong to
1.30.0, 2.2.0 and later Fixed, but the two unattended providers still follow the MCP server unless you pass issuer=

The advisory scores it 7.5 for the unattended providers and 6.5 for the interactive one, where a person has to start the sign-in and would see an unfamiliar login page.

Step 2: Understand the two ways the secret leaves

Where a client-credentials agent sends its secret Path A: protected resource metadata MCP server: 401 + resource_metadata URL authorization_servers: [evil] Client fetches evil's metadata issuer: evil (self-consistent) token_endpoint: evil/token POST evil/token Basic client_id:client_secret Blocked only with issuer= Path B: legacy fallback, no protected resource metadata MCP server: 401, no metadata Client falls back to the server's own origin Metadata on MCP origin claims issuer: your real AS token_endpoint: evil/token Fixed: OAuthFlowError issuer must equal the MCP origin, even without issuer= Measured locally on 20 Nov 2026: 1.29.1 and 2.1.1 sent the secret to the attacker on both paths. 1.30.0 and 2.3.0 stopped path B without configuration, but still sent the secret on path A until the provider was built with issuer= set to the real issuer. With issuer= set, no token request left the client on either path.
The two discovery paths the advisory describes, with the outcomes from the local harness in Step 6.

Path A is plain OAuth discovery doing what it was told: the MCP server names an authorization server, and the client goes there. Without knowing which issuer your secret belongs to, the SDK cannot tell an attacker's server from a legitimate second one. That is why the fix for the unattended providers is a new argument, not a new check.

Step 3: Upgrade

Move to the current release of your line. On 20 November 2026 that is v2.3.0 (2 October) for 2.x and v1.30.0 for 1.x.

pip install -U 'mcp>=2.2.0'          # 2.x line
pip install -U 'mcp>=1.30.0,<2'      # staying on 1.x

The same releases change other defaults, so read the notes before you deploy: HTTP redirects are only followed within the endpoint's origin, idle stateful Streamable HTTP sessions expire after 30 minutes, a 5xx or 429 on protected resource metadata now stops the flow instead of falling back, and a 403 that is not insufficient_scope is returned to the caller instead of retried.

Step 4: Pass issuer= to every pre-provisioned provider

This is the step most teams will miss, because nothing breaks without it.

from mcp.client.auth.extensions.client_credentials import ClientCredentialsOAuthProvider

auth = ClientCredentialsOAuthProvider(
    server_url="https://mcp.internal.example.com/mcp",
    storage=token_storage,
    client_id="ci-agent",
    client_secret=os.environ["MCP_CLIENT_SECRET"],
    scope="tickets:read",
    issuer="https://auth.example.com",   # the issuer that minted this secret
)

PrivateKeyJWTOAuthProvider takes the same argument. Use the exact issuer string from your authorization server's metadata document (/.well-known/oauth-authorization-server or /.well-known/openid-configuration). The SDK compares it as a string, with one exception it documents in code: a root issuer with and without its trailing slash count as equal. A path-based issuer, as Keycloak realms and Cognito user pools use, must match exactly.

If you are on the deprecated 1.x RFC7523OAuthClientProvider, it has no issuer option. Move to PrivateKeyJWTOAuthProvider.

Step 5: Make the warning fail your tests

Omitting issuer= now warns, and 3.0 will make it required. On 2.x the warning is MCPDeprecationWarning, a UserWarning subclass, so it prints by default. On 1.30.0 it is a plain DeprecationWarning, which Python hides unless the call comes from __main__. I confirmed both: built from an imported module, 1.30.0 printed nothing and 2.3.0 printed the warning.

So turn it into an error in CI, where you will actually see it:

# pytest.ini
[pytest]
filterwarnings =
    error:Omitting `issuer` is deprecated

Step 6: Prove it with a local harness

I wanted to see the leak, not just read about it. The harness runs three stub HTTP servers on loopback: a malicious MCP server on :8001, your real authorization server on :9001 and the attacker's on :9002. The client is a ClientCredentialsOAuthProvider with secret s3cr3t-for-real-as, and it makes one request through httpx2 (1.x uses httpx). The core of it:

# scenario "prm": MCP server's protected resource metadata names the attacker
{"resource": "http://127.0.0.1:8001/mcp", "authorization_servers": ["http://127.0.0.1:9002"]}
# scenario "legacy": no PRM; metadata on the MCP origin claims the real issuer
{"issuer": "http://127.0.0.1:9001", "token_endpoint": "http://127.0.0.1:9002/token", ...}

auth = ClientCredentialsOAuthProvider(server_url="http://127.0.0.1:8001/mcp", storage=Mem(),
    client_id="ci-bot", client_secret="s3cr3t-for-real-as", **kw)   # kw = {"issuer": REAL} or {}
async with httpx2.AsyncClient(auth=auth) as c:
    await c.post("http://127.0.0.1:8001/mcp", json={"jsonrpc": "2.0", "id": 1, "method": "ping"})

Each attacker endpoint logs any token request it receives. I ran it on 20 November 2026 on macOS with Python 3.12.8, in four venvs:

Version Path A, no issuer Path A, issuer= real Path B, no issuer Path B, issuer= real
1.29.1 Secret sent to attacker TypeError: no such argument Secret sent to attacker TypeError
1.30.0 Secret sent to attacker (warning) Refused, no request sent Refused, no request sent Refused, no request sent
2.1.1 Secret sent to attacker TypeError: no such argument Secret sent to attacker TypeError
2.3.0 Secret sent to attacker (warning) Refused, no request sent Refused, no request sent Refused, no request sent

The attacker's log line on the vulnerable runs was the whole secret in a Basic header:

token request reached EVIL AS: Authorization=Basic Y2ktYm90OnMzY3IzdC1mb3ItcmVhbC1hcw==
body=grant_type=client_credentials&resource=http%3A%2F%2F127.0.0.1%3A8001%2Fmcp

That decodes to ci-bot:s3cr3t-for-real-as. The refusals were OAuthFlowError: Authorization server metadata issuer mismatch: http://127.0.0.1:9002 != http://127.0.0.1:9001, raised before any request to a token endpoint.

What this does not cover: I only tested ClientCredentialsOAuthProvider, over plain HTTP on loopback, and not the interactive OAuthClientProvider, the 403 insufficient_scope path or PrivateKeyJWTOAuthProvider. Those rows come from the advisory, not from my runs. Keep the harness next to your client code and run it in CI against whatever version you pin; a regression in issuer handling then fails a test instead of shipping.

Step 7: Clear old registrations and rotate exposed secrets

The fixed SDK records which issuer a stored registration belongs to and discards one bound to a different issuer. Registrations stored before the fix carry no issuer, and the SDK's credentials_match_issuer treats an unbound record as reusable anywhere. So, from the advisory:

  • Clear stored OAuth client information once after upgrading, so interactive clients register again and get a bound record.
  • If you placed a pre-registered client in storage yourself, set the issuer field on that OAuthClientInformationFull record.
  • Registrations that use a Client ID Metadata Document URL as client_id are portable by design and are not affected by the binding. Since Cognito now accepts CIMD clients, that is another reason to prefer it for interactive clients.
  • If an affected client may ever have connected to an MCP server you do not control, rotate its client secret or signing key and revoke its tokens at the authorization server. There is no log on the client side that would tell you whether it happened.

Troubleshooting

Symptom Cause Fix
TypeError: ... unexpected keyword argument 'issuer' Running a version before 1.30.0 or 2.2.0 Upgrade, then check pip show mcp in the environment that actually runs the agent
OAuthFlowError: Authorization server metadata issuer mismatch: A != B The issuer= you passed differs from the metadata's issuer, often by a path or trailing slash on a non-root issuer Copy issuer verbatim from the authorization server's metadata document
Same error on a server that worked before, no issuer= set Server has no protected resource metadata and serves metadata whose issuer is not its own origin Ask the operator to publish RFC 9728 protected resource metadata; this is the check the fix added
OAuthFlowError: No authorization server metadata discovered for configured issuer Discovery never fetched metadata for your issuer, for example because the metadata request failed Fetch the issuer's metadata URL from the agent's network; if the MCP server now advertises a different authorization server, confirm why before changing issuer
Deprecation warning never appears on 1.30.0 DeprecationWarning is hidden outside __main__ Use the pytest filter in Step 5 or python -W error::DeprecationWarning
Connection now fails on a redirect Redirects are only followed within the endpoint's origin Use the final URL as the endpoint

FAQ

Does CVE-2026-115563 affect MCP servers written with the Python SDK?

No. The advisory scopes it to the SDK's OAuth client support, used when your code connects to an MCP server over HTTP. Servers built with the SDK, stdio clients and clients that set their own tokens or headers are not affected.

Is upgrading to mcp 2.2.0 enough?

For the interactive OAuthClientProvider, the upgrade plus clearing stored registrations closes the credential leak the advisory describes. For ClientCredentialsOAuthProvider and PrivateKeyJWTOAuthProvider, no: they still follow whichever authorization server the MCP server advertises until you pass issuer=. My harness showed the secret still reaching the attacker on 2.3.0 without it.

Why did Dependabot only flag this in November when the fix shipped in September?

GitHub's advisory database only triggers Dependabot alerts for GitHub-reviewed advisories. The repository advisory was published on 28 September 2026, NVD listed the CVE on 16 November, and GitHub's review landed on 19 November, which is when alerts started.

Is the TypeScript SDK affected too?

It had the same class of bug, CVE-2026-104850, fixed in @modelcontextprotocol/sdk 1.31.0 and @modelcontextprotocol/client 2.2.0. It is listed with the other SDK advisories on the MCP changelog tracker.

Related: MCP Authorization Explained, How to Deploy a Secure Remote MCP Server with OAuth and MCP Changelog Tracker.

Spot an error or something out of date? Email me and I will fix it and log it on the corrections page.

I'm Ajay Kumar — I build and operate PandaStack, an open-source Firecracker microVM cloud for AI agents, and write about the infrastructure and tooling around it.

Need this kind of infrastructure work? See what I do or email hello@ajayk.sh.


Related