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(discoverable_endpoints.py): redirect to redirect uri

Krrish Dholakia0d36e6cbe9e5
diff --git a/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py b/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py
index d38edf5daed..513b590b8dc 100644
--- a/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py
+++ b/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py
@@ -12,9 +12,14 @@ router = APIRouter(
)
[email protected]("/{mcp_server_name}/authorize")
@router.get("/authorize")
async def authorize(
- request: Request, client_id: str, redirect_uri: str, state: str = ""
+ request: Request,
+ client_id: str,
+ redirect_uri: str,
+ state: str = "",
+ mcp_server_name: Optional[str] = None,
):
# Redirect to real GitHub OAuth
from litellm.proxy._experimental.mcp_server.mcp_server_manager import (
@@ -115,17 +120,10 @@ async def callback(code: str, state: str):
# Forward token to Claude ephemeral endpoint
redirect_uri = STATE_MAP.pop(state, None)
- complete_returned_url = f"{redirect_uri}?{urlencode(params)}"
if redirect_uri:
- async with httpx.AsyncClient() as client:
- await client.post(
- complete_returned_url,
- json={},
- )
- # Return simple page so the browser doesn't hang
- return HTMLResponse(
- "<html><body>Authentication complete. You can close this window.</body></html>"
- )
+ complete_returned_url = f"{redirect_uri}?{urlencode(params)}"
+
+ return RedirectResponse(url=complete_returned_url, status_code=302)
# fallback if redirect_uri not found
return HTMLResponse(