Handle '&scope=' in authorize request to return empty list #979
+13
−0
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.
Resolves #977
Motivation and Context
I am attempting to authorize to the ChatGPT web client using Okta OAuth. I got it working, but with significant rewrites and patching to the internals of the MCP Python SDK.
I'm not comfortable proposing support for everything I needed to do as many of those are client side issues with OpenAI's implementation, including lack of PKCE support. However, one of the things that tripped me up seems to be a minor issue on the MCP Python SDK's side, which is that the ChatGPT client was requesting
&scope=
. I'm not 100% sure what's going on as I give the client a default scope when it registers that it in turn is not requesting.In any case, if
None
is a valid value for the scopes, then it seems that[]
should also be, and furthermore that&scope=
in the query params should correspond to eitherNone
or[]
. However, right now the MCP SDK only sets the scopes toNone
if the query parameter is not defined at all, whereas the ChatGPT web client sends&scope=
, which parses as""
, which in turn fails validation unless""
is defined as a valid scope in theClientRegistrationOptions
.How Has This Been Tested?
I have a patched version of this running and connecting to ChatGPT's web client.
Breaking Changes
Should be no breaking changes.
Types of changes
Checklist
Additional context