@mcp-use/inspector 0.4.10 → 0.4.11-canary.1

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.
Files changed (53) hide show
  1. package/dist/cli.js +90 -43
  2. package/dist/client/assets/chunk-VL2OQCWN-DfcO0mnz.js +8 -0
  3. package/dist/client/assets/embeddings-xed8XPUx.js +1 -0
  4. package/dist/client/assets/index-B1D3L6Rv.js +81 -0
  5. package/dist/client/assets/index-BZ1_aNq6.js +1775 -0
  6. package/dist/client/assets/{index-CWYxvW-c.js → index-Bob6AdPG.js} +4 -4
  7. package/dist/client/assets/{index-Ba21hizt.css → index-BrUPorMz.css} +1 -1
  8. package/dist/client/assets/{index-F8MAAt6D.js → index-CMBY6iPe.js} +6 -6
  9. package/dist/client/assets/index-CMXxZksu.js +70 -0
  10. package/dist/client/assets/{index-DHsHh1_g.js → index-DAnTywZM.js} +3 -3
  11. package/dist/client/assets/index-DE-CW45b.js +4 -0
  12. package/dist/client/assets/index-R3N_effq.js +1 -0
  13. package/dist/client/assets/langfuse-LCJ6VJEP-CbWGt6Q5.js +570 -0
  14. package/dist/client/index.html +33 -13
  15. package/dist/server/{chunk-GZSRGACL.js → chunk-222XA5JA.js} +7 -3
  16. package/dist/server/{chunk-HPZTE753.js → chunk-76XNP4ZB.js} +44 -20
  17. package/dist/server/{chunk-XJDEAO7Y.js → chunk-JCLAFMDT.js} +3 -1
  18. package/dist/server/{chunk-BE2QCYB4.js → chunk-TIYOH5C4.js} +56 -24
  19. package/dist/server/{chunk-UAGOQUEV.js → chunk-YGCKPAWJ.js} +9 -5
  20. package/dist/server/{chunk-G2KU64MV.js → chunk-ZFMPIRVB.js} +36 -21
  21. package/dist/server/cli.js +11 -7
  22. package/dist/server/index.d.ts +2 -2
  23. package/dist/server/index.d.ts.map +1 -1
  24. package/dist/server/index.js +6 -6
  25. package/dist/server/middleware.d.ts +2 -2
  26. package/dist/server/middleware.d.ts.map +1 -1
  27. package/dist/server/middleware.js +6 -6
  28. package/dist/server/server.d.ts.map +1 -1
  29. package/dist/server/server.js +20 -10
  30. package/dist/server/shared-routes.d.ts +1 -1
  31. package/dist/server/shared-routes.d.ts.map +1 -1
  32. package/dist/server/shared-routes.js +3 -3
  33. package/dist/server/shared-static.d.ts +1 -1
  34. package/dist/server/shared-static.d.ts.map +1 -1
  35. package/dist/server/shared-static.js +2 -2
  36. package/dist/server/shared-utils-browser.d.ts +3 -3
  37. package/dist/server/shared-utils-browser.d.ts.map +1 -1
  38. package/dist/server/shared-utils-browser.js +1 -1
  39. package/dist/server/shared-utils.d.ts +3 -3
  40. package/dist/server/shared-utils.d.ts.map +1 -1
  41. package/dist/server/shared-utils.js +1 -1
  42. package/dist/server/utils.d.ts.map +1 -1
  43. package/dist/server/utils.js +1 -1
  44. package/package.json +2 -2
  45. package/dist/client/assets/browser-BkJdGGVq.js +0 -611
  46. package/dist/client/assets/chunk-VL2OQCWN-Dm4XquLI.js +0 -8
  47. package/dist/client/assets/embeddings-BvWgxmh-.js +0 -1
  48. package/dist/client/assets/index-BxUJEXs5.js +0 -1734
  49. package/dist/client/assets/index-CEkgKN2t.js +0 -1
  50. package/dist/client/assets/index-Dnm19mgK.js +0 -150
  51. package/dist/client/assets/index-WLUXcbDv.js +0 -4
  52. package/dist/client/assets/langfuse-6AJGHMAV-QljN0jPu.js +0 -1
  53. package/dist/client/assets/v4-BKrj-4V8.js +0 -1
