Can an MCP Server Skip Your Consent Screen? The Confused Deputy Problem, Explained
The problem
You connect an AI app to your calendar through an MCP server. A login page pops up, you click "Allow", and everything works. A week later you click a link someone sent you. No consent screen appears this time, because your browser remembers you already said yes. But this time the access code doesn't go to your app. It goes to the attacker.
That is the confused deputy problem, and it is the first attack listed in the official MCP Security Best Practices document. This post explains it in plain words, shows why it happens, and covers the fix the spec requires. It also covers a closely related mistake, token passthrough, which the spec forbids outright.
If MCP is new to you, start with What is MCP, in plain English. The short version: MCP is a standard way for AI apps (the "clients") to connect to tools and data (the "servers").
What a "confused deputy" is
The term is older than AI. A deputy is a program that holds more power than the person asking it to do something. It gets "confused" when it uses its own power on behalf of someone who should never have had it.
A simple picture: a hotel front desk can open any room. If a stranger says "I lost my key to room 512" and the desk opens it without checking, the desk is a confused deputy. It had legitimate authority. It applied it to the wrong person.
In MCP, the deputy is a specific kind of server the spec calls an MCP proxy server. It sits between AI apps and some other company's API, like a calendar or a CRM, and talks to that API using one login of its own.
The setup that makes the attack possible
The spec says the attack works only when all four of these are true:
- The proxy uses one fixed client ID with the third-party login system. Every AI app that comes through the proxy looks like the same app to the calendar company.
- The proxy lets AI apps register themselves (dynamic client registration). Each one gets its own ID with the proxy, but the calendar company never sees those.
- The third-party login system sets a consent cookie after you approve once, so it can skip the "Allow?" screen next time.
- The proxy does not ask for consent per client before sending you on to the third-party login.
Each piece is normal on its own. Fixed client IDs exist because many API providers don't support dynamic registration. Consent cookies exist because nobody wants to click "Allow" every day. The danger is the combination.
The attack, step by step
This sequence follows the spec's own description:
- You log in through the MCP proxy to use the calendar API. Normal.
- The calendar's login system sets a cookie in your browser: "this user approved the proxy's client ID."
- The attacker registers their own client with the proxy, giving a redirect address that points to their server.
- The attacker sends you a link that starts a login with their client ID and their redirect address.
- You click it. Your browser still has the consent cookie.
- The calendar's login system sees the cookie, thinks "already approved", and skips the consent screen.
- The authorization code is sent to the attacker's redirect address.
- The attacker trades that code for access tokens and can now use the API as you.
You never saw a screen asking if this new app could access your calendar. From the calendar company's side, nothing looked wrong: same client ID, valid cookie, valid code.
The fix the spec requires
The spec uses MUST here, not SHOULD. MCP proxy servers must run their own consent step, per client, before handing you to the third-party login. In practice that means:
- Keep a list of approved client IDs per user, and check it before starting the third-party login.
- Show an MCP-level consent page that names the requesting client, lists the third-party scopes it wants, and shows the exact redirect address where tokens will go.
- Protect that page: CSRF protection, and block framing (with
frame-ancestorsorX-Frame-Options: DENY) so nobody can hide it inside another page and trick you into clicking. - Lock down consent cookies:
__Host-prefix,Secure,HttpOnly,SameSite=Lax, signed, and tied to a specific client ID rather than just "this user said yes once." - Match redirect addresses exactly, as plain strings. No wildcards, no pattern matching.
- Use the OAuth
statevalue properly: random, stored only after you approve, checked at the callback, used once, short-lived (the spec gives 10 minutes as an example).
That state detail matters more than it looks. If the proxy saves the state before you approve, an attacker can craft a request that skips the consent page entirely.
The cousin attack: token passthrough
The same spec document describes a second mistake that often travels with the first. Token passthrough is when an MCP server accepts a token from a client without checking that the token was issued for that server, then forwards it to a downstream API.
The spec gives four reasons this is forbidden:
- Security controls get skipped. Rate limits, request checks and monitoring often depend on who a token was issued to. Forwarded tokens dodge them.
- Audit trails break. The server can't tell clients apart, and the downstream API's logs show the wrong caller.
- Trust boundaries break. If many services accept the same token without checking, stealing it from one opens all of them.
- Future fixes get harder. A "pure proxy" today might need real controls later. Starting with proper separation makes that possible.
The rule is one line: MCP servers must not accept any tokens that were not explicitly issued for them. If a server needs to call another API, it gets its own separate token for that API.
Here is the check in its simplest form. Tokens carry an "audience" field naming who they were made for, and the server refuses anything that doesn't name it:
pythonMY_SERVER = "https://mcp.example.com" def accept(token): """Accept a request only if its token was issued for this exact server.""" if token.get("aud") != MY_SERVER: return f"reject: token was issued for {token.get('aud')}" return "accept" tokens = [ {"sub": "user-42", "aud": "https://mcp.example.com"}, {"sub": "user-42", "aud": "https://api.calendar.example"}, ] for t in tokens: print(t["aud"], "->", accept(t))
Running it prints:
https://mcp.example.com -> accept
https://api.calendar.example -> reject: token was issued for https://api.calendar.example
Real servers also verify the signature, issuer and expiry, but the audience check is the part people skip, and it is the part that stops one stolen token from working everywhere.
What this means if you build or use MCP servers
If you build an MCP server that fronts another company's API: you are the deputy. Add the per-client consent page before anything else, check token audiences, and never forward a client's token downstream.
If you only use MCP servers: you can't fix a proxy's code, but you can lower the stakes. Prefer servers from the company that owns the API. Be suspicious of login links you didn't start yourself. Revoke old app approvals in the third-party account settings now and then.
If you are building agents in general: confused deputies also show up outside OAuth. A tool that runs with a powerful shared account, while the user asking can only see a few records, has the same shape. Our agent course covers this in Safe Agent Tools in Python: Allowlists, Human Approval and Prompt Injection.
The takeaway
The confused deputy problem isn't a bug in one product. It shows up whenever something with power acts for someone it never checked. MCP's answer is to make the proxy ask its own question: "Does this specific app get to act for you?" Ask it per client, before the third-party login, and the skipped consent screen stops being a free pass.
Related reading on blogllm.com:
- Can a Tool Description Hijack Your AI Agent? How MCP Tool Poisoning Works
- What Makes an AI Agent Leak Your Data? The Lethal Trifecta, Explained
- Connect a Python Agent to MCP Servers With the Official MCP SDK
Sources
- Model Context Protocol, "Security Best Practices" (spec revision 2025-06-18): https://modelcontextprotocol.io/specification/2025-06-18/basic/security_best_practices
- Apollo GraphQL, Apollo MCP Server best practices, section on avoiding token passthrough: https://www.apollographql.com/docs/deploy-preview/a7fa14ebf9e66e0b65c8094e/apollo-mcp-server/best-practices
