Skip to content

Instantly share code, notes, and snippets.

@pjcdawkins
Last active September 9, 2025 13:31
Show Gist options
  • Save pjcdawkins/07570b0b43df98fdec192ac61a0b4b0c to your computer and use it in GitHub Desktop.
Save pjcdawkins/07570b0b43df98fdec192ac61a0b4b0c to your computer and use it in GitHub Desktop.
MCP + OAuth2 flow (assumed)
sequenceDiagram
    participant User
    participant MCP Client
    participant Browser
    participant OAuth2 Server
    participant MCP Server

    User->>MCP Client: Install MCP server
    MCP Server<<->>MCP Client: Obtain OAuth2 server info/URL
    MCP Client<<->>OAuth2 Server: Discover config
    MCP Client->>MCP Client: Start temporary server (random port)
    MCP Client->>User: Auto-open browser
    User->>Browser: Switch to browser
    Browser->>OAuth2 Server: Authorization redirect (with PKCE challenge)
    OAuth2 Server<<->>User: Authenticate and authorize
    OAuth2 Server->>MCP Client: Redirect to MCP Client callback
    MCP Client->>OAuth2 Server: Exchange code (+ PKCE verifier) for token
    OAuth2 Server->>MCP Client: Return access token
    MCP Client->>Browser: Display success/final page
    MCP Client->>MCP Server: Send access token
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment