File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -16,10 +16,30 @@ const inspectorClientPath = join(__dirname, "../client/bin/cli.js");
16
16
17
17
console . log ( "Starting MCP inspector..." ) ;
18
18
19
+ function escapeArg ( arg ) {
20
+ if ( arg . includes ( " " ) || arg . includes ( "'" ) || arg . includes ( '"' ) ) {
21
+ return `\\"${ arg . replace ( / " / g, '\\\\\\"' ) } \\"` ;
22
+ }
23
+ return arg ;
24
+ }
25
+
26
+ const serverCommand = [
27
+ `node` ,
28
+ inspectorServerPath ,
29
+ command ? `--env ${ escapeArg ( command ) } ` : "" ,
30
+ mcpServerArgs . length
31
+ ? `--args="${ mcpServerArgs . map ( escapeArg ) . join ( " " ) } "`
32
+ : "" ,
33
+ ]
34
+ . filter ( Boolean )
35
+ . join ( " " ) ;
36
+
37
+ console . log ( serverCommand ) ;
38
+
19
39
const { result } = concurrently (
20
40
[
21
41
{
22
- command : `node ${ inspectorServerPath } ${ command ? ` --env ${ command } ` : "" } ${ mcpServerArgs . length ? ` --args=" ${ mcpServerArgs . join ( " " ) } "` : "" } ` ,
42
+ command : serverCommand ,
23
43
name : "server" ,
24
44
} ,
25
45
{
You can’t perform that action at this time.
0 commit comments