scaledockhq/scaledock-skills/mcp-authorization

Claude Code and agent skill by scaledockhq/scaledock-skills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

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), OAuth Client Credentials (machine-to-machine), token passthrough, confused deputy, SSRF, and TypeScript SDK auth helpers. Targets MCP 2026-07-28; supports 2025-11-25 and 2025-06-18, upgrades from 2025-03-26, and tracks the MCP draft.

Install

npx vskill@latest install scaledockhq/scaledock-skills/mcp-authorization

SKILL.md

The same SKILL.md was published earlier as scaledockhq/scaledock-skills/mcp-authorization.

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.
  • User presence: whether a user authorizes access, or the client runs with no user (a service, pipeline or daemon), which brings in the Draft OAuth Client Credentials extension.
  • Target version: MCP 2026-07-28 (current, the default; the revision the MCP Versioning page marks Current). MCP 2025-11-25 and MCP 2025-06-18 are supported: keep their behaviour only for a named peer on that revision. MCP 2025-03-26 is legacy: read it and upgrade from it, never author it. The MCP draft is a preview (posture: track): never emit it. OAuth 2.1 (draft-ietf-oauth-v2-1-16) and OAuth Client ID Metadata Document (draft-ietf-oauth-client-id-metadata-document-02) are previews (posture: track). Revision 2024-11-05 had no authorization. See `references/versions.md`.
  • 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

  1. 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).
  2. 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).
  3. The server says where the metadata is. It MUST send resource_metadata in the WWW-Authenticate header 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).
  4. Clients check the issuer of the metadata. The issuer in 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).
  5. Every token request names the MCP server. Clients MUST send resource in 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).
  6. 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).
  7. 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).
  8. 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).
  9. PKCE with S256. Clients MUST use PKCE, MUST use S256 when technically capable, and MUST refuse to proceed when the authorization server metadata has no code_challenge_methods_supported (Authorization Security Considerations, Authorization Code Protection).
  10. Validate `iss` before using the code. The client records the validated issuer with 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).
  11. 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).
  12. 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).
  13. 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

  1. Scope the work and pick the version. Confirm the role and transport from Inputs. For STDIO, stop: this skill does not apply. Target MCP 2026-07-28, and list any peers that still speak a supported older revision.

-> `references/versions.md` ✓ The design names the role, the HTTP transport, the canonical server URI and the target revision, and it is not a legacy or draft revision.

  1. Publish Protected Resource Metadata and challenges (server). Serve RFC 9728 metadata, send 401 with resource_metadata and an initial scope, and send 403 insufficient_scope for 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.

  1. 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.

  1. 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.

  1. 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` ✓ The client_id in use was obtained for this issuer.

  1. Run the authorization code flow. Send PKCE S256, state, resource and the selected scopes; validate iss and state on the callback; send resource again in the token request.

-> `references/client-flow.md` ✓ A callback with a wrong or missing iss is rejected according to the RFC 9207 table.

  1. 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.

  1. 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-JAG aud is the resource authorization server issuer and its resource is the MCP server.

  1. Use OAuth Client Credentials if no user is present. Discover as in step 4, then run the client_credentials grant with a pre-registered client, authenticating with a JWT assertion (recommended) or a client secret, and send resource and scope.

-> `references/client-credentials.md` ✓ The token request uses an authentication method listed in the authorization server's token_endpoint_auth_methods_supported, and no browser or DCR step runs.

  1. 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.

  1. 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 validates state itself and keys credentials by ctx.issuer.

  1. Upgrade (only when asked). Follow the checklist for each step from the source revision to MCP 2026-07-28.

-> `references/versions.md` ✓ The upgraded server or client passes the Verify list below, and existing users keep the same grants.

Verify before done

  • [ ] GET on the metadata URL returns JSON with resource equal to the server's identifier and a non-empty authorization_servers (RFC 9728 §2, §3.3).
  • [ ] A request without a token gets 401 with WWW-Authenticate: Bearer resource_metadata="…".
  • [ ] A token whose audience is a different resource gets 401; a token without the needed scope gets 403 with error="insufficient_scope" and scope.
  • [ ] Authorization and token requests both carry resource with 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 lacks code_challenge_methods_supported.
  • [ ] The callback handler checks state and iss before the code exchange, and does not show error_description after an iss mismatch.
  • [ ] 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.
  • [ ] A client_credentials client uses pre-registered credentials, sends resource in the token request, and prefers a JWT assertion over a client secret.
  • [ ] Every outbound fetch of URLs taken from metadata or CIMD goes through the SSRF controls in the security reference.

Reference index

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/scaledockhq/scaledock-skills/mcp-authorization/badge)](https://verified-skill.com/skills/scaledockhq/scaledock-skills/mcp-authorization)

Something wrong with this skill or its page? Tell us.