Upgrade to Pro — share decks privately, control downloads, hide ads and more …

OAuth for MCP

OAuth for MCP

Avatar for Aaron Parecki

Aaron Parecki

May 23, 2025
Tweet

More Decks by Aaron Parecki

Other Decks in Technology

Transcript

  1. RFC6749 RFC6750 CLIENT TYPE AUTH METHOD GRANT TYPE RFC6819 RFC7009

    RFC7592 RFC7662 RFC7636 RFC7591 RFC7519 RFC8252 OIDC RFC8414 STATE PARAM TLS CSRF UMA 2 FAPI RFC7515 RFC7516 RFC7517 RFC7518 TOKEN BINDING POP SECURITY BCP CIBA HTTP SIGNING MUTUAL TLS SPA BCP JARM JAR TOKEN EXCHANGE DPOP
  2. OAuth 2.0 RFC6749 OAuth Core Authorization Code Implicit Password Client

    Credentials RFC6750 Bearer Tokens Tokens in HTTP Header Tokens in POST Form Body Tokens in GET Query String RFC7636 +PKCE RFC8252 PKCE for mobile Browser App BCP PKCE for SPAs PKCE for con fi dential clients Security BCP
  3. OAuth 2.1 Consolidate the OAuth 2.0 specs,
 adding best practices,

    
 removing deprecated features Capture current best practices in OAuth 2.0 under a single name oauth.net/2.1
  4. The Password Anti-Pattern • How do you revoke this app’s

    access? • Do you trust the app to not store your password? • Do you trust the app to access only the things it says it needs? • Do you trust the app to not do things like change your password or delete your account?
  5. Tells the application about the user authenticating Gives the application

    a way to make API requests ID Token Access Token
  6. MCP Authorization Server auth.example.com MCP Resource Server api.example.com Client authorization

    requests resource requests Current draft version of MCP Authorization Spec
  7. User Agent MCP Client OAuth Server MCP Server ? Authorization

    Request Authorization Code Response Token Request Token Response "Log In" MCP Request
  8. User Agent OAuth Server Authorization Request Authorization Code Response Token

    Request Token Response "Log In" Front Channel Back Channel MCP Request MCP Client MCP Server ?
  9. User Agent OAuth Server Authorization Request Authorization Code Response Token

    Request Token Response "Log In" Front Channel Back Channel MCP Request MCP Client MCP Server What the 
 MCP Client Sees ?
  10. User Agent OAuth Server ? Authorization Request Authorization Code Response

    Token Request Token Response "Log In" Front Channel Back Channel MCP Request MCP Client MCP Server What the 
 MCP Server Sees
  11. Access Token Validation GET /v1/contexts HTTP/1.1 Host: mcp.example.com Authorization: Bearer

    eyJhbGciOiJIUzI1NiIs... How does your MCP server validate access tokens?
  12. Access Token Validation Local Validation Remote Introspection ‣ Faster ‣

    No network requests ‣ Use a JWT library ‣ Slower ‣ Requires a network request ‣ No library needed eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZS I6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImp0aSI6ImI5ZDRhNzViLTA2MDMtNDgxYy1hM jgyLTY3YTk0NDJiNGRkNiIsImlhdCI6MTUzMjQwMDkyMiwiZXhwIjoxNTMyNDA0NTIyfQ.S jYROEt8lZpEOq1eKh3OxRmRk3xttOXZeD5yW8aW2k8 { "sub": "1234567890", "name": "John Doe", "admin": true, "jti": "b9d4a75b-0603-481c-a282-67a9442b4dd6", "iat": 1532400922, "exp": 1532404522 } POST https://authorization-server.com/introspect token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3OD &client_id={CLIENT_ID} &client_secret={CLIENT_SECRET}
  13. Goal 1: Con fi gure an MCP client with only

    the single URL of the MCP server No copying API keys, no copying multiple OAuth URLs, no client credentials
  14. GET / HTTP/1.1 Host: mcp.example.com HTTP/1.1 401 Unauthorized WWW-Authenticate: Bearer

    resource_metadata="https://mcp.example.com/.well-known/oauth-protected-resource"
  15. GET / HTTP/1.1 Host: mcp.example.com HTTP/1.1 401 Unauthorized WWW-Authenticate: Bearer

    resource_metadata="https://mcp.example.com/.well-known/oauth-protected-resource" GET /.well-known/oauth-protected-resource Host: mcp.example.com HTTP/1.1 200 Ok Content-type: application/json { "authorization_servers": ["https://auth.example.com/"], ... }
  16. GET / HTTP/1.1 Host: mcp.example.com HTTP/1.1 401 Unauthorized WWW-Authenticate: Bearer

    resource_metadata="https://mcp.example.com/.well-known/oauth-protected-resource" GET /.well-known/oauth-protected-resource Host: mcp.example.com HTTP/1.1 200 Ok Content-type: application/json { "authorization_servers": ["https://auth.example.com/"], ... } GET /.well-known/oauth-authorization-server Host: auth.example.com HTTP/1.1 200 Ok Content-type: application/json { "issuer": "https://auth.example.com/",
  17. Goal 2: Enable people to build MCP servers that can

    be used by MCP clients
 that have never before seen that client
  18. POST /oauth/register HTTP/1.1 Host: auth.example.com Content-Type: application/json { "client_name": "Claude",

    "logo_uri": "https://claude.ai/logo.png", "redirect_uris": ["https://auth.example.com/redirect"] ... } HTTP/1.1 201 Created Content-Type: application/json { "client_id": "ad2669221ba94de0ee0", "client_secret": "6a58a307937e98c459be3bfe8e19af3a", ... }
  19. Granting Claude Access to Google via SSO 1. Connect Button

    2. Login to Google through IdP 3. Google Consent Prompt
  20. Claude Okta (IdP) 1. Redirect to Log In 2. ID

    Token Returned https://datatracker.ietf.org/doc/draft-parecki-oauth-identity-assertion-authz-grant/
  21. Claude Okta (IdP) 3. POST ID Token with 
 Cross-App

    Access Request 4. Cross-Domain JWT Returned https://datatracker.ietf.org/doc/draft-parecki-oauth-identity-assertion-authz-grant/
  22. Claude Okta (IdP) 5. POST Cross-Domain JWT to Request Access

    Token 7. Access Token Returned Slack 6. Validates JWT using signature with IdP public key https://datatracker.ietf.org/doc/draft-parecki-oauth-identity-assertion-authz-grant/
  23. Claude Okta (IdP) 5. POST Cross-Domain JWT to Request Access

    Token 7. Access Token Returned Slack 6. Validates JWT using signature with IdP public key 1. Redirect to Log In 2. ID Token Returned 3. POST ID Token with 
 Cross-App Access Request 4. Cross-Domain JWT Returned https://datatracker.ietf.org/doc/draft-parecki-oauth-identity-assertion-authz-grant/