Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | 1x 1x 1x 1x 6x 6x 6x 6x 1x 1x 1x 1x 6x 1x 1x 1x 1x 6x 6x 2x 2x 2x 1x 4x 4x 4x 4x 4x 4x 1x 1x 1x 1x | import { NexusProxyServer } from './server/NexusProxyServer.js'; import { defineCommand, runMain } from 'citty'; import { logger } from './utils/logger.js'; const stdio = defineCommand({ meta: { name: 'stdio', description: 'Run in STDIO mode (default)', }, args: { config: { type: 'string', description: 'Path to configuration file', alias: 'c', required: false, }, }, async run() { // Enable file logging for STDIO mode to keep stderr clean for MCP protocol logger.setStdioMode(true); logger.log(`Starting Project Nexus MCP Server in STDIO mode. Log file: ${logger.getLogFile()}`); const server = new NexusProxyServer(); process.on('SIGINT', () => { void (async () => { logger.log('Received SIGINT, shutting down gracefully'); await server.shutdown(); process.exit(0); })(); }); process.on('SIGTERM', () => { void (async () => { logger.log('Received SIGTERM, shutting down gracefully'); await server.shutdown(); process.exit(0); })(); }); try { await server.runStdio(); } catch (error) { logger.error('Failed to start server:', error); process.stderr.write( `Failed to start server: ${error instanceof Error ? error.message : String(error)}\n`, ); process.exit(1); } }, }); const http = defineCommand({ meta: { name: 'http', description: 'Run as HTTP/SSE server', }, args: { port: { type: 'string', description: 'Port to listen on', default: '3000', alias: 'p', }, config: { type: 'string', description: 'Path to configuration file', alias: 'c', required: false, }, }, async run(ctx) { const server = new NexusProxyServer(); const port = parseInt(ctx.args.port, 10); process.on('SIGINT', () => { void (async () => { await server.shutdown(); process.exit(0); })(); }); process.on('SIGTERM', () => { void (async () => { await server.shutdown(); process.exit(0); })(); }); try { await server.runHttp(port); } catch (error) { process.stderr.write( `Failed to start server: ${error instanceof Error ? error.message : String(error)}\n`, ); process.exit(1); } }, }); const main = defineCommand({ meta: { name: 'project-nexus-mcp', description: 'Unified MCP proxy for DevOps platforms', version: '1.0.0', }, subCommands: { stdio, http, }, }); runMain(main).catch((error: unknown) => { process.stderr.write(`Fatal error: ${error instanceof Error ? error.message : String(error)}\n`); process.exit(1); }); |