@modelcontextprotocol/inspector 0.17.5 → 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/client/dist/assets/{OAuthCallback-Bojw9MF2.js → OAuthCallback-CXY8DEIM.js} +1 -1
- package/client/dist/assets/{OAuthDebugCallback-ms23dRpk.js → OAuthDebugCallback-zr6INHin.js} +1 -1
- package/client/dist/assets/{index-DH5T2nDo.css → index-DoQUGvvr.css} +1 -1
- package/client/dist/assets/{index-CneFQkmB.js → index-Dw52pmVD.js} +590 -447
- package/client/dist/index.html +2 -2
- package/package.json +5 -5
- package/server/build/index.js +20 -5
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",
|
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 = {};
|
|
@@ -388,8 +403,8 @@ app.post("/mcp", originValidationMiddleware, authMiddleware, async (req, res) =>
|
|
|
388
403
|
await webAppTransport.handleRequest(req, res, req.body);
|
|
389
404
|
}
|
|
390
405
|
catch (error) {
|
|
391
|
-
if (error
|
|
392
|
-
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);
|
|
393
408
|
res.status(401).json(error);
|
|
394
409
|
return;
|
|
395
410
|
}
|
|
@@ -521,7 +536,7 @@ app.get("/stdio", originValidationMiddleware, authMiddleware, async (req, res) =
|
|
|
521
536
|
});
|
|
522
537
|
}
|
|
523
538
|
catch (error) {
|
|
524
|
-
if (error
|
|
539
|
+
if (is401Error(error)) {
|
|
525
540
|
console.error("Received 401 Unauthorized from MCP server. Authentication failure.");
|
|
526
541
|
res.status(401).json(error);
|
|
527
542
|
return;
|
|
@@ -552,7 +567,7 @@ app.get("/sse", originValidationMiddleware, authMiddleware, async (req, res) =>
|
|
|
552
567
|
});
|
|
553
568
|
}
|
|
554
569
|
catch (error) {
|
|
555
|
-
if (error
|
|
570
|
+
if (is401Error(error)) {
|
|
556
571
|
console.error("Received 401 Unauthorized from MCP server. Authentication failure.");
|
|
557
572
|
res.status(401).json(error);
|
|
558
573
|
return;
|