MCP authentication
MCP server OAuth and authorization
MCP authorization is OAuth 2.1 with a discovery step, so a client that has never seen your server can find out where to sign in. Here is the flow in the order the requests happen.
Written by Octri · Checked 3 November 2026
The three roles
The MCP server is an OAuth resource server. The MCP client is an OAuth client acting for a person. The authorization server signs that person in and issues tokens, and it can be part of the MCP server or a separate system such as your existing identity provider.
Discovery
The client starts by sending an MCP request with no token. The server answers 401, and its WWW-Authenticate header can point to the Protected Resource Metadata document and name the scopes to request.
That document lists one or more authorization servers. The client then reads the chosen server’s metadata, through OAuth Authorization Server Metadata or OpenID Connect Discovery, to learn its endpoints.
Client registration
A client needs a client ID, and most MCP clients and servers have never met. The specification lists these options in priority order for a client that supports them all: pre-registered details, Client ID Metadata Documents, then Dynamic Client Registration.
With a metadata document, the client ID is an HTTPS URL pointing to a JSON file that names the client and its redirect URIs. Dynamic Client Registration is deprecated as of this revision and remains available for authorization servers that have not moved.
Scope step-up
A token can be valid and still lack the permission for one tool. The server should then answer 403 with error="insufficient_scope" and the scopes it needs. A client acting for a person should run the authorization flow again for the larger set and retry a limited number of times.
This is what lets a server start with narrow scopes. The first sign-in stays short, and the person sees a request for more access at the moment a tool needs it.
Token checks on the server
The server validates each access token and confirms it was issued for this server, using the audience claim or an equivalent check. A missing or invalid token gets 401 and a token with too little scope gets 403. Authorization goes on every HTTP request, including requests that belong to one logical workflow.
How Octri handles this
The hosted server publishes Protected Resource Metadata and answers an unauthenticated request with a 401 challenge that points to the authorization server.
With your own authorization server, Octri checks each token first through your JWKS or introspection endpoint, covering signature, issuer, expiry and audience.
With Octri signing people in to your OAuth, the person approves access on a consent page, the upstream token is kept encrypted, and refresh tokens rotate on every use.
Sign-in tokens are bound to the address they were issued on, so a token from your custom domain is refused on the default address.
Everyone who signed in is listed with their client and last call, and you can end any grant from that list.
Questions
The hosted sign-in was built against the 2025-11-25 authorization revision. The current revision is 2026-07-28, which this guide describes, so treat the steps here as the protocol and check our docs for what the hosted server does today.
References
Checked against MCP specification revision 2026-07-28 on 3 November 2026.
Further reading
- Your MCP server authenticates users. Does it preserve their permissions?From the Octri blog.
- MCP security best practicesThe full checklist: sign-in, token checks, least privilege, approvals, limits and audit logs.
- Token passthrough and confused deputyWhat the specification forbids, why it does, and how per-client consent closes the proxy attack.
- Tool poisoning and prompt injectionHow instructions reach a model through tool metadata and results, and the controls that contain them.
- MCP audit logs and rate limitsThe fields worth recording for each tool call, and how to size per-tool limits and write caps.
Try it on your own spec
Generate an MCP server from your OpenAPI spec on the Free plan, with every tool set to run, ask first or stay off.