@mcp-use/inspector 3.0.0 → 3.0.1-canary.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.
@@ -26920,7 +26920,7 @@ var Gd = class {
26920
26920
  //#region src/client/telemetry/utils.ts
26921
26921
  function cf() {
26922
26922
  try {
26923
- return "3.0.0";
26923
+ return "3.0.1-canary.0";
26924
26924
  } catch {
26925
26925
  return "0.0.0";
26926
26926
  }
@@ -48457,9 +48457,9 @@ var aj, oj, sj, cj, lj, uj, dj, fj, pj, mj, hj, gj, _j, vj, Lce, Rce, yj, bj, xj
48457
48457
  }(), VF);
48458
48458
  }));
48459
48459
  //#endregion
48460
- //#region ../mcp-use/dist/chunk-FYY3DYRU.js
48460
+ //#region ../mcp-use/dist/chunk-Z6OOEG4Q.js
48461
48461
  Zp();
48462
- var Hue = "1.25.0";
48462
+ var Hue = "1.25.1-canary.0";
48463
48463
  function KF() {
48464
48464
  return Hue;
48465
48465
  }
@@ -110597,7 +110597,9 @@ function SFe() {
110597
110597
  url: e,
110598
110598
  name: n,
110599
110599
  proxyConfig: r,
110600
- transportType: i
110600
+ transportType: i,
110601
+ preventAutoAuth: !0,
110602
+ useRedirectFlow: !0
110601
110603
  });
