@@ -50,71 +50,29 @@ function delay(ms: number): Promise<void> {
5050}
5151
5252async function runWebClient ( args : Args ) : Promise < void > {
53- const inspectorServerPath = resolve (
54- __dirname ,
55- "../../" ,
56- "server" ,
57- "build" ,
58- "index.js" ,
59- ) ;
60-
6153 // Path to the client entry point
6254 const inspectorClientPath = resolve (
6355 __dirname ,
6456 "../../" ,
6557 "client" ,
6658 "bin" ,
67- "client .js" ,
59+ "start .js" ,
6860 ) ;
6961
70- const CLIENT_PORT : string = process . env . CLIENT_PORT ?? "6274" ;
71- const SERVER_PORT : string = process . env . SERVER_PORT ?? "6277" ;
72-
73- console . log ( "Starting MCP inspector..." ) ;
74-
7562 const abort = new AbortController ( ) ;
7663 let cancelled : boolean = false ;
7764 process . on ( "SIGINT" , ( ) => {
7865 cancelled = true ;
7966 abort . abort ( ) ;
8067 } ) ;
8168
82- let server : ReturnType < typeof spawnPromise > ;
83- let serverOk : unknown ;
84-
8569 try {
86- server = spawnPromise (
87- "node" ,
88- [
89- inspectorServerPath ,
90- ...( args . command ? [ `--env` , args . command ] : [ ] ) ,
91- ...( args . args ? [ `--args=${ args . args . join ( " " ) } ` ] : [ ] ) ,
92- ] ,
93- {
94- env : {
95- ...process . env ,
96- PORT : SERVER_PORT ,
97- MCP_ENV_VARS : JSON . stringify ( args . envArgs ) ,
98- } ,
99- signal : abort . signal ,
100- echoOutput : true ,
101- } ,
102- ) ;
103-
104- // Make sure server started before starting client
105- serverOk = await Promise . race ( [ server , delay ( 2 * 1000 ) ] ) ;
106- } catch ( error ) { }
107-
108- if ( serverOk ) {
109- try {
110- await spawnPromise ( "node" , [ inspectorClientPath ] , {
111- env : { ...process . env , PORT : CLIENT_PORT } ,
112- signal : abort . signal ,
113- echoOutput : true ,
114- } ) ;
115- } catch ( e ) {
116- if ( ! cancelled || process . env . DEBUG ) throw e ;
117- }
70+ await spawnPromise ( "node" , [ inspectorClientPath ] , {
71+ signal : abort . signal ,
72+ echoOutput : true ,
73+ } ) ;
74+ } catch ( e ) {
75+ if ( ! cancelled || process . env . DEBUG ) throw e ;
11876 }
11977}
12078
0 commit comments