@modelcontextprotocol/inspector 0.7.0 → 0.8.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/README.md CHANGED
@@ -30,7 +30,7 @@ npx @modelcontextprotocol/inspector -e KEY=value -e KEY2=$VALUE2 node build/inde
30
30
  npx @modelcontextprotocol/inspector -e KEY=$VALUE -- node build/index.js -e server-flag
31
31
  ```
32
32
 
33
- The inspector runs both a client UI (default port 5173) and an MCP proxy server (default port 3000). Open the client UI in your browser to use the inspector. You can customize the ports if needed:
33
+ The inspector runs both an MCP Inspector (MCPI) client UI (default port 6274) and an MCP Proxy (MCPP) server (default port 6277). Open the MCPI client UI in your browser to use the inspector. (These ports are derived from the T9 dialpad mapping of MCPI and MCPP respectively, as a mnemonic). You can customize the ports if needed:
34
34
 
35
35
  ```bash
36
36
  CLIENT_PORT=8080 SERVER_PORT=9000 npx @modelcontextprotocol/inspector node build/index.js
@@ -42,6 +42,19 @@ For more details on ways to use the inspector, see the [Inspector section of the
42
42
 
43
43
  The inspector supports bearer token authentication for SSE connections. Enter your token in the UI when connecting to an MCP server, and it will be sent in the Authorization header.
44
44
 
45
+ ### Security Considerations
46
+
47
+ The MCP Inspector includes a proxy server that can run and communicate with local MCP processes. The proxy server should not be exposed to untrusted networks as it has permissions to spawn local processes and can connect to any specified MCP server.
48
+
49
+ ### Configuration
50
+
51
+ The MCP Inspector supports the following configuration settings. To change them click on the `Configuration` button in the MCP Inspector UI :
52
+
53
+ | Name | Purpose | Default Value |
54
+ | -------------------------- | ----------------------------------------------------------------------------------------- | ------------- |
55
+ | MCP_SERVER_REQUEST_TIMEOUT | Maximum time in milliseconds to wait for a response from the MCP server before timing out | 10000 |
56
+ | MCP_PROXY_FULL_ADDRESS | The full URL of the MCP Inspector proxy server (e.g. `http://10.2.1.14:2277`) | `null` |
57
+
45
58
  ### From this repository
46
59
 
47
60
  If you're working on the inspector itself:
package/bin/cli.js CHANGED
@@ -7,7 +7,7 @@ import { fileURLToPath } from "url";
7
7
  const __dirname = dirname(fileURLToPath(import.meta.url));
8
8
 
9
9
  function delay(ms) {
10
- return new Promise((resolve) => setTimeout(resolve, ms));
10
+ return new Promise((resolve) => setTimeout(resolve, ms, true));
11
11
  }
12
12
 
13
13
  async function main() {
@@ -61,8 +61,8 @@ async function main() {
61
61
  "cli.js",
62
62
  );
63
63
 
64
- const CLIENT_PORT = process.env.CLIENT_PORT ?? "5173";
65
- const SERVER_PORT = process.env.SERVER_PORT ?? "3000";
64
+ const CLIENT_PORT = process.env.CLIENT_PORT ?? "6274";
65
+ const SERVER_PORT = process.env.SERVER_PORT ?? "6277";
66
66
 
67
67
  console.log("Starting MCP inspector...");
68
68
 
@@ -73,42 +73,40 @@ async function main() {
73
73
  cancelled = true;
74
74
  abort.abort();
75
75
  });
76
-
77
- const server = spawnPromise(
78
- "node",
79
- [
80
- inspectorServerPath,
81
- ...(command ? [`--env`, command] : []),
82
- ...(mcpServerArgs ? [`--args=${mcpServerArgs.join(" ")}`] : []),
83
- ],
84
- {
85
- env: {
86
- ...process.env,
87
- PORT: SERVER_PORT,
88
- MCP_ENV_VARS: JSON.stringify(envVars),
89
- },
90
- signal: abort.signal,
91
- echoOutput: true,
92
- },
93
- );
94
-
95
- const client = spawnPromise("node", [inspectorClientPath], {
96
- env: { ...process.env, PORT: CLIENT_PORT },
97
- signal: abort.signal,
98
- echoOutput: true,
99
- });
100
-
101
- // Make sure our server/client didn't immediately fail
102
- await Promise.any([server, client, delay(2 * 1000)]);
103
- const portParam = SERVER_PORT === "3000" ? "" : `?proxyPort=${SERVER_PORT}`;
104
- console.log(
105
- `\n🔍 MCP Inspector is up and running at http://localhost:${CLIENT_PORT}${portParam} 🚀`,
106
- );
107
-
76
+ let server, serverOk;
108
77
  try {
109
- await Promise.any([server, client]);
110
- } catch (e) {
111
- if (!cancelled || process.env.DEBUG) throw e;
78
+ server = spawnPromise(
79
+ "node",
80
+ [
81
+ inspectorServerPath,
82
+ ...(command ? [`--env`, command] : []),
83
+ ...(mcpServerArgs ? [`--args=${mcpServerArgs.join(" ")}`] : []),
84
+ ],
85
+ {
86
+ env: {
87
+ ...process.env,
88
+ PORT: SERVER_PORT,
89
+ MCP_ENV_VARS: JSON.stringify(envVars),
90
+ },
91
+ signal: abort.signal,
92
+ echoOutput: true,
93
+ },
94
+ );
95
+
96
+ // Make sure server started before starting client
97
+ serverOk = await Promise.race([server, delay(2 * 1000)]);
98
+ } catch (error) {}
99
+
100
+ if (serverOk) {
101
+ try {
102
+ await spawnPromise("node", [inspectorClientPath], {
103
+ env: { ...process.env, PORT: CLIENT_PORT },
104
+ signal: abort.signal,
105
+ echoOutput: true,
106
+ });
107
+ } catch (e) {
108
+ if (!cancelled || process.env.DEBUG) throw e;
109
+ }
112
110
  }
113
111
 
114
112
  return 0;
package/client/bin/cli.js CHANGED
@@ -15,5 +15,19 @@ const server = http.createServer((request, response) => {
15
15
  });
16
16
  });
17
17
 
18
- const port = process.env.PORT || 5173;
19
- server.listen(port, () => {});
18
+ const port = process.env.PORT || 6274;
19
+ server.on("listening", () => {
20
+ console.log(
21
+ `🔍 MCP Inspector is up and running at http://127.0.0.1:${port} 🚀`,
22
+ );
23
+ });
24
+ server.on("error", (err) => {
25
+ if (err.message.includes(`EADDRINUSE`)) {
26
+ console.error(
27
+ `❌ MCP Inspector PORT IS IN USE at http://127.0.0.1:${port} ❌ `,
28
+ );
29
+ } else {
30
+ throw err;
31
+ }
32
+ });
33
+ server.listen(port);
@@ -1,4 +1,4 @@
1
- import { r as reactExports, j as jsxRuntimeExports, S as SESSION_KEYS, a as auth, b as authProvider } from "./index-D7o7JmLV.js";
1
+ import { r as reactExports, j as jsxRuntimeExports, S as SESSION_KEYS, a as auth, b as authProvider } from "./index-D8hlx_TY.js";
2
2
  const OAuthCallback = () => {
3
3
  const hasProcessedRef = reactExports.useRef(false);
4
4
  reactExports.useEffect(() => {