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 MCP client
Ishaan Jaffer36dfa0f2ee42
diff --git a/litellm/experimental_mcp_client/client.py b/litellm/experimental_mcp_client/client.pyindex e2de3cd5021..3e8f9bc337b 100644--- a/litellm/experimental_mcp_client/client.py+++ b/litellm/experimental_mcp_client/client.py@@ -11,10 +11,12 @@ from mcp import ClientSession, ReadResourceResult, Resource, StdioServerParametefrom mcp.client.sse import sse_clientfrom mcp.client.stdio import stdio_client+streamable_http_client: Optional[Any] = Nonetry:- from mcp.client.streamable_http import streamable_http_client # type: ignore+ import mcp.client.streamable_http as streamable_http_module # type: ignore+ streamable_http_client = getattr(streamable_http_module, "streamable_http_client", None)except ImportError:- streamable_http_client = None+ passfrom mcp.types import CallToolRequestParams as MCPCallToolRequestParamsfrom mcp.types import CallToolResult as MCPCallToolResultfrom mcp.types import (@@ -111,6 +113,12 @@ class MCPClient:), None# HTTP transport (default)+ if streamable_http_client is None:+ raise ImportError(+ "streamable_http_client is not available. "+ "Please install mcp with HTTP support."+ )+headers = self._get_auth_headers()httpx_client_factory = self._create_httpx_client_factory()verbose_logger.debug(