@modelcontextprotocol/inspector 0.14.3 → 0.16.0

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.
@@ -5,10 +5,10 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/mcp.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>MCP Inspector</title>
8
- <script type="module" crossorigin src="/assets/index-DYfnI33L.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-C1MLjTGf.css">
8
+ <script type="module" crossorigin src="/assets/index-DI7JCTeu.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-BwWj6LL9.css">
10
10
  </head>
11
11
  <body>
12
- <div id="root"></div>
12
+ <div id="root" class="w-full"></div>
13
13
  </body>
14
14
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelcontextprotocol/inspector",
3
- "version": "0.14.3",
3
+ "version": "0.16.0",
4
4
  "description": "Model Context Protocol inspector",
5
5
  "license": "MIT",
6
6
  "author": "Anthropic, PBC (https://anthropic.com)",
@@ -27,13 +27,14 @@
27
27
  "build-client": "cd client && npm run build",
28
28
  "build-cli": "cd cli && npm run build",
29
29
  "clean": "rimraf ./node_modules ./client/node_modules ./cli/node_modules ./build ./client/dist ./server/build ./cli/build ./package-lock.json && npm install",
30
- "dev": "concurrently \"cd client && npm run dev\" \"cd server && npm run dev\"",
31
- "dev:windows": "concurrently \"cd client && npm run dev\" \"cd server && npm run dev:windows\"",
30
+ "dev": "node client/bin/start.js --dev",
31
+ "dev:windows": "node client/bin/start.js --dev",
32
32
  "start": "node client/bin/start.js",
33
33
  "start-server": "cd server && npm run start",
34
34
  "start-client": "cd client && npm run preview",
35
35
  "test": "npm run prettier-check && cd client && npm test",
36
36
  "test-cli": "cd cli && npm run test",
37
+ "test:e2e": "MCP_AUTO_OPEN_ENABLED=false npm run test:e2e --workspace=client",
37
38
  "prettier-fix": "prettier --write .",
38
39
  "prettier-check": "prettier --check .",
39
40
  "lint": "prettier --check . && cd client && npm run lint",
@@ -43,10 +44,10 @@
43
44
  "check-version": "node scripts/check-version-consistency.js"
44
45
  },
45
46
  "dependencies": {
46
- "@modelcontextprotocol/inspector-cli": "^0.14.3",
47
- "@modelcontextprotocol/inspector-client": "^0.14.3",
48
- "@modelcontextprotocol/inspector-server": "^0.14.3",
49
- "@modelcontextprotocol/sdk": "^1.12.1",
47
+ "@modelcontextprotocol/inspector-cli": "^0.16.0",
48
+ "@modelcontextprotocol/inspector-client": "^0.16.0",
49
+ "@modelcontextprotocol/inspector-server": "^0.16.0",
50
+ "@modelcontextprotocol/sdk": "^1.13.1",
50
51
  "concurrently": "^9.0.1",
51
52
  "open": "^10.1.0",
52
53
  "shell-quote": "^1.8.2",
@@ -55,6 +56,7 @@
55
56
  "zod": "^3.23.8"
56
57
  },
57
58
  "devDependencies": {
59
+ "@playwright/test": "^1.52.0",
58
60
  "@types/jest": "^29.5.14",
59
61
  "@types/node": "^22.7.5",
60
62
  "@types/shell-quote": "^1.7.5",
@@ -62,5 +64,8 @@
62
64
  "prettier": "3.3.3",
63
65
  "rimraf": "^6.0.1",
64
66
  "typescript": "^5.4.2"
67
+ },
68
+ "engines": {
69
+ "node": ">=22.7.5"
65
70
  }
66
71
  }
@@ -11,6 +11,7 @@ import express from "express";
11
11
  import { findActualExecutable } from "spawn-rx";
12
12
  import mcpProxy from "./mcpProxy.js";
13
13
  import { randomUUID, randomBytes, timingSafeEqual } from "node:crypto";
14
+ const DEFAULT_MCP_PROXY_LISTEN_PORT = "6277";
14
15
  const SSE_HEADERS_PASSTHROUGH = ["authorization"];
