#!/usr/bin/env node
import { AccessibilityMCPServer } from './mcpServer.js';
import { startWebServer } from './webServer.js';
async function main() {
console.log('🚀 Starting servers...');
// Start the web server for the frontend UI
startWebServer();
// Start the MCP server for AI agent communication
const mcpServer = new AccessibilityMCPServer();
// Handle process termination gracefully
const cleanup = async () => {
console.log('\nShutting down servers...');
// The web server will be terminated by the process exit.
// If the MCP server had resources to clean up, it would be done here.
// await mcpServer.stop();
process.exit(0);
};
process.on('SIGINT', cleanup);
process.on('SIGTERM', cleanup);
try {
// The MCP server's start method is a long-running process that listens to stdio
await mcpServer.start();
} catch (error) {
console.error('Failed to start MCP server:', error);
process.exit(1);
}
}
// Start the servers
main().catch(console.error);