Skip to content
Putting technology to work.
Insights to guide decisions and action.

Search articles

MCP Python SDK: a weakness that sends credentials to a different destination

Table of contents · 6 items

When you hand internal work to an AI agent, you may build it so the agent connects to an external MCP server and obtains OAuth authorization for the services behind it. In that setup, the only party the client should send secrets (client_secret or authorization codes) to is the authorization server your company has contracted with. However, it has been disclosed that the MCP server side was able to decide where those secrets were sent.

For the Python SDK of MCP (Model Context Protocol) (the PyPI package mcp), the project published an advisory on its OAuth client functionality (GHSA-qx49-fqc8-xw99, CVE-2026-115563, HIGH) in its repository on September 28, 2026. The fixed versions had already been released earlier, on September 7. On November 19, the advisory was added to the GitHub Advisory Database as reviewed. According to GitHub's documentation, repositories with Dependabot alerts enabled receive a notification when a newly reviewed advisory is added for a package they depend on.

Even if you upgrade after seeing the notification, note that depending on the flow you use, simply updating changes nothing. This article uses the advisory and the SDK code to lay out which configurations are affected and how to fix them.

Consequence

When an MCP client obtains OAuth authorization, it first learns which authorization server to use from information published by the MCP server it connects to (the protected resource metadata). According to the advisory, the affected versions lacked the following two things.

  • They did not verify the issuer (issuer) in the authorization server metadata on every retrieval path
  • They did not bind stored or pre-registered client credentials to the authorization server they belong to

As a result, a malicious or compromised MCP server could make the client use a token endpoint it controlled, either by pointing to its own authorization server in the protected resource metadata, or by not publishing that metadata and instead returning its own metadata with the genuine authorization server written in issuer. That endpoint would receive the client_secret, the authorization code, and the PKCE code_verifier (and, in flows that sign with a private key, the signed assertion) that should have gone to the genuine authorization server.

Diagram comparing the OAuth client of the MCP Python SDK before and after the fix: before, client_secret and authorization codes were sent to the authorization server indicated by the connected MCP server; after, specifying issuer makes the flow stop with OAuthFlowError when the issuer in the metadata does not match

Affected configurations

The advisory covers cases where both of the following apply.

  1. You use the SDK as an MCP client over HTTP and pass OAuthClientProvider, ClientCredentialsOAuthProvider, PrivateKeyJWTOAuthProvider, or RFC7523OAuthClientProvider (deprecated in the 1.x series) to auth
  2. You may connect to an MCP server that is not fully trusted while holding credentials for a legitimate authorization server (pre-issued secrets, signing keys, or stored client registrations)

Out of scope are MCP servers built with the SDK, clients that connect over standard input/output (stdio), and clients that attach their own tokens or headers themselves.

The HIGH severity (CVSS 7.5) assumes flows that run without human interaction. According to the advisory, OAuthClientProvider alone, which requires the user to start the sign-in, scores 6.5.

Release lineAffected versionsFixed version (PyPI release date)
1.x1.9.1–1.29.1 (all paths)1.30.0 (September 7, 2026)
2.x2.0.0–2.1.1 (some paths, such as servers that do not publish metadata)2.2.0 (September 7, 2026)

As of November 20, the latest version on PyPI is 2.3.0 (released October 2). In both series, ClientCredentialsOAuthProvider and PrivateKeyJWTOAuthProvider had no way to specify the authorization server that the credentials belong to.

Flows that updating alone does not fix

For OAuthClientProvider, where the user signs in on screen, upgrading to a fixed version makes the client determine the expected issuer in advance and stop with OAuthFlowError if the issuer in the metadata does not match.

On the other hand, as the advisory states explicitly, ClientCredentialsOAuthProvider and PrivateKeyJWTOAuthProvider, which run without human interaction, do not change behavior until you pass issuer=. If you do not pass it, they keep using the authorization server indicated by the MCP server, as before.

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

provider = ClientCredentialsOAuthProvider(
    server_url="https://mcp.example.com/mcp",
    storage=token_storage,
    client_id=CLIENT_ID,
    client_secret=CLIENT_SECRET,
    issuer="https://auth.example.com",  # 認証情報を発行した認可サーバー
)

In the 2.2.0 code, omitting issuer emits a MCPDeprecationWarning warning. Because this warning inherits from UserWarning, it is shown even with Python's default settings. In the 1.30.0 code, the warning type is DeprecationWarning, which the advisory describes as one that "Python does not display by default." In 3.0, issuer becomes required. In addition, the 2.2.0 and 1.30.0 code stops with ValueError if you pass issuer a value that does not start with http or https. As of November 20, this part of the code in the latest version, 2.3.0, is the same as in 2.2.0.

How to fix it (editorial suggestions)

  1. Check the version and flow you use. Check the version with pip show mcp, and check in your code which class you pass to auth=. If you are on 1.29.1 or earlier, or 2.1.1 or earlier, upgrade.
  2. Add issuer= to flows that run without human interaction. Pass the authorization server's issuer URL everywhere you use ClientCredentialsOAuthProvider and PrivateKeyJWTOAuthProvider. Also check your logs and tests for MCPDeprecationWarning (DeprecationWarning in 1.30.0). Because RFC7523OAuthClientProvider in the 1.x series has no way to accept issuer, the advisory asks users to move to one of these two.
  3. Clear stored registrations once. According to the advisory, registrations stored without issuer (including everything stored by the 1.x series before 1.30.0) remain unbound even in the fixed versions. Clear the stored client information once and register again, or, for registrations you placed yourself, add issuer.
  4. Review past connections. For clients that may have connected to an untrusted MCP server, regenerate the secrets at the authorization server and revoke tokens that have already been issued.

We covered designing OAuth protection for MCP servers you publish in our article on OAuth 2.1, and the idea of consolidating internal MCP servers behind a single entry point in our article on MCP server portals. Both assume that you decide in advance which servers to trust.

Scope of verification

On November 20, 2026, we checked GHSA-qx49-fqc8-xw99 in the GitHub Advisory Database (added to the database on November 19, published in the repository on September 28), the release notes for v1.30.0, v2.2.0, and v2.3.0, and the release dates and times of each version of mcp on PyPI, and read the mcp 2.2.0 source (client/auth/extensions/client_credentials.py, client/auth/utils.py, shared/exceptions.py) and client_credentials.py in 1.30.0 and 2.3.0 (document research; dates in UTC). We had planned to run each version with and without issuer and compare the warnings, but did not do so. We also did not reproduce the issue with a malicious server.

GleamHub's development, AI, and automation consulting can help with development that connects AI agents to internal systems and with reviewing the design of MCP connections. Please reach out via our contact form.

References

Share this articleXFacebook
Kakeru Suzuki

Fascinated by the possibilities of technology, has had a deep interest in programming and digital art since student days

Turn this article's theme into your company's next step

Concrete steps forward for your organization.

We organize your desired architecture, legacy systems, and operational requirements to formulate your next steps toward execution.

  • Desired architecture
  • Integration with existing environments
  • Operational requirements
Consult on development & operations initiatives

You can consult with us from the initial conceptual stage. Details from this article will be carried over to the inquiry form.

Receive the latest articles by email