MCPcopy Create free account
hub / github.com/getsentry/XcodeBuildMCP / shutdown

Function shutdown

src/server/mcp-lifecycle.ts:427–454  ·  view source on GitHub ↗
(reason: McpShutdownReason, error?: unknown)

Source from the content-addressed store, hash-verified

425 },
426
427 async shutdown(reason: McpShutdownReason, error?: unknown): Promise<void> {
428 if (state.shutdownPromise) {
429 return state.shutdownPromise;
430 }
431
432 state.shutdownRequested = true;
433 state.shutdownReason = reason;
434 const phaseAtShutdown = state.phase;
435 state.phase = 'shutting-down';
436
437 state.shutdownPromise = (async (): Promise<void> => {
438 const snapshot = await buildMcpLifecycleSnapshot({
439 phase: phaseAtShutdown,
440 shutdownReason: state.shutdownReason,
441 startedAtMs: state.startedAtMs,
442 commandExecutor: options.commandExecutor,
443 });
444 await options.onShutdown({
445 reason,
446 error,
447 snapshot,
448 server: state.server,
449 });
450 state.phase = 'stopped';
451 })();
452
453 return state.shutdownPromise;
454 },
455 };
456
457 return coordinator;

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected