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]

basic MCP client structure

Ishaan Jaff3a48f9eee5d0
diff --git a/litellm/litellm_core_utils/mcp_client/Readme.md b/litellm/litellm_core_utils/mcp_client/Readme.md
new file mode 100644
index 00000000000..4fbd624369c
--- /dev/null
+++ b/litellm/litellm_core_utils/mcp_client/Readme.md
@@ -0,0 +1,6 @@
+# LiteLLM MCP Client
+
+LiteLLM MCP Client is a client that allows you to use MCP tools with LiteLLM.
+
+
+
diff --git a/litellm/litellm_core_utils/mcp_client/__init__.py b/litellm/litellm_core_utils/mcp_client/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/litellm/litellm_core_utils/mcp_client/client.py b/litellm/litellm_core_utils/mcp_client/client.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/litellm/litellm_core_utils/mcp_client/tools.py b/litellm/litellm_core_utils/mcp_client/tools.py
new file mode 100644
index 00000000000..6dc9863853c
--- /dev/null
+++ b/litellm/litellm_core_utils/mcp_client/tools.py
@@ -0,0 +1,30 @@
+from typing import List, Literal, Union
+
+from mcp import ClientSession
+from mcp.types import Tool as MCPTool
+
+from litellm.types.llms.openai import Tool
+
+
+def transform_mcp_tool_to_openai_tool(tool: MCPTool) -> Tool:
+ """Convert an MCP tool to an OpenAI tool."""
+ raise NotImplementedError("Not implemented")
+
+
+async def load_mcp_tools(
+ session: ClientSession, format: Literal["mcp", "openai"] = "mcp"
+) -> Union[List[MCPTool], List[Tool]]:
+ """
+ Load all available MCP tools
+
+ Args:
+ session: The MCP session to use
+ format: The format to convert the tools to
+ By default, the tools are returned in MCP format.
+
+ If format is set to "openai", the tools are converted to OpenAI tools.
+ """
+ tools = await session.list_tools()
+ if format == "openai":
+ return [transform_mcp_tool_to_openai_tool(tool) for tool in tools.tools]
+ return tools.tools