110602
110604
  }, [t]), d = (0, A.useCallback)(async (e, t) => {
110603
110605
  if (l.current.has(e)) {
@@ -110706,6 +110708,7 @@ function SFe() {
110706
110708
  name: E.trim() || e,
110707
110709
  transportType: "http",
110708
110710
  preventAutoAuth: !0,
110711
+ useRedirectFlow: !0,
110709
110712
  clientOptions: { capabilities: { extensions: { "io.modelcontextprotocol/ui": { mimeTypes: ["text/html;profile=mcp-app"] } } } },
110710
110713
  ...r ? {
110711
110714
  proxyConfig: r,
@@ -111053,8 +111056,6 @@ function SFe() {
111053
111056
  asChild: !0,
111054
111057
  children: /* @__PURE__ */ (0, O.jsx)("a", {
111055
111058
  href: e.authUrl,
111056
- target: "_blank",
111057
- rel: "noopener noreferrer",
111058
111059
  onClick: (e) => e.stopPropagation(),
111059
111060
  children: "Authenticate"
111060
111061
  })
@@ -111187,7 +111188,8 @@ function CFe({ children: e }) {
111187
111188
  embeddedConfig: t ? {
111188
111189
  chatApiUrl: t,
111189
111190
  chatStreamProtocol: "data-stream",
111190
- chatCredentials: "include"
111191
+ chatCredentials: "include",
111192
+ chatEnableFreeTierUpgrade: !0
111191
111193
  } : {}
111192
111194
  }), i = (0, A.useCallback)((e) => {
111193
111195
  r((t) => ({
@@ -134248,40 +134250,40 @@ var kZe = /(?:^\/$|\s+\/$)/, AZe = [
134248
134250
  "Escape",
134249
134251
  "Enter"
134250
134252
  ];
134251
- function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeyboardShortcuts: r = !0, prompts: i, serverId: a, callPrompt: o, readResource: s, chatApiUrl: c, waitForChatApiUrl: l, initialMessages: u, managedLlmConfig: d, clearButtonLabel: f, hideTitle: p, hideModelBadge: m, hideServerUrl: h, clearButtonHideIcon: g, clearButtonHideShortcut: _, clearButtonVariant: v, hideClearButton: y, hideToolSelector: b, chatQuickQuestions: x = [], chatFollowups: S = [], streamProtocol: C, credentials: w, extraHeaders: T, body: E }) {
134252
- let [D, k] = (0, A.useState)(""), [j, M] = (0, A.useState)(!1), [N, P] = (0, A.useState)(-1), [F, I] = (0, A.useState)(x), [L, ee] = (0, A.useState)(S), [te, ne] = (0, A.useState)(/* @__PURE__ */ new Set()), re = (0, A.useRef)(null), ie = (0, A.useRef)(null), R = (0, A.useRef)(null), z = (0, A.useMemo)(() => (e.tools ?? []).map((e) => ({
134253
+ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeyboardShortcuts: r = !0, prompts: i, serverId: a, callPrompt: o, readResource: s, chatApiUrl: c, waitForChatApiUrl: l, initialMessages: u, managedLlmConfig: d, enableFreeTierUpgrade: f = !1, clearButtonLabel: p, hideTitle: m, hideModelBadge: h, hideServerUrl: g, clearButtonHideIcon: _, clearButtonHideShortcut: v, clearButtonVariant: y, hideClearButton: b, hideToolSelector: x, chatQuickQuestions: S = [], chatFollowups: C = [], streamProtocol: w, credentials: T, extraHeaders: E, body: D }) {
134254
+ let [k, j] = (0, A.useState)(""), [M, N] = (0, A.useState)(!1), [P, F] = (0, A.useState)(-1), [I, L] = (0, A.useState)(S), [ee, te] = (0, A.useState)(C), [ne, re] = (0, A.useState)(/* @__PURE__ */ new Set()), ie = (0, A.useRef)(null), R = (0, A.useRef)(null), z = (0, A.useRef)(null), ae = (0, A.useMemo)(() => (e.tools ?? []).map((e) => ({
134253
134255
  name: e.name,
134254
134256
  description: e.description
134255
- })), [e.tools]), { llmConfig: ae, authConfig: oe, configDialogOpen: se, setConfigDialogOpen: ce, tempProvider: le, setTempProvider: ue, tempApiKey: de, setTempApiKey: fe, tempModel: pe, setTempModel: me, saveLLMConfig: he, clearConfig: ge } = Y7({ mcpServerUrl: e.url }), [_e, ve] = (0, A.useState)(() => !!ae), ye = n || _e || !!ae, be = ye ? ae : d ?? ae, xe = !ye && !!d, { getAllModelContexts: Se } = Z4(), Ce = Se(), we = {
134257
+ })), [e.tools]), { llmConfig: oe, authConfig: se, configDialogOpen: ce, setConfigDialogOpen: le, tempProvider: ue, setTempProvider: de, tempApiKey: fe, setTempApiKey: pe, tempModel: me, setTempModel: he, saveLLMConfig: ge, clearConfig: _e } = Y7({ mcpServerUrl: e.url }), [ve, ye] = (0, A.useState)(() => !!oe), be = n || ve || !!oe, xe = be ? oe : d ?? oe, Se = !be && !!d, { getAllModelContexts: Ce } = Z4(), we = Ce(), Te = {
134256
134258
  connection: e,
134257
- llmConfig: be,
134259
+ llmConfig: xe,
134258
134260
  isConnected: t,
134259
134261
  readResource: s,
134260
- widgetModelContexts: Ce,
134261
- disabledTools: te
134262
- }, Te = yZe({
134262
+ widgetModelContexts: we,
134263
+ disabledTools: ne
134264
+ }, Ee = yZe({
134263
134265
  mcpServerUrl: e.url,
134264
- llmConfig: be,
134265
- authConfig: oe,
134266
+ llmConfig: xe,
134267
+ authConfig: se,
134266
134268
  isConnected: t,
134267
134269
  chatApiUrl: c,
134268
134270
  waitForChatApiUrl: l,
134269
- widgetModelContexts: Ce,
134271
+ widgetModelContexts: we,
134270
134272
  initialMessages: u,
134271
- disabledTools: te,
134272
- streamProtocol: C,
134273
- credentials: w,
134274
- extraHeaders: T,
134275
- body: E
134276
- }), Ee = CZe(we), { messages: De, isLoading: Oe, attachments: ke, sendMessage: Ae, clearMessages: je, setMessages: Me, stop: Ne, addAttachment: Pe, removeAttachment: Fe } = ye ? Ee : Te, Ie = ye ? null : Te.rateLimitInfo ?? null, Le = ye ? void 0 : Te.clearRateLimitInfo, Re = (0, A.useCallback)(() => {
134277
- Le?.(), ve(!0), ce(!0);
134278
- }, [Le, ce]), [ze, Be] = (0, A.useState)(!1), Ve = (0, A.useCallback)(() => {
134279
- ce(!1), Be(!0);
134280
- }, [ce]), He = xe ? { onLoginClick: Ve } : void 0, { filteredPrompts: B, setSelectedPrompt: Ue, selectedPrompt: We, setPromptArgs: Ge, executePrompt: Ke, results: qe, handleDeleteResult: Je, clearPromptResults: Ye } = fIe({
134273
+ disabledTools: ne,
134274
+ streamProtocol: w,
134275
+ credentials: T,
134276
+ extraHeaders: E,
134277
+ body: D
134278
+ }), De = CZe(Te), { messages: Oe, isLoading: ke, attachments: Ae, sendMessage: je, clearMessages: Me, setMessages: Ne, stop: Pe, addAttachment: Fe, removeAttachment: Ie } = be ? De : Ee, Le = be ? null : Ee.rateLimitInfo ?? null, Re = be ? void 0 : Ee.clearRateLimitInfo, ze = (0, A.useCallback)(() => {
134279
+ Re?.(), ye(!0), le(!0);
134280
+ }, [Re, le]), [Be, Ve] = (0, A.useState)(!1), He = (0, A.useCallback)(() => {
134281
+ le(!1), Ve(!0);
134282
+ }, [le]), B = Se && f ? { onLoginClick: He } : void 0, { filteredPrompts: Ue, setSelectedPrompt: We, selectedPrompt: Ge, setPromptArgs: Ke, executePrompt: qe, results: Je, handleDeleteResult: Ye, clearPromptResults: Xe } = fIe({
134281
134283
  prompts: i,
134282
134284
  callPrompt: o,
134283
134285
  serverId: a
134284
- }), Xe = (0, A.useCallback)((e) => Array.isArray(e) ? e.filter((e) => typeof e == "string").map((e) => e.trim()).filter(Boolean).slice(0, 8) : [], []), Ze = (0, A.useCallback)((e) => {
134286
+ }), Ze = (0, A.useCallback)((e) => Array.isArray(e) ? e.filter((e) => typeof e == "string").map((e) => e.trim()).filter(Boolean).slice(0, 8) : [], []), Qe = (0, A.useCallback)((e) => {
134285
134287
  if (typeof e.content == "string" && e.content.trim()) return e.content;
134286
134288
  if (Array.isArray(e.content) && e.content.length > 0) return e.content.map((e) => typeof e == "string" ? e : e.text ?? "").join("");
134287
134289
  if (e.parts && e.parts.length > 0) {
@@ -134289,7 +134291,7 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
134289
134291
  if (t.length > 0) return t.join("\n");
134290
134292
  }
134291
134293
  return "";
134292
- }, []), Qe = (0, A.useCallback)((e) => {
134294
+ }, []), $e = (0, A.useCallback)((e) => {
134293
134295
  if (e == null) return "No result";
134294
134296
  if (typeof e == "string") try {
134295
134297
  let t = JSON.parse(e);
@@ -134312,8 +134314,8 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
134312
134314
  }).join("\n\n");
134313
134315
  }
134314
134316
  return JSON.stringify(e, null, 2);
134315
- }, []), $e = (0, A.useCallback)(() => De.map((e) => {
134316
- let t = Ze(e), n = e.parts?.filter((e) => e.type === "tool-invocation" && e.toolInvocation).map((e) => ({
134317
+ }, []), et = (0, A.useCallback)(() => Oe.map((e) => {
134318
+ let t = Qe(e), n = e.parts?.filter((e) => e.type === "tool-invocation" && e.toolInvocation).map((e) => ({
134317
134319
  toolName: e.toolInvocation.toolName,
134318
134320
  args: e.toolInvocation.args,
134319
134321
  state: e.toolInvocation.state,
@@ -134326,7 +134328,7 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
134326
134328
  timestamp: e.timestamp,
134327
134329
  toolInvocations: n?.length ? n : void 0
134328
134330
  };
134329
- }), [De, Ze]), et = (0, A.useCallback)((e, t = {}) => {
134331
+ }), [Oe, Qe]), tt = (0, A.useCallback)((e, t = {}) => {
134330
134332
  typeof window > "u" || window.parent === window || window.parent.postMessage({
134331
134333
  type: e,
134332
134334
  serverId: a,
@@ -134334,7 +134336,7 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
134334
134336
  }, "*");
134335
134337
  }, [a]);
134336
134338
  (0, A.useEffect)(() => {
134337
- et("mcp-inspector:chat:ready", { capabilities: {
134339
+ tt("mcp-inspector:chat:ready", { capabilities: {
134338
134340
  send: !0,
134339
134341
  clear: !0,
134340
134342
  getState: !0,
@@ -134342,28 +134344,28 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
134342
134344
  setFollowups: !0,
134343
134345
  loadMessages: !0
134344
134346
  } });
134345
- }, [et]), (0, A.useEffect)(() => {
134346
- et("mcp-inspector:chat:state_changed", {
134347
- isLoading: Oe,
134348
- messageCount: De.length,
134349
- messages: $e(),
134350
- quickQuestions: F,
134351
- followups: L
134347
+ }, [tt]), (0, A.useEffect)(() => {
134348
+ tt("mcp-inspector:chat:state_changed", {
134349
+ isLoading: ke,
134350
+ messageCount: Oe.length,
134351
+ messages: et(),
134352
+ quickQuestions: I,
134353
+ followups: ee
134352
134354
  });
134353
134355
  }, [
134354
- L,
134355
- $e,
134356
- Oe,
134357
- De.length,
134356
+ ee,
134358
134357
  et,
134359
- F
134358
+ ke,
134359
+ Oe.length,
134360
+ tt,
134361
+ I
134360
134362
  ]), (0, A.useEffect)(() => {
134361
134363
  let e = (e) => {
134362
134364
  if (!e.data || typeof e.data != "object") return;
134363
134365
  let n = e.data;
134364
134366
  if (!n.type?.startsWith("mcp-inspector:chat:") || n.serverId && n.serverId !== a) return;
134365
134367
  let r = n.requestId, i = (e, t = {}) => {
134366
- et("mcp-inspector:chat:command_result", {
134368
+ tt("mcp-inspector:chat:command_result", {
134367
134369
  requestId: r,
134368
134370
  ok: e,
134369
134371
  ...t
@@ -134375,12 +134377,12 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
134375
134377
  i(!1, { error: "Missing message" });
134376
134378
  return;
134377
134379
  }
134378
- if (!be || !t) {
134380
+ if (!xe || !t) {
134379
134381
  i(!1, { error: "Chat is not ready to send messages" });
134380
134382
  return;
134381
134383
  }
134382
- Ae(e, []).then(() => {
134383
- et("mcp-inspector:chat:message_sent", {
134384
+ je(e, []).then(() => {
134385
+ tt("mcp-inspector:chat:message_sent", {
134384
134386
  requestId: r,
134385
134387
  message: e,
134386
134388
  source: "bridge"
@@ -134391,28 +134393,28 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
134391
134393
  return;
134392
134394
  }
134393
134395
  if (n.type === "mcp-inspector:chat:clear") {
134394
- je(), et("mcp-inspector:chat:cleared", { requestId: r }), i(!0);
134396
+ Me(), tt("mcp-inspector:chat:cleared", { requestId: r }), i(!0);
134395
134397
  return;
134396
134398
  }
134397
134399
  if (n.type === "mcp-inspector:chat:get_state") {
134398
- et("mcp-inspector:chat:state", {
134400
+ tt("mcp-inspector:chat:state", {
134399
134401
  requestId: r,
134400
- isLoading: Oe,
134401
- messageCount: De.length,
134402
- messages: $e(),
134403
- quickQuestions: F,
134404
- followups: L
134402
+ isLoading: ke,
134403
+ messageCount: Oe.length,
134404
+ messages: et(),
134405
+ quickQuestions: I,
134406
+ followups: ee
134405
134407
  }), i(!0);
134406
134408
  return;
134407
134409
  }
134408
134410
  if (n.type === "mcp-inspector:chat:set_quick_questions") {
134409
- let e = Xe(n.questions);
134410
- I(e), i(!0, { quickQuestions: e });
134411
+ let e = Ze(n.questions);
134412
+ L(e), i(!0, { quickQuestions: e });
134411
134413
  return;
134412
134414
  }
134413
134415
  if (n.type === "mcp-inspector:chat:set_followups") {
134414
- let e = Xe(n.followups);
134415
- ee(e), i(!0, { followups: e });
134416
+ let e = Ze(n.followups);
134417
+ te(e), i(!0, { followups: e });
134416
134418
  return;
134417
134419
  }
134418
134420
  if (n.type === "mcp-inspector:chat:load_messages") {
@@ -134421,7 +134423,7 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
134421
134423
  i(!1, { error: "messages must be an array" });
134422
134424
  return;
134423
134425
  }
134424
- Me(e), i(!0, { count: e.length });
134426
+ Ne(e), i(!0, { count: e.length });
134425
134427
  return;
134426
134428
  }
134427
134429
  if (n.type === "mcp-inspector:chat:screenshot") {
@@ -134433,7 +134435,7 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
134433
134435
  let e = document.querySelectorAll("[data-tool-call-id]");
134434
134436
  e.length > 0 && (t = e[e.length - 1]);
134435
134437
  }
134436
- if (!t && ie.current && (t = ie.current), !t) {
134438
+ if (!t && R.current && (t = R.current), !t) {
134437
134439
  i(!1, { error: "No screenshot target found" });
134438
134440
  return;
134439
134441
  }
@@ -134467,15 +134469,15 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
134467
134469
  } catch (e) {
134468
134470
  s = e instanceof Error ? e.message : String(e);
134469
134471
  }
134470
- if (a) et("mcp-inspector:chat:screenshot_result", {
134472
+ if (a) tt("mcp-inspector:chat:screenshot_result", {
134471
134473
  requestId: r,
134472
134474
  toolCallId: e || null,
134473
134475
  image: a,
134474
134476
  timestamp: Date.now()
134475
134477
  }), i(!0);
134476
134478
  else {
134477
- let t = ie.current || document.body, n = t.innerText?.substring(0, 5e3) || "", a = t.innerHTML?.substring(0, 1e4) || "";
134478
- et("mcp-inspector:chat:screenshot_result", {
134479
+ let t = R.current || document.body, n = t.innerText?.substring(0, 5e3) || "", a = t.innerHTML?.substring(0, 1e4) || "";
134480
+ tt("mcp-inspector:chat:screenshot_result", {
134479
134481
  requestId: r,
134480
134482
  toolCallId: e || null,
134481
134483
  image: "",
@@ -134486,8 +134488,8 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
134486
134488
  }), i(!1, { error: `html-to-image: ${o}; html2canvas: ${s}` });
134487
134489
  }
134488
134490
  } catch (t) {
134489
- let n = (ie.current || document.body).innerText?.substring(0, 5e3) || "";
134490
- et("mcp-inspector:chat:screenshot_result", {
134491
+ let n = (R.current || document.body).innerText?.substring(0, 5e3) || "";
134492
+ tt("mcp-inspector:chat:screenshot_result", {
134491
134493
  requestId: r,
134492
134494
  toolCallId: e || null,
134493
134495
  image: "",
@@ -134502,114 +134504,114 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
134502
134504
  };
134503
134505
  return window.addEventListener("message", e), () => window.removeEventListener("message", e);
134504
134506
  }, [
134505
- je,
134506
134507
  Me,
134507
- L,
134508
- $e,
134509
- Oe,
134510
- De.length,
134508
+ Ne,
134509
+ ee,
134511
134510
  et,
134512
- F,
134513
- Xe,
134514
- Ae,
134511
+ ke,
134512
+ Oe.length,
134513
+ tt,
134514
+ I,
134515
+ Ze,
134516
+ je,
134515
134517
  a,
134516
- be,
134518
+ xe,
134517
134519
  t
134518
- ]), a0(r ? { onNewChat: je } : {});
134519
- let tt = (0, A.useCallback)(() => {
134520
- P(-1), M(!1), R.current = null;
134521
- }, []), nt = (0, A.useCallback)(() => {
134522
- if (!re.current) return;
134523
- let e = re.current.selectionStart, t = D.slice(0, e), n = kZe.test(t);
134524
- M(n), n ? (R.current = {
134520
+ ]), a0(r ? { onNewChat: Me } : {});
134521
+ let nt = (0, A.useCallback)(() => {
134522
+ F(-1), N(!1), z.current = null;
134523
+ }, []), rt = (0, A.useCallback)(() => {
134524
+ if (!ie.current) return;
134525
+ let e = ie.current.selectionStart, t = k.slice(0, e), n = kZe.test(t);
134526
+ N(n), n ? (z.current = {
134525
134527
  start: e - 1,
134526
134528
  end: e
134527
- }, P(0)) : tt();
134528
- }, [D, tt]);
134529
+ }, F(0)) : nt();
134530
+ }, [k, nt]);
134529
134531
  (0, A.useEffect)(() => {
134530
- be && De.length === 0 && re.current && re.current.focus();
134531
- }, [be, De.length]), (0, A.useEffect)(() => {
134532
- !Oe && De.length > 0 && re.current && re.current.focus();
134533
- }, [Oe, De.length]), (0, A.useEffect)(() => {
134534
- re.current && nt();
134535
- }, [D, nt]);
134536
- let rt = (0, A.useCallback)(() => {
134537
- Ue(null), Ge({}), tt();
134538
- }, [tt]), it = (0, A.useCallback)(async (e) => {
134539
- if (Ue(e), e.arguments && e.arguments.length > 0) {
134540
- Ue(null), EB.error("Prompts with arguments are not supported", { description: "This prompt requires arguments which are not yet supported in chat mode." });
134532
+ xe && Oe.length === 0 && ie.current && ie.current.focus();
134533
+ }, [xe, Oe.length]), (0, A.useEffect)(() => {
134534
+ !ke && Oe.length > 0 && ie.current && ie.current.focus();
134535
+ }, [ke, Oe.length]), (0, A.useEffect)(() => {
134536
+ ie.current && rt();
134537
+ }, [k, rt]);
134538
+ let it = (0, A.useCallback)(() => {
134539
+ We(null), Ke({}), nt();
134540
+ }, [nt]), at = (0, A.useCallback)(async (e) => {
134541
+ if (We(e), e.arguments && e.arguments.length > 0) {
134542
+ We(null), EB.error("Prompts with arguments are not supported", { description: "This prompt requires arguments which are not yet supported in chat mode." });
134541
134543
  return;
134542
134544
  }
134543
134545
  try {
134544
- await Ke(e, {});
134546
+ await qe(e, {});
134545
134547
  } catch (e) {
134546
134548
  console.error("Error executing prompt", e);
134547
134549
  } finally {
134548
- if (re.current && R.current) {
134549
- let { start: e, end: t } = R.current;
134550
- k(D.slice(0, e) + D.slice(t)), requestAnimationFrame(() => {
134551
- re.current?.focus(), re.current?.setSelectionRange(e, e);
134550
+ if (ie.current && z.current) {
134551
+ let { start: e, end: t } = z.current;
134552
+ j(k.slice(0, e) + k.slice(t)), requestAnimationFrame(() => {
134553
+ ie.current?.focus(), ie.current?.setSelectionRange(e, e);
134552
134554
  });
134553
134555
  }
134554
- rt();
134556
+ it();
134555
134557
  }
134556
134558
  }, [
134557
- Ke,
134558
- rt,
134559
- D
134560
- ]), at = (0, A.useCallback)(() => {
134561
- (D.trim() || qe.length > 0 || ke.length > 0) && (Ae(D, qe), k(""), Ye());
134562
- }, [
134563
- D,
134564
134559
  qe,
134565
- Ae,
134566
- Ye,
134567
- ke
134568
- ]), ot = (0, A.useCallback)((e) => {
134569
- if (e.key === "ArrowDown") P((e) => B.length === 0 ? -1 : (e + 1) % B.length);
134570
- else if (e.key === "ArrowUp") P((e) => B.length === 0 ? -1 : (e - 1 + B.length) % B.length);
134571
- else if (e.key === "Escape") e.stopPropagation(), tt();
134572
- else if (e.key === "Enter" && N >= 0) {
134573
- let e = B[N];
134574
- e && it(e);
134575
- }
134576
- }, [
134577
- B,
134578
- N,
134579
134560
  it,
134580
- tt
134561
+ k
134562
+ ]), ot = (0, A.useCallback)(() => {
134563
+ (k.trim() || Je.length > 0 || Ae.length > 0) && (je(k, Je), j(""), Xe());
134564
+ }, [
134565
+ k,
134566
+ Je,
134567
+ je,
134568
+ Xe,
134569
+ Ae
134581
134570
  ]), st = (0, A.useCallback)((e) => {
134582
- AZe.includes(e.key) && j ? (e.preventDefault(), ot(e)) : e.key === "Enter" && !e.shiftKey && (e.preventDefault(), at());
134571
+ if (e.key === "ArrowDown") F((e) => Ue.length === 0 ? -1 : (e + 1) % Ue.length);
134572
+ else if (e.key === "ArrowUp") F((e) => Ue.length === 0 ? -1 : (e - 1 + Ue.length) % Ue.length);
134573
+ else if (e.key === "Escape") e.stopPropagation(), nt();
134574
+ else if (e.key === "Enter" && P >= 0) {
134575
+ let e = Ue[P];
134576
+ e && at(e);
134577
+ }
134583
134578
  }, [
134579
+ Ue,
134580
+ P,
134584
134581
  at,
134585
- ot,
134586
- j
134582
+ nt
134587
134583
  ]), ct = (0, A.useCallback)((e) => {
134588
- (e.key === "ArrowLeft" || e.key === "ArrowRight") && nt();
134589
- }, [nt]), lt = (0, A.useCallback)((e) => {
134584
+ AZe.includes(e.key) && M ? (e.preventDefault(), st(e)) : e.key === "Enter" && !e.shiftKey && (e.preventDefault(), ot());
134585
+ }, [
134586
+ ot,
134587
+ st,
134588
+ M
134589
+ ]), lt = (0, A.useCallback)((e) => {
134590
+ (e.key === "ArrowLeft" || e.key === "ArrowRight") && rt();
134591
+ }, [rt]), ut = (0, A.useCallback)((e) => {
134590
134592
  let t = `# Chat Export - ${(/* @__PURE__ */ new Date()).toLocaleString()}\n\n`;
134591
134593
  return t += e.map((e) => {
134592
134594
  let t = e.role.charAt(0).toUpperCase() + e.role.slice(1);
134593
134595
  if (!e.parts || e.parts.length === 0) {
134594
- let n = Ze(e).trim();
134596
+ let n = Qe(e).trim();
134595
134597
  return n ? `## ${t}\n${n}` : "";
134596
134598
  }
134597
134599
  let n = [];
134598
134600
  for (let t of e.parts) if (t.type === "text" && t.text?.trim()) n.push(t.text.trim());
134599
134601
  else if (t.type === "tool-invocation" && t.toolInvocation) {
134600
- let e = t.toolInvocation, r = Qe(e.result);
134602
+ let e = t.toolInvocation, r = $e(e.result);
134601
134603
  n.push(`#### ${e.toolName}\n**Arguments:**\n\`\`\`json\n${JSON.stringify(e.args, null, 2)}\n\`\`\`\n**Result:**\n\n${r}`);
134602
134604
  }
134603
134605
  return n.length === 0 ? "" : `## ${t}\n\n${n.join("\n\n")}`;
134604
134606
  }).filter((e) => e !== "").join("\n\n---\n\n"), t;
134605
- }, [Ze, Qe]), ut = (0, A.useCallback)(() => {
134606
- yz(lt(De)).then(() => EB.success("Chat copied to clipboard"), () => EB.error("Failed to copy chat"));
134607
- }, [De, lt]), dt = (0, A.useCallback)((e) => {
134607
+ }, [Qe, $e]), dt = (0, A.useCallback)(() => {
134608
+ yz(ut(Oe)).then(() => EB.success("Chat copied to clipboard"), () => EB.error("Failed to copy chat"));
134609
+ }, [Oe, ut]), ft = (0, A.useCallback)((e) => {
134608
134610
  let t = `chat-export-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}`;
134609
- if (e === "json") Uye(De.map((e) => ({
134611
+ if (e === "json") Uye(Oe.map((e) => ({
134610
134612
  id: e.id,
134611
134613
  role: e.role,
134612
- content: Ze(e),
134614
+ content: Qe(e),
134613
134615
  timestamp: e.timestamp,
134614
134616
  toolInvocations: e.parts?.filter((e) => e.type === "tool-invocation" && e.toolInvocation).map((e) => ({
134615
134617
  toolName: e.toolInvocation.toolName,
@@ -134618,175 +134620,175 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
134618
134620
  }))
134619
134621
  })), t + ".json");
134620
134622
  else {
134621
- let e = lt(De), n = new Blob([e], { type: "text/markdown" }), r = URL.createObjectURL(n), i = document.createElement("a");
134623
+ let e = ut(Oe), n = new Blob([e], { type: "text/markdown" }), r = URL.createObjectURL(n), i = document.createElement("a");
134622
134624
  i.href = r, i.download = t + ".md", document.body.appendChild(i), i.click(), document.body.removeChild(i), setTimeout(() => URL.revokeObjectURL(r), 100);
134623
134625
  }
134624
134626
  EB.success(`Chat exported as ${e.toUpperCase()}`);
134625
134627
  }, [
134626
- De,
134627
- lt,
134628
- Ze
134629
- ]), ft = (0, A.useCallback)(() => {
134630
- ge(), je();
134631
- }, [ge, je]), pt = (0, A.useCallback)((e) => {
134632
- e.trim() && (!be || !t || Ae(e, []).then(() => {
134633
- et("mcp-inspector:chat:message_sent", {
134628
+ Oe,
134629
+ ut,
134630
+ Qe
134631
+ ]), pt = (0, A.useCallback)(() => {
134632
+ _e(), Me();
134633
+ }, [_e, Me]), mt = (0, A.useCallback)((e) => {
134634
+ e.trim() && (!xe || !t || je(e, []).then(() => {
134635
+ tt("mcp-inspector:chat:message_sent", {
134634
134636
  message: e,
134635
134637
  source: "quick_question"
134636
134638
  });
134637
134639
  }));
134638
134640
  }, [
134639
- et,
134640
- Ae,
134641
- be,
134641
+ tt,
134642
+ je,
134643
+ xe,
134642
134644
  t
134643
- ]), mt = (0, A.useCallback)((e) => {
134644
- e.trim() && (!be || !t || Ae(e, []).then(() => {
134645
- et("mcp-inspector:chat:message_sent", {
134645
+ ]), ht = (0, A.useCallback)((e) => {
134646
+ e.trim() && (!xe || !t || je(e, []).then(() => {
134647
+ tt("mcp-inspector:chat:message_sent", {
134646
134648
  message: e,
134647
134649
  source: "followup"
134648
134650
  });
134649
134651
  }));
134650
134652
  }, [
134651
- et,
134652
- Ae,
134653
- be,
134653
+ tt,
134654
+ je,
134655
+ xe,
134654
134656
  t
134655
- ]), ht = (Ie || ze) && c ? /* @__PURE__ */ (0, O.jsx)(OZe, {
134657
+ ]), gt = (Le || Be) && c ? /* @__PURE__ */ (0, O.jsx)(OZe, {
134656
134658
  authOrigin: new URL(c).origin,
134657
134659
  onDismiss: () => {
134658
- Le?.(), Be(!1);
134660
+ Re?.(), Ve(!1);
134659
134661
  },
134660
- onUseApiKey: Re
134662
+ onUseApiKey: ze
134661
134663
  }) : null;
134662
- return be && De.length === 0 ? /* @__PURE__ */ (0, O.jsxs)("div", {
134664
+ return xe && Oe.length === 0 ? /* @__PURE__ */ (0, O.jsxs)("div", {
134663
134665
  className: "flex flex-col h-full",
134664
134666
  children: [
134665
134667
  /* @__PURE__ */ (0, O.jsx)("div", {
134666
134668
  className: "absolute top-4 right-4 z-10",
134667
134669
  children: /* @__PURE__ */ (0, O.jsx)(GIe, {
134668
- open: se,
134669
- onOpenChange: ce,
134670
- tempProvider: le,
134671
- tempModel: pe,
134672
- tempApiKey: de,
134673
- onProviderChange: ue,
134674
- onModelChange: me,
134675
- onApiKeyChange: fe,
134676
- onSave: he,
134677
- onClear: ft,
134678
- showClearButton: !xe,
134670
+ open: ce,
134671
+ onOpenChange: le,
134672
+ tempProvider: ue,
134673
+ tempModel: me,
134674
+ tempApiKey: fe,
134675
+ onProviderChange: de,
134676
+ onModelChange: he,
134677
+ onApiKeyChange: pe,
134678
+ onSave: ge,
134679
+ onClear: pt,
134680
+ showClearButton: !Se,
134679
134681
  buttonLabel: "Change API Key",
134680
- freeTierInfo: He
134682
+ freeTierInfo: B
134681
134683
  })
134682
134684
  }),
134683
134685
  /* @__PURE__ */ (0, O.jsx)(xLe, {
134684
134686
  mcpServerUrl: e.url,
134685
- inputValue: D,
134687
+ inputValue: k,
134686
134688
  isConnected: t,
134687
- isLoading: Oe,
134688
- textareaRef: re,
134689
- llmConfig: be,
134690
- promptsDropdownOpen: j,
134691
- promptFocusedIndex: N,
134692
- prompts: B,
134693
- selectedPrompt: We,
134694
- promptResults: qe,
134695
- attachments: ke,
134696
- tools: b ? void 0 : z,
134697
- disabledTools: b ? void 0 : te,
134698
- onDisabledToolsChange: b ? void 0 : ne,
134699
- onDeletePromptResult: Je,
134700
- onPromptSelect: it,
134701
- onInputChange: k,
134702
- onKeyDown: st,
134703
- onKeyUp: ct,
134704
- onClick: nt,
134689
+ isLoading: ke,
134690
+ textareaRef: ie,
134691
+ llmConfig: xe,
134692
+ promptsDropdownOpen: M,
134693
+ promptFocusedIndex: P,
134694
+ prompts: Ue,
134695
+ selectedPrompt: Ge,
134696
+ promptResults: Je,
134697
+ attachments: Ae,
134698
+ tools: x ? void 0 : ae,
134699
+ disabledTools: x ? void 0 : ne,
134700
+ onDisabledToolsChange: x ? void 0 : re,
134701
+ onDeletePromptResult: Ye,
134702
+ onPromptSelect: at,
134703
+ onInputChange: j,
134704
+ onKeyDown: ct,
134705
+ onKeyUp: lt,
134706
+ onClick: rt,
134705
134707
  onSubmit: (e) => {
134706
- e.preventDefault(), at();
134707
- },
134708
- onConfigDialogOpenChange: ce,
134709
- onAttachmentAdd: Pe,
134710
- onAttachmentRemove: Fe,
134711
- hideModelBadge: m && !ye,
134712
- hideServerUrl: h,
134713
- quickQuestions: F,
134714
- onQuickQuestionSelect: pt,
134715
- freeTierInfo: He
134708
+ e.preventDefault(), ot();
134709
+ },
134710
+ onConfigDialogOpenChange: le,
134711
+ onAttachmentAdd: Fe,
134712
+ onAttachmentRemove: Ie,
134713
+ hideModelBadge: h && !be,
134714
+ hideServerUrl: g,
134715
+ quickQuestions: I,
134716
+ onQuickQuestionSelect: mt,
134717
+ freeTierInfo: B
134716
134718
  }),
134717
- ht
134719
+ gt
134718
134720
  ]
134719
134721
  }) : /* @__PURE__ */ (0, O.jsxs)("div", {
134720
134722
  className: "flex flex-col h-full relative",
134721
134723
  children: [
134722
134724
  /* @__PURE__ */ (0, O.jsx)(KIe, {
134723
- llmConfig: be,
134724
- hasMessages: De.length > 0,
134725
- configDialogOpen: se,
134726
- onConfigDialogOpenChange: ce,
134727
- onClearChat: je,
134728
- tempProvider: le,
134729
- tempModel: pe,
134730
- tempApiKey: de,
134731
- onProviderChange: ue,
134732
- onModelChange: me,
134733
- onApiKeyChange: fe,
134734
- onSaveConfig: he,
134735
- onClearConfig: ft,
134736
- hideConfigButton: xe && !He,
134737
- freeTierInfo: He,
134738
- onCopyChat: ut,
134739
- onExportChat: dt,
134740
- clearButtonLabel: f,
134741
- hideTitle: p,
134742
- clearButtonHideIcon: g,
134743
- clearButtonHideShortcut: _,
134744
- clearButtonVariant: v,
134745
- hideClearButton: y
134725
+ llmConfig: xe,
134726
+ hasMessages: Oe.length > 0,
134727
+ configDialogOpen: ce,
134728
+ onConfigDialogOpenChange: le,
134729
+ onClearChat: Me,
134730
+ tempProvider: ue,
134731
+ tempModel: me,
134732
+ tempApiKey: fe,
134733
+ onProviderChange: de,
134734
+ onModelChange: he,
134735
+ onApiKeyChange: pe,
134736
+ onSaveConfig: ge,
134737
+ onClearConfig: pt,
134738
+ hideConfigButton: Se && !B,
134739
+ freeTierInfo: B,
134740
+ onCopyChat: dt,
134741
+ onExportChat: ft,
134742
+ clearButtonLabel: p,
134743
+ hideTitle: m,
134744
+ clearButtonHideIcon: _,
134745
+ clearButtonHideShortcut: v,
134746
+ clearButtonVariant: y,
134747
+ hideClearButton: b
134746
134748
  }),
134747
134749
  /* @__PURE__ */ (0, O.jsx)("div", {
134748
- ref: ie,
134750
+ ref: R,
134749
134751
  className: "flex-1 overflow-y-auto p-2 sm:p-4 pt-[80px] sm:pt-[100px]",
134750
- children: be ? /* @__PURE__ */ (0, O.jsx)(gZe, {
134751
- messages: De,
134752
- isLoading: Oe,
134752
+ children: xe ? /* @__PURE__ */ (0, O.jsx)(gZe, {
134753
+ messages: Oe,
134754
+ isLoading: ke,
134753
134755
  serverId: e.url,
134754
134756
  readResource: s,
134755
134757
  tools: e.tools,
134756
- sendMessage: (e, t) => Ae(e, [], t),
134758
+ sendMessage: (e, t) => je(e, [], t),
134757
134759
  serverBaseUrl: e.url,
134758
134760
  pendingElicitationRequests: e.pendingElicitationRequests,
134759
134761
  onApproveElicitation: e.approveElicitation,
134760
134762
  onRejectElicitation: e.rejectElicitation
134761
- }) : /* @__PURE__ */ (0, O.jsx)(SLe, { onConfigureClick: () => ce(!0) })
134763
+ }) : /* @__PURE__ */ (0, O.jsx)(SLe, { onConfigureClick: () => le(!0) })
134762
134764
  }),
134763
- ht,
134764
- be && /* @__PURE__ */ (0, O.jsx)(yLe, {
134765
- inputValue: D,
134766
- isConnected: t && !Ie,
134767
- isLoading: Oe,
134768
- textareaRef: re,
134769
- promptsDropdownOpen: j,
134770
- promptFocusedIndex: N,
134771
- prompts: B,
134772
- promptResults: qe,
134773
- selectedPrompt: We,
134774
- attachments: ke,
134775
- tools: b ? void 0 : z,
134776
- disabledTools: b ? void 0 : te,
134777
- onDisabledToolsChange: b ? void 0 : ne,
134778
- onDeletePromptResult: Je,
134779
- onPromptSelect: it,
134780
- onInputChange: k,
134781
- onKeyDown: st,
134782
- onKeyUp: ct,
134783
- onClick: nt,
134784
- onSendMessage: at,
134785
- onStopStreaming: Ne,
134786
- onAttachmentAdd: Pe,
134787
- onAttachmentRemove: Fe,
134788
- followups: L,
134789
- onFollowupSelect: mt
134765
+ gt,
134766
+ xe && /* @__PURE__ */ (0, O.jsx)(yLe, {
134767
+ inputValue: k,
134768
+ isConnected: t && !Le,
134769
+ isLoading: ke,
134770
+ textareaRef: ie,
134771
+ promptsDropdownOpen: M,
134772
+ promptFocusedIndex: P,
134773
+ prompts: Ue,
134774
+ promptResults: Je,
134775
+ selectedPrompt: Ge,
134776
+ attachments: Ae,
134777
+ tools: x ? void 0 : ae,
134778
+ disabledTools: x ? void 0 : ne,
134779
+ onDisabledToolsChange: x ? void 0 : re,
134780
+ onDeletePromptResult: Ye,
134781
+ onPromptSelect: at,
134782
+ onInputChange: j,
134783
+ onKeyDown: ct,
134784
+ onKeyUp: lt,
134785
+ onClick: rt,
134786
+ onSendMessage: ot,
134787
+ onStopStreaming: Pe,
134788
+ onAttachmentAdd: Fe,
134789
+ onAttachmentRemove: Ie,
134790
+ followups: ee,
134791
+ onFollowupSelect: ht
134790
134792
  })
134791
134793
  ]
134792
134794
  });
@@ -142121,6 +142123,7 @@ function P1e({ selectedServer: e, activeTab: t, toolsSearchRef: n, promptsSearch
142121
142123
  model: "claude-haiku-4-5",
142122
142124
  apiKey: "server-managed"
142123
142125
  },
142126
+ enableFreeTierUpgrade: o.chatEnableFreeTierUpgrade,
142124
142127
  hideTitle: o.chatHideTitle,
142125
142128
  hideModelBadge: o.chatHideModelBadge ?? !0,
142126
142129
  hideServerUrl: o.chatHideServerUrl ?? !0,
@@ -142192,6 +142195,7 @@ function P1e({ selectedServer: e, activeTab: t, toolsSearchRef: n, promptsSearch
142192
142195
  model: "claude-haiku-4-5",
142193
142196
  apiKey: "server-managed"
142194
142197
  } : void 0),
142198
+ enableFreeTierUpgrade: o.chatEnableFreeTierUpgrade,
142195
142199
  hideTitle: o.chatHideTitle,
142196
142200
  hideModelBadge: o.chatHideModelBadge ?? !!o.chatApiUrl,
142197
142201
  hideServerUrl: o.chatHideServerUrl ?? !!o.chatApiUrl,
@@ -144436,6 +144440,7 @@ function O0e({ children: e }) {
144436
144440
  proxyConfig: n,
144437
144441
  transportType: r,
144438
144442
  preventAutoAuth: !0,
144443
+ useRedirectFlow: !0,
144439
144444
  clientOptions: { capabilities: { extensions: { "io.modelcontextprotocol/ui": { mimeTypes: ["text/html;profile=mcp-app"] } } } }
144440
144445
  });
144441
144446
  }, [i]), u = (0, A.useCallback)(async (e, t) => {