Skip to content

0012: Cloudflare Access Managed OAuth confirmed for Claude connectors ​

Context ​

ADR 0004 proposed Cloudflare Access with Managed OAuth in front of the MCP endpoint, with a fallback to an OAuth server built into the app, and flagged the decision as unverified pending a spike. A related review of the owner's other MCP servers found that his one prior attempt at Cloudflare Access in front of Claude (ppp-mcp, August 2026) failed: Access only offered a browser-redirect login with no Dynamic Client Registration, so every OAuth and MCP path had to bypass Access entirely.

Decision ​

Run the spike. Managed OAuth is a distinct, newer capability from what ppp-mcp hit, and it works.

Verified on 2026-09-27 against a live Cloudflare Access application (GetMy Books MCP, mcp.getmy.group), identity provider Microsoft Entra ID (tenant getmy.group, app registration getmy-books-cloudflare-access), with no origin server yet running behind the tunnel:

  • GET /.well-known/oauth-protected-resource returns valid RFC 9728 metadata, served at Cloudflare's edge.
  • GET /.well-known/oauth-authorization-server returns valid RFC 8414 metadata, code_challenge_methods_supported: ["S256"].
  • POST https://<team>.cloudflareaccess.com/cdn-cgi/access/oauth/registration performs real Dynamic Client Registration (RFC 7591) and issues a client_id, once the exact redirect URI is added to the Access application's oauth_configuration.dynamic_client_registration.allowed_uris. Confirmed working with https://claude.ai/api/mcp/auth_callback, Claude's real callback, not a wildcard or a guess.
    • allow_any_on_localhost / allow_any_on_loopback work immediately and need no allow-list entry, useful for local MCP Inspector testing.
    • Gotcha: a config change to allowed_uris needs roughly 30-60 seconds to propagate to Cloudflare's edge. A request made immediately after saving fails with redirect_uri is not allowed by the account configuration, which looks identical to a real misconfiguration. Wait and retry once before concluding the config is wrong.
  • Unauthenticated GET /mcp returns 401 with a spec-correct WWW-Authenticate: Bearer ... resource_metadata="..." header.

Not yet verified: the full interactive flow (/authorize through Entra login, /token exchange, and a real Claude client completing the connection). That needs the owner to click through it, since it requires an interactive Entra sign-in as rob.duncan@getmy.group.

The app never sees an OAuth request. It only receives requests that have already passed Access's policy check, carrying a validated Access identity.

Consequences ​

  • Supersedes ADR 0004. No OAuth server is built into the app. No fallback needed.
  • src/mcp/ stays limited to tool definitions, as ADR 0004's module boundary already required.
  • The app must still validate the Access assertion on every request (audience and identity), not trust the network path alone.
  • Infrastructure created for this spike, kept:
    • Cloudflare Tunnel getmy-books, DNS mcp.getmy.group (proxied CNAME)
    • Access application GetMy Books MCP, policy: rob.duncan@getmy.group only
    • Access identity provider GetMy (getmy.group) (Entra, tenant getmy.group)
    • Entra app registration getmy-books-cloudflare-access (958aea95-501a-42df-a530-5c1995052f37)
    • Doppler project getmy-books holding GETMYGROUP_TENANT_ID, GETMYGROUP_ACCESS_CLIENT_ID, GETMYGROUP_ACCESS_CLIENT_SECRET, GETMY_BOOKS_TUNNEL_TOKEN
  • Not yet done: no cloudflared connector is running anywhere, so the tunnel has no origin. /mcp is not mounted over HTTP in the app; only the stdio entry point exists. Next slice: mount /mcp, test first, then run cloudflared on the NAS or Mac mini and complete one real Claude connection as the exit test.