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 order of imports
Ishaan Jaff385e8bff4cc4
diff --git a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.pyindex 9eb44f55977..df9ae0ea570 100644--- a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py+++ b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py@@ -8,17 +8,11 @@ This is a Proxyimport asyncioimport json-from typing import TYPE_CHECKING, Any, Dict, List, Optional--if TYPE_CHECKING:- from mcp import ClientSession- from mcp.client.sse import sse_client- from mcp.types import Tool as MCPTool-else:- # Provide fallback types for runtime incase `mcp` is not installed- ClientSession = None- MCPTool = object- sse_client = None+from typing import Any, Dict, List, Optional++from mcp import ClientSession+from mcp.client.sse import sse_client+from mcp.types import Tool as MCPToolfrom litellm._logging import verbose_loggerfrom litellm.types.mcp_server.mcp_server_manager import MCPInfo, MCPSSEServerdiff --git a/litellm/proxy/_experimental/mcp_server/server.py b/litellm/proxy/_experimental/mcp_server/server.pyindex 510bd6ab3b7..603370711f0 100644--- a/litellm/proxy/_experimental/mcp_server/server.py+++ b/litellm/proxy/_experimental/mcp_server/server.py@@ -265,7 +265,7 @@ if MCP_AVAILABLE:))except Exception as e:- verbose_logger.error(f"Error getting tools from {server.name}: {e}")+ verbose_logger.exception(f"Error getting tools from {server.name}: {e}")continuereturn list_tools_resultdiff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.pyindex 1a469d2c27f..99d665d94c8 100644--- a/litellm/proxy/proxy_server.py+++ b/litellm/proxy/proxy_server.py@@ -127,9 +127,6 @@ from litellm.litellm_core_utils.core_helpers import (from litellm.litellm_core_utils.credential_accessor import CredentialAccessorfrom litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObjfrom litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler-from litellm.proxy._experimental.mcp_server.mcp_server_manager import (- global_mcp_server_manager,-)from litellm.proxy._experimental.mcp_server.server import router as mcp_routerfrom litellm.proxy._experimental.mcp_server.tool_registry import (global_mcp_tool_registry,@@ -1966,6 +1963,10 @@ class ProxyConfig:mcp_servers_config = config.get("mcp_servers", None)if mcp_servers_config:+ from litellm.proxy._experimental.mcp_server.mcp_server_manager import (+ global_mcp_server_manager,+ )+global_mcp_server_manager.load_servers_from_config(mcp_servers_config)## CREDENTIALS