@modelcontextprotocol/inspector 0.12.0 → 0.13.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.
@@ -0,0 +1,33 @@
1
+ const parseOAuthCallbackParams = (location) => {
2
+ const params = new URLSearchParams(location);
3
+ const code = params.get("code");
4
+ if (code) {
5
+ return { successful: true, code };
6
+ }
7
+ const error = params.get("error");
8
+ const error_description = params.get("error_description");
9
+ const error_uri = params.get("error_uri");
10
+ if (error) {
11
+ return { successful: false, error, error_description, error_uri };
12
+ }
13
+ return {
14
+ successful: false,
15
+ error: "invalid_request",
16
+ error_description: "Missing code or error in response",
17
+ error_uri: null
18
+ };
19
+ };
20
+ const generateOAuthErrorDescription = (params) => {
21
+ const error = params.error;
22
+ const errorDescription = params.error_description;
23
+ const errorUri = params.error_uri;
24
+ return [
25
+ `Error: ${error}.`,
26
+ errorDescription ? `Details: ${errorDescription}.` : "",
27
+ errorUri ? `More info: ${errorUri}.` : ""
28
+ ].filter(Boolean).join("\n");
29
+ };
30
+ export {
31
+ generateOAuthErrorDescription as g,
32
+ parseOAuthCallbackParams as p
33
+ };
@@ -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-CHwMp9hp.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-D5WIP3OH.css">
8
+ <script type="module" crossorigin src="/assets/index-Dhd4mhZ2.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-CIxCnj5w.css">
10
10
  </head>
11
11
  <body>
12
12
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelcontextprotocol/inspector",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Model Context Protocol inspector",
5
5
  "license": "MIT",
6
6
  "author": "Anthropic, PBC (https://anthropic.com)",
@@ -40,11 +40,12 @@
40
40
  "publish-all": "npm publish --workspaces --access public && npm publish --access public"
41
41
  },
42
42
  "dependencies": {
43
- "@modelcontextprotocol/inspector-cli": "^0.12.0",
44
- "@modelcontextprotocol/inspector-client": "^0.12.0",
45
- "@modelcontextprotocol/inspector-server": "^0.12.0",
46
- "@modelcontextprotocol/sdk": "^1.11.0",
43
+ "@modelcontextprotocol/inspector-cli": "^0.13.0",
44
+ "@modelcontextprotocol/inspector-client": "^0.13.0",
45
+ "@modelcontextprotocol/inspector-server": "^0.13.0",
46
+ "@modelcontextprotocol/sdk": "^1.11.5",
47
47
  "concurrently": "^9.0.1",
48
+ "open": "^10.1.0",
48
49
  "shell-quote": "^1.8.2",
49
50
  "spawn-rx": "^5.1.2",
50
51
  "ts-node": "^10.9.2",
@@ -1,3 +1,4 @@
1
+ import { isJSONRPCRequest } from "@modelcontextprotocol/sdk/types.js";
1
2
  function onClientError(error) {
2
3
  console.error("Error from inspector client:", error);
3
4
  }
@@ -8,7 +9,21 @@ export default function mcpProxy({ transportToClient, transportToServer, }) {
8
9
  let transportToClientClosed = false;
9
10
  let transportToServerClosed = false;
10
11
  transportToClient.onmessage = (message) => {
11
- transportToServer.send(message).catch(onServerError);
12
+ transportToServer.send(message).catch((error) => {
13
+ // Send error response back to client if it was a request (has id) and connection is still open
14
+ if (isJSONRPCRequest(message) && !transportToClientClosed) {
15
+ const errorResponse = {
16
+ jsonrpc: "2.0",
17
+ id: message.id,
18
+ error: {
19
+ code: -32001,
20
+ message: error.message,
21
+ data: error,
22
+ },
23
+ };
24
+ transportToClient.send(errorResponse).catch(onClientError);
25
+ }
26
+ });
12
27
  };
13
28
  transportToServer.onmessage = (message) => {
14
29
  transportToClient.send(message).catch(onClientError);