MCPcopy
hub / github.com/21st-dev/magic-mcp / cleanup

Function cleanup

src/index.ts:33–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31 let isShuttingDown = false;
32
33 const cleanup = () => {
34 if (isShuttingDown) return;
35 isShuttingDown = true;
36
37 console.log(`Shutting down server (PID: ${process.pid})...`);
38 try {
39 transport.close();
40 } catch (error) {
41 console.error(`Error closing transport (PID: ${process.pid}):`, error);
42 }
43 console.log(`Server closed (PID: ${process.pid})`);
44 process.exit(0);
45 };
46
47 transport.onerror = (error: Error) => {
48 console.error(`Transport error (PID: ${process.pid}):`, error);

Callers 1

runServerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected