ai-debug-local-mcp
Version:
🎯 ENHANCED AI GUIDANCE v4.1.2: Dramatically improved tool descriptions help AI users choose the right tools instead of 'close enough' options. Ultra-fast keyboard automation (10x speed), universal recording, multi-ecosystem debugging support, and compreh
61 lines (49 loc) • 1.57 kB
JavaScript
const { spawn } = require('child_process');
const path = require('path');
const fs = require('fs');
// Parse command line arguments
const args = process.argv.slice(2);
const isHelp = args.includes('--help') || args.includes('-h');
const isServe = args.includes('serve');
// Show help
if (isHelp || args.length === 0) {
console.log(`
AI Debug MCP Server
Usage:
ai-debug-mcp serve Start the MCP server
ai-debug-mcp --help Show this help message
When used with Claude Desktop, the server starts automatically.
`);
process.exit(0);
}
// Main logic
if (isServe || process.argv.includes('--stdio')) {
// Find the server script
const projectRoot = path.join(__dirname, '..');
const serverScript = path.join(projectRoot, 'dist', 'server.js');
if (!fs.existsSync(serverScript)) {
console.error('Error: Server not found. Please run: npm run build');
process.exit(1);
}
console.log('Starting AI Debug MCP Server...');
// Spawn the server
const server = spawn('node', [serverScript], {
stdio: 'inherit',
env: { ...process.env }
});
server.on('error', (err) => {
console.error('Failed to start server:', err);
process.exit(1);
});
server.on('exit', (code) => {
process.exit(code || 0);
});
// Handle signals
process.on('SIGINT', () => server.kill('SIGINT'));
process.on('SIGTERM', () => server.kill('SIGTERM'));
} else {
console.error(`Unknown command: ${args[0]}`);
console.error('Run "ai-debug-mcp --help" for usage information.');
process.exit(1);
}