@@ -18,7 +18,6 @@ import {
1818} from '../utils/sentry.ts' ;
1919import { version } from '../version.ts' ;
2020import process from 'node:process' ;
21- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' ;
2221import { bootstrapServer } from './bootstrap.ts' ;
2322import { createStartupProfiler , getStartupProfileNowMs } from './startup-profiler.ts' ;
2423import { getConfig } from '../utils/config-store.ts' ;
@@ -38,17 +37,13 @@ export async function startMcpServer(): Promise<void> {
3837 const isCrash = reason === 'uncaught-exception' || reason === 'unhandled-rejection' ;
3938 const event = isCrash ? 'crash' : 'shutdown' ;
4039
41- if ( reason === 'stdin-end' ) {
42- log ( 'info' , 'MCP stdin ended; shutting down MCP server' ) ;
43- } else if ( reason === 'stdin-close' ) {
44- log ( 'info' , 'MCP stdin closed; shutting down MCP server' ) ;
45- } else if ( reason === 'stdout-error' ) {
46- log ( 'info' , 'MCP stdout pipe broke; shutting down MCP server' ) ;
47- } else if ( reason === 'stderr-error' ) {
48- log ( 'info' , 'MCP stderr pipe broke; shutting down MCP server' ) ;
49- } else {
50- log ( 'info' , `MCP shutdown requested: ${ reason } ` ) ;
51- }
40+ const transportMessages : Record < string , string > = {
41+ 'stdin-end' : 'MCP stdin ended; shutting down MCP server' ,
42+ 'stdin-close' : 'MCP stdin closed; shutting down MCP server' ,
43+ 'stdout-error' : 'MCP stdout pipe broke; shutting down MCP server' ,
44+ 'stderr-error' : 'MCP stderr pipe broke; shutting down MCP server' ,
45+ } ;
46+ log ( 'info' , transportMessages [ reason ] ?? `MCP shutdown requested: ${ reason } ` ) ;
5247
5348 if ( ! isTransportDisconnectReason ( reason ) ) {
5449 recordMcpLifecycleMetric ( {
@@ -75,7 +70,7 @@ export async function startMcpServer(): Promise<void> {
7570 reason,
7671 error,
7772 snapshot,
78- server : server ? ( { close : ( ) => server . close ( ) } as Pick < McpServer , 'close' > ) : null ,
73+ server,
7974 } ) ;
8075
8176 lifecycle . detachProcessHandlers ( ) ;
0 commit comments