fix: omit oauth scopes when authorization server advertises scopes_supported: [] - #240
Open
wolever-gl wants to merge 1 commit into
Open
fix: omit oauth scopes when authorization server advertises scopes_supported: []#240wolever-gl wants to merge 1 commit into
wolever-gl wants to merge 1 commit into
Conversation
Authorization servers that advertise scopes_supported: [] (e.g. Datadog MCP) reject authorize requests that include openid/email/profile defaults with invalid_scope. - Treat empty scopes_supported as explicit 'no scopes' and return '' - Only add scope to authorize URL and client metadata when non-empty - Keep OIDC fallback when metadata omits scopes_supported entirely Made-with: Cursor
|
Hello @geelen , would it be possible to have this one merged? I think it's fairly straightfoward and it does fix some "big" MCP (like DataDog's) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
OAuth authorize fails with
invalid_scopefor servers whose AS metadata includes"scopes_supported": []. The client was falling through to a hardcodedopenid email profiledefault, which those servers do not support.This bug was uncovered trying to connect to Datadog's MCP, which advertises
"scopes_supported": [].The fix has been tested against Datadog's MCP:
Fix
authorizationServerMetadata.scopes_supportedis present and empty, treat that as no scopes and return an empty effective scope.scopequery param on the authorize URL and only includescopein dynamic client metadata when the effective scope is non-empty.scopes_supportedentirely, keep the existing OIDC fallback so behavior stays the same for unknown servers.Tests
scopewhenscopes_supported: []scopeparam in that caseRefs: RFC 6749 §3.3 (omitted scope → server default or error); servers advertising an empty supported list should not receive unrelated OIDC scopes.
Made with Cursor