Proof Key for Code Exchange
PKCE An extension to the OAuth authorization code flow that stops a stolen authorization code from being redeemed by anyone else.
#
An extension to the OAuth authorization code flow that stops a stolen authorization code from being redeemed by anyone else. The client generates a random code_verifier, sends its transformed code_challenge on the authorization request, and presents the original verifier at the token endpoint. OAuth 2.1, which MCP requires, makes PKCE mandatory for the authorization code grant.
The registered code_challenge_method values are plain and S256, where S256 is BASE64URL-ENCODE(SHA256(ASCII(code_verifier))). RFC 7636 says a client capable of S256 must use it, and plain is only for clients that cannot compute a SHA-256. Every MCP client that runs the OAuth flow itself does this unprompted, so PKCE usually surfaces only when an authorization server rejects the method.
Also written: PKCE · proof key for code exchange · RFC 7636 · code_challenge · code_verifier · S256