Cluster 18 · RFC 9728 & MCP Auth · /.well-known/oauth-protected-resource

RFC 9728 MCP Protected Resource Metadata Builder & WWW-Authenticate Guide

Generate compliant RFC 9728 /.well-known/oauth-protected-resource manifests and 401 WWW-Authenticate challenges for remote Streamable HTTP MCP servers and APIs.

OAuth 2.1 · WebAuthn · Zero Upload · Strict CSP

2. OIDC Discovery Linter & RFC 9728 MCP Builder

OIDC Core · RFC 9728
RFC 9728 Metadata (/.well-known/oauth-protected-resource)
{
  "resource": "https://mcp.acme.example.com/mcp",
  "authorization_servers": [
    "https://auth.acme.example.com"
  ],
  "bearer_methods_supported": [
    "header"
  ],
  "scopes_supported": [
    "openid",
    "profile",
    "email",
    "mcp:tools"
  ],
  "resource_documentation": "https://mcp.acme.example.com/docs/auth",
  "dpop_signing_alg_values_supported": [
    "ES256",
    "EdDSA"
  ],
  "dpop_bound_access_tokens_required": true
}
HTTP 401 WWW-Authenticate Header
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="https://mcp.acme.example.com/.well-known/oauth-protected-resource", scope="openid profile email mcp:tools"
Cache-Control: no-store
AuthPosture · OAuth 2.1 & Passkeys $39 AuthPosture Fix Pack

Verify Live OAuth 2.1, OIDC, Passkey & Cookie Posture ($39 Fix Pack)

Run an automated live authentication probe on AuthPosture (auth.runglab.dev) or integrate fleet checks via RungLab Hub API (hub.runglab.dev) and Official MCP Server dev.runglab/devtools — or ship the $39 AuthPosture Fix Pack (tailored OIDC & PKCE S256 patches, RFC 9728 MCP metadata, /.well-known/passkey-endpoints, __Host- cookie rules, COOP/CSP login headers, magic-link DMARC/SPF, and SOC 2 CC6.1 / NIST 800-63B CI gate). Prefer PayPal invoicing? Email [email protected].

Authentication Security Specification & Baseline

Control / Header Hardened Baseline Security & Compliance Rationale
Discovery Path /.well-known/oauth-protected-resource Mandatory MCP Authorization spec discovery path (RFC 9728 §3)
401 Challenge Header WWW-Authenticate: Bearer resource_metadata="..." Directs unauthenticated MCP clients to exact protected resource metadata URL
authorization_servers ["https://auth.<domain>"] Array of trusted OAuth 2.1 / RFC 8414 authorization server issuers
bearer_methods_supported ["header"] Accept tokens only in Authorization: Bearer header — never query strings

RFC 9728 Protected Resource Metadata (/.well-known/oauth-protected-resource)

oauth-protected-resource.json
{
  "resource": "https://mcp.acme.example.com/mcp",
  "authorization_servers": ["https://auth.acme.example.com"],
  "bearer_methods_supported": ["header"],
  "scopes_supported": ["openid", "profile", "email", "mcp:tools"],
  "resource_documentation": "https://mcp.acme.example.com/docs/auth",
  "dpop_signing_alg_values_supported": ["ES256", "EdDSA"],
  "dpop_bound_access_tokens_required": true
}

MCP Server 401 Unauthorized Response Header

mcp-401-www-authenticate.http
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="https://mcp.acme.example.com/.well-known/oauth-protected-resource", scope="openid profile email mcp:tools"
Cache-Control: no-store

Implementation Steps & Key Insights

  1. Open Mode 2 tab '2. RFC 9728 MCP Protected Resource' above and enter your MCP resource URL and OAuth issuer.
  2. Host the generated JSON at /.well-known/oauth-protected-resource with Content-Type: application/json and Access-Control-Allow-Origin: *.
  3. Update HTTP 401 handlers on /mcp endpoints to return WWW-Authenticate with the resource_metadata parameter.
  4. Bind access tokens to your resource URI (RFC 8707 audience) and verify live discovery at https://auth.runglab.dev.
  • In RungLab's 100-server MCP audit, 97.5% of auth-gated MCP servers omitted RFC 9728 WWW-Authenticate resource_metadata headers, breaking zero-config client auth.
  • Separating resource metadata (RFC 9728) from authorization server metadata (RFC 8414) prevents token replay across unrelated MCP servers.

Common OAuth, Passkey & Cookie Pitfalls

  • Returning generic 403 Forbidden without WWW-Authenticate resource_metadata on unauthenticated MCP calls.
  • Omitting resource audience validation (aud claim) on the MCP server when accepting tokens from shared IdPs.
Verify Live: Audit your live domain at auth.runglab.dev ($39 AuthPosture Fix Pack), automate via hub.runglab.dev, or connect Official MCP Server dev.runglab/devtools.

More OAuth 2.1, Passkey & Session Security Tools

← Back to AuthPosture Hub · AuthPosture ($39 Fix Pack) → · hub.runglab.dev → · dev.runglab/devtools →

Frequently Asked Questions

Why does the MCP specification require RFC 9728 Protected Resource Metadata?

MCP clients need an automated way to discover which OAuth 2.1 authorization server protects a remote Streamable HTTP MCP endpoint when encountering HTTP 401.

Should bearer_methods_supported ever include 'query'?

No. Passing bearer tokens in URL query parameters leaks credentials into CDN logs, proxies, and browser history. Restrict to ['header'] only.

Does AuthPosture verify RFC 9728 + OAuth 2.1 on live MCP endpoints?

Yes — scan live at https://auth.runglab.dev ($39 AuthPosture Fix Pack) or query Official MCP Server dev.runglab/devtools.