Repository navigation
Description
Problem
Claude Code (v2.1.76) cannot authenticate with the Sentry MCP server. The OAuth flow fails with:
invalid_target: The resource parameter does not match this authorization server
Root Cause
The path-specific Protected Resource Metadata (PRM) endpoint returns a resource value that the authorization server does not accept.
Root PRM (/.well-known/oauth-protected-resource):
{
"resource": "https://mcp.sentry.dev",
"authorization_servers": ["https://mcp.sentry.dev"]
}Path-specific PRM (/.well-known/oauth-protected-resource/mcp):
{
"resource": "https://mcp.sentry.dev/mcp",
"authorization_servers": ["https://mcp.sentry.dev"]
}Per RFC 9728, Claude Code discovers the path-specific PRM (since the MCP URL is https://mcp.sentry.dev/mcp) and sends resource=https://mcp.sentry.dev/mcp in the OAuth authorization request.
However, the authorization server only recognizes https://mcp.sentry.dev as a valid resource, so it rejects with invalid_target.
Steps to Reproduce
- Add Sentry MCP to Claude Code config:
{ "mcpServers": { "sentry": { "type": "http", "url": "https://mcp.sentry.dev/mcp" } } } - Start Claude Code, attempt to authenticate with Sentry
- Browser opens, immediately shows: "Authentication Error — invalid_target: The resource parameter does not match this authorization server"
Expected Behavior
Either:
- The path-specific PRM at
/.well-known/oauth-protected-resource/mcpshould returnresource: "https://mcp.sentry.dev"(matching what the AS accepts), OR - The authorization server should accept
https://mcp.sentry.dev/mcpas a valid resource
Environment
- Claude Code 2.1.76 on macOS
- MCP URL:
https://mcp.sentry.dev/mcp
Related
- RFC 9728: Handle dynamic paths for OAuth Protected Resource Metadata #755 (RFC 9728: Handle dynamic paths for OAuth Protected Resource Metadata)
- Unable to authenticate with Sentry MCP server #780 (Unable to authenticate with Sentry MCP server)
- [BUG] Omits OAuth resource parameter required by MCP 2025-06-18 anthropics/claude-code#10572 (Omits OAuth resource parameter — fixed, but now the resource value itself mismatches)
Activity
fix(cloudflare): align protected resource metadata with RFC 9728
test(cloudflare): Cover scoped OAuth resources
docs(cloudflare): Clarify OAuth resource compatibility
fix(cloudflare): Reject empty OAuth resource fragments
fix(cloudflare): align protected-resource metadata with RFC 9728 (get…