OAuth: use authorization_servers URL from resource metadata#1153
OAuth: use authorization_servers URL from resource metadata#1153BobDickinson wants to merge 4 commits intomodelcontextprotocol:v1.5/mainfrom
Conversation
…cope discovery - discoverScopes now uses resourceMetadata.authorization_servers[0] when present; otherwise falls back to the MCP server URL. - Add tests: different-domain auth server, path preserved, empty list fallback. Backport of PR 1133 (core/auth layout). Made-with: Cursor
…ncluding centralizing getAuthorizationServerUrl)
|
@claude review |
|
Claude finished @BobDickinson's task in 1m 19s —— View job Code Review
Summary: The fix is correct and well-structured. The core bug was that
|
Summary
Fixed issue from main PR #1133 on the v1.5 branch.
Also, per comment on the PR, put fix into getAuthorizationServerUrl() which is now called from both places.
Type of Change
Changes Made
Scope discovery and metadata discovery no longer always use the MCP server URL for the OAuth authorization server. When the server returns resource metadata with authorization_servers, we use that URL (e.g. authorization_servers[0]) for both discovering OAuth metadata and discovering scopes.
Testing
Note: I did not have a test server that presented an auth server in resource metadata to test against (Keycloak, Entra ID, etc). But the PR functionality and tests match the main PR #1133.
Checklist
npm run prettier-fix)Breaking Changes
No