15
16
  const STREAMABLE_HTTP_HEADERS_PASSTHROUGH = [
16
17
  "authorization",
@@ -65,18 +66,18 @@ app.use((req, res, next) => {
65
66
  });
66
67
  const webAppTransports = new Map(); // Web app transports by web app sessionId
67
68
  const serverTransports = new Map(); // Server Transports by web app sessionId
68
- const sessionToken = randomBytes(32).toString("hex");
69
+ // Use provided token from environment or generate a new one
70
+ const sessionToken = process.env.MCP_PROXY_TOKEN || randomBytes(32).toString("hex");
69
71
  const authDisabled = !!process.env.DANGEROUSLY_OMIT_AUTH;
70
72
  // Origin validation middleware to prevent DNS rebinding attacks
71
73
  const originValidationMiddleware = (req, res, next) => {
72
74
  const origin = req.headers.origin;
73
75
  // Default origins based on CLIENT_PORT or use environment variable
74
76
  const clientPort = process.env.CLIENT_PORT || "6274";
75
- const defaultOrigins = [
76
- `http://localhost:${clientPort}`,
77
- `http://127.0.0.1:${clientPort}`,
77
+ const defaultOrigin = `http://localhost:${clientPort}`;
78
+ const allowedOrigins = process.env.ALLOWED_ORIGINS?.split(",") || [
79
+ defaultOrigin,
78
80
  ];
79
- const allowedOrigins = process.env.ALLOWED_ORIGINS?.split(",") || defaultOrigins;
80
81
  if (origin && !allowedOrigins.includes(origin)) {
81
82
  console.error(`Invalid origin: ${origin}`);
82
83
  res.status(403).json({
@@ -404,18 +405,14 @@ app.get("/config", originValidationMiddleware, authMiddleware, (req, res) => {
404
405
  res.status(500).json(error);
405
406
  }
406
407
  });
407
- const PORT = parseInt(process.env.PORT || "6277", 10);
408
- const HOST = process.env.HOST || "127.0.0.1";
408
+ const PORT = parseInt(process.env.SERVER_PORT || DEFAULT_MCP_PROXY_LISTEN_PORT, 10);
409
+ const HOST = process.env.HOST || "localhost";
409
410
  const server = app.listen(PORT, HOST);
410
411
  server.on("listening", () => {
411
412
  console.log(`⚙️ Proxy server listening on ${HOST}:${PORT}`);
412
413
  if (!authDisabled) {
413
- console.log(`🔑 Session token: ${sessionToken}`);
414
- console.log(`Use this token to authenticate requests or set DANGEROUSLY_OMIT_AUTH=true to disable auth`);
415
- // Display clickable URL with pre-filled token
416
- const clientPort = process.env.CLIENT_PORT || "6274";
417
- const clientUrl = `http://localhost:${clientPort}/?MCP_PROXY_AUTH_TOKEN=${sessionToken}`;
418
- console.log(`\n🔗 Open inspector with token pre-filled:\n ${clientUrl}\n (Auto-open is disabled when authentication is enabled)\n`);
414
+ console.log(`🔑 Session token: ${sessionToken}\n ` +
415
+ `Use this token to authenticate requests or set DANGEROUSLY_OMIT_AUTH=true to disable auth`);
419
416
  }
420
417
  else {
421
418
  console.log(`⚠️ WARNING: Authentication is disabled. This is not recommended.`);
@@ -3,11 +3,12 @@ function onClientError(error) {
3
3
  console.error("Error from inspector client:", error);
4
4
  }
5
5
  function onServerError(error) {
6
- if ((error?.message &&
7
- error.message.includes("Error POSTing to endpoint (HTTP 404)")) ||
8
- (error?.cause && JSON.stringify(error.cause).includes("ECONNREFUSED"))) {
6
+ if (error?.cause && JSON.stringify(error.cause).includes("ECONNREFUSED")) {
9
7
  console.error("Connection refused. Is the MCP server running?");
10
8
  }
9
+ else if (error.message && error.message.includes("404")) {
10
+ console.error("Error accessing endpoint (HTTP 404)");
11
+ }
11
12
  else {
12
13
  console.error("Error from MCP server:", error);
13
14
  }