MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / runMcpStdioServer

Function runMcpStdioServer

apps/local/src/mcp.ts:297–326  ·  view source on GitHub ↗
(config: ExecutorMcpServerConfig)

Source from the content-addressed store, hash-verified

295// ---------------------------------------------------------------------------
296
297export const runMcpStdioServer = async (config: ExecutorMcpServerConfig): Promise<void> => {
298 startIntegrationsRefresh();
299
300 const server = await Effect.runPromise(createExecutorMcpServer(config));
301 const transport = new StdioServerTransport();
302
303 const waitForExit = () =>
304 new Promise<void>((resolve) => {
305 const finish = () => {
306 process.off("SIGINT", finish);
307 process.off("SIGTERM", finish);
308 process.stdin.off("end", finish);
309 process.stdin.off("close", finish);
310 resolve();
311 };
312 process.once("SIGINT", finish);
313 process.once("SIGTERM", finish);
314 process.stdin.once("end", finish);
315 process.stdin.once("close", finish);
316 });
317
318 // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: stdio server lifetime uses Promise-based SDK/process APIs and always closes resources
319 try {
320 await server.connect(transport);
321 await waitForExit();
322 } finally {
323 await ignoreClose(() => transport.close());
324 await ignoreClose(() => server.close());
325 }
326};

Callers

nothing calls this directly

Calls 6

startIntegrationsRefreshFunction · 0.90
createExecutorMcpServerFunction · 0.90
waitForExitFunction · 0.85
ignoreCloseFunction · 0.70
connectMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected