Skip to content

Conversation

@mattzcarey
Copy link
Contributor

Some servers incorrectly set authorization_servers to an endpoint path instead of the issuer URL, violating RFC 9470. Add a fallback to try root-level OAuth discovery (/.well-known/oauth-authorization-server) when path-based discovery fails. This allows discovery to succeed with non-compliant server implementations while maintaining spec-compliant behavior as the primary path.

Fixes this issue which apparently uses better-auth

cloudflare/agents#686

Motivation and Context

How Has This Been Tested?

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Some servers incorrectly set authorization_servers to an endpoint path instead of the issuer URL, violating RFC 9470. Add a fallback to try root-level OAuth discovery (/.well-known/oauth-authorization-server) when path-based discovery fails. This allows discovery to succeed with non-compliant server implementations while maintaining spec-compliant behavior as the primary path.
@mattzcarey mattzcarey requested review from a team as code owners November 28, 2025 18:54
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 28, 2025

Open in StackBlitz

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/sdk@1192

commit: 46af223

@mattzcarey
Copy link
Contributor Author

Closing this since it was fixed in better-auth

@mattzcarey mattzcarey closed this Nov 29, 2025
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.

2 participants