Workaround patch for root path OAuth discovery in MCP SDK#689
Workaround patch for root path OAuth discovery in MCP SDK#689mattzcarey merged 2 commits intomainfrom
Conversation
Add fallback to try root path (/.well-known/oauth-authorization-server) when path-based OAuth discovery fails. This handles cases where MCP servers provide an endpoint path instead of the issuer URL in authorization_servers, which violates RFC 9470 but occurs in practice.
🦋 Changeset detectedLatest commit: db6bbf3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Claude Code ReviewStatus: Approved ✓ This PR adds a pragmatic workaround for OAuth discovery with MCP servers that violate RFC 9470 by providing endpoint paths instead of issuer URLs in SummaryThe patch adds a fallback to try Issues Identified1. Missing test coverageThe patch modifies
Recommendation: Add tests in 2. Potential ordering concernThe root path fallback is added after all other discovery attempts. Consider whether this is optimal - if better-auth servers consistently fail on path-based discovery, trying root first might be more efficient. However, the current order is safer for RFC-compliant servers. Minor Notes
|
commit: |
Add fallback to try root path (/.well-known/oauth-authorization-server) when path-based OAuth discovery fails. This handles cases where MCP servers provide an endpoint path instead of the issuer URL in authorization_servers, which violates RFC 9470 but occurs in practice.
fixes: #686