@@ -2,31 +2,51 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="https://inspector-cdn.mcp-use.com/favicon-black.svg" />
6
- <link rel="icon" type="image/svg+xml" href="https://inspector-cdn.mcp-use.com/favicon-white.svg" media="(prefers-color-scheme: dark)" />
7
- <link rel="icon" type="image/svg+xml" href="https://inspector-cdn.mcp-use.com/favicon-black.svg" media="(prefers-color-scheme: light)" />
5
+ <link
6
+ rel="icon"
7
+ type="image/svg+xml"
8
+ href="https://inspector-cdn.mcp-use.com/favicon-black.svg"
9
+ />
10
+ <link
11
+ rel="icon"
12
+ type="image/svg+xml"
13
+ href="https://inspector-cdn.mcp-use.com/favicon-white.svg"
14
+ media="(prefers-color-scheme: dark)"
15
+ />
16
+ <link
17
+ rel="icon"
18
+ type="image/svg+xml"
19
+ href="https://inspector-cdn.mcp-use.com/favicon-black.svg"
20
+ media="(prefers-color-scheme: light)"
21
+ />
8
22
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
9
23
  <link rel="preconnect" href="https://fonts.googleapis.com" />
10
24
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
11
- <link href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;500;700&display=swap" rel="stylesheet" />
25
+ <link
26
+ href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;500;700&display=swap"
27
+ rel="stylesheet"
28
+ />
12
29
  <title>Inspector | mcp-use</title>
13
- <script type="module" crossorigin src="/inspector/assets/index-BxUJEXs5.js"></script>
14
- <link rel="stylesheet" crossorigin href="/inspector/assets/index-Ba21hizt.css">
15
- <script>window.__INSPECTOR_VERSION__ = "0.4.10";</script>
30
+ <script type="module" crossorigin src="/inspector/assets/index-BZ1_aNq6.js"></script>
31
+ <link rel="stylesheet" crossorigin href="/inspector/assets/index-BrUPorMz.css">
32
+ <script>window.__INSPECTOR_VERSION__ = "0.4.11-canary.1";</script>
16
33
  </head>
17
34
  <body>
18
35
  <script>
19
36
  // Ensure process is defined globally before any modules load
20
37
  // This prevents "process is not defined" errors in browser environments
21
- if (typeof window !== 'undefined' && typeof window.process === 'undefined') {
38
+ if (
39
+ typeof window !== "undefined" &&
40
+ typeof window.process === "undefined"
41
+ ) {
22
42
  window.process = {
23
43
  env: {},
24
- platform: 'browser',
44
+ platform: "browser",
25
45
  browser: true,
26
- version: 'v18.0.0',
27
- versions: { node: '18.0.0' },
28
- cwd: () => '/',
29
- nextTick: (fn, ...args) => queueMicrotask(() => fn(...args))
46
+ version: "v18.0.0",
47
+ versions: { node: "18.0.0" },
48
+ cwd: () => "/",
49
+ nextTick: (fn, ...args) => queueMicrotask(() => fn(...args)),
30
50
  };
31
51
  }
32
52
  </script>
@@ -2,7 +2,7 @@ import {
2
2
  checkClientFiles,
3
3
  getClientDistPath,
4
4
  getContentType
5
- } from "./chunk-BE2QCYB4.js";
5
+ } from "./chunk-TIYOH5C4.js";
6
6
 
7
7
  // src/server/shared-static.ts
8
8
  import { existsSync, readFileSync } from "fs";
