Skip to main content

OAuth & Security — Production & Sec

← Back to Dashboard
1. OAuth & Security2. Deployment Strategies3. MCP Across Tools4. Agentic Orchestration5. Remote MCP & Connectors

OAuth & Security

📚 Production & Sec⏱ 9 min⭐ 110 XP⌨ Hands-on lab

OAuth 2.1 Authorization over Streamable HTTP

When running local stdio servers, access relies on local OS process permissions. Once you deploy an MCP Server over Streamable HTTP, the MCP specification mandates a rigorous OAuth 2.1 security architecture where the MCP server acts strictly as an OAuth 2.1 Resource Server:

  • Protected Resource Metadata (RFC 9728): Unauthenticated requests receive 401 Unauthorized with a WWW-Authenticate header pointing to /.well-known/oauth-protected-resource, telling clients which Authorization Server(s) and scopes protect the MCP endpoint.
  • Authorization Server Discovery (RFC 8414 & OIDC 1.0): Clients inspect /.well-known/oauth-authorization-server or /.well-known/openid-configuration to locate authorization, token, and JWKS endpoints automatically.
  • Client ID Metadata Documents (CIMD): Introduced in 2025-11-25 (and deprecating RFC 7591 Dynamic Client Registration in 2026-07-28), clients identify themselves using an HTTPS URL as their client_id that hosts a signed/verified client metadata JSON document.
  • Mandatory PKCE & Resource Indicators (RFC 8707): Clients execute OAuth 2.1 with PKCE and pass the resource parameter (e.g., resource=https://mcp.acme.com/mcp) to bind the minted Bearer token strictly to that MCP server's audience—preventing confused-deputy token passthrough to downstream APIs.
🔒 Security Invariant (No Token Passthrough): An MCP server MUST validate that incoming Bearer tokens were explicitly issued for its own canonical URI (RFC 8707 audience check) and MUST NEVER blindly forward a client's MCP access token to upstream APIs.
⌨ HANDS-ON LABAuthenticate Remote Client with OAuth Bearer
⭐ +150 XP

Authorize against an enterprise MCP OAuth 2.1 protected endpoint with a Bearer token.

1POST to the enterprise Streamable HTTP /mcp endpoint with an Authorization Bearer header.
lab-sandbox — simulated environment
INFINITY LAB SANDBOX v2.6 — simulated shell
Type the command for the current objective. Helpers: "hint", "solution", "clear".
$
OBJECTIVE 1 / 1 — type "hint" if stuck
🧪 Knowledge Check
Press 1-4 to select1 of 3
What protocol stack is standardized for securing remote Streamable HTTP MCP servers?
Basic Auth over plain text
OAuth 2.1 with PKCE, RFC 9728 Protected Resource Metadata, and RFC 8707 Resource Indicators
IP Whitelisting only
Custom cryptographic handshakes