@modelcontextprotocol/inspector 0.17.2 → 0.18.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.
- package/cli/build/client/prompts.js +10 -5
- package/cli/build/client/resources.js +12 -6
- package/cli/build/client/tools.js +17 -4
- package/cli/build/index.js +25 -8
- package/client/dist/assets/{OAuthCallback-DOgG8dke.js → OAuthCallback-CXY8DEIM.js} +1 -1
- package/client/dist/assets/{OAuthDebugCallback-m70IPFbL.js → OAuthDebugCallback-zr6INHin.js} +1 -1
- package/client/dist/assets/{index-CV-uzqYs.css → index-DoQUGvvr.css} +30 -3
- package/client/dist/assets/{index-Bl2jgoAl.js → index-Dw52pmVD.js} +30607 -12552
- package/client/dist/index.html +2 -2
- package/package.json +6 -6
- package/server/build/index.js +37 -8
package/client/dist/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
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-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-Dw52pmVD.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DoQUGvvr.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="root" class="w-full"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modelcontextprotocol/inspector",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Model Context Protocol inspector",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Anthropic, PBC (https://anthropic.com)",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"check-version": "node scripts/check-version-consistency.js"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@modelcontextprotocol/inspector-cli": "^0.
|
|
51
|
-
"@modelcontextprotocol/inspector-client": "^0.
|
|
52
|
-
"@modelcontextprotocol/inspector-server": "^0.
|
|
53
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
50
|
+
"@modelcontextprotocol/inspector-cli": "^0.18.0",
|
|
51
|
+
"@modelcontextprotocol/inspector-client": "^0.18.0",
|
|
52
|
+
"@modelcontextprotocol/inspector-server": "^0.18.0",
|
|
53
|
+
"@modelcontextprotocol/sdk": "^1.24.3",
|
|
54
54
|
"concurrently": "^9.2.0",
|
|
55
55
|
"node-fetch": "^3.3.2",
|
|
56
56
|
"open": "^10.2.0",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"jest-fixed-jsdom": "^0.0.9",
|
|
69
69
|
"lint-staged": "^16.1.5",
|
|
70
70
|
"playwright": "^1.56.1",
|
|
71
|
-
"prettier": "^3.
|
|
71
|
+
"prettier": "^3.7.1",
|
|
72
72
|
"rimraf": "^6.0.1",
|
|
73
73
|
"typescript": "^5.4.2"
|
|
74
74
|
},
|
package/server/build/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const fetch = nodeFetch;
|
|
|
8
8
|
const Headers = NodeHeaders;
|
|
9
9
|
import { SSEClientTransport, SseError, } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
10
10
|
import { StdioClientTransport, getDefaultEnvironment, } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
11
|
-
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
11
|
+
import { StreamableHTTPClientTransport, StreamableHTTPError, } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
12
12
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
13
13
|
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
|
14
14
|
import express from "express";
|
|
@@ -30,6 +30,21 @@ const { values } = parseArgs({
|
|
|
30
30
|
"server-url": { type: "string", default: "" },
|
|
31
31
|
},
|
|
32
32
|
});
|
|
33
|
+
/**
|
|
34
|
+
* Helper function to detect 401 Unauthorized errors from various transport types.
|
|
35
|
+
* StreamableHTTPClientTransport throws a generic Error with "HTTP 401" in the message
|
|
36
|
+
* when there's no authProvider configured, while SSEClientTransport throws SseError.
|
|
37
|
+
*/
|
|
38
|
+
const is401Error = (error) => {
|
|
39
|
+
if (error instanceof SseError && error.code === 401)
|
|
40
|
+
return true;
|
|
41
|
+
if (error instanceof StreamableHTTPError && error.code === 401)
|
|
42
|
+
return true;
|
|
43
|
+
if (error instanceof Error &&
|
|
44
|
+
(error.message.includes("HTTP 401") || error.message.includes("(401)")))
|
|
45
|
+
return true;
|
|
46
|
+
return false;
|
|
47
|
+
};
|
|
33
48
|
// Function to get HTTP headers.
|
|
34
49
|
const getHttpHeaders = (req) => {
|
|
35
50
|
const headers = {};
|
|
@@ -187,18 +202,31 @@ const authMiddleware = (req, res, next) => {
|
|
|
187
202
|
* This is necessary for the EventSource polyfill which expects web streams
|
|
188
203
|
*/
|
|
189
204
|
const createWebReadableStream = (nodeStream) => {
|
|
205
|
+
let closed = false;
|
|
190
206
|
return new ReadableStream({
|
|
191
207
|
start(controller) {
|
|
192
208
|
nodeStream.on("data", (chunk) => {
|
|
193
|
-
|
|
209
|
+
if (!closed) {
|
|
210
|
+
controller.enqueue(chunk);
|
|
211
|
+
}
|
|
194
212
|
});
|
|
195
213
|
nodeStream.on("end", () => {
|
|
196
|
-
|
|
214
|
+
if (!closed) {
|
|
215
|
+
closed = true;
|
|
216
|
+
controller.close();
|
|
217
|
+
}
|
|
197
218
|
});
|
|
198
219
|
nodeStream.on("error", (err) => {
|
|
199
|
-
|
|
220
|
+
if (!closed) {
|
|
221
|
+
closed = true;
|
|
222
|
+
controller.error(err);
|
|
223
|
+
}
|
|
200
224
|
});
|
|
201
225
|
},
|
|
226
|
+
cancel() {
|
|
227
|
+
closed = true;
|
|
228
|
+
nodeStream.destroy();
|
|
229
|
+
},
|
|
202
230
|
});
|
|
203
231
|
};
|
|
204
232
|
/**
|
|
@@ -375,8 +403,8 @@ app.post("/mcp", originValidationMiddleware, authMiddleware, async (req, res) =>
|
|
|
375
403
|
await webAppTransport.handleRequest(req, res, req.body);
|
|
376
404
|
}
|
|
377
405
|
catch (error) {
|
|
378
|
-
if (error
|
|
379
|
-
console.error("Received 401 Unauthorized from MCP server:", error.message);
|
|
406
|
+
if (is401Error(error)) {
|
|
407
|
+
console.error("Received 401 Unauthorized from MCP server:", error instanceof Error ? error.message : error);
|
|
380
408
|
res.status(401).json(error);
|
|
381
409
|
return;
|
|
382
410
|
}
|
|
@@ -396,6 +424,7 @@ app.delete("/mcp", originValidationMiddleware, authMiddleware, async (req, res)
|
|
|
396
424
|
}
|
|
397
425
|
else {
|
|
398
426
|
await serverTransport.terminateSession();
|
|
427
|
+
await serverTransport.close();
|
|
399
428
|
webAppTransports.delete(sessionId);
|
|
400
429
|
serverTransports.delete(sessionId);
|
|
401
430
|
sessionHeaderHolders.delete(sessionId);
|
|
@@ -507,7 +536,7 @@ app.get("/stdio", originValidationMiddleware, authMiddleware, async (req, res) =
|
|
|
507
536
|
});
|
|
508
537
|
}
|
|
509
538
|
catch (error) {
|
|
510
|
-
if (error
|
|
539
|
+
if (is401Error(error)) {
|
|
511
540
|
console.error("Received 401 Unauthorized from MCP server. Authentication failure.");
|
|
512
541
|
res.status(401).json(error);
|
|
513
542
|
return;
|
|
@@ -538,7 +567,7 @@ app.get("/sse", originValidationMiddleware, authMiddleware, async (req, res) =>
|
|
|
538
567
|
});
|
|
539
568
|
}
|
|
540
569
|
catch (error) {
|
|
541
|
-
if (error
|
|
570
|
+
if (is401Error(error)) {
|
|
542
571
|
console.error("Received 401 Unauthorized from MCP server. Authentication failure.");
|
|
543
572
|
res.status(401).json(error);
|
|
544
573
|
return;
|