Skip to content

Commit ef4e167

Browse files
Remove strict validation on response_modes_supported member of OAuthMetadata (#1243)
1 parent e68e513 commit ef4e167

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/mcp/shared/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class OAuthMetadata(BaseModel):
114114
registration_endpoint: AnyHttpUrl | None = None
115115
scopes_supported: list[str] | None = None
116116
response_types_supported: list[str] = ["code"]
117-
response_modes_supported: list[Literal["query", "fragment", "form_post"]] | None = None
117+
response_modes_supported: list[str] | None = None
118118
grant_types_supported: list[str] | None = None
119119
token_endpoint_auth_methods_supported: list[str] | None = None
120120
token_endpoint_auth_signing_alg_values_supported: list[str] | None = None

tests/shared/test_auth.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,25 @@ def test_oidc(self):
3737
"userinfo_endpoint": "https://example.com/oauth2/userInfo",
3838
}
3939
)
40+
41+
def test_oauth_with_jarm(self):
42+
"""Should not throw when parsing OAuth metadata that includes JARM response modes."""
43+
OAuthMetadata.model_validate(
44+
{
45+
"issuer": "https://example.com",
46+
"authorization_endpoint": "https://example.com/oauth2/authorize",
47+
"token_endpoint": "https://example.com/oauth2/token",
48+
"scopes_supported": ["read", "write"],
49+
"response_types_supported": ["code", "token"],
50+
"response_modes_supported": [
51+
"query",
52+
"fragment",
53+
"form_post",
54+
"query.jwt",
55+
"fragment.jwt",
56+
"form_post.jwt",
57+
"jwt",
58+
],
59+
"token_endpoint_auth_methods_supported": ["client_secret_basic", "client_secret_post"],
60+
}
61+
)

0 commit comments

Comments
 (0)