Independent analysis by NHI Mgmt GroupSource article: Akeyless, “MCP OAuth 2.1: How the Flow Works and Where Tokens Still Leak” (November 6, 2026)

TL;DR: Akeyless describes how an MCP server can satisfy OAuth 2.1 checks and still leak the credential that matters, because the flow only governs client-to-server access while upstream secrets, token passthrough and proxy consent gaps sit outside its visibility. The governing assumption is wrong: authorization can look correct while the server’s own long-lived credentials remain the real blast radius.


At a glance

What this is: NHI Mgmt Group's analysis, drawing on Akeyless's blog post: MCP OAuth can validate the client-to-server hop while leaving the server’s upstream credential exposed to theft and misuse.

Why it matters: IAM and NHI teams need to treat MCP servers as credential holders, not just OAuth resource servers, because the upstream secret can outlive and outscope the user token.

👉 Read Akeyless's analysis of MCP OAuth and the hidden server credential


Context

MCP authorization protects one boundary: a client getting permission to call a remote server. It does not, by itself, govern the secrets the server loads from its own environment, forwards to upstream systems, or caches behind a proxy, which is where the most durable exposure can sit.

For identity teams, that means the governance question is not only whether the OAuth exchange is correct. It is also whether the server’s own credentials are inventoried, scoped, rotated and separated from the user-facing access path.


Key questions

Q: How can organizations secure their MCP server credentials?

A: To secure MCP server credentials, organizations should adopt OAuth for authentication, avoid hard-coded values, and implement strict access controls. Dynamic credential management and regular audits can further enhance security.

Q: Why does token passthrough create access risk?

A: Token passthrough creates access risk because a service forwards the caller’s token to another system, so the downstream service may act with the original user or workload’s authority instead of a narrowly scoped server-side credential. That weakens trust boundaries, makes privilege harder to constrain, and can expose data or actions beyond the proxy’s intended role.

Q: How can a proxy create a consent bypass in OAuth flows?

A: A proxy can create a consent bypass when it reuses or injects OAuth tokens in a way that avoids the normal per-user client approval checks, so an application gains access without the user granting consent for that client or scope. The risk arises when the proxy changes who appears to be the authorised OAuth client.

Q: What should teams do first when MCP secrets appear in config files?

A: First, remove the exposed secrets from the MCP configuration file and rotate every credential found there, including API keys, tokens and certificates. Then identify who or what used them, check repository history and build pipelines for further copies, and move the secrets into a managed secret store with scoped access and rotation controls.


Technical breakdown

Why MCP OAuth only covers one hop

The MCP authorization flow is an OAuth 2.1 code grant with PKCE, plus metadata discovery so a client can find the right authorization server and resource server. That design binds a token to a specific MCP server and narrows the risk of code interception or audience confusion. But it only governs the token exchange and the request path that follows. Anything the server uses outside that path, such as upstream API keys, database credentials or environment-variable secrets, remains outside the protocol boundary. See the MCP Authorisation Specification Guide.

Practical implication: Treat the protocol as a client authorization layer, not as full server credential governance.

Why token passthrough breaks the trust boundary

Token passthrough happens when an MCP server forwards the client’s bearer token to another API instead of using its own credential. That collapses audience separation, which means rate limits, monitoring and accountability tied to the original token no longer apply cleanly. It also makes the server a confused deputy, because one accepted token can be reused across services that should have distinct trust boundaries. This is a protocol-architecture problem, not just a configuration mistake. See the MCP Security Guide.

Practical implication: Keep upstream calls on a server-owned credential path rather than relaying the user token.

Why environment variables remain the weak link

A STDIO or local MCP server often starts with credentials already present in its environment, which means the secret exists before OAuth ever begins. In practice, that can be a long-lived API key or GitHub token with write scope, readable by any process running under the same user. The authorization flow cannot see that credential because it is not part of the token exchange. The real risk is not just storage, but lifetime: the secret can outlive the access token by months or years. See the MCP Server Security Checklist.

Practical implication: Move persistent upstream credentials out of host-local environment storage and into runtime-brokered retrieval.


Threat narrative

Attacker objective: The attacker wants the server’s own upstream credential, because that secret can outlast the MCP access token and unlock a broader target surface.

  1. Entry occurs when a remote MCP server starts with a long-lived upstream credential in its environment or local config, separate from the user OAuth flow.
  2. Credential exposure follows because the server can read and retain a write-scoped token or API key that never passes through the authorization exchange.
  3. Impact comes when that upstream credential is reused against GitHub, a database or another downstream service, giving the attacker durable access beyond the MCP token's lifetime.

Read and download The State of NHI & AI Agent Breach Report 2026, covering 200+ breaches impacting Non-Human Identities including AI Agents.


NHI Mgmt Group analysis

MCP authorization is not the same as MCP credential governance: the flow can bind a client token to a server, yet still leave the server’s own long-lived secrets untouched. That distinction matters because identity controls aimed at the browser or client do not govern the upstream credential the server uses later. Practitioners should read MCP as a delegation boundary, not as an end-to-end secret boundary.

Server-held credentials create the real blast radius: once an MCP server can reach GitHub, a database or another API with its own token, the question becomes who owns that secret lifecycle. The OAuth exchange may prove the user consented to one hop, but it says nothing about the credential that persists behind the hop. That is an NHI governance problem first and an MCP problem second.

