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

Function runMcpStdioServer

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

Source from the content-addressed store, hash-verified

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

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