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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix: format
Yuta Saitoaa0ff9131ea0
diff --git a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.pyindex 1171eef75d7..58e9a345dc7 100644--- a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py+++ b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py@@ -11,7 +11,7 @@ import datetimeimport hashlibimport jsonimport re-from typing import Any, Dict, List, Optional, Set, Tuple, Union, cast+from typing import Any, Dict, List, Literal, Optional, Set, Tuple, Union, castfrom urllib.parse import urlparsefrom fastapi import HTTPException@@ -2152,7 +2152,7 @@ class MCPServerManager:last_health_check=datetime.now(),)- status = "unknown"+ status: Literal["healthy", "unhealthy", "unknown"] = "unknown"health_check_error = None# Check if we should skip health check based on auth configuration@@ -2162,7 +2162,11 @@ class MCPServerManager:if server.auth_type == MCPAuth.oauth2:should_skip_health_check = True# Skip if auth_type is not none and authentication_token is missing- elif server.auth_type and server.auth_type != MCPAuth.none and not server.authentication_token:+ elif (+ server.auth_type+ and server.auth_type != MCPAuth.none+ and not server.authentication_token+ ):should_skip_health_check = Trueif not should_skip_health_check:@@ -2178,6 +2182,7 @@ class MCPServerManager:)try:+async def _noop(session):return "ok"@@ -2192,9 +2197,7 @@ class MCPServerManager:server_name=server.server_name,alias=server.alias,description=(- server.mcp_info.get("description")- if server.mcp_info- else None+ server.mcp_info.get("description") if server.mcp_info else None),url=server.url,transport=server.transport,@@ -2235,7 +2238,9 @@ class MCPServerManager:allowed_server_ids = await self.get_allowed_mcp_servers(user_api_key_auth)# Run health checks concurrently- tasks = [self.health_check_server(server_id) for server_id in allowed_server_ids]+ tasks = [+ self.health_check_server(server_id) for server_id in allowed_server_ids+ ]results = await asyncio.gather(*tasks)# Filter out None results (servers that were not found)diff --git a/litellm/proxy/management_endpoints/mcp_management_endpoints.py b/litellm/proxy/management_endpoints/mcp_management_endpoints.pyindex a77c7c87542..59b9659dd88 100644--- a/litellm/proxy/management_endpoints/mcp_management_endpoints.py+++ b/litellm/proxy/management_endpoints/mcp_management_endpoints.py@@ -296,7 +296,6 @@ if MCP_AVAILABLE:access_groups_list = sorted(list(access_groups))return {"access_groups": access_groups_list}-## FastAPI Routes@router.get("/server",@@ -374,7 +373,9 @@ if MCP_AVAILABLE:server_id)# Update the server object with health check results- mcp_server.status = health_result.status if health_result.status else "unknown"+ mcp_server.status = (+ health_result.status if health_result.status else "unknown"+ )mcp_server.last_health_check = health_result.last_health_checkmcp_server.health_check_error = health_result.health_check_errorexcept Exception as e: