#!/usr/bin/env node /** * Project Mind MCP - Installation Helper * * Assists with configuring Claude Desktop for Project Mind MCP. */ import * as fs from 'fs'; import * as path from 'path'; import * as os from 'os'; const CONFIG_PATHS = { windows: 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'), }; function getConfigPath(): string { const platform = os.platform(); if (platform === 'win32') return CONFIG_PATHS.windows; if (platform === 'darwin') return CONFIG_PATHS.darwin; return CONFIG_PATHS.linux; } function getCurrentPath(): string { return path.resolve(process.cwd(), 'dist', 'index.js'); } async function main() { console.log('šŸš€ Project Mind MCP - Installation Helper\n'); // Get config path const configPath = getConfigPath(); console.log(`šŸ“ Configuration file: ${configPath}\n`); // Check if config exists const configExists = fs.existsSync(configPath); if (!configExists) { console.log('āš ļø Configuration file does not exist. Creating...\n'); // Create directory if needed const configDir = path.dirname(configPath); if (!fs.existsSync(configDir)) { fs.mkdirSync(configDir, { recursive: true }); } } // Read existing config or create new let config: any = { mcpServers: {} }; if (configExists) { try { const content = fs.readFileSync(configPath, 'utf8'); config = JSON.parse(content); if (!config.mcpServers) { config.mcpServers = {}; } console.log('āœ… Existing configuration found\n'); } catch (error) { console.error('āŒ Error reading configuration:', error); process.exit(1); } } // Check if Project Mind already configured if (config.mcpServers['project-mind']) { console.log('āš ļø Project Mind MCP is already configured:\n'); console.log(JSON.stringify(config.mcpServers['project-mind'], null, 2)); console.log('\nTo reconfigure, manually edit the config file or remove the existing entry.\n'); return; } // Add Project Mind configuration const projectMindPath = getCurrentPath(); config.mcpServers['project-mind'] = { command: 'node', args: [projectMindPath] }; // Write configuration try { fs.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf8'); console.log('āœ… Configuration updated successfully!\n'); console.log('šŸ“ Project Mind MCP configuration:\n'); console.log(JSON.stringify(config.mcpServers['project-mind'], null, 2)); console.log('\nšŸ”„ Next steps:'); console.log('1. Restart Claude Desktop completely'); console.log('2. Open a new conversation'); console.log('3. Type: "Use Project Mind to check connection"\n'); console.log('šŸ“š For detailed integration guide, see: docs/INTEGRATION.md\n'); } catch (error) { console.error('āŒ Error writing configuration:', error); process.exit(1); } } main().catch(console.error);