@@ -50,71 +50,29 @@ function delay(ms: number): Promise<void> {
50
50
}
51
51
52
52
async function runWebClient ( args : Args ) : Promise < void > {
53
- const inspectorServerPath = resolve (
54
- __dirname ,
55
- "../../" ,
56
- "server" ,
57
- "build" ,
58
- "index.js" ,
59
- ) ;
60
-
61
53
// Path to the client entry point
62
54
const inspectorClientPath = resolve (
63
55
__dirname ,
64
56
"../../" ,
65
57
"client" ,
66
58
"bin" ,
67
- "client .js" ,
59
+ "start .js" ,
68
60
) ;
69
61
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
-
75
62
const abort = new AbortController ( ) ;
76
63
let cancelled : boolean = false ;
77
64
process . on ( "SIGINT" , ( ) => {
78
65
cancelled = true ;
79
66
abort . abort ( ) ;
80
67
} ) ;
81
68
82
- let server : ReturnType < typeof spawnPromise > ;
83
- let serverOk : unknown ;
84
-
85
69
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 ;
118
76
}
119
77
}
120
78
0 commit comments