Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix: added additional grant type into oauth_authorization_server response for fixing mcp auth register bad request issue

Eric846263a2ab6b0d12b
diff --git a/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py b/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py
index ffa17a5b7c4..5433196dfe3 100644
--- a/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py
+++ b/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py
@@ -428,7 +428,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
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_discoverable_endpoints.py b/tests/test_litellm/proxy/_experimental/mcp_server/test_discoverable_endpoints.py
index 6df9abd3fee..30f3d55f028 100644
--- a/tests/test_litellm/proxy/_experimental/mcp_server/test_discoverable_endpoints.py
+++ b/tests/test_litellm/proxy/_experimental/mcp_server/test_discoverable_endpoints.py
@@ -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
diff --git a/ui/litellm-dashboard/src/hooks/useMcpOAuthFlow.tsx b/ui/litellm-dashboard/src/hooks/useMcpOAuthFlow.tsx
index 9600c962564..a62d8baa75b 100644
--- a/ui/litellm-dashboard/src/hooks/useMcpOAuthFlow.tsx
+++ b/ui/litellm-dashboard/src/hooks/useMcpOAuthFlow.tsx
@@ -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",