mcp-authorization
Skill1 starsChanged 31 days agoMITView on GitHub
MCP authorization: secure MCP servers with OAuth 2.1 as resource servers, and build MCP clients that discover, register and request audience-bound tokens. Use when adding or reviewing authorization on an HTTP MCP server, client, gateway or authorization server: 401 and 403 WWW-Authenticate challenges with resource_metadata, RFC 9728 Protected Resource Metadata at /.well-known/oauth-protected-resource, authorization server discovery through RFC 8414 or OpenID Connect Discovery, RFC 8707 resource indicators and audience validation, Client ID Metadata Documents (CIMD), pre-registration and deprecated Dynamic Client Registration (DCR), PKCE S256, insufficient_scope step-up and scope accumulation, RFC 9207 iss validation and mix-up attacks, Enterprise-Managed Authorization (ID-JAG, RFC 8693 token exchange, RFC 7523 JWT bearer), token passthrough, confused deputy, SSRF, and the MCP TypeScript SDK auth helpers (requireBearerAuth, OAuthClientProvider, CrossAppAccessProvider). Pins MCP revision 2026-07-28.
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 48
Validate tokens (server): Check signature or introspection, expiry, audience and scopes on every request.
- Very specific: line 51
Discover the authorization server (client): Follow the header or the well-known probe order, pick an authorization server, fetch its …
- Very specific: line 54
Register the client: Use pre-registered credentials, then CIMD, then DCR, then ask the user, and key the result by issuer.
- Distinctive: line 69
Map to the TypeScript SDK if it is used: Use the SDK's resource-server gate and client provider, and add the checks the SDK leaves to the …
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
MCP authorization
The Model Context Protocol (MCP) authorization specification defines how an HTTP MCP server acts as an OAuth 2.1 resource server and how an MCP client finds the authorization server, registers, and obtains a token bound to that one server. This skill pins MCP revision 2026-07-28 and produces a server, client or review that meets its MUST-level rules.
Follow the workflow below step by step. Every rule here comes from a source in Sources, with the page and heading it cites. MCP pages have no stable section numbers, so MCP rules cite the page and heading name; RFC and draft rules cite the section number. When a rule and the pinned source disagree, the source wins; when the source has a newer revision than the pin, follow the refresh steps.
Inputs (fill in, or ask before starting)
- Role: MCP server (resource server), MCP client, authorization server, or an MCP server that also calls upstream APIs (a proxy or gateway).
- Transport: Streamable HTTP or another HTTP transport (this skill applies), or STDIO (it does not; credentials come from the environment).
- Enterprise: whether an enterprise identity provider (IdP) must control access, which brings in Enterprise-Managed Authorization.
- Revision: MCP 2026-07-28, the revision the MCP Versioning page marks Current, unless the user names another.
- Sources: when refreshing this skill or when a rule looks out of date, re-read the MCP Versioning page for a newer Current revision, then the changelog and Deprecated Features page of that revision, then every URL in Sources. Update the pins and bump the version.
Invariants
- Authorization applies to HTTP transports only. Authorization is OPTIONAL. HTTP-based implementations SHOULD conform to it, and STDIO implementations SHOULD NOT follow it and retrieve credentials from the environment instead (Authorization, Protocol Requirements).
- The server publishes Protected Resource Metadata. MCP servers MUST implement RFC 9728, and the document MUST list at least one authorization server in
authorization_servers(Authorization, Overview; Authorization Server Discovery, Authorization Server Location). - The server says where the metadata is. It MUST send
resource_metadatain theWWW-Authenticateheader of a 401 (RFC 9728 §5.1) or serve the metadata at a well-known URI. Clients MUST support both and use the header when present (Authorization Server Discovery, Protected Resource Metadata Discovery Requirements). - Clients check the issuer of the metadata. The
issuerin the authorization server metadata MUST be identical to the issuer used to build the metadata URL, or the client rejects it (Authorization Server Discovery, Authorization Server Metadata Discovery; RFC 8414 §3.3). - Every token request names the MCP server. Clients MUST send
resourcein the authorization request and the token request, set to the canonical URI of the MCP server, whether or not the authorization server supports it (Authorization, Resource Parameter Implementation; RFC 8707 §2). - The server accepts only its own tokens. Servers MUST validate access tokens per OAuth 2.1 §5.2, MUST validate that the token was issued for them as the audience (RFC 8707 §2), and MUST answer invalid or expired tokens with 401 (Authorization, Token Handling).
- No token passthrough. A server MUST NOT accept or transit any other token, and MUST NOT pass the client's token to an upstream API; it gets a separate token for the upstream (Authorization, Token Handling; Authorization Security Considerations, Access Token Privilege Restriction; Security Best Practices, Token Passthrough).
- Bearer header only. Clients MUST send
Authorization: Bearer <token>on every HTTP request, and the token MUST NOT be in the query string (Authorization, Token Requirements). - PKCE with S256. Clients MUST use PKCE, MUST use
S256when technically capable, and MUST refuse to proceed when the authorization server metadata has nocode_challenge_methods_supported(Authorization Security Considerations, Authorization Code Protection). - Validate
issbefore using the code. The client records the validatedissuerwith the PKCE verifier and applies RFC 9207 §2.4 to the authorization response before it sends the code to the token endpoint (Authorization, Authorization Response Validation). - Credentials belong to one authorization server. Clients MUST key client credentials by issuer and MUST NOT reuse them with a different authorization server (Client Registration, Authorization Server Binding).
- HTTPS and exact redirects. Authorization server endpoints MUST use HTTPS; redirect URIs MUST be localhost or HTTPS, MUST be registered, and the authorization server MUST match them exactly (Authorization Security Considerations, Communication Security and Open Redirection).
- Proxies get consent per client. An MCP proxy server that uses a static client ID with a third-party authorization server MUST obtain user consent for each dynamically registered client before forwarding to the third party (Authorization Security Considerations, Confused Deputy Problem).
Workflow
- Scope the work. Confirm the role and transport from Inputs. For STDIO, stop: this skill does not apply. ✓ The design names the role, the HTTP transport and the canonical server URI.
- Publish Protected Resource Metadata and challenges (server). Serve RFC 9728 metadata, send
401withresource_metadataand an initialscope, and send403 insufficient_scopefor per-operation scopes. ->references/resource-server.md✓ An unauthenticated request gets a 401 whose header leads a client to the metadata, and the metadata lists an authorization server. - Validate tokens (server). Check signature or introspection, expiry, audience and scopes on every request; map failures to 401 or 403.
->
references/resource-server.md✓ A token issued for another resource is rejected with 401, and no client token reaches an upstream API. - Discover the authorization server (client). Follow the header or the well-known probe order, pick an authorization server, fetch its metadata in the defined order and check
issuer. ->references/client-flow.md✓ The client reaches the authorization server metadata from only the MCP server URL. - Register the client. Use pre-registered credentials, then CIMD, then DCR, then ask the user, and key the result by issuer.
->
references/client-flow.md✓ Theclient_idin use was obtained for this issuer. - Run the authorization code flow. Send PKCE
S256,state,resourceand the selected scopes; validateissandstateon the callback; sendresourceagain in the token request. ->references/client-flow.md✓ A callback with a wrong or missingissis rejected according to the RFC 9207 table. - Handle step-up. On
403 insufficient_scope, request the union of previously requested and newly challenged scopes, with a retry limit. ->references/client-flow.md✓ A second scope challenge does not drop the scopes from the first. - Add Enterprise-Managed Authorization if the IdP must control access. Exchange the IdP ID Token for an ID-JAG (RFC 8693), then the ID-JAG for an access token (RFC 7523).
->
references/enterprise-managed-authorization.md✓ The ID-JAGaudis the resource authorization server issuer and itsresourceis the MCP server. - Review the attack surface. Go through confused deputy, token passthrough, SSRF, session handles, URL validation, mix-up, localhost redirects and scope minimization.
->
references/security.md✓ Each item in the security reference has a mitigation or a reason it does not apply. - Map to the TypeScript SDK if it is used. Use the SDK's resource-server gate and client provider, and add the checks the SDK leaves to the app.
->
references/typescript-sdk.md✓ The app validatesstateitself and keys credentials byctx.issuer.
Verify before done
GETon the metadata URL returns JSON withresourceequal to the server's identifier and a non-emptyauthorization_servers(RFC 9728 §2, §3.3).- A request without a token gets
401withWWW-Authenticate: Bearer resource_metadata="…". - A token whose audience is a different resource gets
401; a token without the needed scope gets403witherror="insufficient_scope"andscope. - Authorization and token requests both carry
resourcewith the canonical server URI, without a fragment or trailing slash. - The authorization request carries
code_challenge_method=S256, and the client stops when the metadata lackscode_challenge_methods_supported. - The callback handler checks
stateandissbefore the code exchange, and does not showerror_descriptionafter anissmismatch. - Client credentials are stored per issuer, and DCR is used only when neither pre-registration nor CIMD is available.
- No code path forwards the incoming access token to another service.
- Every outbound fetch of URLs taken from metadata or CIMD goes through the SSRF controls in the security reference.
Reference index
references/resource-server.md: Protected Resource Metadata, well-known URIs, 401 and 403 challenges, scope selection, token and audience validation, refresh token hints, error codes.references/client-flow.md: discovery order, authorization server selection, CIMD, pre-registration and DCR, PKCE,resource,issvalidation, step-up and scope accumulation.references/enterprise-managed-authorization.md: the ext-auth Enterprise-Managed Authorization extension, ID-JAG token exchange, JWT bearer grant and discovery.references/security.md: confused deputy, token passthrough, SSRF, session handles, local servers, URL validation, mix-up, localhost redirects, CIMD trust policies, scope minimization.references/typescript-sdk.md: what the MCP TypeScript SDK v2 provides for servers and clients, and what it leaves to the app.
Related skills
oauth, for OAuth 2.1 and the RFCs this profile builds on:npx skills add ScaleDockHQ/scaledock-skills --skill oauthjwt, for validating JWT access tokens and ID-JAGs:npx skills add ScaleDockHQ/scaledock-skills --skill jwtproblem-details, for error bodies next to 401 and 403 challenges:npx skills add ScaleDockHQ/scaledock-skills --skill problem-details
Sources
Status uses the publishing body's own maturity term. Checked is the date the source was last read.
- MCP Versioning: Specification page, lists 2026-07-28 as Current, checked 2026-10-02.
- MCP Authorization: Current, 2026-07-28, checked 2026-10-02.
- MCP Authorization Server Discovery: Current, 2026-07-28, checked 2026-10-02.
- MCP Client Registration: Current, 2026-07-28, checked 2026-10-02.
- MCP Authorization Security Considerations: Current, 2026-07-28, checked 2026-10-02.
- MCP Key Changes: Current, 2026-07-28, checked 2026-10-02.
- MCP Deprecated Features: Current, 2026-07-28, checked 2026-10-02.
- MCP Security Best Practices: Documentation, 2026-07-28, checked 2026-10-02.
- SEP-2350: Clarify client-side scope accumulation in step-up authorization: SEP, Final, merged 2026-03-28, checked 2026-10-02.
- Enterprise-Managed Authorization: Stable extension, main at e5eef54 (2026-06-18), checked 2026-10-02.
- MCP TypeScript SDK v2 documentation: Released, v2 (packages 2.2.0, 2026-09-28), checked 2026-10-02.
- TypeScript SDK: Authorization (server): Released, v2.2.0, checked 2026-10-02.
- TypeScript SDK: OAuth (client): Released, v2.2.0, checked 2026-10-02.
- TypeScript SDK: Machine authentication: Released, v2.2.0, checked 2026-10-02.
- TypeScript SDK: client auth source: Released, v2.2.0, checked 2026-10-02.
- The OAuth 2.1 Authorization Framework: Internet-Draft (WG document), draft-ietf-oauth-v2-1-13 as pinned by MCP (latest is -16); Draft posture: build at -13, checked 2026-10-02.
- OAuth Client ID Metadata Document: Internet-Draft (WG document), draft-ietf-oauth-client-id-metadata-document-00 as pinned by MCP (latest is -02); Draft posture: build at -00, checked 2026-10-02.
- Identity Assertion JWT Authorization Grant: Internet-Draft (WG document), draft-ietf-oauth-identity-assertion-authz-grant-04 (latest); Draft posture: build at -04 through the Stable extension, checked 2026-10-02.
- RFC 9728: OAuth 2.0 Protected Resource Metadata: RFC (Proposed Standard), RFC 9728, checked 2026-10-02.
- RFC 8414: OAuth 2.0 Authorization Server Metadata: RFC (Proposed Standard), RFC 8414, checked 2026-10-02.
- OpenID Connect Discovery 1.0: Final, incorporating errata set 2, checked 2026-10-02.
- RFC 8707: Resource Indicators for OAuth 2.0: RFC (Proposed Standard), RFC 8707, checked 2026-10-02.
- RFC 9207: OAuth 2.0 Authorization Server Issuer Identification: RFC (Proposed Standard), RFC 9207, checked 2026-10-02.
- RFC 6750: OAuth 2.0 Bearer Token Usage: RFC (Proposed Standard, updated by RFC 8996 and RFC 9700), RFC 6750, checked 2026-10-02.
- RFC 7591: OAuth 2.0 Dynamic Client Registration Protocol: RFC (Proposed Standard), RFC 7591, checked 2026-10-02.
- RFC 8693: OAuth 2.0 Token Exchange: RFC (Proposed Standard), RFC 8693, checked 2026-10-02.
- RFC 7523: JWT Profile for OAuth 2.0 Client Authentication and Authorization Grants: RFC (Proposed Standard), RFC 7523, checked 2026-10-02.
In this repository40 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- find-skillsSkill
- a2aSkill
- ag-uiSkill
- ap2Skill
- asyncapiSkill
- authzenSkill
- cedarSkill
- cloudeventsSkill
- eu-ai-actSkill
- fapiSkill
- gnapSkill
- jwtSkill
- oauthSkill
- ocsfSkill
- openapi-arazzoSkill
- openapi-overlaySkill
- openapiSkill
- openfeatureSkill
- openid4vcSkill
- openid-connectSkill
- openid-federationSkill
- openidSkill
- opentelemetry-genaiSkill
- owasp-agenticSkill
- problem-detailsSkill
- ratelimit-headersSkill
- scaledock-agent-permissionsSkill
- scaledock-enterprise-identitySkill
- scaledock-http-apiSkill
- scaledock-mcp-serverSkill
- scaledock-repo-standardSkill
- scimSkill
- shared-signalsSkill
- spiffeSkill
- standard-schemaSkill
- typespecSkill
- web-bot-authSkill
- webmcpSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

