Issue 1379 patch - Fix MCP server OAuth not working with Visual Studio Code and others with extra grant_types (#1380)

This commit is contained in:
automaton82 2025-09-29 06:13:16 -04:00 • committed by GitHub
commit 9323efad99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 2 deletions

View file

@ -68,7 +68,7 @@ class RegistrationHandler:
),
status_code=400,
)
if set(client_metadata.grant_types) != {"authorization_code", "refresh_token"}:
if not {"authorization_code", "refresh_token"}.issubset(set(client_metadata.grant_types)):
return PydanticJSONResponse(
content=RegistrationErrorResponse(
error="invalid_client_metadata",

View file

@ -47,7 +47,7 @@ class OAuthClientMetadata(BaseModel):
# ie: we do not support client_secret_basic
token_endpoint_auth_method: Literal["none", "client_secret_post"] = "client_secret_post"
# grant_types: this implementation only supports authorization_code & refresh_token
grant_types: list[Literal["authorization_code", "refresh_token"]] = [
grant_types: list[Literal["authorization_code", "refresh_token"] | str] = [
"authorization_code",
"refresh_token",
]