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: add MCP test support to completions on Playground
Yuta Saitof6ed80028d42
diff --git a/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.test.tsx b/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.test.tsxindex 2de324499e1..8c85fb3bb2b 100644--- a/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.test.tsx+++ b/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.test.tsx@@ -218,4 +218,56 @@ describe("ChatUI", () => {expect(options[0]).toHaveTextContent("Enter custom model");});});++ it("should enable the MCP tools selector for chat completions", async () => {+ render(+ <ChatUI+ accessToken="1234567890"+ token="1234567890"+ userRole="user"+ userID="1234567890"+ disabledPersonalKeyCreation={false}+ />,+ );++ await waitFor(() => {+ expect(screen.getByText("Test Key")).toBeInTheDocument();+ });++ const endpointTypeText = screen.getByText("Endpoint Type");+ const endpointSelect = endpointTypeText.parentElement?.querySelector(".ant-select-selector") as HTMLElement | null;+ expect(endpointSelect).not.toBeNull();++ const selectEndpointOption = async (label: string) => {+ act(() => {+ fireEvent.mouseDown(endpointSelect!);+ });++ await waitFor(() => {+ expect(screen.getByText(label)).toBeInTheDocument();+ });++ act(() => {+ fireEvent.click(screen.getByText(label));+ });+ };++ const getMcpSelect = () =>+ screen.getByText("MCP Tool").closest("div")?.querySelector(".ant-select") as HTMLElement | null;++ await selectEndpointOption("/v1/embeddings");++ const mcpSelect = getMcpSelect();+ expect(mcpSelect).not.toBeNull();++ await waitFor(() => {+ expect(mcpSelect).toHaveClass("ant-select-disabled");+ });++ await selectEndpointOption("/v1/chat/completions");++ await waitFor(() => {+ expect(mcpSelect).not.toHaveClass("ant-select-disabled");+ });+ });});diff --git a/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.tsx b/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.tsxindex a963aa706be..348a059b6d6 100644--- a/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.tsx+++ b/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.tsx@@ -84,6 +84,11 @@ interface ChatUIProps {};}+const MCP_SUPPORTED_ENDPOINTS = new Set<EndpointType>([+ EndpointType.CHAT,+ EndpointType.RESPONSES,+]);+const ChatUI: React.FC<ChatUIProps> = ({accessToken,token,@@ -1319,7 +1324,7 @@ const ChatUI: React.FC<ChatUIProps> = ({<ToolOutlined className="mr-2" /> MCP Tool<TooltipclassName="ml-1"- title="Select MCP tools to use in your conversation, only available for /v1/responses endpoint"+ title="Select MCP tools to use in your conversation."><InfoCircleOutlined /></Tooltip>@@ -1334,7 +1339,7 @@ const ChatUI: React.FC<ChatUIProps> = ({className="mb-4"allowClearoptionLabelProp="label"- disabled={!(endpointType === EndpointType.RESPONSES)}+ disabled={!MCP_SUPPORTED_ENDPOINTS.has(endpointType as EndpointType)}maxTagCount="responsive">{Array.isArray(mcpTools) &&diff --git a/ui/litellm-dashboard/src/components/playground/llm_calls/chat_completion.tsx b/ui/litellm-dashboard/src/components/playground/llm_calls/chat_completion.tsxindex 799f050fc8c..8bdaa94ec65 100644--- a/ui/litellm-dashboard/src/components/playground/llm_calls/chat_completion.tsx+++ b/ui/litellm-dashboard/src/components/playground/llm_calls/chat_completion.tsx@@ -60,7 +60,7 @@ export async function makeOpenAIChatCompletionRequest({type: "mcp",server_label: "litellm",- server_url: `${proxyBaseUrl}/mcp`,+ server_url: 'litellm_proxy/mcp',require_approval: "never",allowed_tools: selectedMCPTools,headers: {