@ai-mapping/mcp-nextjs-dev
Version:
MCP server for managing Next.js development processes with AI tools
66 lines (52 loc) • 1.7 kB
JavaScript
/**
* @ai-mapping/nextjs-dev-mcp
* CLI entry point for the Next.js Development MCP Server
*/
// Check Node.js version
const nodeVersion = process.versions.node;
const majorVersion = parseInt(nodeVersion.split('.')[0], 10);
if (majorVersion < 22) {
console.error(`Error: Node.js 22 or higher is required. You are using ${nodeVersion}`);
process.exit(1);
}
// ESM entry point for the MCP server
import { startServer } from '../dist/server.js';
// Handle uncaught errors
process.on('uncaughtException', (error) => {
console.error('Uncaught Exception:', error);
process.exit(1);
});
process.on('unhandledRejection', (reason, promise) => {
console.error('Unhandled Rejection at:', promise, 'reason:', reason);
process.exit(1);
});
// Parse command line arguments
const args = process.argv.slice(2);
const debugMode = args.includes('--debug') || process.env.DEBUG === '1';
if (debugMode) {
console.error('[DEBUG] Starting Next.js Development MCP Server in debug mode');
console.error('[DEBUG] Node.js version:', nodeVersion);
console.error('[DEBUG] Working directory:', process.cwd());
}
// Show help if requested
if (args.includes('--help') || args.includes('-h')) {
console.log(`
@ai-mapping/nextjs-dev-mcp - MCP server for Next.js development
Usage:
nextjs-dev-mcp [options]
Options:
--debug Enable debug logging
--help Show this help message
Environment Variables:
DEBUG=1 Enable debug logging
For more information, visit:
https://github.com/ai-mapping/nextjs-dev-mcp
`);
process.exit(0);
}
// Start the server
startServer().catch((error) => {
console.error('Failed to start MCP server:', error);
process.exit(1);
});