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.tsx index 2f80bb24e99..fb9efffb9b5 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 @@ -3,7 +3,7 @@ import { Modal, Tooltip, Form, Select, Input } from "antd"; import { InfoCircleOutlined } from "@ant-design/icons"; import { Button, TextInput } from "@tremor/react"; import { createMCPServer } from "../networking"; -import { AUTH_TYPE, DiscoverableMCPServer, OAUTH_FLOW, MCPServer, MCPServerCostInfo } from "./types"; +import { AUTH_TYPE, DiscoverableMCPServer, OAUTH_FLOW, MCPServer, MCPServerCostInfo, TRANSPORT } from "./types"; import OAuthFormFields from "./OAuthFormFields"; import MCPServerCostConfig from "./mcp_server_cost_config"; import MCPConnectionStatus from "./mcp_connection_status"; @@ -316,6 +316,11 @@ const CreateMCPServer: React.FC = ({ } } + // Map "openapi" transport to "http" for the backend + if (restValues.transport === TRANSPORT.OPENAPI) { + restValues.transport = "http"; + } + // Prepare the payload with cost configuration and allowed tools const payload: Record = { ...restValues, @@ -377,9 +382,11 @@ const CreateMCPServer: React.FC = ({ setTransportType(value); // Clear fields that are not relevant for the selected transport if (value === "stdio") { - form.setFieldsValue({ url: undefined, auth_type: undefined, credentials: undefined }); + form.setFieldsValue({ url: undefined, spec_path: undefined, auth_type: undefined, credentials: undefined }); + } else if (value === TRANSPORT.OPENAPI) { + form.setFieldsValue({ url: undefined, command: undefined, args: undefined, env: undefined }); } else { - form.setFieldsValue({ command: undefined, args: undefined, env: undefined }); + form.setFieldsValue({ spec_path: undefined, command: undefined, args: undefined, env: undefined }); } }; @@ -555,15 +562,17 @@ const CreateMCPServer: React.FC = ({ Streamable HTTP (Recommended) Server-Sent Events (SSE) Standard Input/Output (stdio) + OpenAPI Spec {/* URL field - only show for HTTP and SSE */} - {transportType !== "stdio" && ( + {(transportType === "http" || transportType === "sse") && ( MCP Server URL} name="url" rules={[ + { required: true, message: "Please enter a server URL" }, { validator: (_, value) => validateMCPServerUrl(value) }, ]} > @@ -574,28 +583,29 @@ const CreateMCPServer: React.FC = ({ )} - {/* OpenAPI Spec URL - only show for HTTP and SSE */} - {transportType !== "stdio" && ( + {/* OpenAPI Spec URL - only show for OpenAPI transport */} + {transportType === TRANSPORT.OPENAPI && ( - OpenAPI Spec URL (optional) - + OpenAPI Spec URL + } name="spec_path" + rules={[{ required: true, message: "Please enter an OpenAPI spec URL" }]} > )} - {/* Authentication - only show for HTTP and SSE */} - {transportType !== "stdio" && ( + {/* Authentication - show for HTTP, SSE, and OpenAPI */} + {transportType !== "stdio" && transportType !== "" && ( Authentication} name="auth_type" @@ -611,7 +621,7 @@ const CreateMCPServer: React.FC = ({ )} - {transportType !== "stdio" && shouldShowAuthValueField && ( + {transportType !== "stdio" && transportType !== "" && shouldShowAuthValueField && ( @@ -632,7 +642,7 @@ const CreateMCPServer: React.FC = ({ )} - {transportType !== "stdio" && isOAuthAuthType && ( + {transportType !== "stdio" && transportType !== "" && isOAuthAuthType && (