Skip to content

Fix /.well-known/oauth-authorization-server dropping path #687

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 24, 2025

Conversation

calclavia
Copy link
Member

@calclavia calclavia commented Jun 23, 2025

This fixes the TS SDK so it properly handles the provided path in the authorizationServerUrl, as per rfc 8414:
https://datatracker.ietf.org/doc/html/rfc8414#section-3

Authorization servers supporting metadata MUST make a JSON document containing metadata as specified in Section 2 available at a path formed by inserting a well-known URI string into the authorization server's issuer identifier between the host component and the path component, if any. By default, the well-known URI string used is "/.well-known/oauth-authorization-server". This path MUST use the "https" scheme. The syntax and semantics of ".well-known" are defined in RFC 5785 [RFC5785]. The well-known URI suffix used MUST be registered in the IANA "Well-Known URIs" registry [IANA.well-known].

Motivation and Context

Without this change, auth servers hosted at a subpath will break.

How Has This Been Tested?

Yes, this is being used at Smithery to handle servers hosted under different subpaths.

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

Relevant reviewer: @ihrpr

@calclavia calclavia marked this pull request as ready for review June 23, 2025 20:40
Copy link
Contributor

@ihrpr ihrpr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@ihrpr ihrpr merged commit 0fc9bd0 into modelcontextprotocol:main Jun 24, 2025
2 checks passed
@ihrpr
Copy link
Contributor

ihrpr commented Jun 24, 2025

added fallback for backwards compatibility in #692

@calclavia calclavia deleted the patch-1 branch June 24, 2025 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants