fix: add OAuth discovery endpoints for claude.ai handshake #3
Reference in New Issue
Block a user
Delete Branch "fix/oauth-discovery-endpoints"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #2.
What
claude.ai makes two discovery requests before the MCP handshake. Both were returning 404, causing "Couldn't reach the MCP server."
Changes
GET /.well-known/oauth-protected-resource→ 200{"authorization_servers":[]}— signals no OAuth required (RFC 9728)GET /.well-known/oauth-authorization-server→ 404 — explicit, no auth server presentHEAD /mcp→ 200 +MCP-Protocol-Version: 2025-06-18headerNo new dependencies. Test added for the HEAD handler.
Acceptance criteria
GET /.well-known/oauth-protected-resourcereturns 200 with valid JSONHEAD /mcpreturns 200 withMCP-Protocol-Version: 2025-06-18Implements RFC 9728 protected resource metadata and HEAD probe so claude.ai can complete its pre-handshake discovery without hitting 404. - GET /.well-known/oauth-protected-resource → 200 {"authorization_servers":[]} - GET /.well-known/oauth-authorization-server → 404 (no auth server) - HEAD /mcp → 200 + MCP-Protocol-Version: 2025-06-18 header Closes #2 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>