Agents are public clients that cannot keep a secret, so they rely on PKCE to bind an authorization code to the client that started the flow. Native app guidance covers loopback redirects and system browsers, and the device grant handles headless machines. MCP requires clients to implement PKCE and to confirm the authorization server supports it.
Read in this order
- OfficialRFC 7636: Proof Key for Code ExchangeStart here: how PKCE stops a stolen authorization code from being redeemed.
- OfficialRFC 8252: OAuth 2.0 for Native AppsRedirect and browser rules for apps that run on a user's machine.
- OfficialRFC 8628: OAuth 2.0 Device Authorization GrantThe device flow for agents on machines without a browser.