Understanding Authorization in MCP changeddocs/2026-07-28/tutorials/security/authorization
Nearest release: v2.1.336, published under an hour after upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Upstream edited this page at 3 Dec 2026 17:43 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 3 Dec 2026 18:07 UTC.
Upstream edited
Recorded here
Lines+37added
Lines−10removed
From line
237
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits9to this page, all time
The whole hunk
from line 237, old and new numbered
/
from line 237
237237* **Audience.** Your MCP server must reject tokens that weren't issued for it. The `resource` value from the client should become the token's audience, which is the `aud` claim in a JWT. Some products need a setting for this, or let you configure the audience on a scope instead. Others always use their own identifier. In that case, compare the audience with that identifier, and keep your server's URL as the PRM `resource`. The identifier must belong to this MCP server only, so don't share one application registration between servers.
238238* **Metadata.** It must serve metadata through RFC 8414 or OpenID Connect Discovery. The metadata must contain `code_challenge_methods_supported`. Look at the real document, because some products support PKCE but leave this value out, and clients that follow the specification then refuse to connect.
239239* **CIMD.** It should support CIMD, which it advertises with `client_id_metadata_document_supported`. In some products you have to enable this, or list the client domains you accept.
240* **Token format.** The examples below need signed JWT access tokens. Otherwise, you need an introspection endpoint.
240* **Token format.** The examples below need signed JWT access tokens. Otherwise, you need another way to validate tokens, such as a vendor SDK or an introspection endpoint.
241241* **Public clients.** Many MCP clients have no secret. The authorization server must accept them, and its `token_endpoint_auth_methods_supported` should contain `none`.
242242* **Scopes.** Define a scope such as `mcp:tools` and make it available to the clients that will connect. Some products add a prefix to scope names. If yours does, use the full name everywhere the examples use `mcp:tools`. If you define more than one scope, read [Scope Minimization](https://modelcontextprotocol.io/docs/2026-07-28/tutorials/security/security_best_practices.md#scope-minimization), and list only the scopes needed for basic use in `scopes_supported`.
243243* **Token lifetime.** Access tokens should be short-lived, because a stolen token works until it expires. The authorization server must rotate refresh tokens for public clients.
from line 675
675675
676676### Opaque Tokens
677677
678If your authorization server issues opaque tokens, use its [token introspection](https://datatracker.ietf.org/doc/html/rfc7662) endpoint instead of validating a JWT. Its URL is the `introspection_endpoint` value in the metadata.
678If your authorization server issues opaque tokens, use its SDK or validation API if it has one. If it supports [token introspection](https://datatracker.ietf.org/doc/html/rfc7662), its metadata lists the endpoint as `introspection_endpoint`.
679679
680The endpoint requires authorization, so your MCP server needs its own credentials at the authorization server. If you use HTTP Basic authentication, form-encode the client ID and secret first. The credentials must be allowed to introspect tokens for this server. If they aren't, the response for a valid token has `active` set to `false`.
680> [!NOTE]
681>
682> To call the introspection endpoint, your MCP server needs its own credentials
683> at the authorization server, with permission to introspect tokens issued for
684> it. Without that permission, the authorization server might report valid
685> tokens as inactive instead of returning an error.
681686
682If `active` is `false`, reject the token. If it is `true`, check that `aud` contains the expected audience before you report the resource to the SDK. Check `scope` and `exp` too. These values are optional in the RFC, so make sure your authorization server returns them, and reject a token whose `aud` is missing. If the endpoint can't be reached or returns an error status, even a `401`, treat that as an outage.
687With introspection, reject the token unless the response meets all of these:
683688
684If you cache tokens or results, encrypt the tokens and delete each entry no later than the token expires. Keep your server's credentials in a secret manager.
689| Field | Requirement |
690| - | - |
691| `active` | Must be `true`. |
692| `aud` | Must be present and contain the expected audience, usually your server's URL. |
693| `exp` | Must be in the future. |
685694
686In TypeScript and Python, make the call in the verifier. In C#, replace `AddJwtBearer` with an authentication handler that supports introspection.
695Don't reject a token for a missing scope. Pass its `scope` values to the SDK, which answers a missing scope with a `403` challenge, so the client can request it. Rejecting the token produces a `401`.
696
697> [!NOTE]
698>
699> RFC 7662 makes `aud`, `scope`, and `exp` optional. Check that your
700> authorization server returns them, and enable any that it omits. Reject a
701> token whose response lacks `aud` or `exp`.
702
703If the introspection endpoint can't be reached or returns an error, answer the client with a `5xx`. A `401` makes the client sign the user in again. This includes a `401` from the introspection endpoint, which means the authorization server rejected your MCP server's credentials.
704
705If you cache tokens or results, encrypt the tokens and delete each entry by the time its token expires.
706
707With the TypeScript and Python SDKs, validate the token in your verifier. With `expectedResource` (TypeScript) or `validate_token_resource` (Python) set, as in the examples above, the SDK compares the `resource` value your verifier returns with your server's URL. It doesn't check the token's audience, so check `aud` before you return `resource`. If introspection fails, throw from the verifier and the client gets a `5xx`. In TypeScript, throw an error that isn't an `OAuthError`. In Python, raise an exception instead of returning `None`.
708
709For MCP servers written in C#, use your authorization server's ASP.NET Core library in place of `AddJwtBearer`, if one exists. Otherwise, if the authorization server supports introspection, use `AddOAuth2Introspection` from the [`Duende.AspNetCore.Authentication.OAuth2Introspection`](https://www.nuget.org/packages/Duende.AspNetCore.Authentication.OAuth2Introspection) package. With this handler:
710
711* Check `aud` in the `OnTokenValidated` event. The handler doesn't validate it.
712* In `OnAuthenticationFailed`, check `context.Error` and throw unless the token is inactive, so the client gets a `500`. The handler answers an introspection failure with a `401`, the same as an inactive token.
713* Write the `401` and `403` challenges elsewhere, such as in an `IAuthorizationMiddlewareResultHandler`. The handler has no `OnChallenge` or `OnForbidden` event, and its `401` has no `WWW-Authenticate` header.
687714
688715### Deploying Beyond Localhost
689716
No line in this hunk matches that.