Merge pull request #2 from Eric84626/feature/add_grant_type_for_mcp_register_api

fix: added additional grant type into oauth_authorization_server resp…
This commit is contained in:
Eric84626 2025-12-20 12:17:52 +08:00 committed by GitHub
commit c1954952c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View file

@ -447,7 +447,7 @@ async def oauth_authorization_server_mcp(
"authorization_endpoint": authorization_endpoint,
"token_endpoint": token_endpoint,
"response_types_supported": ["code"],
"grant_types_supported": ["authorization_code"],
"grant_types_supported": ["authorization_code", "refresh_token"],
"code_challenge_methods_supported": ["S256"],
"token_endpoint_auth_methods_supported": ["client_secret_post"],
# Claude expects a registration endpoint, even if we just fake it

View file

@ -354,7 +354,7 @@ async def test_register_client_remote_registration_success():
request_payload = {
"client_name": "Litellm Proxy",
"grant_types": ["authorization_code"],
"grant_types": ["authorization_code", "refresh_token"],
"response_types": ["code"],
"token_endpoint_auth_method": "client_secret_post",
}
@ -603,6 +603,7 @@ async def test_oauth_authorization_server_respects_x_forwarded_proto():
assert response["authorization_endpoint"].startswith("https://litellm.example.com/")
assert response["token_endpoint"].startswith("https://litellm.example.com/")
assert response["registration_endpoint"].startswith("https://litellm.example.com/")
assert response["grant_types_supported"] == ["authorization_code", "refresh_token"]
@pytest.mark.asyncio

View file

@ -136,7 +136,7 @@ export const useMcpOAuthFlow = ({
if (!hasPreconfiguredCredentials) {
const registration = await registerMcpOAuthClient(accessToken, serverId, {
client_name: temporaryPayload.alias || temporaryPayload.server_name || serverId,
grant_types: ["authorization_code"],
grant_types: ["authorization_code", "refresh_token"],
response_types: ["code"],
token_endpoint_auth_method:
temporaryPayload.credentials && temporaryPayload.credentials.client_secret ? "client_secret_post" : "none",