Skip to content

Commit 8423776

Browse files
committed
Fixed conflicts
1 parent 73d4cec commit 8423776

File tree

7 files changed

+1008
-706
lines changed

7 files changed

+1008
-706
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The MCP Inspector includes a proxy server that can run and communicate with loca
4848

4949
### Configuration
5050

51-
The MCP Inspector supports the following configuration settings. To change them click on the `Configuration` button in the MCP Inspector UI:
51+
The MCP Inspector supports the following configuration settings. To change them, click on the `Configuration` button in the MCP Inspector UI:
5252

5353
| Name | Purpose | Default Value |
5454
| -------------------------- | ----------------------------------------------------------------------------------------- | ------------- |

bin/cli.js

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -37,48 +37,47 @@ async function runWebClient(args) {
3737
"bin",
3838
"cli.js",
3939
);
40-
const CLIENT_PORT = process.env.CLIENT_PORT ?? "5173";
41-
const SERVER_PORT = process.env.SERVER_PORT ?? "3000";
40+
const CLIENT_PORT = process.env.CLIENT_PORT ?? "6274";
41+
const SERVER_PORT = process.env.SERVER_PORT ?? "6277";
4242
console.log("Starting MCP inspector...");
4343
const abort = new AbortController();
4444
let cancelled = false;
4545
process.on("SIGINT", () => {
4646
cancelled = true;
4747
abort.abort();
4848
});
49-
const server = spawnPromise(
50-
"node",
51-
[
52-
inspectorServerPath,
53-
...(args.command ? [`--env`, args.command] : []),
54-
...(args.args ? [`--args=${args.args.join(" ")}`] : []),
55-
],
56-
{
57-
env: {
58-
...process.env,
59-
PORT: SERVER_PORT,
60-
MCP_ENV_VARS: JSON.stringify(args.envArgs),
61-
},
62-
signal: abort.signal,
63-
echoOutput: true,
64-
},
65-
);
66-
const client = spawnPromise("node", [inspectorClientPath], {
67-
env: { ...process.env, PORT: CLIENT_PORT },
68-
signal: abort.signal,
69-
echoOutput: true,
70-
});
71-
// Make sure our server/client didn't immediately fail
72-
await Promise.any([server, client, delay(2 * 1000)]);
73-
const portParam = SERVER_PORT === "3000" ? "" : `?proxyPort=${SERVER_PORT}`;
74-
console.log(
75-
`\n🔍 MCP Inspector is up and running at http://127.0.0.1:${CLIENT_PORT}${portParam} 🚀`,
76-
);
49+
let server;
50+
let serverOk;
7751
try {
78-
await Promise.any([server, client]);
79-
} catch (e) {
80-
if (!cancelled || process.env.DEBUG) {
81-
throw e;
52+
server = spawnPromise(
53+
"node",
54+
[
55+
inspectorServerPath,
56+
...(args.command ? [`--env`, args.command] : []),
57+
...(args.args ? [`--args=${args.args.join(" ")}`] : []),
58+
],
59+
{
60+
env: {
61+
...process.env,
62+
PORT: SERVER_PORT,
63+
MCP_ENV_VARS: JSON.stringify(args.envArgs),
64+
},
65+
signal: abort.signal,
66+
echoOutput: true,
67+
},
68+
);
69+
// Make sure server started before starting client
70+
serverOk = await Promise.race([server, delay(2 * 1000)]);
71+
} catch (error) {}
72+
if (serverOk) {
73+
try {
74+
await spawnPromise("node", [inspectorClientPath], {
75+
env: { ...process.env, PORT: CLIENT_PORT },
76+
signal: abort.signal,
77+
echoOutput: true,
78+
});
79+
} catch (e) {
80+
if (!cancelled || process.env.DEBUG) throw e;
8281
}
8382
}
8483
}

bin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modelcontextprotocol/inspector-bin",
3-
"version": "0.7.0",
3+
"version": "0.8.2",
44
"description": "Model Context Protocol inspector",
55
"license": "MIT",
66
"author": "Anthropic, PBC (https://anthropic.com)",

bin/src/index.ts

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -67,55 +67,53 @@ async function runWebClient(args: Args): Promise<void> {
6767
"cli.js",
6868
);
6969

70-
const CLIENT_PORT = process.env.CLIENT_PORT ?? "5173";
71-
const SERVER_PORT = process.env.SERVER_PORT ?? "3000";
70+
const CLIENT_PORT: string = process.env.CLIENT_PORT ?? "6274";
71+
const SERVER_PORT: string = process.env.SERVER_PORT ?? "6277";
7272

7373
console.log("Starting MCP inspector...");
7474

7575
const abort = new AbortController();
76-
77-
let cancelled = false;
76+
let cancelled: boolean = false;
7877
process.on("SIGINT", () => {
7978
cancelled = true;
8079
abort.abort();
8180
});
8281

83-
const server = spawnPromise(
84-
"node",
85-
[
86-
inspectorServerPath,
87-
...(args.command ? [`--env`, args.command] : []),
88-
...(args.args ? [`--args=${args.args.join(" ")}`] : []),
89-
],
90-
{
91-
env: {
92-
...process.env,
93-
PORT: SERVER_PORT,
94-
MCP_ENV_VARS: JSON.stringify(args.envArgs),
95-
},
96-
signal: abort.signal,
97-
echoOutput: true,
98-
},
99-
);
100-
101-
const client = spawnPromise("node", [inspectorClientPath], {
102-
env: { ...process.env, PORT: CLIENT_PORT },
103-
signal: abort.signal,
104-
echoOutput: true,
105-
});
106-
107-
// Make sure our server/client didn't immediately fail
108-
await Promise.any([server, client, delay(2 * 1000)]);
109-
const portParam = SERVER_PORT === "3000" ? "" : `?proxyPort=${SERVER_PORT}`;
110-
console.log(
111-
`\n🔍 MCP Inspector is up and running at http://127.0.0.1:${CLIENT_PORT}${portParam} 🚀`,
112-
);
82+
let server: ReturnType<typeof spawnPromise>;
83+
let serverOk: unknown;
11384

11485
try {
115-
await Promise.any([server, client]);
116-
} catch (e) {
117-
if (!cancelled || process.env.DEBUG) {
118-
throw e;
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;
119117
}
120118
}
121119
}

cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modelcontextprotocol/inspector-cli",
3-
"version": "0.7.0",
3+
"version": "0.8.2",
44
"description": "CLI for the Model Context Protocol inspector",
55
"license": "MIT",
66
"author": "Nicolas Barraud",

0 commit comments

Comments
 (0)