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

Function runMcpStdioServer

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

Source from the content-addressed store, hash-verified

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

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