Security¶
This page explains the fine-grained access control the gateway adds in front of an API. Each caller reaches only the operations its task needs, with a credential no wider than those operations, which a server sharing one API key cannot offer.
Access Control Layers¶
The gateway controls access at four layers, from the endpoint down to the credential the API receives. Each layer narrows what the one around it allowed.
| Layer | Question It Answers | Control | Set Up In |
|---|---|---|---|
| Endpoint | Who may call at all? | the gateway's own sign-in, your identity provider, or registered agents | Mode Selection |
| Client | Which applications may sign in? | pre-registered clients, and metadata document clients by host | Client Registration |
| Operation | Which tools may each client list and call? | operation scopes, such as read, write and delete per tag, with uncovered operations closed by default | Scopes |
| Upstream Credential | What may the API token itself do? | each user's own token, asked with enforce_scopes for only the scopes the client's operations need |
Asking the Upstream for Less |
Comparison With Common Setups¶
Two setups are common when an API is put behind MCP. A server holds one API key for every caller, or it passes each caller's own token through to the API, which the MCP specification calls token passthrough and forbids. The table compares both with the gateway under a per-user mode and operation scopes.
| Concern | The Gateway | One Shared Key | Token Passthrough |
|---|---|---|---|
| Caller Identity | each client signs in, or your identity provider vouches for it | anyone who can reach the URL | the caller's own API token |
| Credential at the API | each user's own token, obtained by the gateway | the same key for every caller | the caller's token as is |
| Tool Access | per operation and per client | every tool for every caller | every tool, limited only by what the API refuses |
| Upstream Permission | only what the client's operations need, with enforce_scopes |
everything the key allows | everything the caller's token allows |
| Needing More Access | a step-up during the call, with the user's consent | a config change on the server | a new token issued by hand |
| Removing a Caller | removing that client, or revoking it at the identity provider | rotating the key for everyone | revoking that token at the API |
Scope Model states the rules behind the operation and upstream layers.
Built-In Safeguards¶
Beneath the four layers, the gateway follows the MCP specification's security rules with no configuration.
- Token Not Relayed: a client's token never reaches a separate API, as Token Forwarding Policy explains.
- Bound Tokens: every token works only at the endpoint and server that minted it, as Token Audience states.
- Safe Metadata Fetch: a client's metadata document is fetched from a public
httpsaddress only, within size and time limits, as Client Registration states. - Consent: the user sees which client asks, where access is sent, and what it may do, on the consent page.
- Issuer Check: with
auth.upstream.issuerset, an upstream response that carriesissmust name it, which stops an authorization server mix-up, as Per-User Sign-In states. - Browser Protection: on a loopback bind,
HostandOriginchecks stop a web page from reaching a local gateway. The default bind is not loopback, so it accepts anyHostuntildns_rebinding_protection.allowed_hostsis set, as Host and Origin Checks states. - Fail-Closed Config: an unknown key is refused at startup, and credentials can come from environment variables, as Values and Validation states.
- Model-Proof Limits: policy, operation scopes and hidden parameters hold whatever a prompt asks, since the gateway applies them before a request leaves it, and the integration and end-to-end tests check them.
Out of Scope¶
The gateway leaves these to other parts of a deployment.
- TLS: the gateway serves plain HTTP, so a reverse proxy in front terminates TLS.
- Upstream Authorization: the upstream decides what its credential may do. Under a shared credential every caller reaches it as one identity, and an upstream refusal reaches the client unchanged.
- External Issuer Revocation: a token the issuer revokes stays valid until it expires, as Revocation explains, so keep token lifetimes short at the issuer.
- The MCP Client: the client holds its tokens, and a loopback redirect reaches any program on the computer, which the consent page warns about.
- Response Content: an upstream response reaches the model as the upstream sent it, reshaped only by
response, so instructions planted in its data are not filtered.
Related¶
The auth mode decides which of these defenses apply, and a few deployment settings need checking before the gateway is reachable from a network.
- Guides: Authorization for choosing a mode and Security Notes for the settings to check before exposing the gateway
- Reference:
auth.mcpfor every field that decides who may call the endpoint