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(ui): OpenAPI MCP server support with popular API quick-picker (#23200)
Ishaan Jaff8c12781487c5
diff --git a/litellm/proxy/management_endpoints/mcp_management_endpoints.py b/litellm/proxy/management_endpoints/mcp_management_endpoints.pyindex 14d9e6d0b20..46c59b48791 100644--- a/litellm/proxy/management_endpoints/mcp_management_endpoints.py+++ b/litellm/proxy/management_endpoints/mcp_management_endpoints.py@@ -11,9 +11,11 @@ Endpoints here:- GET `/v1/mcp/tools - lists all the tools available for a key- GET `/v1/mcp/access_groups` - lists all available MCP access groups- GET `/v1/mcp/discover` - Returns curated list of well-known MCP servers for discovery UI+- GET `/v1/mcp/openapi-registry` - Returns well-known OpenAPI APIs with OAuth 2.0 metadata"""+import functoolsimport importlibimport jsonimport os@@ -1608,3 +1610,40 @@ if MCP_AVAILABLE:"servers": servers,"categories": categories,}++ # --- OpenAPI Registry ---++ _OPENAPI_REGISTRY_PATH = os.path.join(+ os.path.dirname(os.path.dirname(os.path.abspath(__file__))),+ "openapi_registry.json",+ )++ @functools.lru_cache(maxsize=1)+ def _load_openapi_registry() -> Dict[str, Any]:+ with open(_OPENAPI_REGISTRY_PATH, "r") as f:+ data: Dict[str, Any] = json.load(f)+ return data++ @router.get(+ "/openapi-registry",+ description="Returns well-known OpenAPI APIs with OAuth 2.0 metadata for the OpenAPI MCP picker",+ )+ async def get_openapi_registry(+ user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),+ ):+ if user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN:+ raise HTTPException(+ status_code=403,+ detail={+ "error": "Only proxy admins can access the OpenAPI registry. Your role={}".format(+ user_api_key_dict.user_role+ )+ },+ )+ try:+ return _load_openapi_registry()+ except Exception as e:+ verbose_proxy_logger.warning(+ f"Failed to load OpenAPI registry from {_OPENAPI_REGISTRY_PATH}: {e}"+ )+ return {"apis": []}diff --git a/litellm/proxy/openapi_registry.json b/litellm/proxy/openapi_registry.jsonnew file mode 100644index 00000000000..d525b504a7b--- /dev/null+++ b/litellm/proxy/openapi_registry.json@@ -0,0 +1,222 @@+{+ "apis": [+ {+ "name": "github",+ "title": "GitHub",+ "description": "Repos, issues, PRs, and workflow automation via the GitHub REST API",+ "icon_url": "https://cdn.simpleicons.org/github",+ "spec_url": "https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json",+ "oauth": {+ "authorization_url": "https://github.com/login/oauth/authorize",+ "token_url": "https://github.com/login/oauth/access_token",+ "pkce": false,+ "docs_url": "https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app"+ },+ "key_tools": [+ { "name": "list_repos", "description": "List repositories for a user or organization" },+ { "name": "get_file_contents", "description": "Read a file or directory from a repository" },+ { "name": "list_issues", "description": "List issues in a repository with filters" },+ { "name": "create_issue", "description": "Open a new issue in a repository" },+ { "name": "list_pull_requests", "description": "List open and merged pull requests" },+ { "name": "create_pull_request", "description": "Open a pull request between branches" },+ { "name": "search_code", "description": "Search code across all GitHub repositories" },+ { "name": "list_commits", "description": "List commits with authors and messages" }+ ]+ },+ {+ "name": "atlassian",+ "title": "Atlassian",+ "description": "Jira issues, Confluence pages, and project management",+ "icon_url": "https://cdn.simpleicons.org/atlassian",+ "spec_url": "https://dac-static.atlassian.com/cloud/jira/platform/swagger-v3.v3.json",+ "oauth": {+ "authorization_url": "https://auth.atlassian.com/authorize",+ "token_url": "https://auth.atlassian.com/oauth/token",+ "pkce": true,+ "docs_url": "https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/"+ },+ "key_tools": [+ { "name": "search_issues", "description": "Search Jira issues using JQL queries" },+ { "name": "get_issue", "description": "Get full details of a Jira issue by key" },+ { "name": "create_issue", "description": "Create a new Jira issue or bug report" },+ { "name": "update_issue", "description": "Update issue fields like status, assignee, priority" },+ { "name": "add_comment", "description": "Add a comment to an issue" },+ { "name": "transition_issue", "description": "Move an issue through the workflow (e.g. In Progress → Done)" },+ { "name": "list_projects", "description": "List all Jira projects in the workspace" },+ { "name": "get_project", "description": "Get project details, board, and sprint info" }+ ]+ },+ {+ "name": "figma",+ "title": "Figma",+ "description": "Design files, components, prototypes, and comments",+ "icon_url": "https://cdn.simpleicons.org/figma",+ "spec_url": "https://raw.githubusercontent.com/figma/rest-api-spec/main/openapi/openapi.yaml",+ "oauth": {+ "authorization_url": "https://www.figma.com/oauth",+ "token_url": "https://www.figma.com/api/oauth/token",+ "pkce": false,+ "docs_url": "https://www.figma.com/developers/api#oauth2"+ },+ "key_tools": [+ { "name": "get_file", "description": "Get the full node tree and structure of a Figma file" },+ { "name": "get_file_nodes", "description": "Get specific nodes by ID from a Figma file" },+ { "name": "get_image", "description": "Export nodes as PNG, SVG, or PDF" },+ { "name": "get_comments", "description": "List all comments on a Figma file" },+ { "name": "post_comment", "description": "Add a comment to a file or specific node" },+ { "name": "get_team_projects", "description": "List all projects belonging to a team" },+ { "name": "get_project_files", "description": "List all Figma files in a project" },+ { "name": "get_file_versions", "description": "Get the version history of a file" }+ ]+ },+ {+ "name": "gmail",+ "title": "Gmail",+ "description": "Read, send, and manage Gmail messages and threads",+ "icon_url": "https://cdn.simpleicons.org/gmail",+ "spec_url": "https://raw.githubusercontent.com/APIs-guru/openapi-directory/main/APIs/googleapis.com/gmail/v1/openapi.yaml",+ "oauth": {+ "authorization_url": "https://accounts.google.com/o/oauth2/v2/auth",+ "token_url": "https://oauth2.googleapis.com/token",+ "pkce": true,+ "docs_url": "https://developers.google.com/gmail/api/auth/about-auth"+ },+ "key_tools": [+ { "name": "list_messages", "description": "List Gmail messages with search filters" },+ { "name": "get_message", "description": "Get the full content of a specific message" },+ { "name": "send_message", "description": "Send an email via Gmail" },+ { "name": "create_draft", "description": "Create a draft email" },+ { "name": "list_labels", "description": "List all labels in the mailbox" },+ { "name": "modify_message", "description": "Add or remove labels from a message" },+ { "name": "list_threads", "description": "List email threads" },+ { "name": "trash_message", "description": "Move a message to trash" }+ ]+ },+ {+ "name": "stripe",+ "title": "Stripe",+ "description": "Payments, customers, subscriptions, and billing",+ "icon_url": "https://cdn.simpleicons.org/stripe",+ "spec_url": "https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json",+ "oauth": {+ "authorization_url": "https://connect.stripe.com/oauth/authorize",+ "token_url": "https://connect.stripe.com/oauth/token",+ "pkce": false,+ "docs_url": "https://stripe.com/docs/connect/oauth-reference"+ },+ "key_tools": [+ { "name": "list_customers", "description": "List and search Stripe customers" },+ { "name": "create_customer", "description": "Create a new Stripe customer record" },+ { "name": "create_payment_intent", "description": "Create a payment intent for a charge" },+ { "name": "list_subscriptions", "description": "List active and cancelled subscriptions" },+ { "name": "create_subscription", "description": "Subscribe a customer to a price plan" },+ { "name": "list_invoices", "description": "List invoices for a customer or subscription" },+ { "name": "create_refund", "description": "Refund a charge fully or partially" },+ { "name": "list_products", "description": "List products and their pricing plans" }+ ]+ },+ {+ "name": "hubspot",+ "title": "HubSpot",+ "description": "CRM contacts and properties via the HubSpot Contacts API",+ "icon_url": "https://cdn.simpleicons.org/hubspot",+ "spec_url": "https://raw.githubusercontent.com/HubSpot/HubSpot-public-api-spec-collection/main/PublicApiSpecs/CRM/Contacts/Rollouts/424/v3/contacts.json",+ "oauth": {+ "authorization_url": "https://app.hubspot.com/oauth/authorize",+ "token_url": "https://api.hubspot.com/oauth/v1/token",+ "pkce": false,+ "docs_url": "https://developers.hubspot.com/docs/api/oauth-quickstart-guide"+ },+ "key_tools": [+ { "name": "search_contacts", "description": "Search CRM contacts by email, name, or custom properties" },+ { "name": "create_contact", "description": "Create a new CRM contact with properties" },+ { "name": "update_contact", "description": "Update contact properties like lifecycle stage or owner" },+ { "name": "get_contact", "description": "Get full details of a specific contact" },+ { "name": "archive_contact", "description": "Archive (soft-delete) a contact record" },+ { "name": "merge_contacts", "description": "Merge two duplicate contact records" },+ { "name": "list_contacts", "description": "List all contacts with pagination" },+ { "name": "get_contact_properties", "description": "Get available contact property definitions" }+ ]+ },+ {+ "name": "notion",+ "title": "Notion",+ "description": "Pages, databases, and workspace content in Notion",+ "icon_url": "https://cdn.simpleicons.org/notion",+ "spec_url": "https://raw.githubusercontent.com/APIs-guru/openapi-directory/main/APIs/notion.com/1.0.0/openapi.yaml",+ "oauth": {+ "authorization_url": "https://api.notion.com/v1/oauth/authorize",+ "token_url": "https://api.notion.com/v1/oauth/token",+ "pkce": false,+ "docs_url": "https://developers.notion.com/docs/authorization"+ },+ "key_tools": [+ { "name": "search", "description": "Search pages and databases across the workspace" },+ { "name": "get_page", "description": "Get a page and its properties" },+ { "name": "create_page", "description": "Create a new page inside a database or as a subpage" },+ { "name": "update_page", "description": "Update page properties (title, status, dates, etc.)" },+ { "name": "query_database", "description": "Query a database with filters and sorts" },+ { "name": "create_database_item", "description": "Add a new row/item to a Notion database" },+ { "name": "append_block_children", "description": "Append content blocks (text, bullets, code) to a page" },+ { "name": "get_database", "description": "Get a database schema including all property types" }+ ]+ },+ {+ "name": "slack",+ "title": "Slack",+ "description": "Channels, messages, users, and workspace management",+ "icon_url": "https://raw.githubusercontent.com/simple-icons/simple-icons/develop/icons/slack.svg",+ "spec_url": "https://raw.githubusercontent.com/slackapi/slack-api-specs/master/web-api/slack_web_openapi_v2.json",+ "oauth": {+ "authorization_url": "https://slack.com/oauth/v2/authorize",+ "token_url": "https://slack.com/api/oauth.v2.access",+ "pkce": false,+ "docs_url": "https://api.slack.com/authentication/oauth-v2"+ },+ "key_tools": [+ { "name": "chat_post_message", "description": "Send a message to a channel or DM" },+ { "name": "conversations_history", "description": "Get message history from a channel" },+ { "name": "conversations_list", "description": "List all public and private channels" },+ { "name": "conversations_replies", "description": "Get replies in a message thread" },+ { "name": "users_list", "description": "List all members of the Slack workspace" },+ { "name": "search_messages", "description": "Full-text search across all messages" },+ { "name": "files_upload", "description": "Upload a file and share it in a channel" },+ { "name": "reactions_add", "description": "Add an emoji reaction to a message" }+ ]+ },+ {+ "name": "shopify",+ "title": "Shopify",+ "description": "Products, orders, customers, and store management via Shopify Admin REST API (requires your store subdomain)",+ "icon_url": "https://cdn.simpleicons.org/shopify",+ "spec_url": "https://raw.githubusercontent.com/Shopify/shopify-api-specs/main/admin/rest/2023-10/openapi.json",+ "key_tools": [+ { "name": "list_products", "description": "List products with variants, pricing, and inventory" },+ { "name": "get_product", "description": "Get full product details including all variants" },+ { "name": "list_orders", "description": "List orders with status, customer, and line item filters" },+ { "name": "get_order", "description": "Get full order details including shipping and payment" },+ { "name": "list_customers", "description": "List customers with order history and tags" },+ { "name": "update_order", "description": "Update order notes, tags, or shipping address" },+ { "name": "create_fulfillment", "description": "Fulfill an order with tracking info" },+ { "name": "list_inventory_levels", "description": "Get stock levels across locations" }+ ]+ },+ {+ "name": "snowflake",+ "title": "Snowflake",+ "description": "Data warehouse queries, database operations, and analytics via the Snowflake SQL API",+ "icon_url": "https://cdn.simpleicons.org/snowflake",+ "spec_url": "https://raw.githubusercontent.com/snowflakedb/snowflake-rest-api-specs/refs/heads/main/specifications/sqlapi.yaml",+ "key_tools": [+ { "name": "execute_statement", "description": "Execute a SQL statement and get results" },+ { "name": "fetch_results", "description": "Fetch paginated results from a running query" },+ { "name": "cancel_statement", "description": "Cancel a running query by statement handle" },+ { "name": "list_databases", "description": "List all accessible databases in the account" },+ { "name": "list_schemas", "description": "List all schemas within a database" },+ { "name": "list_tables", "description": "List tables and views in a schema" },+ { "name": "describe_table", "description": "Get column definitions and data types for a table" },+ { "name": "list_warehouses", "description": "List virtual warehouses and their current status" }+ ]+ }+ ]+}diff --git a/ui/litellm-dashboard/src/components/mcp_tools/OpenAPIFormSection.tsx b/ui/litellm-dashboard/src/components/mcp_tools/OpenAPIFormSection.tsxnew file mode 100644index 00000000000..68412ea21bc--- /dev/null+++ b/ui/litellm-dashboard/src/components/mcp_tools/OpenAPIFormSection.tsx@@ -0,0 +1,86 @@+import React, { useState } from "react";+import { Form, Input, Tooltip } from "antd";+import { InfoCircleOutlined } from "@ant-design/icons";+import { FormInstance } from "antd/es/form";+import { AUTH_TYPE } from "./types";+import OpenAPIQuickPicker, { OpenAPIRegistryEntry, OpenAPIKeyTool } from "./OpenAPIQuickPicker";++interface OpenAPIFormSectionProps {+ form: FormInstance;+ accessToken: string | null;+ /** Called when a preset is selected so the parent can sync its formValues state. */+ onValuesChange: (updates: Record<string, any>) => void;+ /** Called when key tools change (from registry preset selection). */+ onKeyToolsChange?: (tools: OpenAPIKeyTool[]) => void;+}++/**+ * Encapsulates all OpenAPI-specific form fields:+ * - popular API quick-picker (logos)+ * - spec URL input+ */+const OpenAPIFormSection: React.FC<OpenAPIFormSectionProps> = ({+ form,+ accessToken,+ onValuesChange,+ onKeyToolsChange,+}) => {+ const [selectedPreset, setSelectedPreset] = useState<string | null>(null);++ const handlePresetSelect = (entry: OpenAPIRegistryEntry) => {+ setSelectedPreset(entry.name);+ onKeyToolsChange?.(entry.key_tools ?? []);+ const updates: Record<string, any> = {+ spec_path: entry.spec_url,+ };+ if (entry.oauth) {+ updates.auth_type = AUTH_TYPE.OAUTH2;+ updates.authorization_url = entry.oauth.authorization_url;+ updates.token_url = entry.oauth.token_url;+ form.setFieldsValue(updates);+ } else {+ // resetFields is required to visually clear Ant Design form fields —+ // setFieldsValue with undefined silently skips undefined keys.+ form.resetFields(["auth_type", "authorization_url", "token_url"]);+ form.setFieldsValue(updates);+ }+ onValuesChange(updates);+ };++ return (+ <>+ <OpenAPIQuickPicker+ accessToken={accessToken}+ selectedName={selectedPreset}+ onSelect={handlePresetSelect}+ />++ <Form.Item+ label={+ <span className="text-sm font-medium text-gray-700 flex items-center">+ OpenAPI Spec URL+ <Tooltip title="URL to an OpenAPI specification (JSON or YAML). MCP tools will be automatically generated from the API endpoints defined in the spec.">+ <InfoCircleOutlined className="ml-2 text-blue-400 hover:text-blue-600 cursor-help" />+ </Tooltip>+ </span>+ }+ name="spec_path"+ rules={[{ required: true, message: "Please enter an OpenAPI spec URL" }]}+ >+ <Input+ placeholder="https://petstore3.swagger.io/api/v3/openapi.json"+ className="rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"+ onChange={() => {+ // Clear the preset selection when the user manually edits the spec URL+ // so stale suggested tools from a previous preset don't persist.+ setSelectedPreset(null);+ onKeyToolsChange?.([]);+ }}+ />+ </Form.Item>+ </>+ );+};++export default OpenAPIFormSection;+export type { OpenAPIKeyTool };diff --git a/ui/litellm-dashboard/src/components/mcp_tools/OpenAPIQuickPicker.tsx b/ui/litellm-dashboard/src/components/mcp_tools/OpenAPIQuickPicker.tsxnew file mode 100644index 00000000000..2959ed25e57--- /dev/null+++ b/ui/litellm-dashboard/src/components/mcp_tools/OpenAPIQuickPicker.tsx@@ -0,0 +1,115 @@+import React, { useEffect, useState } from "react";+import { Spin } from "antd";+import { fetchOpenAPIRegistry } from "../networking";++export interface OpenAPIKeyTool {+ name: string;+ description: string;+}++export interface OpenAPIRegistryEntry {+ name: string;+ title: string;+ description: string;+ icon_url: string;+ spec_url: string;+ oauth?: {+ authorization_url: string;+ token_url: string;+ pkce: boolean;+ docs_url: string;+ };+ key_tools?: OpenAPIKeyTool[];+}++interface OpenAPIQuickPickerProps {+ accessToken: string | null;+ selectedName: string | null;+ onSelect: (entry: OpenAPIRegistryEntry) => void;+}++const OpenAPIQuickPicker: React.FC<OpenAPIQuickPickerProps> = ({+ accessToken,+ selectedName,+ onSelect,+}) => {+ const [apis, setApis] = useState<OpenAPIRegistryEntry[]>([]);+ const [loading, setLoading] = useState(false);+ const [imgErrors, setImgErrors] = useState<Set<string>>(new Set());++ useEffect(() => {+ if (!accessToken) return;+ setLoading(true);+ fetchOpenAPIRegistry(accessToken)+ .then((data) => setApis(data.apis ?? []))+ .catch(() => setApis([]))+ .finally(() => setLoading(false));+ }, [accessToken]);++ const handleImgError = (name: string) => {+ setImgErrors((prev) => new Set(prev).add(name));+ };++ if (loading) {+ return (+ <div className="mb-4">+ <span className="text-sm font-medium text-gray-700">Popular APIs</span>+ <div className="flex justify-center py-6">+ <Spin size="small" />+ </div>+ </div>+ );+ }++ if (apis.length === 0) return null;++ return (+ <div className="mb-4">+ <span className="text-sm font-medium text-gray-700 block mb-2">Popular APIs</span>++ <div className="grid grid-cols-5 gap-2">+ {apis.map((api) => {+ const isSelected = selectedName === api.name;+ const imgFailed = imgErrors.has(api.name);+ return (+ <button+ key={api.name}+ type="button"+ title={api.description}+ onClick={() => onSelect(api)}+ className={`flex flex-col items-center gap-1.5 p-3 rounded-lg border transition-all cursor-pointer+ ${+ isSelected+ ? "border-blue-500 bg-blue-50 shadow-sm"+ : "border-gray-200 hover:border-blue-300 hover:bg-gray-50"+ }`}+ >+ {imgFailed ? (+ <span className="w-7 h-7 rounded-full bg-gray-200 flex items-center justify-center text-sm font-bold text-gray-600">+ {api.title.charAt(0)}+ </span>+ ) : (+ <img+ src={api.icon_url}+ alt={api.title}+ className="w-7 h-7 object-contain"+ onError={() => handleImgError(api.name)}+ />+ )}+ <span className="text-xs text-gray-600 text-center leading-tight font-medium">+ {api.title}+ </span>+ </button>+ );+ })}+ </div>++ <p className="text-xs text-gray-400 mt-2">+ Select an API to pre-fill the spec URL and OAuth 2.0 settings, or enter+ your own spec URL below.+ </p>+ </div>+ );+};++export default OpenAPIQuickPicker;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 7237f903c3c..de60ff2b782 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@@ -10,10 +10,12 @@ import MCPConnectionStatus from "./mcp_connection_status";import MCPToolConfiguration from "./mcp_tool_configuration";import StdioConfiguration from "./StdioConfiguration";import MCPPermissionManagement from "./MCPPermissionManagement";+import OpenAPIFormSection, { OpenAPIKeyTool } from "./OpenAPIFormSection";import { isAdminRole } from "@/utils/roles";import { validateMCPServerUrl, validateMCPServerName } from "./utils";import NotificationsManager from "../molecules/notifications_manager";import { useMcpOAuthFlow } from "@/hooks/useMcpOAuthFlow";+import { useTestMCPConnection } from "@/hooks/useTestMCPConnection";const asset_logos_folder = "../ui/assets/logos/";export const mcpLogoImg = `${asset_logos_folder}mcp_logo.png`;@@ -52,13 +54,22 @@ const CreateMCPServer: React.FC<CreateMCPServerProps> = ({transport?: string;} | null>(null);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 [keyTools, setKeyTools] = useState<OpenAPIKeyTool[]>([]);const [searchValue, setSearchValue] = useState<string>("");const [oauthAccessToken, setOauthAccessToken] = useState<string | null>(null);++ // Single hook call shared by MCPConnectionStatus and MCPToolConfiguration to avoid duplicate requests.+ const { tools, isLoadingTools, toolsError, toolsErrorStackTrace, canFetchTools, fetchTools, clearTools } = useTestMCPConnection({+ accessToken,+ oauthAccessToken,+ formValues,+ enabled: true,+ });+const authType = formValues.auth_type as string | undefined;const shouldShowAuthValueField = authType ? AUTH_TYPES_REQUIRING_AUTH_VALUE.includes(authType) : false;const isOAuthAuthType = authType === AUTH_TYPE.OAUTH2;@@ -384,7 +395,7 @@ const CreateMCPServer: React.FC<CreateMCPServerProps> = ({);form.resetFields();setCostConfig({});- setTools([]);+ clearTools();setAllowedTools([]);setAliasManuallyEdited(false);setModalVisible(false);@@ -505,6 +516,7 @@ const CreateMCPServer: React.FC<CreateMCPServerProps> = ({width={1000}onCancel={handleCancel}footer={null}+ forceRenderclassName="top-8"styles={{body: { padding: "24px" },@@ -628,25 +640,16 @@ const CreateMCPServer: React.FC<CreateMCPServerProps> = ({</Form.Item>)}- {/* OpenAPI Spec URL - only show for OpenAPI transport */}+ {/* OpenAPI: logo picker + spec URL input */}{transportType === TRANSPORT.OPENAPI && (- <Form.Item- label={- <span className="text-sm font-medium text-gray-700 flex items-center">- OpenAPI Spec URL- <Tooltip title="URL to an OpenAPI specification (JSON or YAML). MCP tools will be automatically generated from the API endpoints defined in the spec.">- <InfoCircleOutlined className="ml-2 text-blue-400 hover:text-blue-600 cursor-help" />- </Tooltip>- </span>+ <OpenAPIFormSection+ form={form}+ accessToken={isModalVisible ? accessToken : null}+ onValuesChange={(updates) =>+ setFormValues((prev) => ({ ...prev, ...updates }))}- name="spec_path"- rules={[{ required: true, message: "Please enter an OpenAPI spec URL" }]}- >- <Input- placeholder="https://petstore3.swagger.io/api/v3/openapi.json"- className="rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"- />- </Form.Item>+ onKeyToolsChange={setKeyTools}+ />)}{/* BYOK toggle - only for OpenAPI */}@@ -810,10 +813,13 @@ const CreateMCPServer: React.FC<CreateMCPServerProps> = ({{/* Connection Status Section */}<div className="mt-8 pt-6 border-t border-gray-200"><MCPConnectionStatus- accessToken={accessToken}- oauthAccessToken={oauthAccessToken}formValues={formValues}- onToolsLoaded={setTools}+ tools={tools}+ isLoadingTools={isLoadingTools}+ toolsError={toolsError}+ toolsErrorStackTrace={toolsErrorStackTrace}+ canFetchTools={canFetchTools}+ fetchTools={fetchTools}/></div>@@ -830,6 +836,11 @@ const CreateMCPServer: React.FC<CreateMCPServerProps> = ({toolNameToDescription={toolNameToDescription}onToolNameToDisplayNameChange={setToolNameToDisplayName}onToolNameToDescriptionChange={setToolNameToDescription}+ keyTools={keyTools}+ externalTools={tools}+ externalIsLoading={isLoadingTools}+ externalError={toolsError}+ externalCanFetch={canFetchTools}/></div>diff --git a/ui/litellm-dashboard/src/components/mcp_tools/mcp_connection_status.tsx b/ui/litellm-dashboard/src/components/mcp_tools/mcp_connection_status.tsxindex 5a90a182b11..d6d6c07c1d7 100644--- a/ui/litellm-dashboard/src/components/mcp_tools/mcp_connection_status.tsx+++ b/ui/litellm-dashboard/src/components/mcp_tools/mcp_connection_status.tsx@@ -1,28 +1,27 @@-import React, { useEffect } from "react";+import React from "react";import { Button, Spin, Alert, Collapse } from "antd";import { CheckCircleOutlined, ExclamationCircleOutlined, ReloadOutlined, ToolOutlined } from "@ant-design/icons";import { Card, Title, Text } from "@tremor/react";-import { useTestMCPConnection } from "../../hooks/useTestMCPConnection";interface MCPConnectionStatusProps {- accessToken: string | null;- oauthAccessToken?: string | null;formValues: Record<string, any>;- onToolsLoaded?: (tools: any[]) => void;+ tools: any[];+ isLoadingTools: boolean;+ toolsError: string | null;+ toolsErrorStackTrace: string | null;+ canFetchTools: boolean;+ fetchTools: () => Promise<void>;}-const MCPConnectionStatus: React.FC<MCPConnectionStatusProps> = ({ accessToken, oauthAccessToken, formValues, onToolsLoaded }) => {- const { tools, isLoadingTools, toolsError, toolsErrorStackTrace, canFetchTools, fetchTools } = useTestMCPConnection({- accessToken,- oauthAccessToken,- formValues,- enabled: true, // Auto-fetch when required fields are available- });-- // Notify parent component when tools change- useEffect(() => {- onToolsLoaded?.(tools);- }, [tools, onToolsLoaded]);+const MCPConnectionStatus: React.FC<MCPConnectionStatusProps> = ({+ formValues,+ tools,+ isLoadingTools,+ toolsError,+ toolsErrorStackTrace,+ canFetchTools,+ fetchTools,+}) => {// Don't show anything if required fields aren't filledif (!canFetchTools && !formValues.url && !formValues.spec_path) {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 87f14021f46..360bb893b52 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,9 +1,14 @@-import React, { useEffect, useRef, useState } from "react";+import React, { useEffect, useMemo, useRef, useState } from "react";import { Card, Title, Text } from "@tremor/react";import { ToolOutlined, CheckCircleOutlined, SearchOutlined, EditOutlined } from "@ant-design/icons";import { Badge, Spin, Checkbox, Input } from "antd";import { useTestMCPConnection } from "../../hooks/useTestMCPConnection";+interface KeyTool {+ name: string;+ description: string;+}+interface MCPToolConfigurationProps {accessToken: string | null;oauthAccessToken?: string | null;@@ -15,8 +20,127 @@ interface MCPToolConfigurationProps {toolNameToDescription: Record<string, string>;onToolNameToDisplayNameChange: (map: Record<string, string>) => void;onToolNameToDescriptionChange: (map: Record<string, string>) => void;+ /** Curated key tools from the OpenAPI registry preset (shown before spec loads). */+ keyTools?: KeyTool[];+ /** External tool state lifted from parent to avoid duplicate fetch requests. */+ externalTools?: any[];+ externalIsLoading?: boolean;+ externalError?: string | null;+ externalCanFetch?: boolean;+}++interface ToolEntry {+ name: string;+ description?: string;+}++interface ToolRowProps {+ tool: ToolEntry;+ isEnabled: boolean;+ isEditExpanded: boolean;+ toolNameToDisplayName: Record<string, string>;+ toolNameToDescription: Record<string, string>;+ onToggle: (name: string) => void;+ onToggleExpand: (name: string, e: React.MouseEvent) => void;+ onDisplayNameChange: (name: string, value: string) => void;+ onDescriptionChange: (name: string, value: string) => void;}+const ToolRow: React.FC<ToolRowProps> = ({+ tool,+ isEnabled,+ isEditExpanded,+ toolNameToDisplayName,+ toolNameToDescription,+ onToggle,+ onToggleExpand,+ onDisplayNameChange,+ onDescriptionChange,+}) => (+ <div+ 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"+ }`}+ >+ <div className="p-4 cursor-pointer" onClick={() => onToggle(tool.name)}>+ <div className="flex items-start gap-3">+ <Checkbox checked={isEnabled} onChange={() => onToggle(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>+ <button+ type="button"+ onClick={(e) => onToggleExpand(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"+ >+ <EditOutlined />+ </button>+ </div>+ </div>+ {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) => onDisplayNameChange(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) => onDescriptionChange(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>+);+const MCPToolConfiguration: React.FC<MCPToolConfigurationProps> = ({accessToken,oauthAccessToken,@@ -28,65 +152,134 @@ const MCPToolConfiguration: React.FC<MCPToolConfigurationProps> = ({toolNameToDescription,onToolNameToDisplayNameChange,onToolNameToDescriptionChange,+ keyTools,+ externalTools,+ externalIsLoading,+ externalError,+ externalCanFetch,}) => {- const previousToolsRef = useRef<any[]>([]);+ const previousToolsRef = useRef<ToolEntry[]>([]);const [toolSearchTerm, setToolSearchTerm] = useState("");const hasInitializedRef = useRef(false);+ const previousSuggestedToolNamesRef = useRef<string>("");const [expandedTools, setExpandedTools] = useState<Set<string>>(new Set());- const { tools, isLoadingTools, toolsError, canFetchTools } = useTestMCPConnection({+ // Use external tool state when provided (avoids duplicate fetch with MCPConnectionStatus).+ // Fall back to internal hook when used standalone (e.g., edit flow).+ const hasExternalState = externalTools !== undefined;+ const internalHook = useTestMCPConnection({accessToken,oauthAccessToken,formValues,- enabled: true,+ enabled: !hasExternalState,});+ const tools: ToolEntry[] = hasExternalState ? externalTools : internalHook.tools;+ const isLoadingTools = hasExternalState ? (externalIsLoading ?? false) : internalHook.isLoadingTools;+ const toolsError = hasExternalState ? (externalError ?? null) : internalHook.toolsError;+ const canFetchTools = hasExternalState ? (externalCanFetch ?? false) : internalHook.canFetchTools;++ // Fuzzy-match curated key tool names against actual loaded tool names+ const suggestedTools = useMemo(() => {+ if (!keyTools || keyTools.length === 0 || tools.length === 0) return [];+ const usedNames = new Set<string>();+ const result: typeof tools = [];+ for (const keyTool of keyTools) {+ const keywords = keyTool.name.split("_").map((k) => k.toLowerCase()).filter((k) => k.length > 1);+ if (keywords.length === 0) continue;+ const normalize = (s: string) => s.toLowerCase().replace(/[-_/]/g, " ");+ let match = tools.find((t) => {+ if (usedNames.has(t.name)) return false;+ const n = normalize(t.name);+ return keywords.every((kw) => n.includes(kw));+ });+ if (!match) {+ const mainKw = keywords.find((k) => k.length > 3) ?? keywords[keywords.length - 1];+ match = tools.find((t) => {+ if (usedNames.has(t.name)) return false;+ return normalize(t.name).includes(mainKw);+ });+ }+ if (match) {+ result.push(match);+ usedNames.add(match.name);+ }+ }+ return result;+ }, [keyTools, tools]);++ const suggestedToolNames = useMemo(+ () => new Set(suggestedTools.map((t) => t.name)),+ [suggestedTools]+ );// Filter tools based on search term- const filteredTools = tools.filter((tool) => {- const searchLower = toolSearchTerm.toLowerCase();- return (- tool.name.toLowerCase().includes(searchLower) ||- (tool.description && tool.description.toLowerCase().includes(searchLower))- );- });+ const filteredTools = useMemo(+ () =>+ tools.filter((tool) => {+ const searchLower = toolSearchTerm.toLowerCase();+ return (+ tool.name.toLowerCase().includes(searchLower) ||+ (tool.description && tool.description.toLowerCase().includes(searchLower))+ );+ }),+ [tools, toolSearchTerm]+ );++ const pinnedFiltered = useMemo(+ () => filteredTools.filter((t) => suggestedToolNames.has(t.name)),+ [filteredTools, suggestedToolNames]+ );++ const restFiltered = useMemo(+ () => filteredTools.filter((t) => !suggestedToolNames.has(t.name)),+ [filteredTools, suggestedToolNames]+ );// Auto-select tools when tools are first loaded or when tools list changesuseEffect(() => {- // Check if the tools list has actually changed by comparing tool namesconst currentToolNames = tools.map((tool) => tool.name).sort().join(",");const previousToolNames = previousToolsRef.current.map((tool) => tool.name).sort().join(",");const toolsListChanged = currentToolNames !== previousToolNames;+ // Reset initialization when a new preset is selected (suggestedTools fingerprint changes)+ const currentSuggestedNames = suggestedTools.map((t) => t.name).sort().join(",");+ if (currentSuggestedNames !== previousSuggestedToolNamesRef.current) {+ previousSuggestedToolNamesRef.current = currentSuggestedNames;+ if (currentSuggestedNames !== "") {+ hasInitializedRef.current = false;+ }+ }+if (tools.length > 0 && toolsListChanged) {const availableToolNames = tools.map((tool) => tool.name);-- // On initial load (first time tools are fetched)+if (!hasInitializedRef.current) {hasInitializedRef.current = true;-+if (existingAllowedTools && existingAllowedTools.length > 0) {// Edit mode: pre-select tools that match existing allowed tools- const validExistingTools = existingAllowedTools.filter((toolName) => availableToolNames.includes(toolName));+ const validExistingTools = existingAllowedTools.filter((toolName) =>+ availableToolNames.includes(toolName)+ );onAllowedToolsChange(validExistingTools);+ } else if (suggestedTools.length > 0) {+ // OpenAPI preset: only enable suggested tools by default+ onAllowedToolsChange(+ suggestedTools.map((t) => t.name).filter((name) => availableToolNames.includes(name))+ );} else {// Create mode: auto-select all toolsonAllowedToolsChange(availableToolNames);}} else {// Tools list changed after initial load (e.g., URL was edited)- // Keep any tools from the current selection that exist in the new tools listconst matchingTools = allowedTools.filter((toolName) => availableToolNames.includes(toolName));onAllowedToolsChange(matchingTools);}- } else if (tools.length === 0 && previousToolsRef.current.length > 0) {- // Tools were cleared (e.g., URL became invalid or is being edited)- // Don't clear allowedTools here - let the user keep their selection- // until new tools are loaded}-- // Update ref to track current tools+previousToolsRef.current = tools;- }, [tools, allowedTools, existingAllowedTools, onAllowedToolsChange]);+ }, [tools, allowedTools, existingAllowedTools, onAllowedToolsChange, suggestedTools]);const handleToolToggle = (toolName: string) => {if (allowedTools.includes(toolName)) {@@ -96,15 +289,6 @@ const MCPToolConfiguration: React.FC<MCPToolConfigurationProps> = ({}};- const handleSelectAll = () => {- const allToolNames = tools.map((tool) => tool.name);- onAllowedToolsChange(allToolNames);- };-- const handleDeselectAll = () => {- onAllowedToolsChange([]);- };-const handleToggleEditExpanded = (toolName: string, e: React.MouseEvent) => {e.stopPropagation();setExpandedTools((prev) => {@@ -138,6 +322,30 @@ const MCPToolConfiguration: React.FC<MCPToolConfigurationProps> = ({onToolNameToDescriptionChange(next);};+ const handleEnableSuggested = () => {+ // Enable ALL suggested tools (not just the currently filtered subset)+ const suggestedNames = suggestedTools.map((t) => t.name);+ const others = allowedTools.filter((n) => !suggestedToolNames.has(n));+ onAllowedToolsChange([...others, ...suggestedNames]);+ };++ const handleDisableSuggested = () => {+ // Disable ALL suggested tools (not just the currently filtered subset)+ onAllowedToolsChange(allowedTools.filter((n) => !suggestedToolNames.has(n)));+ };++ const handleEnableRest = () => {+ // Enable ALL non-suggested tools (not just the currently filtered subset)+ const restNames = tools.filter((t) => !suggestedToolNames.has(t.name)).map((t) => t.name);+ const current = new Set(allowedTools);+ onAllowedToolsChange([...allowedTools, ...restNames.filter((n) => !current.has(n))]);+ };++ const handleDisableRest = () => {+ // Disable ALL non-suggested tools (not just the currently filtered subset)+ onAllowedToolsChange(allowedTools.filter((n) => suggestedToolNames.has(n)));+ };+// Don't show anything if required fields aren't filledif (!canFetchTools && !formValues.url && !formValues.spec_path) {return null;@@ -173,7 +381,7 @@ const MCPToolConfiguration: React.FC<MCPToolConfigurationProps> = ({{isLoadingTools && (<div className="flex items-center justify-center py-6"><Spin size="large" />- <Text className="ml-3">Loading tools...</Text>+ <Text className="ml-3">Loading tools from spec...</Text></div>)}@@ -189,12 +397,22 @@ const MCPToolConfiguration: React.FC<MCPToolConfigurationProps> = ({{/* No tools state */}{!isLoadingTools && !toolsError && tools.length === 0 && canFetchTools && (- <div className="text-center py-6 text-gray-400 border rounded-lg border-dashed">- <ToolOutlined className="text-2xl mb-2" />- <Text>No tools available for configuration</Text>- <br />- <Text className="text-sm">Connect to an MCP server with tools to configure them</Text>- </div>+ keyTools && keyTools.length > 0 ? (+ <div className="text-center py-4 text-gray-400 border rounded-lg border-dashed">+ <ToolOutlined className="text-2xl mb-2" />+ <Text>No tools loaded from spec</Text>+ <Text className="text-sm block mt-1">+ Expected tools: {keyTools.map((t) => t.name).join(", ")}+ </Text>+ </div>+ ) : (+ <div className="text-center py-6 text-gray-400 border rounded-lg border-dashed">+ <ToolOutlined className="text-2xl mb-2" />+ <Text>No tools available for configuration</Text>+ <br />+ <Text className="text-sm">Connect to an MCP server with tools to configure them</Text>+ </div>+ ))}{/* Incomplete form state */}@@ -210,30 +428,12 @@ const MCPToolConfiguration: React.FC<MCPToolConfigurationProps> = ({{/* Tools loaded successfully */}{!isLoadingTools && !toolsError && tools.length > 0 && (<div className="space-y-3">- <div className="flex items-center justify-between">- <div className="flex items-center gap-2 p-3 bg-green-50 rounded-lg border border-green-200 flex-1">- <CheckCircleOutlined className="text-green-600" />- <Text className="text-green-700 font-medium">- {allowedTools.length} of {tools.length} {tools.length === 1 ? "tool" : "tools"} enabled for user- access- </Text>- </div>- <div className="flex gap-2 ml-3">- <button- type="button"- onClick={handleSelectAll}- className="px-3 py-1.5 text-sm text-blue-600 hover:text-blue-700 hover:bg-blue-50 rounded-md transition-colors"- >- Enable All- </button>- <button- type="button"- onClick={handleDeselectAll}- className="px-3 py-1.5 text-sm text-gray-600 hover:text-gray-700 hover:bg-gray-100 rounded-md transition-colors"- >- Disable All- </button>- </div>+ <div className="flex items-center gap-2 p-3 bg-green-50 rounded-lg border border-green-200">+ <CheckCircleOutlined className="text-green-600" />+ <Text className="text-green-700 font-medium">+ {allowedTools.length} of {tools.length} {tools.length === 1 ? "tool" : "tools"} enabled for user+ access+ </Text></div>{/* Search bar */}@@ -248,115 +448,93 @@ const MCPToolConfiguration: React.FC<MCPToolConfigurationProps> = ({/>{/* Tool list with checkboxes */}- <div className="space-y-2">- {filteredTools.length === 0 ? (- <div className="text-center py-6 text-gray-400 border rounded-lg border-dashed">- <SearchOutlined className="text-2xl mb-2" />- <Text>No tools found matching "{toolSearchTerm}"</Text>- </div>- ) : (- 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 */}+ {filteredTools.length === 0 ? (+ <div className="text-center py-6 text-gray-400 border rounded-lg border-dashed">+ <SearchOutlined className="text-2xl mb-2" />+ <Text>No tools found matching "{toolSearchTerm}"</Text>+ </div>+ ) : (+ <div className="space-y-2">+ {pinnedFiltered.length > 0 && (+ <>+ <div className="flex items-center justify-between px-1">+ <p className="text-xs font-semibold text-gray-500 uppercase tracking-wide">+ Suggested tools+ </p>+ <div className="flex gap-2">+ <button+ type="button"+ onClick={handleEnableSuggested}+ className="text-xs text-blue-600 hover:text-blue-700"+ >+ Enable all+ </button><buttontype="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"+ onClick={handleDisableSuggested}+ className="text-xs text-gray-500 hover:text-gray-700">- <EditOutlined />+ Disable all</button></div></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>+ {pinnedFiltered.map((tool) => (+ <ToolRow+ key={tool.name}+ tool={tool}+ isEnabled={allowedTools.includes(tool.name)}+ isEditExpanded={expandedTools.has(tool.name)}+ toolNameToDisplayName={toolNameToDisplayName}+ toolNameToDescription={toolNameToDescription}+ onToggle={handleToolToggle}+ onToggleExpand={handleToggleEditExpanded}+ onDisplayNameChange={handleDisplayNameChange}+ onDescriptionChange={handleDescriptionChange}+ />+ ))}+ </>+ )}+ {restFiltered.length > 0 && (+ <>+ <div className="flex items-center justify-between px-1 pt-2">+ <p className="text-xs font-semibold text-gray-500 uppercase tracking-wide">+ {pinnedFiltered.length > 0 ? "All tools" : "Tools"}+ </p>+ <div className="flex gap-2">+ <button+ type="button"+ onClick={handleEnableRest}+ className="text-xs text-blue-600 hover:text-blue-700"+ >+ Enable all+ </button>+ <button+ type="button"+ onClick={handleDisableRest}+ className="text-xs text-gray-500 hover:text-gray-700"+ >+ Disable all+ </button></div>- )}- </div>- );- })- )}- </div>+ </div>+ {restFiltered.map((tool) => (+ <ToolRow+ key={tool.name}+ tool={tool}+ isEnabled={allowedTools.includes(tool.name)}+ isEditExpanded={expandedTools.has(tool.name)}+ toolNameToDisplayName={toolNameToDisplayName}+ toolNameToDescription={toolNameToDescription}+ onToggle={handleToolToggle}+ onToggleExpand={handleToggleEditExpanded}+ onDisplayNameChange={handleDisplayNameChange}+ onDescriptionChange={handleDescriptionChange}+ />+ ))}+ </>+ )}+ </div>+ )}</div>)}</div>diff --git a/ui/litellm-dashboard/src/components/networking.tsx b/ui/litellm-dashboard/src/components/networking.tsxindex d11442b9ddf..fbde083c2da 100644--- a/ui/litellm-dashboard/src/components/networking.tsx+++ b/ui/litellm-dashboard/src/components/networking.tsx@@ -78,7 +78,12 @@ import { jsonFields } from "./common_components/check_openapi_schema";import NotificationsManager from "./molecules/notifications_manager";const isLocal = process.env.NODE_ENV === "development";-const defaultProxyBaseUrl = isLocal ? "http://localhost:4000" : null;+// In dev, if NEXT_PUBLIC_USE_REWRITES=true the Next.js dev server proxies API calls+// to the backend — use relative URLs (null) so rewrites can intercept them.+const defaultProxyBaseUrl =+ isLocal && process.env.NEXT_PUBLIC_USE_REWRITES !== "true"+ ? "http://localhost:4000"+ : null;const defaultServerRootPath = "/";export let serverRootPath = defaultServerRootPath;export let proxyBaseUrl = defaultProxyBaseUrl;@@ -98,7 +103,10 @@ const updateProxyBaseUrl = (serverRootPath: string, receivedProxyBaseUrl: string* Special function for updating the proxy base url. Should only be called by getUiConfig.*/const browserLocation = getWindowLocation();- const resolvedDefaultProxyBaseUrl = isLocal ? "http://localhost:4000" : browserLocation?.origin ?? null;+ const resolvedDefaultProxyBaseUrl =+ isLocal && process.env.NEXT_PUBLIC_USE_REWRITES !== "true"+ ? "http://localhost:4000"+ : browserLocation?.origin ?? null;let initialProxyBaseUrl = receivedProxyBaseUrl || resolvedDefaultProxyBaseUrl;console.log("proxyBaseUrl:", proxyBaseUrl);console.log("serverRootPath:", serverRootPath);@@ -6258,6 +6266,32 @@ export const updateInternalUserSettings = async (accessToken: string, settings:}};+export const fetchOpenAPIRegistry = async (accessToken: string) => {+ try {+ const url = proxyBaseUrl+ ? `${proxyBaseUrl}/v1/mcp/openapi-registry`+ : `/v1/mcp/openapi-registry`;++ const response = await fetch(url, {+ method: HTTP_REQUEST.GET,+ headers: {+ [globalLitellmHeaderName]: `Bearer ${accessToken}`,+ "Content-Type": "application/json",+ },+ });++ if (!response.ok) {+ const errorData = await response.json();+ throw new Error(deriveErrorMessage(errorData));+ }++ return await response.json();+ } catch (error) {+ console.error("Failed to fetch OpenAPI registry:", error);+ throw error;+ }+};+export const fetchDiscoverableMCPServers = async (accessToken: string) => {try {const url = proxyBaseUrldiff --git a/ui/litellm-dashboard/src/hooks/useTestMCPConnection.tsx b/ui/litellm-dashboard/src/hooks/useTestMCPConnection.tsxindex 32092e7f33c..eff4ff5cd60 100644--- a/ui/litellm-dashboard/src/hooks/useTestMCPConnection.tsx+++ b/ui/litellm-dashboard/src/hooks/useTestMCPConnection.tsx@@ -58,13 +58,18 @@ export const useTestMCPConnection = ({const requiresOAuthToken = formValues.auth_type === AUTH_TYPE.OAUTH2 && !isM2MOAuth;const isOpenAPITransport = formValues.transport === TRANSPORT.OPENAPI;const hasEndpoint = isOpenAPITransport ? !!formValues.spec_path : !!formValues.url;- const canFetchTools = !!(- hasEndpoint &&- formValues.transport &&- formValues.auth_type &&- accessToken &&- (!requiresOAuthToken || oauthAccessToken)- );++ // For OpenAPI: tools are derived from the spec itself — no auth needed to load them.+ // For other transports: auth_type is required, and OAuth interactive flows need a token.+ const canFetchTools = isOpenAPITransport+ ? !!(hasEndpoint && accessToken)+ : !!(+ hasEndpoint &&+ formValues.transport &&+ formValues.auth_type &&+ accessToken &&+ (!requiresOAuthToken || oauthAccessToken)+ );const staticHeadersKey = JSON.stringify(formValues.static_headers ?? {});const credentialsKey = JSON.stringify(formValues.credentials ?? {});@@ -74,7 +79,8 @@ export const useTestMCPConnection = ({return;}- if (requiresOAuthToken && !oauthAccessToken) {+ // For OpenAPI transport, tools are derived from the spec — no OAuth token needed.+ if (requiresOAuthToken && !oauthAccessToken && !isOpenAPITransport) {return;}