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

Function runMcpStdioServer

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

Source from the content-addressed store, hash-verified

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

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