You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Empty but defined scope query param ("&scope=") validates as [""] and not [] during authorization. #977
Hello, we're trying to get MCP server working with auth in ChatGPT, and I believe I encountered a small bug. OpenAI sends an auth request with &scope=. This seems to imply that it is requesting no scopes.
However, in mcp/shared/auth.py, the code fails with the error message Client+was+not+registered+with+scope+ because requested_scope.split(" ") parses as [""], and so it checks that "" is an allowed scope.
The code causing the error is as follows:
defvalidate_scope(self, requested_scope: str|None) ->list[str] |None:
ifrequested_scopeisNone:
returnNonerequested_scopes=requested_scope.split(" ")
allowed_scopes= [] ifself.scopeisNoneelseself.scope.split(" ")
forscopeinrequested_scopes:
ifscopenotinallowed_scopes:
raiseInvalidScopeError(f"Client was not registered with scope {scope}")
returnrequested_scopes
It seems that the code should probably be changed to look something like this:
defvalidate_scope(self, requested_scope: str|None) ->list[str] |None:
ifrequested_scopeisNone:
returnNoneifrequested_scope=="":
return []
requested_scopes=requested_scope.split(" ")
allowed_scopes= [] ifself.scopeisNoneelseself.scope.split(" ")
forscopeinrequested_scopes:
ifscopenotinallowed_scopes:
raiseInvalidScopeError(f"Client was not registered with scope {scope}")
returnrequested_scopes
Activity
felixweinberger commentedon Oct 3, 2025
Assuming this issue can be closed as no longer affecting you given our conversation on #979