From c28877757cf9aa9b83034b439ed0caeeb8a1fc7f Mon Sep 17 00:00:00 2001 From: Ryan Crabbe Date: Fri, 17 Apr 2026 22:48:39 -0700 Subject: [PATCH 1/2] fix(ui): extra_headers not persisting on MCP server edit Set extra_headers explicitly in initialValues instead of relying on a useEffect setFieldValue call that races with Antd form initialization. Also avoid sending empty array on submit so the backend's exclude_none doesn't overwrite stored values. --- .../src/components/mcp_tools/MCPPermissionManagement.tsx | 4 ---- .../src/components/mcp_tools/mcp_server_edit.tsx | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/ui/litellm-dashboard/src/components/mcp_tools/MCPPermissionManagement.tsx b/ui/litellm-dashboard/src/components/mcp_tools/MCPPermissionManagement.tsx index 89aa756cb2..dcb7298c83 100644 --- a/ui/litellm-dashboard/src/components/mcp_tools/MCPPermissionManagement.tsx +++ b/ui/litellm-dashboard/src/components/mcp_tools/MCPPermissionManagement.tsx @@ -27,10 +27,6 @@ const MCPPermissionManagement: React.FC = ({ // Set initial values when mcpServer changes useEffect(() => { if (mcpServer) { - // Set extra_headers if they exist - if (mcpServer.extra_headers) { - form.setFieldValue("extra_headers", mcpServer.extra_headers); - } if (mcpServer.static_headers) { const staticHeaders = Object.entries(mcpServer.static_headers).map(([header, value]) => ({ header, 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.tsx index 574e787175..e97222acbd 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 @@ -189,6 +189,7 @@ const MCPServerEdit: React.FC = ({ ...mcpServer, transport: effectiveTransport, static_headers: initialStaticHeaders, + extra_headers: mcpServer.extra_headers || [], oauth_flow_type: mcpServer.token_url ? OAUTH_FLOW.M2M : OAUTH_FLOW.INTERACTIVE, token_validation_json: mcpServer.token_validation ? JSON.stringify(mcpServer.token_validation, null, 2) @@ -563,7 +564,7 @@ const MCPServerEdit: React.FC = ({ mcp_access_groups: accessGroups, alias: restValues.alias, // Include permission management fields - extra_headers: restValues.extra_headers || [], + extra_headers: restValues.extra_headers?.length ? restValues.extra_headers : undefined, 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, From e2e5b63b413ec4116c90649cd80aef0f0f454c6a Mon Sep 17 00:00:00 2001 From: Ryan Crabbe Date: Fri, 17 Apr 2026 23:24:46 -0700 Subject: [PATCH 2/2] fix(ui): revert submit guard to allow intentional extra_headers clearing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ?.length guard prevented intentional clears from persisting — send the form value as-is since initialValues now populates it correctly. --- .../src/components/mcp_tools/mcp_server_edit.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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.tsx index e97222acbd..c64214e080 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 @@ -564,7 +564,7 @@ const MCPServerEdit: React.FC = ({ mcp_access_groups: accessGroups, alias: restValues.alias, // Include permission management fields - extra_headers: restValues.extra_headers?.length ? restValues.extra_headers : undefined, + extra_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,