| 9 | import { runMcpServer } from '../../mcp/server.js' |
| 10 | |
| 11 | export async function cmdMcp(): Promise<void> { |
| 12 | await runMcpServer() |
| 13 | // The MCP SDK's connect() returns once stdin/stdout listeners are |
| 14 | // wired up. Node's event loop keeps the process alive while those |
| 15 | // listeners exist — but the CLI dispatcher would otherwise see this |
| 16 | // promise resolve and call process.exit(0), tearing down stdin |
| 17 | // before the client can send any requests. Awaiting indefinitely |
| 18 | // here pins the process to whatever lifetime the parent client |
| 19 | // (Claude Code / Desktop / Codex) chooses to give it. |
| 20 | await new Promise<void>(() => {}) |
| 21 | } |