Long-lived upstream secret persistence: this is the named failure mode that MCP deployments now surface at scale. The server can be compliant with audience checks, issuer checks and PKCE, yet still expose an evergreen credential with broader reach than the access token itself. The implication is that identity programs need a separate control plane for server credentials, not just for user grants.

Token passthrough is a governance shortcut that erases accountability: once a server forwards the client token upstream, the downstream service sees the wrong caller and the audit trail becomes ambiguous. That makes the server both an access broker and an identity amplifier. In practice, the organisation should treat that pattern as a boundary failure, not a convenience feature.

For MCP, the most important control question is where the secret lives when the token expires: if the server still holds a write-capable credential after the session ends, the governance model is incomplete. That is why runtime brokered secrets, strict audience separation and per-user consent checks belong in the same design discussion. The next control to design is the server’s own credential lifecycle.

From our research library:

What this signals

Server credential lifecycle now sits beside OAuth correctness: the access token can be flawless while the upstream secret remains unmanaged. Programmes that stop at protocol validation will miss the credential that survives the session, which is the one that usually matters to attackers and auditors alike.

The operational shift is toward runtime-brokered secrets and away from static host-local credentials. That changes how teams design MCP servers, because the control point moves from token issuance to secret ownership, rotation and offboarding.

A server that still reads a write-capable secret from its environment should be treated as an identity system with an unmanaged privileged account. The next governance task is to make the server’s hidden credential lifecycle visible before the protocol can be considered safe.


For practitioners

  • Inventory every upstream credential List the secrets each MCP server reads at startup, including environment variables, config files and proxy-held tokens, then rank them by expiry and write scope.
  • Enforce audience binding on every token Reject any bearer token not minted for the server’s canonical URI and test the rejection path with a token from another resource.
  • Separate upstream calls from user tokens Call downstream APIs with a server-owned credential path instead of forwarding the client bearer token, especially where monitoring and rate limits depend on audience.
  • Check consent per client in proxy layers If a proxy fronts a third-party API, validate the approved client ID for each user before any authorization redirect or token exchange.
  • Broker high-value secrets at runtime Move the most dangerous long-lived credential into a runtime broker or gateway so the secret is not present in the host environment or local process config.

Key takeaways

  • MCP OAuth can validate the client-to-server hop without addressing the upstream secret the server uses behind the flow.
  • Long-lived write-capable credentials inside server environments create the larger blast radius than the user access token itself.
  • Practitioners need separate governance for protocol authorization and for the server’s own credential lifecycle.

Related NHI Mgmt Group resources: MCP Authorisation Specification Guide · MCP Security Guide · MCP Server Security Checklist · Homebrew GitHub token exposure 2018


Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10, OWASP Agentic AI Top 10 and MITRE ATT&CK define the specific risk controls and attack patterns relevant to this term.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-02 — Secret LeakageThe article centers on server-held secrets that sit outside the MCP OAuth flow and can be exposed.
NHI-07 — Long-Lived SecretsThe core risk is a long-lived upstream credential that outlives the user access token.
NHI-05 — Overprivileged NHIA write-scoped upstream token gives the server more privilege than the client session deserves.
Recommendation — Inventory and eliminate secret leakage paths for MCP servers before treating OAuth as sufficient. Replace persistent upstream secrets with shorter-lived, brokered credentials wherever possible. Reduce server-held credential scope to the minimum upstream permission required.
OWASP Agentic AI Top 10ASI03 — Identity & Privilege AbuseAgent-facing MCP flows can still abuse identity boundaries when server-held credentials are reused broadly.
Recommendation — Separate user authorization from server privilege so agent calls cannot inherit excess authority.
MITRE ATT&CKTA0006;TA0010 — Credential Access; ExfiltrationThe attack pattern is about stealing a server credential and using it against downstream systems.
Recommendation — Map server-side secret exposure to credential access and exfiltration hunts in telemetry.

Key terms

  • OAuth 2.1: OAuth 2.1 is an updated authorisation framework that consolidates safer OAuth 2.0 practices for delegated access to APIs and applications. It removes insecure legacy patterns and expects modern protections such as PKCE and exact redirect handling, so teams should implement strict client, token, and redirect controls.
  • Model Context Protocol: Model Context Protocol is an open protocol that lets AI agents connect to tools and data sources. It expands what an agent can reach, so governance has to cover not only the model and its prompts, but also every system that can receive or return agent-driven data.
  • Protected Resource Metadata: Protected resource metadata is machine-readable discovery data published by a service so clients can find its authorization expectations. For agent registration, it tells the actor where to look for supported flows and how to discover the trust model without relying on ad hoc integration.
  • Token Passthrough: Token passthrough is the practice of forwarding an authentication token through intermediaries instead of validating it at each trust boundary. In MCP this is prohibited because it prevents the server from proving who is actually authorised to act. The result is weaker accountability and a larger attack surface for stolen or replayed credentials.

What's in the full article

Akeyless's full blog post covers the operational detail this post intentionally leaves for the source:

  • The full MCP authorization sequence with discovery, resource indicators, issuer checks and step-up handling.
  • Practical examples of token passthrough and proxy consent failure modes in real MCP deployments.
  • Runtime secret brokering patterns for servers that should not keep write-capable credentials on the host.
  • Implementation detail for STDIO servers, gateways and secret-zero dependencies.

👉 Akeyless's full post covers the MCP flow, token passthrough and server-side secret handling.

Deepen your knowledge

NHI governance, agentic AI identity, and machine identity lifecycle are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If you are building or maturing an IAM programme, it is worth exploring.
NHIMG Editorial Note
Published by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org