diff --git a/src/utils/config.ts b/src/utils/config.ts index 78d6d65..1ada5f1 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -3,10 +3,14 @@ import * as path from 'path'; import * as os from 'os'; import { fileURLToPath } from 'url'; import { dirname } from 'path'; +import { exec } from 'child_process'; +import { promisify } from 'util'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); +const execAsync = promisify(exec); + export interface MCPServerConfig { command: string; args: string[]; @@ -58,7 +62,7 @@ export function writeConfig(config: ClaudeConfig): void { fs.writeFileSync(configPath, JSON.stringify(config, null, 2)); } -export function installMCPServer(packageName: string, envVars?: Record, runtime?: 'node' | 'python'): void { +export async function installMCPServer(packageName: string, envVars?: Record, runtime?: 'node' | 'python'): Promise { const config = readConfig(); const serverName = packageName.replace(/\//g, '-'); @@ -67,11 +71,21 @@ export function installMCPServer(packageName: string, envVars?: Record { const envVars = await promptForEnvVars(pkg.name); - installMCPServer(pkg.name, envVars, pkg.runtime); + await installMCPServer(pkg.name, envVars, pkg.runtime); console.log('Updated Claude desktop configuration'); await promptForRestart(); } catch (error) {