
An MCP server that anyone can call is a liability. It might read customer records, open pull requests, or move money, and the agent calling it may be acting for a person, a team, or nobody in particular. Getting MCP authentication and authorization right decides whether those tools act for the right identity, with the right permissions, and leave a record you can trust.
This guide covers how MCP authentication works under the current specification (revision 2026-07-28), what changed recently, where the spec stops, and how enterprises close the gap with an MCP gateway.
What is MCP authentication?
MCP authentication is how an MCP server confirms who is calling it. MCP authorization is how it decides what that caller is allowed to do. For remote servers, the MCP specification handles both with OAuth 2.1: the client gets an access token from an authorization server, and the MCP server checks that token on every request.
The two are easy to blur, so it helps to keep them apart:
| Authentication | Authorization | |
|---|---|---|
| Question it answers | Who is calling? | What can they do? |
| In MCP | Access token from a trusted authorization server | Token scopes, plus policy on servers, tools, and arguments |
| Typical failure | Anonymous or shared access | An agent that can call every tool it can see |
Why MCP authentication is harder than API authentication
Traditional API auth assumes a known application calling a known endpoint. MCP breaks that assumption in a few ways:
- Agents act for someone else. A tool call might carry a user’s authority, a team’s, or a service account’s. The server needs to know which.
- Clients are many and unknown. Desktop assistants, IDEs, and custom agents all connect to the same server, often with no prior relationship with its authorization server.
- One task spans many servers. A single agent run can touch a CRM, a code host, and a database, each with its own identity system.
- Tools differ in risk. Reading a ticket and deleting a repository may sit on the same server. Coarse permissions treat them the same.
How MCP authentication works: the OAuth 2.1 flow
The specification defines authorization for HTTP-based transports. In it, the MCP server is an OAuth 2.1 resource server, the MCP client is an OAuth 2.1 client, and a separate authorization server (often your existing identity provider) issues tokens.
A typical first connection looks like this:
- The client calls the server without a token. The server returns
401 Unauthorizedwith aWWW-Authenticateheader that points to its Protected Resource Metadata. - The client discovers the authorization server. It reads the server’s Protected Resource Metadata (RFC 9728), then the authorization server’s own metadata.
- The client identifies itself. It uses a pre-registered client ID, a Client ID Metadata Document, or (deprecated) Dynamic Client Registration.
- The user signs in and consents. The client opens the browser with PKCE and a
resourceparameter naming the exact MCP server. - The client checks the response came from the right place. It validates the
issvalue against the issuer it expected. - The client exchanges the code for a token and sends it as
Authorization: Beareron every MCP request.
Example challenge from an MCP server:
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="https://mcp.example.com/.well-known/oauth-protected-resource",
scope="files:read"
Local servers are different. Servers that run over stdio on a user’s machine aren’t expected to use this flow. They take credentials from the environment, which usually means API keys in config files or environment variables. That’s convenient, but it’s also how long-lived secrets end up scattered across laptops.
What changed in the 2026-07-28 MCP specification
If your MCP auth was built against an earlier revision, these are the changes to review:
- Client ID Metadata Documents are now preferred. The client’s ID is an HTTPS URL that serves its metadata. Dynamic Client Registration is deprecated and kept only for backward compatibility.
- Issuer validation is required on the client side. Clients must record the expected issuer and check the
issvalue in the authorization response before using the code (RFC 9207). - Step-up authorization is clearer. When a server answers
403withinsufficient_scope, the client should request the new scopes plus the ones it already had, so it doesn’t lose access it still needs. - Refresh tokens are spelled out. Clients must keep them confidential and can’t assume they’ll be issued. Servers shouldn’t demand
offline_access. - Authorization extensions sit outside the core. Optional extensions, including Enterprise-Managed Authorization, live in a separate MCP repository. Enterprise-Managed Authorization lets a client get MCP tokens through the company’s identity provider instead of a separate consent screen for each server.
The security rules every MCP server must follow
A few requirements in the spec do most of the work of keeping tokens from being misused:
- Audience binding. Clients must name the target server with the
resourceparameter (RFC 8707), and servers must reject tokens that weren’t issued for them. - No token passthrough. A server must not accept a token meant for someone else, and must not forward the token it received to a downstream API. If it needs to call another service, it gets its own token for that service.
- Least-privilege scopes. Servers should advertise the minimum scopes for basic use and ask for more only when an operation needs them.
- Short-lived, protected tokens. Tokens go in headers, never in URLs, over HTTPS, and invalid or expired tokens get a
401. - Confused deputy protection. Proxy-style servers that use a static client ID with a third-party service must get user consent for each client, so one client can’t ride on another’s approval.
Where OAuth stops and enterprise authorization starts
OAuth answers whether a token is valid for a server and which scopes it carries. Enterprises usually need more than that:
- Tool-level and argument-level control. A scope like
repocan’t say “this agent may open pull requests but never merge to main.” - Agent identity next to user identity. Audit and policy often need to know which agent made a call on a user’s behalf, not just which user.
- Consistency across many servers. Each MCP server may have its own authorization server, scope names, and consent screens. Without a common layer, every one is configured and reviewed separately.
- Credential custody. Someone still has to hold the upstream API keys and OAuth tokens for the servers agents use.
- A complete record. Security teams need allowed, denied, and failed calls in one log, not scattered across server logs.
How an MCP gateway handles authentication and authorization
An MCP gateway sits between agents and MCP servers and splits auth into two hops:
- Inbound: client to gateway. Users and agents authenticate once to the gateway, tied to your corporate identity.
- Outbound: gateway to MCP server. The gateway connects to each upstream server with that server’s own credentials, so agents never see or hold them, and tokens aren’t passed through.
In between, the gateway applies policy. That’s where authorization gets more precise than OAuth scopes: which servers a role can reach, which tools inside them, and which argument values are allowed.
How Airia secures MCP authentication and authorization
Airia’s MCP Gateway is the control point for agent tool access in Airia Secure. It gives security and platform teams one place to decide who can use which tools:
- Admin approval first. MCP servers aren’t usable until an administrator approves them.
- Connect once. Users connect an app through its OAuth sign-in flow or with an API key, and the connection is saved to their account.
- Role-based access at three levels. Access is set by role at the app, tool, and parameter level, so an agent can read from a system without being able to write to it.
- One address per gateway. The Dynamic MCP Gateway gives each team one endpoint with a tool set matched to its role.
- Deterministic limits. Agent Constraints enforce rules on what an agent may do, separate from the model’s judgment.
- Every call logged. Each tool call is recorded as succeeded, denied, or errored, which gives auditors a single trail.
- Find what’s already connected. Airia Discover includes MCP Server Detection, so MCP servers connected outside the gateway can be found and brought under the same controls.
MCP authentication best practices checklist
- Use OAuth 2.1 for every remote MCP server. Don’t expose remote servers with static, shared API keys.
- Support Client ID Metadata Documents and plan your move off Dynamic Client Registration.
- Validate token audience on the server and the
issvalue on the client. - Never forward a received token to another service.
- Start with minimal scopes and use step-up for sensitive operations.
- Move local stdio servers’ secrets out of plain config files and into a managed store, or route them through a gateway.
- Authorize at the tool and argument level, not just the server level.
- Record which user and which agent made each call.
- Log denied and failed calls, not only successful ones.
- Review the spec changelog with each new MCP revision.
FAQ
Does MCP require authentication? Authorization is optional in the MCP specification, but any remote server that touches real data should require it. When a server uses an HTTP transport and supports authorization, it should follow the spec’s OAuth 2.1 flow.
What is the difference between MCP authentication and authorization? Authentication confirms who is calling. Authorization decides what they can do: which servers, which tools, and which arguments.
Should MCP servers use API keys? Local stdio servers usually get credentials from the environment, often API keys. Remote servers should use OAuth 2.1 with short-lived, audience-bound tokens instead of shared keys.
What is token passthrough in MCP? It’s when a server accepts or forwards a token that wasn’t issued for it. The spec forbids it because it breaks audit trails and lets a token reach services it was never meant for.
What is Enterprise-Managed Authorization? It’s an optional MCP authorization extension that lets clients get access to MCP servers through the company’s identity provider, so IT controls which apps can connect without users approving each one.
Give every agent the access it needs and nothing more. Request a demo to see how Airia applies role-based, tool-level authorization to every MCP call.
Put these ideas to work.
Schedule a 30-minute walkthrough with our team.