@@ -11,7 +11,9 @@ function registerStaticRoutes(app, clientDistPath) {
11
11
  const distPath = clientDistPath || getClientDistPath();
12
12
  if (!checkClientFiles(distPath)) {
13
13
  console.warn(`\u26A0\uFE0F MCP Inspector client files not found at ${distPath}`);
14
- console.warn(` Run 'yarn build' in the inspector package to build the UI`);
14
+ console.warn(
15
+ ` Run 'yarn build' in the inspector package to build the UI`
16
+ );
15
17
  app.get("*", (c) => {
16
18
  return c.html(`
17
19
  <!DOCTYPE html>
@@ -66,7 +68,9 @@ function registerStaticRoutesWithDevProxy(app, clientDistPath) {
66
68
  const distPath = clientDistPath || getClientDistPath();
67
69
  const isDev = process.env.NODE_ENV === "development" || process.env.VITE_DEV === "true";
68
70
  if (isDev) {
69
- console.warn("\u{1F527} Development mode: Proxying client requests to Vite dev server");
71
+ console.warn(
72
+ "\u{1F527} Development mode: Proxying client requests to Vite dev server"
73
+ );
70
74
  app.get("*", async (c) => {
71
75
  const path = c.req.path;
72
76
  if (path.startsWith("/api/") || path.startsWith("/inspector/api/") || path === "/inspector/config.json") {
@@ -11,7 +11,9 @@ function toBase64(str) {
11
11
  async function* handleChatRequestStream(requestBody) {
12
12
  const { mcpServerUrl, llmConfig, authConfig, messages } = requestBody;
13
13
  if (!mcpServerUrl || !llmConfig || !messages) {
14
- throw new Error("Missing required fields: mcpServerUrl, llmConfig, messages");
14
+ throw new Error(
15
+ "Missing required fields: mcpServerUrl, llmConfig, messages"
16
+ );
15
17
  }
16
18
  const { MCPAgent, MCPClient } = await import("mcp-use");
17
19
  let llm;
@@ -123,7 +125,9 @@ async function* handleChatRequestStream(requestBody) {
123
125
  async function handleChatRequest(requestBody) {
124
126
  const { mcpServerUrl, llmConfig, authConfig, messages } = requestBody;
125
127
  if (!mcpServerUrl || !llmConfig || !messages) {
126
- throw new Error("Missing required fields: mcpServerUrl, llmConfig, messages");
128
+ throw new Error(
129
+ "Missing required fields: mcpServerUrl, llmConfig, messages"
130
+ );
127
131
  }
128
132
  const { MCPAgent, MCPClient } = await import("mcp-use");
129
133
  let llm;
@@ -163,7 +167,10 @@ async function handleChatRequest(requestBody) {
163
167
  const tokenType = authConfig.oauthTokens.token_type ? authConfig.oauthTokens.token_type.charAt(0).toUpperCase() + authConfig.oauthTokens.token_type.slice(1) : "Bearer";
164
168
  serverConfig.headers.Authorization = `${tokenType} ${authConfig.oauthTokens.access_token}`;
165
169
  console.log("Using OAuth access token for MCP server authentication");
166
- console.log("Authorization header:", `${tokenType} ${authConfig.oauthTokens.access_token.substring(0, 20)}...`);
170
+ console.log(
171
+ "Authorization header:",
172
+ `${tokenType} ${authConfig.oauthTokens.access_token.substring(0, 20)}...`
173
+ );
167
174
  } else {
168
175
  console.warn("OAuth selected but no access token provided");
169
176
  }
@@ -218,21 +225,35 @@ setInterval(
218
225
  5 * 60 * 1e3
219
226
  ).unref();
220
227
  function storeWidgetData(data) {
221
- const { serverId, uri, toolInput, toolOutput, resourceData, toolId, widgetCSP } = data;
228
+ const {
229
+ serverId,
230
+ uri,
231
+ toolInput,
232
+ toolOutput,
233
+ resourceData,
234
+ toolId,
235
+ widgetCSP
236
+ } = data;
222
237
  console.log("[Widget Store] Received request for toolId:", toolId);
223
- console.log("[Widget Store] Fields:", { serverId, uri, hasResourceData: !!resourceData, hasToolInput: !!toolInput, hasToolOutput: !!toolOutput, hasWidgetCSP: !!widgetCSP });
238
+ console.log("[Widget Store] Fields:", {
239
+ serverId,
240
+ uri,
241
+ hasResourceData: !!resourceData,
242
+ hasToolInput: !!toolInput,
243
+ hasToolOutput: !!toolOutput,
244
+ hasWidgetCSP: !!widgetCSP
245
+ });
224
246
  if (!serverId || !uri || !toolId || !resourceData) {
225
247
  const missingFields = [];
226
- if (!serverId)
227
- missingFields.push("serverId");
228
- if (!uri)
229
- missingFields.push("uri");
230
- if (!toolId)
231
- missingFields.push("toolId");
232
- if (!resourceData)
233
- missingFields.push("resourceData");
248
+ if (!serverId) missingFields.push("serverId");
249
+ if (!uri) missingFields.push("uri");
250
+ if (!toolId) missingFields.push("toolId");
251
+ if (!resourceData) missingFields.push("resourceData");
234
252
  console.error("[Widget Store] Missing required fields:", missingFields);
235
- return { success: false, error: `Missing required fields: ${missingFields.join(", ")}` };
253
+ return {
254
+ success: false,
255
+ error: `Missing required fields: ${missingFields.join(", ")}`
256
+ };
236
257
  }
237
258
  widgetDataStore.set(toolId, {
238
259
  serverId,
@@ -286,7 +307,10 @@ function generateWidgetContainerHtml(basePath, toolId) {
286
307
  }
287
308
  function generateWidgetContentHtml(widgetData) {
288
309
  const { serverId, uri, toolInput, toolOutput, resourceData, toolId } = widgetData;
289
- console.log("[Widget Content] Using pre-fetched resource for:", { serverId, uri });
310
+ console.log("[Widget Content] Using pre-fetched resource for:", {
311
+ serverId,
312
+ uri
313
+ });
290
314
  let htmlContent = "";
291
315
  const contentsArray = Array.isArray(resourceData?.contents) ? resourceData.contents : [];
292
316
  const firstContent = contentsArray[0];
@@ -309,15 +333,15 @@ function generateWidgetContentHtml(widgetData) {
309
333
  return { html: "", error: "No HTML content found" };
310
334
  }
311
335
  const widgetStateKey = `openai-widget-state:${toolId}`;
312
- const safeToolInput = JSON.stringify(toolInput).replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
313
- const safeToolOutput = JSON.stringify(toolOutput).replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
336
+ const safeToolInput = JSON.stringify(toolInput ?? null).replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
337
+ const safeToolOutput = JSON.stringify(toolOutput ?? null).replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
314
338
  const safeToolId = JSON.stringify(toolId);
315
339
  const safeWidgetStateKey = JSON.stringify(widgetStateKey);
316
340
  const apiScript = `
317
341
  <script>
318
342
  (function() {
319
343
  'use strict';
320
-
344
+
321
345
  // Change URL to "/" for React Router compatibility
322
346
  if (window.location.pathname !== '/') {
323
347
  history.replaceState(null, '', '/');
@@ -516,8 +540,8 @@ function getWidgetSecurityHeaders(widgetCSP) {
516
540
  "X-Frame-Options": "SAMEORIGIN",
517
541
  "X-Content-Type-Options": "nosniff",
518
542
  "Cache-Control": "no-cache, no-store, must-revalidate",
519
- "Pragma": "no-cache",
520
- "Expires": "0"
543
+ Pragma: "no-cache",
544
+ Expires: "0"
521
545
  };
522
546
  }
523
547
 
@@ -23,7 +23,9 @@ async function findAvailablePort(startPort = 8080, maxAttempts = 100) {
23
23
  continue;
24
24
  }
25
25
  }
26
- throw new Error(`No available port found after trying ${maxAttempts} ports starting from ${startPort}`);
26
+ throw new Error(
27
+ `No available port found after trying ${maxAttempts} ports starting from ${startPort}`
28
+ );
27
29
  }
28
30
  async function isPortAvailable(port) {
29
31
  const net = await import("net");
@@ -6,7 +6,9 @@ import { fileURLToPath } from "url";
6
6
  async function* handleChatRequestStream(requestBody) {
7
7
  const { mcpServerUrl, llmConfig, authConfig, messages } = requestBody;
8
8
  if (!mcpServerUrl || !llmConfig || !messages) {
9
- throw new Error("Missing required fields: mcpServerUrl, llmConfig, messages");
9
+ throw new Error(
10
+ "Missing required fields: mcpServerUrl, llmConfig, messages"
11
+ );
10
12
  }
11
13
  const { MCPAgent, MCPClient } = await import("mcp-use");
12
14
  let llm;
@@ -37,7 +39,9 @@ async function* handleChatRequestStream(requestBody) {
37
39
  if (authConfig && authConfig.type !== "none") {
38
40
  serverConfig.headers = {};
39
41
  if (authConfig.type === "basic" && authConfig.username && authConfig.password) {
40
- const auth = Buffer.from(`${authConfig.username}:${authConfig.password}`).toString("base64");
42
+ const auth = Buffer.from(
43
+ `${authConfig.username}:${authConfig.password}`
44
+ ).toString("base64");
41
45
  serverConfig.headers.Authorization = `Basic ${auth}`;
42
46
  } else if (authConfig.type === "bearer" && authConfig.token) {
43
47
  serverConfig.headers.Authorization = `Bearer ${authConfig.token}`;
@@ -51,7 +55,9 @@ async function* handleChatRequestStream(requestBody) {
51
55
  try {
52
56
  const url = new URL(mcpServerUrl);
53
57
  if (url.username && url.password && (!authConfig || authConfig.type === "none")) {
54
- const auth = Buffer.from(`${url.username}:${url.password}`).toString("base64");
58
+ const auth = Buffer.from(`${url.username}:${url.password}`).toString(
59
+ "base64"
60
+ );
55
61
  serverConfig.headers = serverConfig.headers || {};
56
62
  serverConfig.headers.Authorization = `Basic ${auth}`;
57
63
  serverConfig.url = `${url.protocol}//${url.host}${url.pathname}${url.search}`;
@@ -118,7 +124,9 @@ async function* handleChatRequestStream(requestBody) {
118
124
  async function handleChatRequest(requestBody) {
119
125
  const { mcpServerUrl, llmConfig, authConfig, messages } = requestBody;
120
126
  if (!mcpServerUrl || !llmConfig || !messages) {
121
- throw new Error("Missing required fields: mcpServerUrl, llmConfig, messages");
127
+ throw new Error(
128
+ "Missing required fields: mcpServerUrl, llmConfig, messages"
129
+ );
122
130
  }
123
131
  const { MCPAgent, MCPClient } = await import("mcp-use");
124
132
  let llm;
@@ -149,7 +157,9 @@ async function handleChatRequest(requestBody) {
149
157
  if (authConfig && authConfig.type !== "none") {
150
158
  serverConfig.headers = {};
151
159
  if (authConfig.type === "basic" && authConfig.username && authConfig.password) {
152
- const auth = Buffer.from(`${authConfig.username}:${authConfig.password}`).toString("base64");
160
+ const auth = Buffer.from(
161
+ `${authConfig.username}:${authConfig.password}`
162
+ ).toString("base64");
153
163
  serverConfig.headers.Authorization = `Basic ${auth}`;
154
164
  } else if (authConfig.type === "bearer" && authConfig.token) {
155
165
  serverConfig.headers.Authorization = `Bearer ${authConfig.token}`;
@@ -158,7 +168,10 @@ async function handleChatRequest(requestBody) {
158
168
  const tokenType = authConfig.oauthTokens.token_type ? authConfig.oauthTokens.token_type.charAt(0).toUpperCase() + authConfig.oauthTokens.token_type.slice(1) : "Bearer";
159
169
  serverConfig.headers.Authorization = `${tokenType} ${authConfig.oauthTokens.access_token}`;
160
170
  console.log("Using OAuth access token for MCP server authentication");
161
- console.log("Authorization header:", `${tokenType} ${authConfig.oauthTokens.access_token.substring(0, 20)}...`);
171
+ console.log(
172
+ "Authorization header:",
173
+ `${tokenType} ${authConfig.oauthTokens.access_token.substring(0, 20)}...`
174
+ );
162
175
  } else {
163
176
  console.warn("OAuth selected but no access token provided");
164
177
  }
@@ -167,7 +180,9 @@ async function handleChatRequest(requestBody) {
167
180
  try {
168
181
  const url = new URL(mcpServerUrl);
169
182
  if (url.username && url.password && (!authConfig || authConfig.type === "none")) {
170
- const auth = Buffer.from(`${url.username}:${url.password}`).toString("base64");
183
+ const auth = Buffer.from(`${url.username}:${url.password}`).toString(
184
+ "base64"
185
+ );
171
186
  serverConfig.headers = serverConfig.headers || {};
172
187
  serverConfig.headers.Authorization = `Basic ${auth}`;
173
188
  serverConfig.url = `${url.protocol}//${url.host}${url.pathname}${url.search}`;
@@ -245,21 +260,35 @@ setInterval(
245
260
  5 * 60 * 1e3
246
261
  ).unref();
247
262
  function storeWidgetData(data) {
248
- const { serverId, uri, toolInput, toolOutput, resourceData, toolId, widgetCSP } = data;
263
+ const {
264
+ serverId,
265
+ uri,
266
+ toolInput,
267
+ toolOutput,
268
+ resourceData,
269
+ toolId,
270
+ widgetCSP
271
+ } = data;
249
272
  console.log("[Widget Store] Received request for toolId:", toolId);
250
- console.log("[Widget Store] Fields:", { serverId, uri, hasResourceData: !!resourceData, hasToolInput: !!toolInput, hasToolOutput: !!toolOutput, hasWidgetCSP: !!widgetCSP });
273
+ console.log("[Widget Store] Fields:", {
274
+ serverId,
275
+ uri,
276
+ hasResourceData: !!resourceData,
277
+ hasToolInput: !!toolInput,
278
+ hasToolOutput: !!toolOutput,
279
+ hasWidgetCSP: !!widgetCSP
280
+ });
251
281
  if (!serverId || !uri || !toolId || !resourceData) {
252
282
  const missingFields = [];
253
- if (!serverId)
254
- missingFields.push("serverId");
255
- if (!uri)
256
- missingFields.push("uri");
257
- if (!toolId)
258
- missingFields.push("toolId");
259
- if (!resourceData)
260
- missingFields.push("resourceData");
283
+ if (!serverId) missingFields.push("serverId");
284
+ if (!uri) missingFields.push("uri");
285
+ if (!toolId) missingFields.push("toolId");
286
+ if (!resourceData) missingFields.push("resourceData");
261
287
  console.error("[Widget Store] Missing required fields:", missingFields);
262
- return { success: false, error: `Missing required fields: ${missingFields.join(", ")}` };
288
+ return {
289
+ success: false,
290
+ error: `Missing required fields: ${missingFields.join(", ")}`
291
+ };
263
292
  }
264
293
  widgetDataStore.set(toolId, {
265
294
  serverId,
@@ -313,7 +342,10 @@ function generateWidgetContainerHtml(basePath, toolId) {
313
342
  }
314
343
  function generateWidgetContentHtml(widgetData) {
315
344
  const { serverId, uri, toolInput, toolOutput, resourceData, toolId } = widgetData;
316
- console.log("[Widget Content] Using pre-fetched resource for:", { serverId, uri });
345
+ console.log("[Widget Content] Using pre-fetched resource for:", {
346
+ serverId,
347
+ uri
348
+ });
317
349
  let htmlContent = "";
318
350
  const contentsArray = Array.isArray(resourceData?.contents) ? resourceData.contents : [];
319
351
  const firstContent = contentsArray[0];
@@ -336,15 +368,15 @@ function generateWidgetContentHtml(widgetData) {
336
368
  return { html: "", error: "No HTML content found" };
337
369
  }
338
370
  const widgetStateKey = `openai-widget-state:${toolId}`;
339
- const safeToolInput = JSON.stringify(toolInput).replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
340
- const safeToolOutput = JSON.stringify(toolOutput).replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
371
+ const safeToolInput = JSON.stringify(toolInput ?? null).replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
372
+ const safeToolOutput = JSON.stringify(toolOutput ?? null).replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
341
373
  const safeToolId = JSON.stringify(toolId);
342
374
  const safeWidgetStateKey = JSON.stringify(widgetStateKey);
343
375
  const apiScript = `
344
376
  <script>
345
377
  (function() {
346
378
  'use strict';
347
-
379
+
348
380
  // Change URL to "/" for React Router compatibility
349
381
  if (window.location.pathname !== '/') {
350
382
  history.replaceState(null, '', '/');
@@ -542,8 +574,8 @@ function getWidgetSecurityHeaders(widgetCSP) {
542
574
  "X-Frame-Options": "SAMEORIGIN",
543
575
  "X-Content-Type-Options": "nosniff",
544
576
  "Cache-Control": "no-cache, no-store, must-revalidate",
545
- "Pragma": "no-cache",
546
- "Expires": "0"
577
+ Pragma: "no-cache",
578
+ Expires: "0"
547
579
  };
548
580
  }
549
581
 
@@ -1,21 +1,25 @@
1
1
  import {
2
2
  registerInspectorRoutes
3
- } from "./chunk-G2KU64MV.js";
3
+ } from "./chunk-ZFMPIRVB.js";
4
4
  import {
5
5
  registerStaticRoutes
6
- } from "./chunk-GZSRGACL.js";
6
+ } from "./chunk-222XA5JA.js";
7
7
  import {
8
8
  checkClientFiles,
9
9
  getClientDistPath
10
- } from "./chunk-BE2QCYB4.js";
10
+ } from "./chunk-TIYOH5C4.js";
11
11
 
12
12
  // src/server/middleware.ts
13
13
  import { Hono } from "hono";
14
14
  function mountInspector(app) {
15
15
  const clientDistPath = getClientDistPath();
16
16
  if (!checkClientFiles(clientDistPath)) {
17
- console.warn(`\u26A0\uFE0F MCP Inspector client files not found at ${clientDistPath}`);
18
- console.warn(` Run 'yarn build' in the inspector package to build the UI`);
17
+ console.warn(
18
+ `\u26A0\uFE0F MCP Inspector client files not found at ${clientDistPath}`
19
+ );
20
+ console.warn(
21
+ ` Run 'yarn build' in the inspector package to build the UI`
22
+ );
19
23
  }
20
24
  if (app instanceof Hono) {
21
25
  registerInspectorRoutes(app);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  formatErrorResponse
3
- } from "./chunk-XJDEAO7Y.js";
3
+ } from "./chunk-JCLAFMDT.js";
4
4
  import {
5
5
  generateWidgetContainerHtml,
6
6
  generateWidgetContentHtml,
@@ -9,7 +9,7 @@ import {
9
9
  handleChatRequest,
10
10
  handleChatRequestStream,
11
11
  storeWidgetData
12
- } from "./chunk-HPZTE753.js";
12
+ } from "./chunk-76XNP4ZB.js";
13
13
 
14
14
  // src/server/shared-routes.ts
15
15
  import { logger } from "hono/logger";
@@ -78,7 +78,9 @@ function registerInspectorRoutes(app, config) {
78
78
  } catch (error) {
79
79
  const errorMsg = `${JSON.stringify({
80
80
  type: "error",
81
- data: { message: error instanceof Error ? error.message : "Unknown error" }
81
+ data: {
82
+ message: error instanceof Error ? error.message : "Unknown error"
83
+ }
82
84
  })}
83
85
  `;
84
86
  await writer.write(encoder.encode(errorMsg));
@@ -90,7 +92,7 @@ function registerInspectorRoutes(app, config) {
90
92
  headers: {
91
93
  "Content-Type": "text/event-stream",
92
94
  "Cache-Control": "no-cache",
93
- "Connection": "keep-alive"
95
+ Connection: "keep-alive"
94
96
  }
95
97
  });
96
98
  } catch (error) {
@@ -116,7 +118,10 @@ function registerInspectorRoutes(app, config) {
116
118
  return c.json(result);
117
119
  } catch (error) {
118
120
  console.error("[Widget Store] Error:", error);
119
- console.error("[Widget Store] Stack:", error instanceof Error ? error.stack : "");
121
+ console.error(
122
+ "[Widget Store] Stack:",
123
+ error instanceof Error ? error.stack : ""
124
+ );
120
125
  return c.json(formatErrorResponse(error, "storeWidgetData"), 500);
121
126
  }
122
127
  });
@@ -136,7 +141,10 @@ function registerInspectorRoutes(app, config) {
136
141
  const toolId = c.req.param("toolId");
137
142
  const widgetData = getWidgetData(toolId);
138
143
  if (!widgetData) {
139
- console.error("[Widget Content] Widget data not found for toolId:", toolId);
144
+ console.error(
145
+ "[Widget Content] Widget data not found for toolId:",
146
+ toolId
147
+ );
140
148
  return c.html(
141
149
  "<html><body>Error: Widget data not found or expired</body></html>",
142
150
  404
@@ -156,10 +164,7 @@ function registerInspectorRoutes(app, config) {
156
164
  const errorMessage = error instanceof Error ? error.message : "Unknown error";
157
165
  const errorStack = error instanceof Error ? error.stack : "";
158
166
  console.error("[Widget Content] Stack:", errorStack);
159
- return c.html(
160
- `<html><body>Error: ${errorMessage}</body></html>`,
161
- 500
162
- );
167
+ return c.html(`<html><body>Error: ${errorMessage}</body></html>`, 500);
163
168
  }
164
169
  });
165
170
  app.get("/inspector/config.json", (c) => {
@@ -175,9 +180,12 @@ function registerInspectorRoutes(app, config) {
175
180
  return c.json({ success: false, error: "Missing event name" }, 400);
176
181
  }
177
182
  const { PostHog } = await import("posthog-node");
178
- const posthog = new PostHog("phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI", {
179
- host: "https://eu.i.posthog.com"
180
- });
183
+ const posthog = new PostHog(
184
+ "phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI",
185
+ {
186
+ host: "https://eu.i.posthog.com"
187
+ }
188
+ );
181
189
  const distinctId = user_id || "anonymous";
182
190
  posthog.capture({
183
191
  distinctId,
@@ -194,16 +202,23 @@ function registerInspectorRoutes(app, config) {
194
202
  app.post("/inspector/api/tel/scarf", async (c) => {
195
203
  try {
196
204
  const body = await c.req.json();
197
- const response = await fetch("https://mcpuse.gateway.scarf.sh/events-inspector", {
198
- method: "POST",
199
- headers: {
200
- "Content-Type": "application/json"
201
- },
202
- body: JSON.stringify(body)
203
- });
205
+ const response = await fetch(
206
+ "https://mcpuse.gateway.scarf.sh/events-inspector",
207
+ {
208
+ method: "POST",
209
+ headers: {
210
+ "Content-Type": "application/json"
211
+ },
212
+ body: JSON.stringify(body)
213
+ }
214
+ );
204
215
  if (!response.ok) {
205
216
  console.error("[Telemetry] Scarf request failed:", response.status);
206
- return c.json({ success: false, status: response.status, error: response.statusText });
217
+ return c.json({
218
+ success: false,
219
+ status: response.status,
220
+ error: response.statusText
221
+ });
207
222
  }
208
223
  return c.json({ success: true });
209
224
  } catch (error) {
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  registerInspectorRoutes
4
- } from "./chunk-G2KU64MV.js";
4
+ } from "./chunk-ZFMPIRVB.js";
5
5
  import {
6
6
  findAvailablePort,
7
7
  isValidUrl
8
- } from "./chunk-XJDEAO7Y.js";
8
+ } from "./chunk-JCLAFMDT.js";
9
9
  import {
10
10
  registerStaticRoutes
11
- } from "./chunk-GZSRGACL.js";
12
- import "./chunk-HPZTE753.js";
13
- import "./chunk-BE2QCYB4.js";
11
+ } from "./chunk-222XA5JA.js";
12
+ import "./chunk-76XNP4ZB.js";
13
+ import "./chunk-TIYOH5C4.js";
14
14
 
15
15
  // src/server/cli.ts
16
16
  import { serve } from "@hono/node-server";
@@ -34,7 +34,9 @@ for (let i = 0; i < args.length; i++) {
34
34
  } else if (args[i] === "--port" && i + 1 < args.length) {
35
35
  const parsedPort = Number.parseInt(args[i + 1], 10);
36
36
  if (Number.isNaN(parsedPort) || parsedPort < 1 || parsedPort > 65535) {
37
- console.error(`Error: Port must be a number between 1 and 65535, got: ${args[i + 1]}`);
37
+ console.error(
38
+ `Error: Port must be a number between 1 and 65535, got: ${args[i + 1]}`
39
+ );
38
40
  process.exit(1);
39
41
  }
40
42
  startPort = parsedPort;
@@ -84,7 +86,9 @@ async function startServer() {
84
86
  await open(`http://localhost:${port}/inspector`);
85
87
  console.log(`\u{1F310} Browser opened`);
86
88
  } catch {
87
- console.log(`\u{1F310} Please open http://localhost:${port}/inspector in your browser`);
89
+ console.log(
90
+ `\u{1F310} Please open http://localhost:${port}/inspector in your browser`
91
+ );
88
92
  }
89
93
  return { port, fetch: app.fetch };
90
94
  } catch (error) {
@@ -4,6 +4,6 @@
4
4
  * This is the main entry point for importing the inspector as a library.
5
5
  * For standalone server usage, see standalone.ts
6
6
  */
7
- export { mountInspector } from './middleware.js';
8
- export { handleChatRequest, handleChatRequestStream } from './shared-utils-browser.js';
7
+ export { mountInspector } from "./middleware.js";
8
+ export { handleChatRequest, handleChatRequestStream, } from "./shared-utils-browser.js";
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAGhD,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,EACL,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,2BAA2B,CAAC"}
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  mountInspector
3
- } from "./chunk-UAGOQUEV.js";
4
- import "./chunk-G2KU64MV.js";
5
- import "./chunk-XJDEAO7Y.js";
6
- import "./chunk-GZSRGACL.js";
3
+ } from "./chunk-YGCKPAWJ.js";
4
+ import "./chunk-ZFMPIRVB.js";
5
+ import "./chunk-JCLAFMDT.js";
6
+ import "./chunk-222XA5JA.js";
7
7
  import {
8
8
  handleChatRequest,
9
9
  handleChatRequestStream
10
- } from "./chunk-HPZTE753.js";
11
- import "./chunk-BE2QCYB4.js";
10
+ } from "./chunk-76XNP4ZB.js";
11
+ import "./chunk-TIYOH5C4.js";
12
12
  export {
13
13
  handleChatRequest,
14
14
  handleChatRequestStream,
@@ -1,5 +1,5 @@
1
- import type { Express } from 'express';
2
- import { Hono } from 'hono';
1
+ import type { Express } from "express";
2
+ import { Hono } from "hono";
3
3
  /**
4
4
  * Mount the MCP Inspector UI at a specified path on an Express or Hono app
5
5
  * Similar to how FastAPI mounts Swagger UI at /docs
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/server/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAmC,MAAM,SAAS,CAAA;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAQ3B;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CA8DxD"}
1
+ {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/server/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAmC,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAK5B;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAoExD"}
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  mountInspector
3
- } from "./chunk-UAGOQUEV.js";
4
- import "./chunk-G2KU64MV.js";
5
- import "./chunk-XJDEAO7Y.js";
6
- import "./chunk-GZSRGACL.js";
7
- import "./chunk-HPZTE753.js";
8
- import "./chunk-BE2QCYB4.js";
3
+ } from "./chunk-YGCKPAWJ.js";
4
+ import "./chunk-ZFMPIRVB.js";
5
+ import "./chunk-JCLAFMDT.js";
6
+ import "./chunk-222XA5JA.js";
7
+ import "./chunk-76XNP4ZB.js";
8
+ import "./chunk-TIYOH5C4.js";
9
9
  export {
10
10
  mountInspector
11
11
  };