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
fix(ui): staged edit preview sends explicit oauth2_flow and spec_path; invalidation clears the tool list
Tindb8c872c7d3c
diff --git a/ui/litellm-dashboard/src/components/mcp_tools/mcp_server_edit.test.tsx b/ui/litellm-dashboard/src/components/mcp_tools/mcp_server_edit.test.tsxindex 93ff1333cd8..adb3e161da5 100644--- a/ui/litellm-dashboard/src/components/mcp_tools/mcp_server_edit.test.tsx+++ b/ui/litellm-dashboard/src/components/mcp_tools/mcp_server_edit.test.tsx@@ -523,7 +523,13 @@ describe("MCPServerEdit OAuth token invalidation", () => {await waitFor(() => {expect(vi.mocked(networking.testMCPToolsListRequest)).toHaveBeenCalledWith("access-token",- expect.objectContaining({ server_id: "oauth_server_1", url: "https://example.com/mcp" }),+ // oauth2_flow must be explicit: the preview endpoint infers client_credentials from+ // inherited client_id/client_secret/token_url and would strip the staged bearer.+ expect.objectContaining({+ server_id: "oauth_server_1",+ url: "https://example.com/mcp",+ oauth2_flow: "authorization_code",+ }),"staged-obo-tok",);});@@ -536,6 +542,34 @@ describe("MCPServerEdit OAuth token invalidation", () => {mockOauth.tokenResponse = null;});+ it("previews an OpenAPI server's staged token against its spec_path", async () => {+ mockOauth.tokenResponse = { access_token: "staged-obo-tok" };++ render(+ <MCPServerEdit+ mcpServer={{+ ...interactiveOAuthServer,+ transport: "openapi",+ url: null,+ spec_path: "https://example.com/openapi.json",+ }}+ accessToken="access-token"+ onCancel={vi.fn()}+ onSuccess={vi.fn()}+ availableAccessGroups={[]}+ />,+ );++ await waitFor(() => {+ expect(vi.mocked(networking.testMCPToolsListRequest)).toHaveBeenCalledWith(+ "access-token",+ expect.objectContaining({ spec_path: "https://example.com/openapi.json" }),+ "staged-obo-tok",+ );+ });+ mockOauth.tokenResponse = null;+ });+it("keeps the admin's in-flight endpoint edits when the token is invalidated", async () => {// Regression: invalidation used to form.resetFields the endpoint fields; with the edit Form's// initialValues that silently reverted an admin-corrected token_url back to the saved (wrong)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 58f63e12019..7446c96c40e 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@@ -405,6 +405,7 @@ const MCPServerEdit: React.FC<MCPServerEditProps> = ({if (mcpServer.server_id) {removeToken(mcpServer.server_id, userID);}+ setTools([]);resetOAuthFlow();form.resetFields([...CLEARED_ON_INVALIDATION]);const preserved = Object.fromEntries(@@ -442,12 +443,18 @@ const MCPServerEdit: React.FC<MCPServerEditProps> = ({try {const values = form.getFieldsValue(true);const rawTransport = values.transport || mcpServer.transport;+ // oauth2_flow must be explicit: the preview endpoint infers client_credentials from the+ // inherited client_id/client_secret/token_url (common once DCR or discovery filled them) and+ // would strip the staged bearer to preview as M2M. spec_path keeps OpenAPI servers on the+ // spec-based preview path, mirroring the create form's config.const previewConfig = {server_id: mcpServer.server_id,server_name: values.server_name || mcpServer.server_name || mcpServer.alias,url: values.url || mcpServer.url,+ spec_path: values.spec_path || mcpServer.spec_path,transport: rawTransport === TRANSPORT.OPENAPI ? TRANSPORT.HTTP : rawTransport,auth_type: AUTH_TYPE.OAUTH2,+ oauth2_flow: MCP_OAUTH2_FLOW_INTERACTIVE,authorization_url: values.authorization_url,token_url: values.token_url,registration_url: values.registration_url,