Skip to content

feat: add OAuth protected resource metadata (RFC 9728)#40

Merged
mattzcarey merged 4 commits intomainfrom
feat/oauth-protected-resource-metadata
Feb 26, 2026
Merged

feat: add OAuth protected resource metadata (RFC 9728)#40
mattzcarey merged 4 commits intomainfrom
feat/oauth-protected-resource-metadata

Conversation

@mattzcarey
Copy link
Contributor

@mattzcarey mattzcarey commented Feb 23, 2026

Summary

  • Upgrades @cloudflare/workers-oauth-provider to v0.2.4 (released) — replaces the pkg.pr.new preview build
  • Configures scopesSupported and resourceMetadata on the OAuthProvider so the /.well-known/oauth-protected-resource endpoint returns proper metadata for MCP auth discovery

What's in workers-oauth-provider v0.2.4

  • /.well-known/oauth-protected-resource endpoint (#136)
  • resource_metadata in WWW-Authenticate headers (#143)
  • RFC 8252 loopback port flexibility for native apps (#145) — fixes OAuth authorize rejects valid localhost redirect URIs for CLI clients #44, where CLI clients (Claude Code, Cursor) using localhost/127.0.0.1 redirect URIs with dynamic ports were rejected on /authorize with "Invalid redirect URI"
  • Exact match for root apiHandler route (#140)
  • Generic Env type for OAuthProviderOptions (#150)
  • allowPlainPKCE option to enforce S256 PKCE (#151)

Verified on staging

$ curl https://staging.mcp.cloudflare.com/.well-known/oauth-protected-resource
{
  "resource": "https://staging.mcp.cloudflare.com",
  "authorization_servers": ["https://staging.mcp.cloudflare.com"],
  "scopes_supported": ["offline_access", "user:read", "account:read", ...],
  "bearer_methods_supported": ["header"],
  "resource_name": "Cloudflare API MCP Server"
}

Test plan

  • npm run check passes (format, lint, typecheck, tests)
  • Deployed to staging
  • /.well-known/oauth-protected-resource returns valid RFC 9728 metadata
  • /.well-known/oauth-authorization-server still works correctly
  • Bumped to released v0.2.4 (no longer using pkg.pr.new preview)

@mattzcarey mattzcarey force-pushed the feat/oauth-protected-resource-metadata branch from a6d74ed to f39b393 Compare February 23, 2026 12:43
Add resourceMetadata config to OAuthProvider for the
/.well-known/oauth-protected-resource endpoint. Bump
workers-oauth-provider to PR #136 build which implements
the endpoint.
@mattzcarey mattzcarey force-pushed the feat/oauth-protected-resource-metadata branch from f39b393 to 872f7f4 Compare February 23, 2026 13:26
@mattzcarey
Copy link
Contributor Author

Tested and working on staging via MCP Inspector. The /.well-known/oauth-protected-resource endpoint returns correct metadata and the OAuth flow completes successfully.

mattzcarey and others added 3 commits February 23, 2026 15:07
Includes both RFC 9728 changes:
- /.well-known/oauth-protected-resource endpoint (#136)
- resource_metadata in WWW-Authenticate headers (#143)
Replace pkg.pr.new preview build with the released v0.2.4 which
includes RFC 9728 support (#136, #143), RFC 8252 loopback port
flexibility for native apps (#145), and other fixes.
@mattzcarey mattzcarey merged commit 1b9f167 into main Feb 26, 2026
4 checks passed
@mattzcarey mattzcarey deleted the feat/oauth-protected-resource-metadata branch February 26, 2026 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OAuth authorize rejects valid localhost redirect URIs for CLI clients

1 participant