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

Function runMcpStdioServer

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

Source from the content-addressed store, hash-verified

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

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