File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
55import express from 'express' ;
66import { stdin as input , stdout as output } from 'node:process' ;
77import { createInterface } from 'node:readline/promises' ;
8+ import { promisify } from 'node:util' ;
89import { config } from './config/config.js' ;
910import { fetchPrompt } from './fetch.prompt.js' ;
1011import { fetchTool } from './fetch.tool.js' ;
@@ -69,8 +70,14 @@ const expressServer = app.listen(config.port);
6970
7071console . log ( `Server is running on port ${ config . port . toString ( ) } ` ) ;
7172
72- await createInterface ( { input, output } ) . question ( 'Press enter to exit...\n' ) ;
73+ const readline = createInterface ( { input, output } ) ;
7374
74- expressServer . close ( ) ;
75+ await readline . question ( 'Press enter to exit...\n' ) ;
76+
77+ readline . close ( ) ;
78+
79+ expressServer . closeAllConnections ( ) ;
80+
81+ await promisify ( expressServer . close ) ( ) ;
7582
7683await server . close ( ) ;
You can’t perform that action at this time.
0 commit comments