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
feat(mcp): allow admins to override tool name and description per MCP server (#22828)
Ishaan Jaff9897df50898b
diff --git a/docs/my-website/docs/mcp.md b/docs/my-website/docs/mcp.mdindex fcbb31c07d3..822b3f5fabc 100644--- a/docs/my-website/docs/mcp.md+++ b/docs/my-website/docs/mcp.md@@ -336,175 +336,9 @@ litellm_settings:## Converting OpenAPI Specs to MCP Servers-LiteLLM can automatically convert OpenAPI specifications into MCP servers, allowing you to expose any REST API as MCP tools. This is useful when you have existing APIs with OpenAPI/Swagger documentation and want to make them available as MCP tools.+LiteLLM can convert OpenAPI specifications into MCP servers, exposing any REST API as MCP tools without writing custom server code.-**Benefits:**--- **Rapid Integration**: Convert existing APIs to MCP tools without writing custom MCP server code-- **Automatic Tool Generation**: LiteLLM automatically generates MCP tools from your OpenAPI spec-- **Unified Interface**: Use the same MCP interface for both native MCP servers and OpenAPI-based APIs-- **Easy Testing**: Test and iterate on API integrations quickly--**Configuration:**--Add your OpenAPI-based MCP server to your `config.yaml`:--```yaml title="config.yaml - OpenAPI to MCP" showLineNumbers-model_list:- - model_name: gpt-4o- litellm_params:- model: openai/gpt-4o- api_key: sk-xxxxxxx--mcp_servers:- # OpenAPI Spec Example - Petstore API- petstore_mcp:- url: "https://petstore.swagger.io/v2"- spec_path: "/path/to/openapi.json"- auth_type: "none"-- # OpenAPI Spec with API Key Authentication- my_api_mcp:- url: "http://0.0.0.0:8090"- spec_path: "/path/to/openapi.json"- auth_type: "api_key"- auth_value: "your-api-key-here"-- # OpenAPI Spec with Bearer Token- secured_api_mcp:- url: "https://api.example.com"- spec_path: "/path/to/openapi.json"- auth_type: "bearer_token"- auth_value: "your-bearer-token"-```--**Configuration Parameters:**--| Parameter | Required | Description |-|-----------|----------|-------------|-| `url` | Yes | The base URL of your API endpoint |-| `spec_path` | Yes | Path or URL to your OpenAPI specification file (JSON or YAML) |-| `auth_type` | No | Authentication type: `none`, `api_key`, `bearer_token`, `basic`, `authorization` |-| `auth_value` | No | Authentication value (required if `auth_type` is set) |-| `authorization_url` | No | For `auth_type: oauth2`. Optional override; if omitted LiteLLM auto-discovers it. |-| `token_url` | No | For `auth_type: oauth2`. Optional override; if omitted LiteLLM auto-discovers it. |-| `registration_url` | No | For `auth_type: oauth2`. Optional override; if omitted LiteLLM auto-discovers it. |-| `scopes` | No | For `auth_type: oauth2`. Optional override; if omitted LiteLLM uses the scopes advertised by the server. |-| `description` | No | Optional description for the MCP server |-| `allowed_tools` | No | List of specific tools to allow (see [MCP Tool Filtering](#mcp-tool-filtering)) |-| `disallowed_tools` | No | List of specific tools to block (see [MCP Tool Filtering](#mcp-tool-filtering)) |--### Usage Example--Once configured, you can use the OpenAPI-based MCP server just like any other MCP server:--<Tabs>-<TabItem value="fastmcp" label="Python FastMCP">--```python title="Using OpenAPI-based MCP Server" showLineNumbers-from fastmcp import Client-import asyncio--# Standard MCP configuration-config = {- "mcpServers": {- "petstore": {- "url": "http://localhost:4000/petstore_mcp/mcp",- "headers": {- "x-litellm-api-key": "Bearer sk-1234"- }- }- }-}--# Create a client that connects to the server-client = Client(config)--async def main():- async with client:- # List available tools generated from OpenAPI spec- tools = await client.list_tools()- print(f"Available tools: {[tool.name for tool in tools]}")-- # Example: Get a pet by ID (from Petstore API)- response = await client.call_tool(- name="getpetbyid",- arguments={"petId": "1"}- )- print(f"Response:\n{response}\n")-- # Example: Find pets by status- response = await client.call_tool(- name="findpetsbystatus",- arguments={"status": "available"}- )- print(f"Response:\n{response}\n")--if __name__ == "__main__":- asyncio.run(main())-```--</TabItem>--<TabItem value="cursor" label="Cursor IDE">--```json title="Cursor MCP Configuration for OpenAPI Server" showLineNumbers-{- "mcpServers": {- "Petstore": {- "url": "http://localhost:4000/petstore_mcp/mcp",- "headers": {- "x-litellm-api-key": "Bearer $LITELLM_API_KEY"- }- }- }-}-```--</TabItem>--<TabItem value="openai" label="OpenAI Responses API">--```bash title="Using OpenAPI MCP Server with OpenAI" showLineNumbers-curl --location 'https://api.openai.com/v1/responses' \---header 'Content-Type: application/json' \---header "Authorization: Bearer $OPENAI_API_KEY" \---data '{- "model": "gpt-4o",- "tools": [- {- "type": "mcp",- "server_label": "petstore",- "server_url": "http://localhost:4000/petstore_mcp/mcp",- "require_approval": "never",- "headers": {- "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY"- }- }- ],- "input": "Find all available pets in the petstore",- "tool_choice": "required"-}'-```--</TabItem>-</Tabs>--**How It Works**--1. **Spec Loading**: LiteLLM loads your OpenAPI specification from the provided `spec_path`-2. **Tool Generation**: Each API endpoint in the spec becomes an MCP tool-3. **Parameter Mapping**: OpenAPI parameters are automatically mapped to MCP tool parameters-4. **Request Handling**: When a tool is called, LiteLLM converts the MCP request to the appropriate HTTP request-5. **Response Translation**: API responses are converted back to MCP format--**OpenAPI Spec Requirements**--Your OpenAPI specification should follow standard OpenAPI/Swagger conventions:-- **Supported versions**: OpenAPI 3.0.x, OpenAPI 3.1.x, Swagger 2.0-- **Required fields**: `paths`, `info` sections should be properly defined-- **Operation IDs**: Each operation should have a unique `operationId` (this becomes the tool name)-- **Parameters**: Request parameters should be properly documented with types and descriptions+See the **[MCP from OpenAPI Specs guide](./mcp_openapi.md)** for full setup, usage examples, and how to override tool names and descriptions.## MCP OAuthdiff --git a/docs/my-website/docs/mcp_openapi.md b/docs/my-website/docs/mcp_openapi.mdnew file mode 100644index 00000000000..0f18ecc127a--- /dev/null+++ b/docs/my-website/docs/mcp_openapi.md@@ -0,0 +1,226 @@+import Tabs from '@theme/Tabs';+import TabItem from '@theme/TabItem';+import Image from '@theme/IdealImage';++# MCP from OpenAPI Specs++LiteLLM can convert any OpenAPI/Swagger spec into an MCP server — no custom MCP server code required.++## Step 1 — Add the MCP Server++Add your OpenAPI-based server in `config.yaml`:++```yaml title="config.yaml" showLineNumbers+mcp_servers:+ petstore_mcp:+ url: "https://petstore.swagger.io/v2"+ spec_path: "/path/to/openapi.json"+ auth_type: "none"++ my_api_mcp:+ url: "http://0.0.0.0:8090"+ spec_path: "/path/to/openapi.json"+ auth_type: "api_key"+ auth_value: "your-api-key-here"++ secured_api_mcp:+ url: "https://api.example.com"+ spec_path: "/path/to/openapi.json"+ auth_type: "bearer_token"+ auth_value: "your-bearer-token"+```++Or from the UI: go to **MCP Servers → Add New MCP Server**, fill in the URL and spec path, and LiteLLM will fetch the spec and load all endpoints as tools.++**Configuration parameters:**++| Parameter | Required | Description |+|-----------|----------|-------------|+| `url` | Yes | Base URL of your API |+| `spec_path` | Yes | Path or URL to your OpenAPI spec (JSON or YAML) |+| `auth_type` | No | `none`, `api_key`, `bearer_token`, `basic`, `authorization`, `oauth2` |+| `auth_value` | No | Auth value (required if `auth_type` is set) |+| `description` | No | Optional description |+| `allowed_tools` | No | Allowlist of specific tools |+| `disallowed_tools` | No | Blocklist of specific tools |++**Supported spec versions:** OpenAPI 3.0.x, 3.1.x, Swagger 2.0. Each operation's `operationId` becomes the tool name — make sure they're unique.++Once tools are loaded, you'll see them in the Tool Configuration section:++<Image+ img={require('../img/mcp_openapi_tools_loaded.png')}+ style={{width: '80%', display: 'block', margin: '0'}}+/>++<br/>++## Step 2 — Optionally Override Tool Names and Descriptions++By default, tool names and descriptions come from the `operationId` and description fields in your spec. You can rename or rewrite them so MCP clients see something cleaner — without touching the upstream spec.++### From the UI++Each tool card has a pencil icon. Click it to open the inline editor:++<Image+ img={require('../img/mcp_openapi_tool_edit_panel.png')}+ style={{width: '80%', display: 'block', margin: '0'}}+/>++<br/>++- **Display Name** — overrides the name MCP clients see+- **Description** — overrides the description MCP clients see+- Leave a field blank to keep the original from the spec++After setting overrides, a purple **Custom name** badge appears on the tool card:++<Image+ img={require('../img/mcp_openapi_custom_name_badge.png')}+ style={{width: '80%', display: 'block', margin: '0'}}+/>++<br/>++### From the API++Pass `tool_name_to_display_name` and `tool_name_to_description` in the create or update request:++```bash title="Create server with tool name overrides" showLineNumbers+curl -X POST http://localhost:4000/v1/mcp/server \+ -H "Authorization: Bearer $LITELLM_MASTER_KEY" \+ -H "Content-Type: application/json" \+ -d '{+ "name": "petstore_mcp",+ "url": "https://petstore.swagger.io/v2",+ "spec_path": "/path/to/openapi.json",+ "tool_name_to_display_name": {+ "getPetById": "Get Pet",+ "findPetsByStatus": "List Available Pets"+ },+ "tool_name_to_description": {+ "getPetById": "Look up a pet by its ID",+ "findPetsByStatus": "Returns all pets matching a given status (available, pending, sold)"+ }+ }'+```++```bash title="Update overrides on an existing server" showLineNumbers+curl -X PUT http://localhost:4000/v1/mcp/server/{server_id} \+ -H "Authorization: Bearer $LITELLM_MASTER_KEY" \+ -H "Content-Type: application/json" \+ -d '{+ "tool_name_to_display_name": {+ "getPetById": "Get Pet"+ },+ "tool_name_to_description": {+ "getPetById": "Look up a pet by its ID"+ }+ }'+```++The map key is the **original `operationId`** from the spec — not the prefixed tool name. LiteLLM strips the server prefix before doing the lookup.++For example, if your server is `petstore_mcp`, the tool is exposed as `petstore_mcp-getPetById`. The map key is still `getPetById`.++**Before and after:**++```+# Without overrides+Tool: "petstore_mcp-getPetById"+Description: "Returns a single pet"++Tool: "petstore_mcp-findPetsByStatus"+Description: "Finds Pets by status"++# After overrides+Tool: "Get Pet"+Description: "Look up a pet by its ID"++Tool: "List Available Pets"+Description: "Returns all pets matching a given status (available, pending, sold)"+```++## Using the Server++<Tabs>+<TabItem value="fastmcp" label="Python FastMCP">++```python title="Using OpenAPI-based MCP Server" showLineNumbers+from fastmcp import Client+import asyncio++config = {+ "mcpServers": {+ "petstore": {+ "url": "http://localhost:4000/petstore_mcp/mcp",+ "headers": {+ "x-litellm-api-key": "Bearer sk-1234"+ }+ }+ }+}++client = Client(config)++async def main():+ async with client:+ tools = await client.list_tools()+ print(f"Available tools: {[tool.name for tool in tools]}")++ response = await client.call_tool(+ name="Get Pet", # overridden name+ arguments={"petId": "1"}+ )+ print(f"Response: {response}")++if __name__ == "__main__":+ asyncio.run(main())+```++</TabItem>++<TabItem value="cursor" label="Cursor IDE">++```json title="Cursor MCP Configuration" showLineNumbers+{+ "mcpServers": {+ "Petstore": {+ "url": "http://localhost:4000/petstore_mcp/mcp",+ "headers": {+ "x-litellm-api-key": "Bearer $LITELLM_API_KEY"+ }+ }+ }+}+```++</TabItem>++<TabItem value="openai" label="OpenAI Responses API">++```bash title="Using OpenAPI MCP Server with OpenAI" showLineNumbers+curl --location 'https://api.openai.com/v1/responses' \+--header 'Content-Type: application/json' \+--header "Authorization: Bearer $OPENAI_API_KEY" \+--data '{+ "model": "gpt-4o",+ "tools": [+ {+ "type": "mcp",+ "server_label": "petstore",+ "server_url": "http://localhost:4000/petstore_mcp/mcp",+ "require_approval": "never",+ "headers": {+ "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY"+ }+ }+ ],+ "input": "Find all available pets",+ "tool_choice": "required"+}'+```++</TabItem>+</Tabs>diff --git a/docs/my-website/img/mcp_openapi_custom_name_badge.png b/docs/my-website/img/mcp_openapi_custom_name_badge.pngnew file mode 100644index 00000000000..11f94c1e68cBinary files /dev/null and b/docs/my-website/img/mcp_openapi_custom_name_badge.png differdiff --git a/docs/my-website/img/mcp_openapi_tool_edit_panel.png b/docs/my-website/img/mcp_openapi_tool_edit_panel.pngnew file mode 100644index 00000000000..f826fb1f176Binary files /dev/null and b/docs/my-website/img/mcp_openapi_tool_edit_panel.png differdiff --git a/docs/my-website/img/mcp_openapi_tools_loaded.png b/docs/my-website/img/mcp_openapi_tools_loaded.pngnew file mode 100644index 00000000000..bb9f6be2719Binary files /dev/null and b/docs/my-website/img/mcp_openapi_tools_loaded.png differdiff --git a/docs/my-website/sidebars.js b/docs/my-website/sidebars.jsindex f7487d24b12..8701ce0210c 100644--- a/docs/my-website/sidebars.js+++ b/docs/my-website/sidebars.js@@ -608,6 +608,7 @@ const sidebars = {items: ["mcp","mcp_usage",+ "mcp_openapi","mcp_oauth","mcp_public_internet","mcp_semantic_filter",diff --git a/litellm/proxy/_experimental/mcp_server/db.py b/litellm/proxy/_experimental/mcp_server/db.pyindex a9734233a61..1bc7e8f8a9d 100644--- a/litellm/proxy/_experimental/mcp_server/db.py+++ b/litellm/proxy/_experimental/mcp_server/db.py@@ -60,6 +60,12 @@ def _prepare_mcp_server_data(if data.env is not None:data_dict["env"] = safe_dumps(data.env)+ # Handle tool name override serialization+ if data.tool_name_to_display_name is not None:+ data_dict["tool_name_to_display_name"] = safe_dumps(data.tool_name_to_display_name)+ if data.tool_name_to_description is not None:+ data_dict["tool_name_to_description"] = safe_dumps(data.tool_name_to_description)+# mcp_access_groups is already List[str], no serialization neededreturn data_dictdiff --git a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.pyindex b7c013e9f20..51bdfea172b 100644--- a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py+++ b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py@@ -644,6 +644,12 @@ class MCPServerManager:),created_at=getattr(mcp_server, "created_at", None),updated_at=getattr(mcp_server, "updated_at", None),+ tool_name_to_display_name=_deserialize_json_dict(+ getattr(mcp_server, "tool_name_to_display_name", None)+ ),+ tool_name_to_description=_deserialize_json_dict(+ getattr(mcp_server, "tool_name_to_description", None)+ ),)return new_serverdiff --git a/litellm/proxy/_experimental/mcp_server/server.py b/litellm/proxy/_experimental/mcp_server/server.pyindex cdb26acb658..b131800e950 100644--- a/litellm/proxy/_experimental/mcp_server/server.py+++ b/litellm/proxy/_experimental/mcp_server/server.py@@ -40,6 +40,8 @@ from litellm.proxy._experimental.mcp_server.utils import (LITELLM_MCP_SERVER_DESCRIPTION,LITELLM_MCP_SERVER_NAME,LITELLM_MCP_SERVER_VERSION,+ add_server_prefix_to_name,+ get_server_prefix,)from litellm.proxy._types import UserAPIKeyAuthfrom litellm.proxy.auth.ip_address_utils import IPAddressUtils@@ -737,6 +739,29 @@ if MCP_AVAILABLE:return tools_to_return+ def apply_tool_overrides(+ tools: List[MCPTool],+ mcp_server: MCPServer,+ ) -> List[MCPTool]:+ """Apply admin-configured display name/description overrides to tools.++ Overrides are keyed by the unprefixed tool name, same convention as+ allowed_tools configuration.+ """+ display_name_map = mcp_server.tool_name_to_display_name or {}+ description_map = mcp_server.tool_name_to_description or {}+ if not display_name_map and not description_map:+ return tools++ for tool in tools:+ unprefixed, _ = split_server_prefix_from_name(tool.name)+ lookup_key = unprefixed or tool.name+ if lookup_key in display_name_map:+ tool.name = display_name_map[lookup_key]+ if lookup_key in description_map:+ tool.description = description_map[lookup_key]+ return tools+def _get_client_ip_from_context() -> Optional[str]:"""Extract client_ip from auth context.@@ -991,6 +1016,10 @@ if MCP_AVAILABLE:user_api_key_auth=user_api_key_auth,)+ # Apply display-name/description overrides last so that+ # permission filtering always works against original names.+ filtered_tools = apply_tool_overrides(filtered_tools, server)+verbose_logger.debug(f"Successfully fetched {len(tools)} tools from server {server.name}, {len(filtered_tools)} after filtering")@@ -1449,6 +1478,26 @@ if MCP_AVAILABLE:return managed_resource_templates+ def _resolve_display_name_to_original(+ name: str,+ allowed_mcp_servers: List[MCPServer],+ ) -> str:+ """Translate a display-name override back to the original prefixed tool name.++ When a client received a customised display name from tools/list (e.g.+ "Get Pet") it will call tools/call with that same string. We need to+ reverse-map it to the original prefixed name (e.g.+ "petstore_mcp-getPetById") before any routing or permission logic runs.+ """+ for server in allowed_mcp_servers:+ display_map = server.tool_name_to_display_name or {}+ for unprefixed_name, display_name in display_map.items():+ if display_name == name:+ return add_server_prefix_to_name(+ unprefixed_name, get_server_prefix(server)+ )+ return name+async def execute_mcp_tool(name: str,arguments: Dict[str, Any],@@ -1485,6 +1534,10 @@ if MCP_AVAILABLE:# Track resolved MCP server for both permission checks and dispatchmcp_server: Optional[MCPServer] = None+ # If the client called with a display-name override (e.g. "Get Pet"),+ # translate it back to the original prefixed name before any routing.+ name = _resolve_display_name_to_original(name, allowed_mcp_servers)+# Remove prefix from tool name for logging and processingoriginal_tool_name, server_name = split_server_prefix_from_name(name)diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.pyindex 9acc80b0ddd..9b07d44deb6 100644--- a/litellm/proxy/_types.py+++ b/litellm/proxy/_types.py@@ -1095,6 +1095,8 @@ class NewMCPServerRequest(LiteLLMPydanticObjectBase):mcp_info: Optional[MCPInfo] = Nonemcp_access_groups: List[str] = Field(default_factory=list)allowed_tools: Optional[List[str]] = None+ tool_name_to_display_name: Optional[Dict[str, str]] = None+ tool_name_to_description: Optional[Dict[str, str]] = Noneextra_headers: Optional[List[str]] = Nonestatic_headers: Optional[Dict[str, str]] = None# Stdio-specific fields@@ -1149,6 +1151,8 @@ class UpdateMCPServerRequest(LiteLLMPydanticObjectBase):mcp_info: Optional[MCPInfo] = Nonemcp_access_groups: List[str] = Field(default_factory=list)allowed_tools: Optional[List[str]] = None+ tool_name_to_display_name: Optional[Dict[str, str]] = None+ tool_name_to_description: Optional[Dict[str, str]] = Noneextra_headers: Optional[List[str]] = Nonestatic_headers: Optional[Dict[str, str]] = None# Stdio-specific fields@@ -1198,6 +1202,8 @@ class LiteLLM_MCPServerTable(LiteLLMPydanticObjectBase):teams: List[Dict[str, Optional[str]]] = Field(default_factory=list)mcp_access_groups: List[str] = Field(default_factory=list)allowed_tools: List[str] = Field(default_factory=list)+ tool_name_to_display_name: Optional[Dict[str, str]] = None+ tool_name_to_description: Optional[Dict[str, str]] = Noneextra_headers: List[str] = Field(default_factory=list)mcp_info: Optional[MCPInfo] = Nonestatic_headers: Optional[Dict[str, str]] = Nonediff --git a/litellm/proxy/schema.prisma b/litellm/proxy/schema.prismaindex 9e847993efc..5e1ba479298 100644--- a/litellm/proxy/schema.prisma+++ b/litellm/proxy/schema.prisma@@ -288,6 +288,8 @@ model LiteLLM_MCPServerTable {mcp_info Json? @default("{}")mcp_access_groups String[]allowed_tools String[] @default([])+ tool_name_to_display_name Json? @default("{}")+ tool_name_to_description Json? @default("{}")extra_headers String[] @default([])static_headers Json? @default("{}")// Health check statusdiff --git a/litellm/types/mcp_server/mcp_server_manager.py b/litellm/types/mcp_server/mcp_server_manager.pyindex cabac6b9d51..7f6a8b3ea24 100644--- a/litellm/types/mcp_server/mcp_server_manager.py+++ b/litellm/types/mcp_server/mcp_server_manager.py@@ -33,6 +33,8 @@ class MCPServer(BaseModel):] = None # allow admin to specify which headers to forward from client to the MCP serverallowed_tools: Optional[List[str]] = Nonedisallowed_tools: Optional[List[str]] = None+ tool_name_to_display_name: Optional[Dict[str, str]] = None+ tool_name_to_description: Optional[Dict[str, str]] = Noneallowed_params: Optional[Dict[str, List[str]]] = None # map of tool names to allowed parameter listsdiff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server.py b/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server.pyindex 1fcdeb627d0..de2ec13b4a3 100644--- a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server.py+++ b/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server.py@@ -28,6 +28,7 @@ def cleanup_mcp_global_state():from litellm.proxy._experimental.mcp_server.mcp_server_manager import (global_mcp_server_manager,)+# Clear before testglobal_mcp_server_manager.registry.clear()global_mcp_server_manager.tool_name_to_mcp_server_name_mapping.clear()@@ -1788,6 +1789,79 @@ def test_filter_tools_by_allowed_tools():assert filtered_tools[1].name == "my_api_mcp-findpetsbystatus"+def test_apply_tool_overrides():+ """Test that apply_tool_overrides applies custom display names and descriptions."""+ from mcp.types import Tool++ from litellm.proxy._experimental.mcp_server.server import apply_tool_overrides+ from litellm.types.mcp import MCPTransport+ from litellm.types.mcp_server.mcp_server_manager import MCPServer++ mcp_server = MCPServer(+ server_id="my_api_mcp",+ name="my_api_mcp",+ transport=MCPTransport.http,+ tool_name_to_display_name={"getpetbyid": "Get Pet"},+ tool_name_to_description={"getpetbyid": "Custom description for get pet"},+ )+ tools = [+ Tool(+ name="my_api_mcp-getpetbyid",+ title=None,+ description="Original description",+ inputSchema={"type": "object", "properties": {}},+ outputSchema=None,+ annotations=None,+ ),+ Tool(+ name="my_api_mcp-findpetsbystatus",+ title=None,+ description="Finds Pets by status",+ inputSchema={"type": "object", "properties": {}},+ outputSchema=None,+ annotations=None,+ ),+ ]++ result = apply_tool_overrides(tools, mcp_server)++ # First tool should have overridden name and description+ assert result[0].name == "Get Pet"+ assert result[0].description == "Custom description for get pet"+ # Second tool should be unchanged+ assert result[1].name == "my_api_mcp-findpetsbystatus"+ assert result[1].description == "Finds Pets by status"+++def test_apply_tool_overrides_no_overrides():+ """Test that apply_tool_overrides returns tools unchanged when no overrides are set."""+ from mcp.types import Tool++ from litellm.proxy._experimental.mcp_server.server import apply_tool_overrides+ from litellm.types.mcp import MCPTransport+ from litellm.types.mcp_server.mcp_server_manager import MCPServer++ mcp_server = MCPServer(+ server_id="my_api_mcp",+ name="my_api_mcp",+ transport=MCPTransport.http,+ )+ tools = [+ Tool(+ name="my_api_mcp-getpetbyid",+ title=None,+ description="Original description",+ inputSchema={"type": "object", "properties": {}},+ outputSchema=None,+ annotations=None,+ ),+ ]++ result = apply_tool_overrides(tools, mcp_server)+ assert result[0].name == "my_api_mcp-getpetbyid"+ assert result[0].description == "Original description"++def _make_db_mcp_server(server_id: str, updated_at: datetime) -> LiteLLM_MCPServerTable:return LiteLLM_MCPServerTable(server_id=server_id,diff --git a/ui/litellm-dashboard/src/components/mcp_tools/create_mcp_server.tsx b/ui/litellm-dashboard/src/components/mcp_tools/create_mcp_server.tsxindex 0062ca5db4e..6dbb18887da 100644--- a/ui/litellm-dashboard/src/components/mcp_tools/create_mcp_server.tsx+++ b/ui/litellm-dashboard/src/components/mcp_tools/create_mcp_server.tsx@@ -54,6 +54,8 @@ const CreateMCPServer: React.FC<CreateMCPServerProps> = ({const [aliasManuallyEdited, setAliasManuallyEdited] = useState(false);const [tools, setTools] = useState<any[]>([]);const [allowedTools, setAllowedTools] = useState<string[]>([]);+ const [toolNameToDisplayName, setToolNameToDisplayName] = useState<Record<string, string>>({});+ const [toolNameToDescription, setToolNameToDescription] = useState<Record<string, string>>({});const [transportType, setTransportType] = useState<string>("");const [searchValue, setSearchValue] = useState<string>("");const [oauthAccessToken, setOauthAccessToken] = useState<string | null>(null);@@ -353,6 +355,8 @@ const CreateMCPServer: React.FC<CreateMCPServerProps> = ({mcp_access_groups: accessGroups,alias: restValues.alias,allowed_tools: allowedTools.length > 0 ? allowedTools : null,+ tool_name_to_display_name: Object.keys(toolNameToDisplayName).length > 0 ? toolNameToDisplayName : null,+ tool_name_to_description: Object.keys(toolNameToDescription).length > 0 ? toolNameToDescription : null,allow_all_keys: Boolean(allowAllKeysRaw),available_on_public_internet: Boolean(availableOnPublicInternetRaw),static_headers: staticHeaders,@@ -712,6 +716,10 @@ const CreateMCPServer: React.FC<CreateMCPServerProps> = ({allowedTools={allowedTools}existingAllowedTools={null}onAllowedToolsChange={setAllowedTools}+ toolNameToDisplayName={toolNameToDisplayName}+ toolNameToDescription={toolNameToDescription}+ onToolNameToDisplayNameChange={setToolNameToDisplayName}+ onToolNameToDescriptionChange={setToolNameToDescription}/></div>diff --git a/ui/litellm-dashboard/src/components/mcp_tools/mcp_server_edit.tsx b/ui/litellm-dashboard/src/components/mcp_tools/mcp_server_edit.tsxindex cf2eafd43f5..00060658ea1 100644--- a/ui/litellm-dashboard/src/components/mcp_tools/mcp_server_edit.tsx+++ b/ui/litellm-dashboard/src/components/mcp_tools/mcp_server_edit.tsx@@ -38,6 +38,8 @@ const MCPServerEdit: React.FC<MCPServerEditProps> = ({const [searchValue, setSearchValue] = useState<string>("");const [aliasManuallyEdited, setAliasManuallyEdited] = useState(false);const [allowedTools, setAllowedTools] = useState<string[]>([]);+ const [toolNameToDisplayName, setToolNameToDisplayName] = useState<Record<string, string>>({});+ const [toolNameToDescription, setToolNameToDescription] = useState<Record<string, string>>({});const [pendingRestoredValues, setPendingRestoredValues] = useState<Record<string, any> | null>(null);const authType = Form.useWatch("auth_type", form) as string | undefined;const transportType = Form.useWatch("transport", form) as string | undefined;@@ -195,11 +197,13 @@ const MCPServerEdit: React.FC<MCPServerEditProps> = ({}}, [mcpServer]);- // Initialize allowed tools from existing server data+ // Initialize allowed tools and tool overrides from existing server datauseEffect(() => {if (mcpServer.allowed_tools) {setAllowedTools(mcpServer.allowed_tools);}+ setToolNameToDisplayName(mcpServer.tool_name_to_display_name ?? {});+ setToolNameToDescription(mcpServer.tool_name_to_description ?? {});}, [mcpServer]);useEffect(() => {@@ -541,6 +545,8 @@ const MCPServerEdit: React.FC<MCPServerEditProps> = ({// Include permission management fieldsextra_headers: restValues.extra_headers || [],allowed_tools: allowedTools.length > 0 ? allowedTools : null,+ tool_name_to_display_name: Object.keys(toolNameToDisplayName).length > 0 ? toolNameToDisplayName : null,+ tool_name_to_description: Object.keys(toolNameToDescription).length > 0 ? toolNameToDescription : null,disallowed_tools: restValues.disallowed_tools || [],static_headers: staticHeaders,allow_all_keys: Boolean(allowAllKeysRaw ?? mcpServer.allow_all_keys),@@ -906,6 +912,10 @@ const MCPServerEdit: React.FC<MCPServerEditProps> = ({allowedTools={allowedTools}existingAllowedTools={mcpServer.allowed_tools || null}onAllowedToolsChange={setAllowedTools}+ toolNameToDisplayName={toolNameToDisplayName}+ toolNameToDescription={toolNameToDescription}+ onToolNameToDisplayNameChange={setToolNameToDisplayName}+ onToolNameToDescriptionChange={setToolNameToDescription}/></div>diff --git a/ui/litellm-dashboard/src/components/mcp_tools/mcp_tool_configuration.tsx b/ui/litellm-dashboard/src/components/mcp_tools/mcp_tool_configuration.tsxindex 25c20dd0746..87f14021f46 100644--- a/ui/litellm-dashboard/src/components/mcp_tools/mcp_tool_configuration.tsx+++ b/ui/litellm-dashboard/src/components/mcp_tools/mcp_tool_configuration.tsx@@ -1,6 +1,6 @@import React, { useEffect, useRef, useState } from "react";import { Card, Title, Text } from "@tremor/react";-import { ToolOutlined, CheckCircleOutlined, SearchOutlined } from "@ant-design/icons";+import { ToolOutlined, CheckCircleOutlined, SearchOutlined, EditOutlined } from "@ant-design/icons";import { Badge, Spin, Checkbox, Input } from "antd";import { useTestMCPConnection } from "../../hooks/useTestMCPConnection";@@ -11,6 +11,10 @@ interface MCPToolConfigurationProps {allowedTools: string[];existingAllowedTools: string[] | null;onAllowedToolsChange: (tools: string[]) => void;+ toolNameToDisplayName: Record<string, string>;+ toolNameToDescription: Record<string, string>;+ onToolNameToDisplayNameChange: (map: Record<string, string>) => void;+ onToolNameToDescriptionChange: (map: Record<string, string>) => void;}const MCPToolConfiguration: React.FC<MCPToolConfigurationProps> = ({@@ -20,10 +24,15 @@ const MCPToolConfiguration: React.FC<MCPToolConfigurationProps> = ({allowedTools,existingAllowedTools,onAllowedToolsChange,+ toolNameToDisplayName,+ toolNameToDescription,+ onToolNameToDisplayNameChange,+ onToolNameToDescriptionChange,}) => {const previousToolsRef = useRef<any[]>([]);const [toolSearchTerm, setToolSearchTerm] = useState("");const hasInitializedRef = useRef(false);+ const [expandedTools, setExpandedTools] = useState<Set<string>>(new Set());const { tools, isLoadingTools, toolsError, canFetchTools } = useTestMCPConnection({accessToken,@@ -96,6 +105,39 @@ const MCPToolConfiguration: React.FC<MCPToolConfigurationProps> = ({onAllowedToolsChange([]);};+ const handleToggleEditExpanded = (toolName: string, e: React.MouseEvent) => {+ e.stopPropagation();+ setExpandedTools((prev) => {+ const next = new Set(prev);+ if (next.has(toolName)) {+ next.delete(toolName);+ } else {+ next.add(toolName);+ }+ return next;+ });+ };++ const handleDisplayNameChange = (toolName: string, value: string) => {+ const next = { ...toolNameToDisplayName };+ if (value) {+ next[toolName] = value;+ } else {+ delete next[toolName];+ }+ onToolNameToDisplayNameChange(next);+ };++ const handleDescriptionChange = (toolName: string, value: string) => {+ const next = { ...toolNameToDescription };+ if (value) {+ next[toolName] = value;+ } else {+ delete next[toolName];+ }+ onToolNameToDescriptionChange(next);+ };+// Don't show anything if required fields aren't filledif (!canFetchTools && !formValues.url && !formValues.spec_path) {return null;@@ -213,39 +255,106 @@ const MCPToolConfiguration: React.FC<MCPToolConfigurationProps> = ({<Text>No tools found matching "{toolSearchTerm}"</Text></div>) : (- filteredTools.map((tool, index) => (- <div- key={index}- className={`p-4 rounded-lg border transition-colors cursor-pointer ${- allowedTools.includes(tool.name)- ? "bg-blue-50 border-blue-300 hover:border-blue-400"- : "bg-gray-50 border-gray-200 hover:border-gray-300"- }`}- onClick={() => handleToolToggle(tool.name)}- >- <div className="flex items-start gap-3">- <Checkbox checked={allowedTools.includes(tool.name)} onChange={() => handleToolToggle(tool.name)} />- <div className="flex-1">- <div className="flex items-center gap-2">- <Text className="font-medium text-gray-900">{tool.name}</Text>- <span- className={`px-2 py-0.5 text-xs rounded-full font-medium ${- allowedTools.includes(tool.name) ? "bg-green-100 text-green-800" : "bg-red-100 text-red-800"+ filteredTools.map((tool, index) => {+ const isEnabled = allowedTools.includes(tool.name);+ const isEditExpanded = expandedTools.has(tool.name);+ return (+ <div+ key={index}+ className={`rounded-lg border transition-colors ${+ isEnabled+ ? "bg-blue-50 border-blue-300 hover:border-blue-400"+ : "bg-gray-50 border-gray-200 hover:border-gray-300"+ }`}+ >+ {/* Main tool row */}+ <div+ className="p-4 cursor-pointer"+ onClick={() => handleToolToggle(tool.name)}+ >+ <div className="flex items-start gap-3">+ <Checkbox checked={isEnabled} onChange={() => handleToolToggle(tool.name)} />+ <div className="flex-1">+ <div className="flex items-center gap-2">+ <Text className="font-medium text-gray-900">+ {toolNameToDisplayName[tool.name] || tool.name}+ </Text>+ <span+ className={`px-2 py-0.5 text-xs rounded-full font-medium ${+ isEnabled ? "bg-green-100 text-green-800" : "bg-red-100 text-red-800"+ }`}+ >+ {isEnabled ? "Enabled" : "Disabled"}+ </span>+ {toolNameToDisplayName[tool.name] && (+ <span className="px-2 py-0.5 text-xs rounded-full font-medium bg-purple-100 text-purple-800">+ Custom name+ </span>+ )}+ </div>+ {(toolNameToDescription[tool.name] || tool.description) && (+ <Text className="text-gray-500 text-sm block mt-1">+ {toolNameToDescription[tool.name] || tool.description}+ </Text>+ )}+ <Text className="text-gray-400 text-xs block mt-1">+ {isEnabled ? "✓ Users can call this tool" : "✗ Users cannot call this tool"}+ </Text>+ </div>+ {/* Edit toggle button */}+ <button+ type="button"+ onClick={(e) => handleToggleEditExpanded(tool.name, e)}+ className={`p-1.5 rounded-md transition-colors ${+ isEditExpanded+ ? "bg-blue-100 text-blue-600"+ : "text-gray-400 hover:text-gray-600 hover:bg-gray-100"}`}+ title="Edit display name and description">- {allowedTools.includes(tool.name) ? "Enabled" : "Disabled"}- </span>+ <EditOutlined />+ </button></div>- {tool.description && <Text className="text-gray-500 text-sm block mt-1">{tool.description}</Text>}- <Text className="text-gray-400 text-xs block mt-1">- {allowedTools.includes(tool.name)- ? "✓ Users can call this tool"- : "✗ Users cannot call this tool"}- </Text></div>++ {/* Inline edit section */}+ {isEditExpanded && (+ <div+ className="px-4 pb-4 pt-3 border-t border-gray-200 space-y-3 bg-gray-50 rounded-b-lg"+ onClick={(e) => e.stopPropagation()}+ >+ <div>+ <Text className="text-xs font-medium text-gray-600 mb-1 block">+ Display Name+ </Text>+ <Input+ placeholder={tool.name}+ value={toolNameToDisplayName[tool.name] || ""}+ onChange={(e) => handleDisplayNameChange(tool.name, e.target.value)}+ />+ <Text className="text-xs text-gray-400 mt-1 block">+ Override how this tool's name appears to users. Leave blank to use original.+ </Text>+ </div>+ <div>+ <Text className="text-xs font-medium text-gray-600 mb-1 block">+ Description+ </Text>+ <Input.TextArea+ placeholder={tool.description || "No description"}+ value={toolNameToDescription[tool.name] || ""}+ onChange={(e) => handleDescriptionChange(tool.name, e.target.value)}+ rows={2}+ />+ <Text className="text-xs text-gray-400 mt-1 block">+ Override the tool description shown to users. Leave blank to use original.+ </Text>+ </div>+ </div>+ )}</div>- </div>- ))+ );+ }))}</div></div>diff --git a/ui/litellm-dashboard/src/components/mcp_tools/types.tsx b/ui/litellm-dashboard/src/components/mcp_tools/types.tsxindex 1fa447c0e67..8a08f13e22a 100644--- a/ui/litellm-dashboard/src/components/mcp_tools/types.tsx+++ b/ui/litellm-dashboard/src/components/mcp_tools/types.tsx@@ -169,6 +169,8 @@ export interface MCPServer {teams?: Team[];mcp_access_groups?: string[];allowed_tools?: string[];+ tool_name_to_display_name?: Record<string, string>;+ tool_name_to_description?: Record<string, string>;allow_all_keys?: boolean;available_on_public_internet?: boolean;