From f68c61d148077758c3b66de07388df2928dbf636 Mon Sep 17 00:00:00 2001 From: Dustin Healy Date: Mon, 28 Jul 2025 22:47:33 -0700 Subject: [PATCH] fix: change MCP config components to better handle servers without customUserVars - removes the subtle reinitialize button from config components of servers without customUserVars or OAuth - adds a placeholder message for components where servers have no customUserVars configured --- client/src/components/MCP/CustomUserVarsSection.tsx | 8 ++++++-- client/src/components/MCP/MCPConfigDialog.tsx | 1 + .../components/MCP/ServerInitializationSection.tsx | 11 +++++++++-- client/src/components/SidePanel/MCP/MCPPanel.tsx | 4 ++++ client/src/locales/en/translation.json | 1 + 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/client/src/components/MCP/CustomUserVarsSection.tsx b/client/src/components/MCP/CustomUserVarsSection.tsx index 1d6060c914..d97ce60086 100644 --- a/client/src/components/MCP/CustomUserVarsSection.tsx +++ b/client/src/components/MCP/CustomUserVarsSection.tsx @@ -114,9 +114,13 @@ export default function CustomUserVarsSection({ reset(); }; - // Don't render if no fields to configure + // Show message if no fields to configure if (!fields || Object.keys(fields).length === 0) { - return null; + return ( +
+ {localize('com_sidepanel_mcp_no_custom_vars', { '0': serverName })} +
+ ); } return ( diff --git a/client/src/components/MCP/MCPConfigDialog.tsx b/client/src/components/MCP/MCPConfigDialog.tsx index 1ad0ea7b63..5bcd590ec7 100644 --- a/client/src/components/MCP/MCPConfigDialog.tsx +++ b/client/src/components/MCP/MCPConfigDialog.tsx @@ -132,6 +132,7 @@ export default function MCPConfigDialog({ 0} /> diff --git a/client/src/components/MCP/ServerInitializationSection.tsx b/client/src/components/MCP/ServerInitializationSection.tsx index 36c9ca6b17..175d5d1906 100644 --- a/client/src/components/MCP/ServerInitializationSection.tsx +++ b/client/src/components/MCP/ServerInitializationSection.tsx @@ -7,11 +7,13 @@ import { useLocalize } from '~/hooks'; interface ServerInitializationSectionProps { serverName: string; requiresOAuth: boolean; + hasCustomUserVars?: boolean; } export default function ServerInitializationSection({ serverName, requiresOAuth, + hasCustomUserVars = false, }: ServerInitializationSectionProps) { const localize = useLocalize(); @@ -39,8 +41,8 @@ export default function ServerInitializationSection({ cancelOAuthFlow(serverName); }, [cancelOAuthFlow, serverName]); - // Show subtle reinitialize option if connected - if (isConnected) { + // Show subtle reinitialize option if connected AND server has OAuth or custom user vars + if (isConnected && (requiresOAuth || hasCustomUserVars)) { return (