UNPKG

claude-code-subagents-orchestrator

Version:

Claude Code Sub-agents Orchestrator - A powerful MCP server for orchestrating multiple AI sub-agents for complex task execution in Claude Code

75 lines (57 loc) 2.29 kB
#!/usr/bin/env node /** * Pre-uninstall script for Claude Code Subagents Orchestrator * Cleans up MCP server registration */ import fs from 'fs-extra'; import path from 'path'; import os from 'os'; import chalk from 'chalk'; // Platform-specific paths for Claude Code configuration const CLAUDE_CONFIG_PATHS = { win32: path.join(os.homedir(), 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json'), darwin: path.join(os.homedir(), 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json'), linux: path.join(os.homedir(), '.config', 'claude', 'claude_desktop_config.json') }; async function preUninstall() { console.log(chalk.blue('🧹 Cleaning up Claude Code Subagents Orchestrator...')); try { // Skip cleanup in CI environments if (process.env.CI || process.env.NODE_ENV === 'test') { console.log(chalk.yellow('⏭️ Skipping cleanup in CI environment')); return; } const platform = os.platform(); const configPath = CLAUDE_CONFIG_PATHS[platform]; if (!configPath || !await fs.pathExists(configPath)) { console.log(chalk.yellow('⚠️ Claude Code configuration not found')); return; } // Remove MCP server registration await unregisterMCPServer(configPath); console.log(chalk.green('✅ Cleanup completed successfully')); } catch (error) { console.error(chalk.red('❌ Cleanup failed:'), error.message); console.log(chalk.yellow('💡 You may need to manually remove the MCP server configuration')); } } async function unregisterMCPServer(configPath) { const config = await fs.readJson(configPath); if (!config.mcpServers) { console.log(chalk.yellow('⚠️ No MCP servers configured')); return; } const serverName = 'claude-code-subagents-orchestrator'; if (!config.mcpServers[serverName]) { console.log(chalk.yellow(`⚠️ MCP server "${serverName}" not found`)); return; } delete config.mcpServers[serverName]; // Write updated configuration await fs.writeJson(configPath, config, { spaces: 2 }); console.log(chalk.green(`✅ Unregistered MCP server: ${serverName}`)); } // Only run if called directly if (import.meta.url === `file://${process.argv[1]}`) { preUninstall(); }