MCP Shipyard
← Rules catalog

MCP OAuth: code_challenge_methods_supported must include S256 (PKCE fix)

ChatGPT treats authorization servers without PKCE S256 as unsupported. Add code_challenge_methods_supported with S256 and enforce PKCE.

blockerauth.pkce-s256Claude, ChatGPT, Grok Build, VS Code

Your authorization server metadata must list "S256" in code_challenge_methods_supported, and the server must enforce PKCE. Per the rule, ChatGPT treats servers without it as unsupported, and Claude sends S256 on every request.

What you see

  • A scan reports auth.pkce-s256: "code_challenge_methods_supported lacks S256". It is a blocker.
  • Sign-in from ChatGPT fails or the app is rejected. The exact message is not verified here.
  • Your metadata at /.well-known/oauth-authorization-server has no code_challenge_methods_supported key, or lists only plain.

Why it happens

OAuth 2.1 requires PKCE for public clients, and MCP clients are public clients. Many identity providers support PKCE but do not advertise it in discovery metadata, so clients cannot tell. Some default to allowing plain or leave PKCE optional.

Check it yourself

curl -s https://auth.acme.example/.well-known/oauth-authorization-server \
  | jq '.code_challenge_methods_supported'

Expected: ["S256"]. For OpenID Connect providers use /.well-known/openid-configuration instead.

You can also prove enforcement: start an authorization request without code_challenge and confirm the server rejects it.

Fix

Advertise it:

{
  "issuer": "https://auth.acme.example",
  "authorization_endpoint": "https://auth.acme.example/authorize",
  "token_endpoint": "https://auth.acme.example/token",
  "code_challenge_methods_supported": ["S256"]
}

Then enforce it. In a custom server, reject /authorize requests that lack code_challenge or use code_challenge_method other than S256, and verify code_verifier at the token endpoint:

import { createHash } from "node:crypto";
const challenge = createHash("sha256").update(verifier).digest("base64url");
if (challenge !== stored.codeChallenge) throw new Error("invalid_grant");

If you use a hosted identity provider, turn on its PKCE setting and check whether it can publish the field in metadata. If it cannot, front the metadata endpoint yourself.

Verify

Re-run the jq command and confirm S256 is present. Complete a full sign-in from a test client and confirm the token request includes code_verifier.

Which clients care

The rule lists Claude, ChatGPT, Grok Build (formerly Cursor) and VS Code. The rule states ChatGPT treats servers without it as unsupported and that Claude always sends S256. Grok Build and VS Code behaviour is not described.

Source

OpenAI authentication docs: https://developers.openai.com/plugins/build/auth

Run a free scan at https://mcpshipyard.com/scan to check every rule at once.

Check every rule at once

A free scan runs this check and the other 152 against your live URL.

Scan a server