Skip to content
mentoor

Topic 4 of 6 · 4 min read

Why token passthrough is forbidden

Goal: Spot token passthrough in a server's request handler and change it to validate the audience and use its own downstream token.

Token passthrough means an MCP server accepts a token that was not issued for it, or forwards the client's token to another API, and the MCP specification forbids it. A server must only accept tokens issued for itself and must get its own token for any downstream call.

Check yourself · 1 of 3

What is token passthrough?

Choose one answer

Why it matters

An access token carries an audience: the service it is meant for. If your MCP server skips that check, several things break:

  • Security controls disappear. The downstream API's rate limits, scopes and audit trail now see your server's traffic as if it came straight from the client.
  • Audit and accountability blur. Logs cannot show whether the user, the client or your server made a call.
  • Stolen tokens travel further. A token taken from one service works on yours, and yours may relay it onward.
  • Trust boundaries erode. A downstream service that trusts your server's identity cannot tell which of your callers is behind a request.

How to spot it and fix it

  1. Find where the bearer token is read from the Authorization header.
  2. Check validation. Does the code verify the signature, expiry and that the audience equals this server's own identifier? Accepting any valid token from the same issuer is not enough.
  3. Follow the token. If the same string is attached to an outgoing request, that is passthrough.
  4. Replace the downstream call with a credential owned by the server: a service token, or an on-behalf-of exchange that produces a new token with the right audience.

Before and after

 async function handle(req) {
   const token = bearer(req);
-  await verifyJwt(token);
-  return fetch("https://billing.example.test/invoices", {
-    headers: { Authorization: `Bearer ${token}` },
-  });
+  await verifyJwt(token, { audience: "https://mcp.example.test" });
+  const downstream = await exchangeForToken(token, "https://billing.example.test");
+  return fetch("https://billing.example.test/invoices", {
+    headers: { Authorization: `Bearer ${downstream}` },
+  });
 }

The old code only checked that the token was genuine. The new code checks that it was meant for this server and uses a separate token for billing.

What goes wrong

  • Validating signature and expiry only, so a token for another service passes.
  • Passing the user's token "just this once" during a prototype, which then ships.
  • Using one broad service token for every user, which loses the per-user identity.

Examples

The forwarded header

const auth = req.headers.authorization;
const r = await fetch(CRM_URL, { headers: { authorization: auth } });

The handler never checks who the token is for and sends it straight to the CRM. If the token was issued for the email service, an attacker holding it now reaches the CRM through your server. Add an audience check, then get a CRM token for the server.

Right issuer, wrong audience

A token from the company's identity provider is valid, unexpired and signed correctly, but its audience is https://calendar.example.test. The MCP server at https://mcp.example.test must reject it, because the signature proves who issued it, not who it is for.

Key points

  • Token passthrough is accepting tokens not issued for the MCP server or forwarding the client's token downstream.
  • The specification forbids it, because it bypasses downstream controls and breaks audit trails.
  • Validate signature, expiry and that the audience equals the server's own identifier.
  • Use the server's own credential or an on-behalf-of exchange for downstream calls.
  • Look for the same token string appearing in an outgoing request header.

Common mistakes

  • Checking signature and expiry but not the audience.
  • Forwarding the incoming Authorization header to a downstream API.
  • Using one shared service token and losing the per-user identity.
  • Treating passthrough as acceptable for internal APIs.

Check yourself · 2 of 3

A server verifies a token's signature and expiry only. What check is missing?

Choose one answer

Check yourself · 3 of 3

An MCP server must call a billing API for a signed-in user. Which approach follows the specification?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic