Skip to content

Commit 394a0a0

Browse files
committed
merge with recent branch
1 parent 7104629 commit 394a0a0

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/mcp/client/auth/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,23 @@
55
"""
66

77
from mcp.client.auth.oauth2 import (
8+
ClientCredentialsProvider,
89
OAuthClientProvider,
910
OAuthFlowError,
1011
OAuthRegistrationError,
1112
OAuthTokenError,
1213
PKCEParameters,
14+
TokenExchangeProvider,
1315
TokenStorage,
1416
)
1517

1618
__all__ = [
19+
"ClientCredentialsProvider",
1720
"OAuthClientProvider",
1821
"OAuthFlowError",
1922
"OAuthRegistrationError",
2023
"OAuthTokenError",
2124
"PKCEParameters",
25+
"TokenExchangeProvider",
2226
"TokenStorage",
2327
]

src/mcp/server/auth/handlers/register.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,19 @@ async def handle(self, request: Request) -> Response:
6868
),
6969
status_code=400,
7070
)
71+
72+
# Validate redirect_uris is provided for authorization_code grant type
7173
grant_types_set: set[str] = set(client_metadata.grant_types)
74+
if "authorization_code" in grant_types_set and (
75+
client_metadata.redirect_uris is None or len(client_metadata.redirect_uris) == 0
76+
):
77+
return PydanticJSONResponse(
78+
content=RegistrationErrorResponse(
79+
error="invalid_client_metadata",
80+
error_description="redirect_uris: Field required",
81+
),
82+
status_code=400,
83+
)
7284
required_sets = [
7385
{"authorization_code", "refresh_token"},
7486
{"client_credentials"},

0 commit comments

Comments
 (0)