/** * ExternalUninstallDialog — confirmation modal for uninstalling external MCP servers. * * Shows persona dependency warnings before confirming. Non-destructive: * the server files remain on disk and can be reinstalled at any time. * Tools are disabled (not deleted) and automatically re-enabled on reinstall. * * Fully additive — does not modify any existing component. */ import React, { useEffect, useState } from 'react'; import { AlertTriangle, Loader2, X, Users, Wrench } from 'lucide-react'; export function ExternalUninstallDialog({ server, backendUrl, apiKey, onClose, onConfirmUninstall, preview: externalPreview, }) { const [preview, setPreview] = useState(externalPreview ?? null); const [loadingPreview, setLoadingPreview] = useState(!externalPreview); // Fetch preview on mount if not provided useEffect(() => { if (externalPreview) return; const fetchPreview = async () => { setLoadingPreview(true); try { const headers = {}; if (apiKey) headers['x-api-key'] = apiKey; const res = await fetch(`${backendUrl}/v1/agentic/servers/external/${encodeURIComponent(server.id)}/uninstall-preview`, { headers }); if (res.ok) { setPreview(await res.json()); } } catch { // Preview failed — still allow uninstall } finally { setLoadingPreview(false); } }; void fetchPreview(); }, [server.id, backendUrl, apiKey, externalPreview]); const affectedCount = preview?.affected_personas?.length ?? 0; const toolCount = preview?.tools_to_deactivate?.length ?? server.tools_discovered ?? 0; return (
These personas will lose access to {server.label} tools until the server is reinstalled.
This will stop {server.label} and deactivate its tools from your HomePilot instance.
{/* Safety info */}Non-destructive: Server files remain on disk. No data is deleted.
Reversible: Reinstall anytime — disabled tools will be re-enabled automatically.
{affectedCount > 0 && (Personas: Affected personas will have this tool disabled. Re-importing or reinstalling restores them.
)}