@modelcontextprotocol/inspector-cli 0.16.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.js +5 -32
- package/package.json +1 -1
package/build/cli.js
CHANGED
|
@@ -24,50 +24,23 @@ function delay(ms) {
|
|
|
24
24
|
return new Promise((resolve) => setTimeout(resolve, ms, true));
|
|
25
25
|
}
|
|
26
26
|
async function runWebClient(args) {
|
|
27
|
-
const inspectorServerPath = resolve(__dirname, "../../", "server", "build", "index.js");
|
|
28
27
|
// Path to the client entry point
|
|
29
|
-
const inspectorClientPath = resolve(__dirname, "../../", "client", "bin", "
|
|
30
|
-
const CLIENT_PORT = process.env.CLIENT_PORT ?? "6274";
|
|
31
|
-
const SERVER_PORT = process.env.SERVER_PORT ?? "6277";
|
|
32
|
-
console.log("Starting MCP inspector...");
|
|
28
|
+
const inspectorClientPath = resolve(__dirname, "../../", "client", "bin", "start.js");
|
|
33
29
|
const abort = new AbortController();
|
|
34
30
|
let cancelled = false;
|
|
35
31
|
process.on("SIGINT", () => {
|
|
36
32
|
cancelled = true;
|
|
37
33
|
abort.abort();
|
|
38
34
|
});
|
|
39
|
-
let server;
|
|
40
|
-
let serverOk;
|
|
41
35
|
try {
|
|
42
|
-
|
|
43
|
-
inspectorServerPath,
|
|
44
|
-
...(args.command ? [`--env`, args.command] : []),
|
|
45
|
-
...(args.args ? [`--args=${args.args.join(" ")}`] : []),
|
|
46
|
-
], {
|
|
47
|
-
env: {
|
|
48
|
-
...process.env,
|
|
49
|
-
PORT: SERVER_PORT,
|
|
50
|
-
MCP_ENV_VARS: JSON.stringify(args.envArgs),
|
|
51
|
-
},
|
|
36
|
+
await spawnPromise("node", [inspectorClientPath], {
|
|
52
37
|
signal: abort.signal,
|
|
53
38
|
echoOutput: true,
|
|
54
39
|
});
|
|
55
|
-
// Make sure server started before starting client
|
|
56
|
-
serverOk = await Promise.race([server, delay(2 * 1000)]);
|
|
57
40
|
}
|
|
58
|
-
catch (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
await spawnPromise("node", [inspectorClientPath], {
|
|
62
|
-
env: { ...process.env, PORT: CLIENT_PORT },
|
|
63
|
-
signal: abort.signal,
|
|
64
|
-
echoOutput: true,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
catch (e) {
|
|
68
|
-
if (!cancelled || process.env.DEBUG)
|
|
69
|
-
throw e;
|
|
70
|
-
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
if (!cancelled || process.env.DEBUG)
|
|
43
|
+
throw e;
|
|
71
44
|
}
|
|
72
45
|
}
|
|
73
46
|
async function runCli(args) {
|