@modelcontextprotocol/inspector-client 0.9.0 → 0.10.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/bin/start.js ADDED
@@ -0,0 +1,120 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { resolve, dirname } from "path";
4
+ import { spawnPromise } from "spawn-rx";
5
+ import { fileURLToPath } from "url";
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+
9
+ function delay(ms) {
10
+ return new Promise((resolve) => setTimeout(resolve, ms, true));
11
+ }
12
+
13
+ async function main() {
14
+ // Parse command line arguments
15
+ const args = process.argv.slice(2);
16
+ const envVars = {};
17
+ const mcpServerArgs = [];
18
+ let command = null;
19
+ let parsingFlags = true;
20
+
21
+ for (let i = 0; i < args.length; i++) {
22
+ const arg = args[i];
23
+
24
+ if (parsingFlags && arg === "--") {
25
+ parsingFlags = false;
26
+ continue;
27
+ }
28
+
29
+ if (parsingFlags && arg === "-e" && i + 1 < args.length) {
30
+ const envVar = args[++i];
31
+ const equalsIndex = envVar.indexOf("=");
32
+
33
+ if (equalsIndex !== -1) {
34
+ const key = envVar.substring(0, equalsIndex);
35
+ const value = envVar.substring(equalsIndex + 1);
36
+ envVars[key] = value;
37
+ } else {
38
+ envVars[envVar] = "";
39
+ }
40
+ } else if (!command) {
41
+ command = arg;
42
+ } else {
43
+ mcpServerArgs.push(arg);
44
+ }
45
+ }
46
+
47
+ const inspectorServerPath = resolve(
48
+ __dirname,
49
+ "../..",
50
+ "server",
51
+ "build",
52
+ "index.js",
53
+ );
54
+
55
+ // Path to the client entry point
56
+ const inspectorClientPath = resolve(
57
+ __dirname,
58
+ "../..",
59
+ "client",
60
+ "bin",
61
+ "client.js",
62
+ );
63
+
64
+ const CLIENT_PORT = process.env.CLIENT_PORT ?? "6274";
65
+ const SERVER_PORT = process.env.SERVER_PORT ?? "6277";
66
+
67
+ console.log("Starting MCP inspector...");
68
+
69
+ const abort = new AbortController();
70
+
71
+ let cancelled = false;
72
+ process.on("SIGINT", () => {
73
+ cancelled = true;
74
+ abort.abort();
75
+ });
76
+ let server, serverOk;
77
+ try {
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
+ }
110
+ }
111
+
112
+ return 0;
113
+ }
114
+
115
+ main()
116
+ .then((_) => process.exit(0))
117
+ .catch((e) => {
118
+ console.error(e);
119
+ process.exit(1);
120
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelcontextprotocol/inspector-client",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Client-side application for the Model Context Protocol inspector",
5
5
  "license": "MIT",
6
6
  "author": "Anthropic, PBC (https://anthropic.com)",
@@ -8,14 +8,14 @@
8
8
  "bugs": "https://github.com/modelcontextprotocol/inspector/issues",
9
9
  "type": "module",
10
10
  "bin": {
11
- "mcp-inspector-client": "./bin/cli.js"
11
+ "mcp-inspector-client": "./bin/start.js"
12
12
  },
13
13
  "files": [
14
14
  "bin",
15
15
  "dist"
16
16
  ],
17
17
  "scripts": {
18
- "dev": "vite",
18
+ "dev": "vite --port 6274",
19
19
  "build": "tsc -b && vite build",
20
20
  "lint": "eslint .",
21
21
  "preview": "vite preview --port 6274",
@@ -23,7 +23,7 @@
23
23
  "test:watch": "jest --config jest.config.cjs --watch"
24
24
  },
25
25
  "dependencies": {
26
- "@modelcontextprotocol/sdk": "^1.9.0",
26
+ "@modelcontextprotocol/sdk": "^1.10.0",
27
27
  "@radix-ui/react-checkbox": "^1.1.4",
28
28
  "@radix-ui/react-dialog": "^1.1.3",
29
29
  "@radix-ui/react-icons": "^1.3.0",
@@ -72,6 +72,6 @@
72
72
  "ts-jest": "^29.2.6",
73
73
  "typescript": "^5.5.3",
74
74
  "typescript-eslint": "^8.7.0",
75
- "vite": "^5.4.8"
75
+ "vite": "^6.3.0"
76
76
  }
77
77
  }
@@ -1,40 +0,0 @@
1
- import { r as reactExports, j as jsxRuntimeExports, S as SESSION_KEYS, a as auth, b as authProvider } from "./index-CgrYmEaq.js";
2
- const OAuthCallback = () => {
3
- const hasProcessedRef = reactExports.useRef(false);
4
- reactExports.useEffect(() => {
5
- const handleCallback = async () => {
6
- if (hasProcessedRef.current) {
7
- return;
8
- }
9
- hasProcessedRef.current = true;
10
- const params = new URLSearchParams(window.location.search);
11
- const code = params.get("code");
12
- const serverUrl = sessionStorage.getItem(SESSION_KEYS.SERVER_URL);
13
- if (!code || !serverUrl) {
14
- console.error("Missing code or server URL");
15
- window.location.href = "/";
16
- return;
17
- }
18
- try {
19
- const result = await auth(authProvider, {
20
- serverUrl,
21
- authorizationCode: code
22
- });
23
- if (result !== "AUTHORIZED") {
24
- throw new Error(
25
- `Expected to be authorized after providing auth code, got: ${result}`
26
- );
27
- }
28
- window.location.href = `/?serverUrl=${encodeURIComponent(serverUrl)}`;
29
- } catch (error) {
30
- console.error("OAuth callback error:", error);
31
- window.location.href = "/";
32
- }
33
- };
34
- void handleCallback();
35
- }, []);
36
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-screen", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-lg text-gray-500", children: "Processing OAuth callback..." }) });
37
- };
38
- export {
39
- OAuthCallback as default
40
- };