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
121 lines (100 loc) • 3.59 kB
JavaScript
/**
* AI-Debug Global Command
*
* Simple wrapper for the AI-Debug server with all 318 tools.
* Uses stdio mode for MCP protocol communication.
*/
const { spawn } = require('child_process');
const path = require('path');
// Find the original server path (with real implementations)
function findOriginalServerPath() {
// Try standard locations
const possiblePaths = [
'/Users/og/src/ai-debug-local-mcp/dist/server.js',
path.join(__dirname, '../../ai-debug-local-mcp/dist/server.js'),
path.join(process.cwd(), 'dist/server.js')
];
const fs = require('fs');
for (const serverPath of possiblePaths) {
if (fs.existsSync(serverPath)) {
return serverPath;
}
}
return null;
}
// Main execution - direct STDIO passthrough to original server
async function main() {
const serverPath = findOriginalServerPath();
if (!serverPath) {
console.error('❌ AI-Debug server not found. Please ensure ai-debug-local-mcp is installed.');
process.exit(1);
}
// Start original server in STDIO mode with direct passthrough
const serverProcess = spawn('node', [serverPath], {
stdio: ['inherit', 'inherit', 'inherit']
});
// Handle process events
serverProcess.on('error', (error) => {
console.error('❌ Error starting server:', error.message);
process.exit(1);
});
serverProcess.on('exit', (code, signal) => {
if (signal) {
console.error(`🛑 Server terminated by signal: ${signal}`);
} else if (code !== 0) {
console.error(`❌ Server exited with code: ${code}`);
}
process.exit(code || 0);
});
// Forward signals to server
process.on('SIGINT', () => serverProcess.kill('SIGINT'));
process.on('SIGTERM', () => serverProcess.kill('SIGTERM'));
}
// Handle CLI usage
if (process.argv.includes('--help') || process.argv.includes('-h')) {
console.log(`
AI-Debug MCP Server
Comprehensive debugging toolkit with 210+ specialized tools for web applications.
Usage:
ai-debug Start MCP server (stdio mode)
ai-debug --stdio Force STDIO mode (default)
ai-debug --http HTTP mode (coming soon)
ai-debug --help Show this help message
ai-debug --version Show version
Options:
--stdio Use STDIO transport for MCP protocol (default)
--http Use HTTP transport for browser/API access (not yet implemented)
--port HTTP port when using --http mode (default: 8081)
Features:
✓ 210+ debugging and testing tools
✓ Framework support: React, Vue, Angular, Next.js, Flutter, Phoenix/Elixir
✓ TDD with runtime bridging
✓ AI-powered analysis
✓ Performance profiling
✓ Visual regression testing
✓ Accessibility auditing
✓ And much more...
Examples:
ai-debug # Start in STDIO mode (for Claude, Cursor, etc.)
ai-debug --stdio # Explicitly use STDIO mode
ai-debug --http --port 3000 # HTTP mode on port 3000 (coming soon)
For documentation, visit: https://github.com/ai-debug/ai-debug-local-mcp
`);
process.exit(0);
}
if (process.argv.includes('--version') || process.argv.includes('-v')) {
console.log('ai-debug v3.0.3');
process.exit(0);
}
// Check for HTTP mode (not yet implemented)
if (process.argv.includes('--http')) {
console.error('❌ HTTP mode is not yet implemented.');
console.error('🔄 Using STDIO mode instead...');
console.error('');
}
// Start the main program
main().catch(error => {
console.error('❌ Global AI-Debug error:', error.message);
process.exit(1);
});