A remote MCP server that wraps an existing API usually lets the agent do whatever the API token allows. Some hold one API key for everyone, some forward the user's OAuth token, and some check the API's scopes before each tool runs. In each case the agent is scoped the way an API client is. openapi-mcp-gateway signs each agent in with a token of its own, the MCP token, and keeps the user's API token, the upstream token, to itself. The MCP token carries scopes drawn for the agent, per operation, and the gateway checks both tokens at every sign-in and every call. When a call needs more, the agent asks for it and the user approves on a consent page, a step called step-up.
This applies to servers reached over HTTP. A local stdio server has no sign-in, since it reads a key from its environment.
The Gap in API Scopes
An API's OAuth scopes were drawn for programs a developer wrote and reviewed, each signing in as its own client. Agents break three assumptions behind them.
- Shared Client: a company API often accepts only OAuth clients that IT registers, so a remote MCP server signs every agent in through one. Claude Code, a support bot, and a report agent then reach the API as the same client and the same user. Only the MCP server can tell them apart, so only it can give each its own scope.
- Coarse or Missing Scopes: the vendor's scopes follow the vendor's resource model. No GitHub classic scope narrower than
reporeaches a private repository, andrepocovers its code and everything else in it. Many internal APIs check only that a token is valid. An agent's risk lies in what a call can change, so it needs reads and writes split per operation, and you cannot add a scope to someone else's API. - Unpredictable Caller: a program does what its code says. An agent acts on what it reads, and text planted in an issue or a web page can turn it against the user. It should hold read access until a task needs write, and the user should approve each widening.
The upstream token in this example still carries repo. It never leaves the gateway, though, and the gateway refuses any call the agent's MCP token does not cover.
So the agent needs scopes of its own, set per operation and widened only with the user's consent. The MCP spec already keeps the two tokens apart. A server must not pass through the token its client sent, and the gateway puts the agent's scopes on that client-facing token.
Current Approaches
Products that put an agent in front of an API limit it in one of three ways.
| Approach | Examples | What It Leaves Out |
|---|---|---|
| The API's own permissions | The remote MCP servers of GitHub, Notion, and Linear | The agent holds whatever the token or the user holds. Narrower limits stop at a read-only mode or a set of tools. GitHub's server can step up, but only between GitHub's own scopes |
| Agent scopes drawn by the vendor | Atlassian, with scopes such as read:jira:agent-interface | Only the API's owner can draw them |
| A gateway policy per tool | Kong consumer lists, Apigee API products, Cedar policies in AWS AgentCore Gateway, OPA policies in Maverics | An admin writes the rule, so the client has no scope to ask for. None of them documents consent or step-up |
openapi-mcp-gateway takes the second approach in front of an API it does not own. It draws OAuth scopes for agents, as Atlassian did for its own API. Because they are OAuth scopes, a client asks for them at consent and steps up when a call needs more.
The Scope Model
Every operation carries two requirements, one per kind of scope, and a call must meet both.
- MCP Scopes: the gateway's own, on the MCP tokens it mints for each client. They decide which operations an agent may reach.
- Upstream Scopes: the API's, read from each operation's OpenAPI
security. They decide what the user's upstream token must hold.
The scopes a token holds are its grant. The upstream may grant less than a sign-in asks for, for example when the user's own role lacks a scope, so an operation the agent may reach can still be out of the user's reach.
The MCP scopes come from config. They can be derived from the spec's tags, as products:read for every GET under the products tag, or written by hand. Each client, named by its metadata URL, gets a maximum in scopes and what a sign-in receives when it asks for nothing in default_scopes. This excerpt leaves out the server's name and spec:
auth: mcp: operation_scopes: auto: tags clients: https://claude.ai/oauth/claude-code-client-metadata: scopes: [products:read, products:write] default_scopes: [products:read] upstream: type: oauth2 flow: authorization_code client_id: ${SHOP_CLIENT_ID} client_secret: ${SHOP_CLIENT_SECRET} enforce_scopes: true required_scopes: [offline_access] The upstream side needs no list of its own. With enforce_scopes, each sign-in follows the MCP grant to the operations it opens, reads their security, and asks the upstream for exactly those scopes. An agent holding products:read never sends the user to approve write:products. This narrowing is called downscoping.
Step-Up
An agent starts with default_scopes and asks for more only when a call needs it. A call the MCP token does not cover returns 403 with an insufficient_scope challenge naming the scope it needs, as the MCP authorization spec describes. The client signs in again for its current scopes plus the new one. The consent page marks the new MCP scope and the new upstream scope, and the upstream sign-in asks for what the wider grant opens, so both tokens widen together.
The upstream can still refuse a call the gateway's record of the grant allowed, for example when the spec's security understates what the API wants. Under authorization_code, the gateway reads the API's own insufficient_scope challenge. When the missing scope lies within what the gateway may ask the upstream for, it sends the client a URL elicitation, a link the client opens for the user to sign in to the upstream again. The MCP token stays as it is, and the call retries once the sign-in finishes.
Step-up also decides what the model sees. An agent never calls a tool it cannot see, so it never starts a step-up for one. The gateway lists an operation when this client may be granted its MCP scope, even before the token holds it. It hides operations beyond the client's scopes, and those the user's upstream grant cannot run. Kong, Apigee, and AgentCore filter their lists too, as GitHub's server does for classic tokens. Metabase lists every tool on the same reasoning, since only a failed call prompts a client to ask for more.
Limits
The scope model leaves five things to the client, the upstream, or another tool.
- Client Support: step-up needs a client on MCP protocol version 2026-07-28, which names the tool it calls in a header. An older client gets a tool error naming the missing scope, and cannot widen its grant.
- Per-Client Scopes: everyone signing in through one client gets the same MCP scopes. Per-person limits stay with the upstream's own roles, or with an external issuer that grants scopes per user.
- No Step-Down: nothing shrinks a grant during a session, since no call fails for holding too much. A later sign-in asking for fewer scopes narrows it, and one asking for none starts again from
default_scopes. - Flat Scopes: no MCP scope implies another, so a broad scope lists every operation it opens.
- Operation-Level Scopes: a scope opens an operation for any arguments. Holding an agent to one repository or one branch takes the upstream's own permissions, or a policy engine such as AgentCore's Cedar policies.
Wrapping Up
An agent no longer has to hold whatever the API token holds. MCP scopes set per client and per operation narrow it, and step-up widens it only with the user's consent. The Scopes guide covers the setup under every auth mode, and the Scope Model page holds the full rules. If you run agents against an API you do not own, open an issue with the scope split you needed.






