INNER CODE UNIT · TypeScript
releaseMcp
AmrDab/clawdcursor · src/surface/cli.ts:1416
const releaseMcp = () => {
if (mcpExiting) return;
mcpExiting = true;
releasePidFile('mcp'); // sync — must run before any segfault
setImmediate(() => process.exit(0)); // deferred — lets libuv unwind cleanly
};
process.on('SIGINT', releaseMcp);
process.on('SIGTERM', releaseMcp);
// On-screen control banner for EXTERNAL agents driving over stdio. The
// mcp-server tool wrapper touches it on every consequential call; a
// double-click is the human kill switch — exiting the server severs the
// editor's desktop control (the host respawns a fresh server on demand).
const { controlBanner } = await import('../core/banner');
if (opts.banner === false) controlBanner.setEnabled(false);
controlBanner.configure({
onStopRequested: () => {
process.stderr.write('\n[STOP] Control banner double-clicked — shutting down the MCP server.\n');