From 7f35aacebb2fc928afb29c176f3797eaee348f7f Mon Sep 17 00:00:00 2001 From: Dustin Healy Date: Mon, 21 Jul 2025 08:17:19 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20refactor:=20Remove=20unused=20se?= =?UTF-8?q?rver=20reinitialization=20logic=20from=20MCPPanel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Removed the `handleReinitializeServer` function. - Removed the `ServerConfigWithVars` interface. --- .../src/components/SidePanel/MCP/MCPPanel.tsx | 88 ------------------- 1 file changed, 88 deletions(-) diff --git a/client/src/components/SidePanel/MCP/MCPPanel.tsx b/client/src/components/SidePanel/MCP/MCPPanel.tsx index 1bfc96e35a..69dc263422 100644 --- a/client/src/components/SidePanel/MCP/MCPPanel.tsx +++ b/client/src/components/SidePanel/MCP/MCPPanel.tsx @@ -20,13 +20,6 @@ import { type ConfigFieldDetail, } from '~/components/ui/MCP'; -interface ServerConfigWithVars { - serverName: string; - config: { - customUserVars: Record; - }; -} - export default function MCPPanel() { const localize = useLocalize(); const { showToast } = useToastContext(); @@ -116,87 +109,6 @@ export default function MCPPanel() { setSelectedServerNameForEditing(null); }; - const handleReinitializeServer = useCallback( - async (serverName: string) => { - try { - const response = await reinitializeMCPMutation.mutateAsync(serverName); - - // Check if OAuth is required - if (response.oauthRequired) { - if (response.authURL) { - // Show OAuth URL to user - showToast({ - message: `OAuth required for ${serverName}. Please visit the authorization URL.`, - status: 'info', - }); - - // Open OAuth URL in new window/tab - window.open(response.authURL, '_blank', 'noopener,noreferrer'); - - // Show a more detailed message with the URL - setTimeout(() => { - showToast({ - message: `OAuth URL opened for ${serverName}. Complete authentication and try reinitializing again.`, - status: 'info', - }); - }, 1000); - } else { - showToast({ - message: `OAuth authentication required for ${serverName}. Please configure OAuth credentials.`, - status: 'warning', - }); - } - } else if (response.oauthCompleted) { - showToast({ - message: - response.message || - `MCP server '${serverName}' reinitialized successfully after OAuth`, - status: 'success', - }); - } else { - showToast({ - message: response.message || `MCP server '${serverName}' reinitialized successfully`, - status: 'success', - }); - } - } catch (error) { - console.error('Error reinitializing MCP server:', error); - - // Check if the error response contains OAuth information - if ((error as any)?.response?.data?.oauthRequired) { - const errorData = (error as any).response.data; - if (errorData.authURL) { - showToast({ - message: `OAuth required for ${serverName}. Please visit the authorization URL.`, - status: 'info', - }); - - // Open OAuth URL in new window/tab - window.open(errorData.authURL, '_blank', 'noopener,noreferrer'); - - setTimeout(() => { - showToast({ - message: `OAuth URL opened for ${serverName}. Complete authentication and try reinitializing again.`, - status: 'info', - }); - }, 1000); - } else { - showToast({ - message: errorData.message || `OAuth authentication required for ${serverName}`, - status: 'warning', - }); - } - } else { - showToast({ - message: 'Failed to reinitialize MCP server', - status: 'error', - }); - } - } - }, - [showToast, reinitializeMCPMutation], - ); - // Create save and revoke handlers with latest state const handleSave = useCallback( (updatedValues: Record) => {