@modelcontextprotocol/inspector 0.8.1 → 0.9.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.
@@ -7261,43 +7261,60 @@ function composeContextScopes(...scopes) {
7261
7261
  createScope.scopeName = baseScope.scopeName;
7262
7262
  return createScope;
7263
7263
  }
7264
- var Slot = reactExports.forwardRef((props, forwardedRef) => {
7265
- const { children, ...slotProps } = props;
7266
- const childrenArray = reactExports.Children.toArray(children);
7267
- const slottable = childrenArray.find(isSlottable);
7268
- if (slottable) {
7269
- const newElement = slottable.props.children;
7270
- const newChildren = childrenArray.map((child) => {
7271
- if (child === slottable) {
7272
- if (reactExports.Children.count(newElement) > 1) return reactExports.Children.only(null);
7273
- return reactExports.isValidElement(newElement) ? newElement.props.children : null;
7274
- } else {
7275
- return child;
7276
- }
7277
- });
7278
- return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: reactExports.isValidElement(newElement) ? reactExports.cloneElement(newElement, void 0, newChildren) : null });
7279
- }
7280
- return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
7281
- });
7282
- Slot.displayName = "Slot";
7283
- var SlotClone = reactExports.forwardRef((props, forwardedRef) => {
7284
- const { children, ...slotProps } = props;
7285
- if (reactExports.isValidElement(children)) {
7286
- const childrenRef = getElementRef$1(children);
7287
- const props2 = mergeProps(slotProps, children.props);
7288
- if (children.type !== reactExports.Fragment) {
7289
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
7290
- }
7291
- return reactExports.cloneElement(children, props2);
7292
- }
7293
- return reactExports.Children.count(children) > 1 ? reactExports.Children.only(null) : null;
7294
- });
7295
- SlotClone.displayName = "SlotClone";
7296
- var Slottable = ({ children }) => {
7297
- return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children });
7298
- };
7264
+ // @__NO_SIDE_EFFECTS__
7265
+ function createSlot(ownerName) {
7266
+ const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
7267
+ const Slot2 = reactExports.forwardRef((props, forwardedRef) => {
7268
+ const { children, ...slotProps } = props;
7269
+ const childrenArray = reactExports.Children.toArray(children);
7270
+ const slottable = childrenArray.find(isSlottable);
7271
+ if (slottable) {
7272
+ const newElement = slottable.props.children;
7273
+ const newChildren = childrenArray.map((child) => {
7274
+ if (child === slottable) {
7275
+ if (reactExports.Children.count(newElement) > 1) return reactExports.Children.only(null);
7276
+ return reactExports.isValidElement(newElement) ? newElement.props.children : null;
7277
+ } else {
7278
+ return child;
7279
+ }
7280
+ });
7281
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: reactExports.isValidElement(newElement) ? reactExports.cloneElement(newElement, void 0, newChildren) : null });
7282
+ }
7283
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
7284
+ });
7285
+ Slot2.displayName = `${ownerName}.Slot`;
7286
+ return Slot2;
7287
+ }
7288
+ var Slot$3 = /* @__PURE__ */ createSlot("Slot");
7289
+ // @__NO_SIDE_EFFECTS__
7290
+ function createSlotClone(ownerName) {
7291
+ const SlotClone = reactExports.forwardRef((props, forwardedRef) => {
7292
+ const { children, ...slotProps } = props;
7293
+ if (reactExports.isValidElement(children)) {
7294
+ const childrenRef = getElementRef$1(children);
7295
+ const props2 = mergeProps(slotProps, children.props);
7296
+ if (children.type !== reactExports.Fragment) {
7297
+ props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
7298
+ }
7299
+ return reactExports.cloneElement(children, props2);
7300
+ }
7301
+ return reactExports.Children.count(children) > 1 ? reactExports.Children.only(null) : null;
7302
+ });
7303
+ SlotClone.displayName = `${ownerName}.SlotClone`;
7304
+ return SlotClone;
7305
+ }
7306
+ var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
7307
+ // @__NO_SIDE_EFFECTS__
7308
+ function createSlottable(ownerName) {
7309
+ const Slottable2 = ({ children }) => {
7310
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children });
7311
+ };
7312
+ Slottable2.displayName = `${ownerName}.Slottable`;
7313
+ Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
7314
+ return Slottable2;
7315
+ }
7299
7316
  function isSlottable(child) {
7300
- return reactExports.isValidElement(child) && child.type === Slottable;
7317
+ return reactExports.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
7301
7318
  }
7302
7319
  function mergeProps(slotProps, childProps) {
7303
7320
  const overrideProps = { ...childProps };
@@ -7351,17 +7368,19 @@ function createCollection(name) {
7351
7368
  };
7352
7369
  CollectionProvider.displayName = PROVIDER_NAME2;
7353
7370
  const COLLECTION_SLOT_NAME = name + "CollectionSlot";
7371
+ const CollectionSlotImpl = /* @__PURE__ */ createSlot(COLLECTION_SLOT_NAME);
7354
7372
  const CollectionSlot = React$1.forwardRef(
7355
7373
  (props, forwardedRef) => {
7356
7374
  const { scope, children } = props;
7357
7375
  const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
7358
7376
  const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
7359
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Slot, { ref: composedRefs, children });
7377
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionSlotImpl, { ref: composedRefs, children });
7360
7378
  }
7361
7379
  );
7362
7380
  CollectionSlot.displayName = COLLECTION_SLOT_NAME;
7363
7381
  const ITEM_SLOT_NAME = name + "CollectionItemSlot";
7364
7382
  const ITEM_DATA_ATTR = "data-radix-collection-item";
7383
+ const CollectionItemSlotImpl = /* @__PURE__ */ createSlot(ITEM_SLOT_NAME);
7365
7384
  const CollectionItemSlot = React$1.forwardRef(
7366
7385
  (props, forwardedRef) => {
7367
7386
  const { scope, children, ...itemData } = props;
@@ -7372,7 +7391,7 @@ function createCollection(name) {
7372
7391
  context.itemMap.set(ref, { ref, ...itemData });
7373
7392
  return () => void context.itemMap.delete(ref);
7374
7393
  });
7375
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Slot, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
7394
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
7376
7395
  }
7377
7396
  );
7378
7397
  CollectionItemSlot.displayName = ITEM_SLOT_NAME;
@@ -7415,9 +7434,10 @@ var NODES = [
7415
7434
  "ul"
7416
7435
  ];
7417
7436
  var Primitive = NODES.reduce((primitive, node) => {
7437
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
7418
7438
  const Node2 = reactExports.forwardRef((props, forwardedRef) => {
7419
7439
  const { asChild, ...primitiveProps } = props;
7420
- const Comp = asChild ? Slot : node;
7440
+ const Comp = asChild ? Slot2 : node;
7421
7441
  if (typeof window !== "undefined") {
7422
7442
  window[Symbol.for("radix-ui")] = true;
7423
7443
  }
@@ -7654,7 +7674,7 @@ function handleAndDispatchCustomEvent$1(name, handler, detail, { discrete }) {
7654
7674
  }
7655
7675
  var Root$6 = DismissableLayer;
7656
7676
  var Branch = DismissableLayerBranch;
7657
- var useLayoutEffect2 = Boolean(globalThis == null ? void 0 : globalThis.document) ? reactExports.useLayoutEffect : () => {
7677
+ var useLayoutEffect2 = (globalThis == null ? void 0 : globalThis.document) ? reactExports.useLayoutEffect : () => {
7658
7678
  };
7659
7679
  var PORTAL_NAME$4 = "Portal";
7660
7680
  var Portal$3 = reactExports.forwardRef((props, forwardedRef) => {
@@ -15471,6 +15491,10 @@ const ServerCapabilitiesSchema = z.object({
15471
15491
  * Present if the server supports sending log messages to the client.
15472
15492
  */
15473
15493
  logging: z.optional(z.object({}).passthrough()),
15494
+ /**
15495
+ * Present if the server supports sending completions to the client.
15496
+ */
15497
+ completions: z.optional(z.object({}).passthrough()),
15474
15498
  /**
15475
15499
  * Present if the server offers any prompt templates.
15476
15500
  */
@@ -15743,6 +15767,17 @@ const ImageContentSchema = z.object({
15743
15767
  */
15744
15768
  mimeType: z.string()
15745
15769
  }).passthrough();
15770
+ const AudioContentSchema = z.object({
15771
+ type: z.literal("audio"),
15772
+ /**
15773
+ * The base64-encoded audio data.
15774
+ */
15775
+ data: z.string().base64(),
15776
+ /**
15777
+ * The MIME type of the audio. Different providers may support different audio types.
15778
+ */
15779
+ mimeType: z.string()
15780
+ }).passthrough();
15746
15781
  const EmbeddedResourceSchema = z.object({
15747
15782
  type: z.literal("resource"),
15748
15783
  resource: z.union([TextResourceContentsSchema, BlobResourceContentsSchema])
@@ -15752,6 +15787,7 @@ const PromptMessageSchema = z.object({
15752
15787
  content: z.union([
15753
15788
  TextContentSchema,
15754
15789
  ImageContentSchema,
15790
+ AudioContentSchema,
15755
15791
  EmbeddedResourceSchema
15756
15792
  ])
15757
15793
  }).passthrough();
@@ -15789,7 +15825,7 @@ const ListToolsResultSchema = PaginatedResultSchema.extend({
15789
15825
  tools: z.array(ToolSchema)
15790
15826
  });
15791
15827
  const CallToolResultSchema = ResultSchema.extend({
15792
- content: z.array(z.union([TextContentSchema, ImageContentSchema, EmbeddedResourceSchema])),
15828
+ content: z.array(z.union([TextContentSchema, ImageContentSchema, AudioContentSchema, EmbeddedResourceSchema])),
15793
15829
  isError: z.boolean().default(false).optional()
15794
15830
  });
15795
15831
  const CompatibilityCallToolResultSchema = CallToolResultSchema.or(ResultSchema.extend({
@@ -15867,7 +15903,7 @@ const ModelPreferencesSchema = z.object({
15867
15903
  }).passthrough();
15868
15904
  const SamplingMessageSchema = z.object({
15869
15905
  role: z.enum(["user", "assistant"]),
15870
- content: z.union([TextContentSchema, ImageContentSchema])
15906
+ content: z.union([TextContentSchema, ImageContentSchema, AudioContentSchema])
15871
15907
  }).passthrough();
15872
15908
  const CreateMessageRequestSchema = RequestSchema.extend({
15873
15909
  method: z.literal("sampling/createMessage"),
@@ -15909,7 +15945,8 @@ const CreateMessageResultSchema = ResultSchema.extend({
15909
15945
  role: z.enum(["user", "assistant"]),
15910
15946
  content: z.discriminatedUnion("type", [
15911
15947
  TextContentSchema,
15912
- ImageContentSchema
15948
+ ImageContentSchema,
15949
+ AudioContentSchema
15913
15950
  ])
15914
15951
  });
15915
15952
  const ResourceReferenceSchema = z.object({
@@ -16064,12 +16101,13 @@ class Protocol {
16064
16101
  (_request) => ({})
16065
16102
  );
16066
16103
  }
16067
- _setupTimeout(messageId, timeout, maxTotalTimeout, onTimeout) {
16104
+ _setupTimeout(messageId, timeout, maxTotalTimeout, onTimeout, resetTimeoutOnProgress = false) {
16068
16105
  this._timeoutInfo.set(messageId, {
16069
16106
  timeoutId: setTimeout(onTimeout, timeout),
16070
16107
  startTime: Date.now(),
16071
16108
  timeout,
16072
16109
  maxTotalTimeout,
16110
+ resetTimeoutOnProgress,
16073
16111
  onTimeout
16074
16112
  });
16075
16113
  }
@@ -16197,7 +16235,8 @@ class Protocol {
16197
16235
  return;
16198
16236
  }
16199
16237
  const responseHandler = this._responseHandlers.get(messageId);
16200
- if (this._timeoutInfo.has(messageId) && responseHandler) {
16238
+ const timeoutInfo = this._timeoutInfo.get(messageId);
16239
+ if (timeoutInfo && responseHandler && timeoutInfo.resetTimeoutOnProgress) {
16201
16240
  try {
16202
16241
  this._resetTimeout(messageId);
16203
16242
  } catch (error) {
@@ -16241,7 +16280,7 @@ class Protocol {
16241
16280
  */
16242
16281
  request(request, resultSchema, options) {
16243
16282
  return new Promise((resolve, reject) => {
16244
- var _a, _b, _c, _d;
16283
+ var _a, _b, _c, _d, _e2;
16245
16284
  if (!this._transport) {
16246
16285
  reject(new Error("Not connected"));
16247
16286
  return;
@@ -16299,7 +16338,7 @@ class Protocol {
16299
16338
  });
16300
16339
  const timeout = (_d = options === null || options === void 0 ? void 0 : options.timeout) !== null && _d !== void 0 ? _d : DEFAULT_REQUEST_TIMEOUT_MSEC;
16301
16340
  const timeoutHandler = () => cancel(new McpError(ErrorCode.RequestTimeout, "Request timed out", { timeout }));
16302
- this._setupTimeout(messageId, timeout, options === null || options === void 0 ? void 0 : options.maxTotalTimeout, timeoutHandler);
16341
+ this._setupTimeout(messageId, timeout, options === null || options === void 0 ? void 0 : options.maxTotalTimeout, timeoutHandler, (_e2 = options === null || options === void 0 ? void 0 : options.resetTimeoutOnProgress) !== null && _e2 !== void 0 ? _e2 : false);
16303
16342
  this._transport.send(jsonrpcRequest).catch((error) => {
16304
16343
  this._cleanupTimeout(messageId);
16305
16344
  reject(error);
@@ -16396,7 +16435,7 @@ class Client extends Protocol {
16396
16435
  throw new Error(`Server does not support ${capability} (required for ${method})`);
16397
16436
  }
16398
16437
  }
16399
- async connect(transport) {
16438
+ async connect(transport, options) {
16400
16439
  await super.connect(transport);
16401
16440
  try {
16402
16441
  const result = await this.request({
@@ -16406,7 +16445,7 @@ class Client extends Protocol {
16406
16445
  capabilities: this._capabilities,
16407
16446
  clientInfo: this._clientInfo
16408
16447
  }
16409
- }, InitializeResultSchema);
16448
+ }, InitializeResultSchema, options);
16410
16449
  if (result === void 0) {
16411
16450
  throw new Error(`Server sent invalid initialize result: ${result}`);
16412
16451
  }
@@ -16475,8 +16514,8 @@ class Client extends Protocol {
16475
16514
  }
16476
16515
  break;
16477
16516
  case "completion/complete":
16478
- if (!((_e2 = this._serverCapabilities) === null || _e2 === void 0 ? void 0 : _e2.prompts)) {
16479
- throw new Error(`Server does not support prompts (required for ${method})`);
16517
+ if (!((_e2 = this._serverCapabilities) === null || _e2 === void 0 ? void 0 : _e2.completions)) {
16518
+ throw new Error(`Server does not support completions (required for ${method})`);
16480
16519
  }
16481
16520
  break;
16482
16521
  }
@@ -16915,24 +16954,24 @@ function getBaseURL() {
16915
16954
  }
16916
16955
  let crypto;
16917
16956
  crypto = globalThis.crypto;
16918
- function getRandomValues(size2) {
16919
- return crypto.getRandomValues(new Uint8Array(size2));
16957
+ async function getRandomValues(size2) {
16958
+ return (await crypto).getRandomValues(new Uint8Array(size2));
16920
16959
  }
16921
- function random(size2) {
16960
+ async function random(size2) {
16922
16961
  const mask = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";
16923
16962
  let result = "";
16924
- const randomUints = getRandomValues(size2);
16963
+ const randomUints = await getRandomValues(size2);
16925
16964
  for (let i = 0; i < size2; i++) {
16926
16965
  const randomIndex = randomUints[i] % mask.length;
16927
16966
  result += mask[randomIndex];
16928
16967
  }
16929
16968
  return result;
16930
16969
  }
16931
- function generateVerifier(length) {
16932
- return random(length);
16970
+ async function generateVerifier(length) {
16971
+ return await random(length);
16933
16972
  }
16934
16973
  async function generateChallenge(code_verifier) {
16935
- const buffer = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
16974
+ const buffer = await (await crypto).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
16936
16975
  return btoa(String.fromCharCode(...new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
16937
16976
  }
16938
16977
  async function pkceChallenge(length) {
@@ -16941,7 +16980,7 @@ async function pkceChallenge(length) {
16941
16980
  if (length < 43 || length > 128) {
16942
16981
  throw `Expected a length between 43 and 128. Received ${length}.`;
16943
16982
  }
16944
- const verifier = generateVerifier(length);
16983
+ const verifier = await generateVerifier(length);
16945
16984
  const challenge = await generateChallenge(verifier);
16946
16985
  return {
16947
16986
  code_verifier: verifier,
@@ -17040,7 +17079,8 @@ async function auth(provider, { serverUrl, authorizationCode }) {
17040
17079
  metadata,
17041
17080
  clientInformation,
17042
17081
  authorizationCode,
17043
- codeVerifier: codeVerifier2
17082
+ codeVerifier: codeVerifier2,
17083
+ redirectUri: provider.redirectUrl
17044
17084
  });
17045
17085
  await provider.saveTokens(tokens2);
17046
17086
  return "AUTHORIZED";
@@ -17118,7 +17158,7 @@ async function startAuthorization(serverUrl, { metadata, clientInformation, redi
17118
17158
  authorizationUrl.searchParams.set("redirect_uri", String(redirectUrl));
17119
17159
  return { authorizationUrl, codeVerifier };
17120
17160
  }
17121
- async function exchangeAuthorization(serverUrl, { metadata, clientInformation, authorizationCode, codeVerifier }) {
17161
+ async function exchangeAuthorization(serverUrl, { metadata, clientInformation, authorizationCode, codeVerifier, redirectUri }) {
17122
17162
  const grantType = "authorization_code";
17123
17163
  let tokenUrl;
17124
17164
  if (metadata) {
@@ -17133,7 +17173,8 @@ async function exchangeAuthorization(serverUrl, { metadata, clientInformation, a
17133
17173
  grant_type: grantType,
17134
17174
  client_id: clientInformation.client_id,
17135
17175
  code: authorizationCode,
17136
- code_verifier: codeVerifier
17176
+ code_verifier: codeVerifier,
17177
+ redirect_uri: String(redirectUri)
17137
17178
  });
17138
17179
  if (clientInformation.client_secret) {
17139
17180
  params2.set("client_secret", clientInformation.client_secret);
@@ -17366,10 +17407,22 @@ const SESSION_KEYS = {
17366
17407
  const DEFAULT_MCP_PROXY_LISTEN_PORT = "6277";
17367
17408
  const DEFAULT_INSPECTOR_CONFIG = {
17368
17409
  MCP_SERVER_REQUEST_TIMEOUT: {
17410
+ label: "Request Timeout",
17369
17411
  description: "Timeout for requests to the MCP server (ms)",
17370
17412
  value: 1e4
17371
17413
  },
17414
+ MCP_REQUEST_TIMEOUT_RESET_ON_PROGRESS: {
17415
+ label: "Reset Timeout on Progress",
17416
+ description: "Reset timeout on progress notifications",
17417
+ value: true
17418
+ },
17419
+ MCP_REQUEST_MAX_TOTAL_TIMEOUT: {
17420
+ label: "Maximum Total Timeout",
17421
+ description: "Maximum total timeout for requests sent to the MCP server (ms) (Use with progress notifications)",
17422
+ value: 6e4
17423
+ },
17372
17424
  MCP_PROXY_FULL_ADDRESS: {
17425
+ label: "Inspector Proxy Address",
17373
17426
  description: "Set this if you are running the MCP Inspector Proxy on a non-default address. Example: http://10.1.1.22:5577",
17374
17427
  value: ""
17375
17428
  }
@@ -17435,19 +17488,34 @@ class InspectorOAuthClientProvider {
17435
17488
  }
17436
17489
  }
17437
17490
  const authProvider = new InspectorOAuthClientProvider();
17438
- const version$1 = "0.8.1";
17491
+ const version$1 = "0.9.0";
17439
17492
  const packageJson = {
17440
17493
  version: version$1
17441
17494
  };
17495
+ const getMCPProxyAddress = (config) => {
17496
+ const proxyFullAddress = config.MCP_PROXY_FULL_ADDRESS.value;
17497
+ if (proxyFullAddress) {
17498
+ return proxyFullAddress;
17499
+ }
17500
+ return `${window.location.protocol}//${window.location.hostname}:${DEFAULT_MCP_PROXY_LISTEN_PORT}`;
17501
+ };
17502
+ const getMCPServerRequestTimeout = (config) => {
17503
+ return config.MCP_SERVER_REQUEST_TIMEOUT.value;
17504
+ };
17505
+ const resetRequestTimeoutOnProgress = (config) => {
17506
+ return config.MCP_REQUEST_TIMEOUT_RESET_ON_PROGRESS.value;
17507
+ };
17508
+ const getMCPServerRequestMaxTotalTimeout = (config) => {
17509
+ return config.MCP_REQUEST_MAX_TOTAL_TIMEOUT.value;
17510
+ };
17442
17511
  function useConnection({
17443
17512
  transportType,
17444
17513
  command,
17445
17514
  args,
17446
17515
  sseUrl,
17447
17516
  env,
17448
- proxyServerUrl,
17449
17517
  bearerToken,
17450
- requestTimeout,
17518
+ config,
17451
17519
  onNotification,
17452
17520
  onStdErrNotification,
17453
17521
  onPendingRequest,
@@ -17474,21 +17542,30 @@ function useConnection({
17474
17542
  }
17475
17543
  try {
17476
17544
  const abortController = new AbortController();
17477
- const timeoutId = setTimeout(() => {
17478
- abortController.abort("Request timed out");
17479
- }, (options == null ? void 0 : options.timeout) ?? requestTimeout);
17545
+ const mcpRequestOptions = {
17546
+ signal: (options == null ? void 0 : options.signal) ?? abortController.signal,
17547
+ resetTimeoutOnProgress: (options == null ? void 0 : options.resetTimeoutOnProgress) ?? resetRequestTimeoutOnProgress(config),
17548
+ timeout: (options == null ? void 0 : options.timeout) ?? getMCPServerRequestTimeout(config),
17549
+ maxTotalTimeout: (options == null ? void 0 : options.maxTotalTimeout) ?? getMCPServerRequestMaxTotalTimeout(config)
17550
+ };
17551
+ if (mcpRequestOptions.resetTimeoutOnProgress) {
17552
+ mcpRequestOptions.onprogress = (params2) => {
17553
+ if (onNotification) {
17554
+ onNotification({
17555
+ method: "notification/progress",
17556
+ params: params2
17557
+ });
17558
+ }
17559
+ };
17560
+ }
17480
17561
  let response;
17481
17562
  try {
17482
- response = await mcpClient.request(request, schema, {
17483
- signal: (options == null ? void 0 : options.signal) ?? abortController.signal
17484
- });
17563
+ response = await mcpClient.request(request, schema, mcpRequestOptions);
17485
17564
  pushHistory(request, response);
17486
17565
  } catch (error) {
17487
17566
  const errorMessage = error instanceof Error ? error.message : String(error);
17488
17567
  pushHistory(request, { error: errorMessage });
17489
17568
  throw error;
17490
- } finally {
17491
- clearTimeout(timeoutId);
17492
17569
  }
17493
17570
  return response;
17494
17571
  } catch (e) {
@@ -17563,7 +17640,7 @@ function useConnection({
17563
17640
  };
17564
17641
  const checkProxyHealth = async () => {
17565
17642
  try {
17566
- const proxyHealthUrl = new URL(`${proxyServerUrl}/health`);
17643
+ const proxyHealthUrl = new URL(`${getMCPProxyAddress(config)}/health`);
17567
17644
  const proxyHealthResponse = await fetch(proxyHealthUrl);
17568
17645
  const proxyHealth = await proxyHealthResponse.json();
17569
17646
  if ((proxyHealth == null ? void 0 : proxyHealth.status) !== "ok") {
@@ -17604,7 +17681,7 @@ function useConnection({
17604
17681
  setConnectionStatus("error-connecting-to-proxy");
17605
17682
  return;
17606
17683
  }
17607
- const mcpProxyServerUrl = new URL(`${proxyServerUrl}/sse`);
17684
+ const mcpProxyServerUrl = new URL(`${getMCPProxyAddress(config)}/sse`);
17608
17685
  mcpProxyServerUrl.searchParams.append("transportType", transportType);
17609
17686
  if (transportType === "stdio") {
17610
17687
  mcpProxyServerUrl.searchParams.append("command", command);
@@ -17630,7 +17707,6 @@ function useConnection({
17630
17707
  if (onNotification) {
17631
17708
  [
17632
17709
  CancelledNotificationSchema,
17633
- ProgressNotificationSchema,
17634
17710
  LoggingMessageNotificationSchema,
17635
17711
  ResourceUpdatedNotificationSchema,
17636
17712
  ResourceListChangedNotificationSchema,
@@ -17754,7 +17830,7 @@ function useDraggablePane(initialHeight) {
17754
17830
  handleDragStart
17755
17831
  };
17756
17832
  }
17757
- var useReactId = React$2["useId".toString()] || (() => void 0);
17833
+ var useReactId = React$2[" useId ".trim().toString()] || (() => void 0);
17758
17834
  var count$1 = 0;
17759
17835
  function useId(deterministicId) {
17760
17836
  const [id2, setId] = reactExports.useState(useReactId());
@@ -18510,6 +18586,15 @@ const Hash = createLucideIcon("Hash", [
18510
18586
  ["line", { x1: "10", x2: "8", y1: "3", y2: "21", key: "1ggp8o" }],
18511
18587
  ["line", { x1: "16", x2: "14", y1: "3", y2: "21", key: "weycgp" }]
18512
18588
  ]);
18589
+ /**
18590
+ * @license lucide-react v0.447.0 - ISC
18591
+ *
18592
+ * This source code is licensed under the ISC license.
18593
+ * See the LICENSE file in the root directory of this source tree.
18594
+ */
18595
+ const LoaderCircle = createLucideIcon("LoaderCircle", [
18596
+ ["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
18597
+ ]);
18513
18598
  /**
18514
18599
  * @license lucide-react v0.447.0 - ISC
18515
18600
  *
@@ -18659,7 +18744,7 @@ const buttonVariants = cva(
18659
18744
  );
18660
18745
  const Button = reactExports.forwardRef(
18661
18746
  ({ className: className2, variant, size: size2, asChild = false, ...props }, ref) => {
18662
- const Comp = asChild ? Slot : "button";
18747
+ const Comp = asChild ? Slot$3 : "button";
18663
18748
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
18664
18749
  Comp,
18665
18750
  {
@@ -18671,6 +18756,11 @@ const Button = reactExports.forwardRef(
18671
18756
  }
18672
18757
  );
18673
18758
  Button.displayName = "Button";
18759
+ function getDataType(value) {
18760
+ if (Array.isArray(value)) return "array";
18761
+ if (value === null) return "null";
18762
+ return typeof value;
18763
+ }
18674
18764
  function tryParseJson(str) {
18675
18765
  const trimmed = str.trim();
18676
18766
  if (!(trimmed.startsWith("{") && trimmed.endsWith("}")) && !(trimmed.startsWith("[") && trimmed.endsWith("]"))) {
@@ -18682,13 +18772,81 @@ function tryParseJson(str) {
18682
18772
  return { success: false, data: str };
18683
18773
  }
18684
18774
  }
18775
+ function updateValueAtPath(obj, path, value) {
18776
+ if (path.length === 0) return value;
18777
+ if (obj === null || obj === void 0) {
18778
+ obj = !isNaN(Number(path[0])) ? [] : {};
18779
+ }
18780
+ if (Array.isArray(obj)) {
18781
+ return updateArray(obj, path, value);
18782
+ } else if (typeof obj === "object" && obj !== null) {
18783
+ return updateObject(obj, path, value);
18784
+ } else {
18785
+ console.error(
18786
+ `Cannot update path ${path.join(".")} in non-object/array value:`,
18787
+ obj
18788
+ );
18789
+ return obj;
18790
+ }
18791
+ }
18792
+ function updateArray(array, path, value) {
18793
+ const [index2, ...restPath] = path;
18794
+ const arrayIndex = Number(index2);
18795
+ if (isNaN(arrayIndex)) {
18796
+ console.error(`Invalid array index: ${index2}`);
18797
+ return array;
18798
+ }
18799
+ if (arrayIndex < 0) {
18800
+ console.error(`Array index out of bounds: ${arrayIndex} < 0`);
18801
+ return array;
18802
+ }
18803
+ let newArray = [];
18804
+ for (let i = 0; i < array.length; i++) {
18805
+ newArray[i] = i in array ? array[i] : null;
18806
+ }
18807
+ if (arrayIndex >= newArray.length) {
18808
+ const extendedArray = new Array(arrayIndex).fill(null);
18809
+ for (let i = 0; i < newArray.length; i++) {
18810
+ extendedArray[i] = newArray[i];
18811
+ }
18812
+ newArray = extendedArray;
18813
+ }
18814
+ if (restPath.length === 0) {
18815
+ newArray[arrayIndex] = value;
18816
+ } else {
18817
+ newArray[arrayIndex] = updateValueAtPath(
18818
+ newArray[arrayIndex],
18819
+ restPath,
18820
+ value
18821
+ );
18822
+ }
18823
+ return newArray;
18824
+ }
18825
+ function updateObject(obj, path, value) {
18826
+ const [key, ...restPath] = path;
18827
+ if (typeof key !== "string") {
18828
+ console.error(`Invalid object key: ${key}`);
18829
+ return obj;
18830
+ }
18831
+ const newObj = { ...obj };
18832
+ if (restPath.length === 0) {
18833
+ newObj[key] = value;
18834
+ } else {
18835
+ if (!(key in newObj)) {
18836
+ newObj[key] = {};
18837
+ }
18838
+ newObj[key] = updateValueAtPath(newObj[key], restPath, value);
18839
+ }
18840
+ return newObj;
18841
+ }
18685
18842
  const JsonView = reactExports.memo(
18686
18843
  ({
18687
18844
  data,
18688
18845
  name,
18689
18846
  initialExpandDepth = 3,
18690
18847
  className: className2,
18691
- withCopyButton = true
18848
+ withCopyButton = true,
18849
+ isError = false
18692
18850
  }) => {
18693
18851
  const { toast: toast2 } = useToast();
18694
18852
  const [copied, setCopied] = reactExports.useState(false);
@@ -18739,7 +18897,8 @@ const JsonView = reactExports.memo(
18739
18897
  data: normalizedData,
18740
18898
  name,
18741
18899
  depth: 0,
18742
- initialExpandDepth
18900
+ initialExpandDepth,
18901
+ isError
18743
18902
  }
18744
18903
  ) })
18745
18904
  ] });
@@ -18747,22 +18906,24 @@ const JsonView = reactExports.memo(
18747
18906
  );
18748
18907
  JsonView.displayName = "JsonView";
18749
18908
  const JsonNode = reactExports.memo(
18750
- ({ data, name, depth = 0, initialExpandDepth }) => {
18909
+ ({
18910
+ data,
18911
+ name,
18912
+ depth = 0,
18913
+ initialExpandDepth,
18914
+ isError = false
18915
+ }) => {
18751
18916
  const [isExpanded, setIsExpanded] = reactExports.useState(depth < initialExpandDepth);
18752
- const getDataType = (value) => {
18753
- if (Array.isArray(value)) return "array";
18754
- if (value === null) return "null";
18755
- return typeof value;
18756
- };
18757
- const dataType = getDataType(data);
18758
- const typeStyleMap = {
18917
+ const [typeStyleMap] = reactExports.useState({
18759
18918
  number: "text-blue-600",
18760
18919
  boolean: "text-amber-600",
18761
18920
  null: "text-purple-600",
18762
18921
  undefined: "text-gray-600",
18763
- string: "text-green-600 break-all whitespace-pre-wrap",
18922
+ string: "text-green-600 group-hover:text-green-500",
18923
+ error: "text-red-600 group-hover:text-red-500",
18764
18924
  default: "text-gray-700"
18765
- };
18925
+ });
18926
+ const dataType = getDataType(data);
18766
18927
  const renderCollapsible = (isArray) => {
18767
18928
  const items = isArray ? data : Object.entries(data);
18768
18929
  const itemCount = items.length;
@@ -18835,11 +18996,20 @@ const JsonNode = reactExports.memo(
18835
18996
  name,
18836
18997
  ":"
18837
18998
  ] }),
18838
- /* @__PURE__ */ jsxRuntimeExports.jsxs("pre", { className: typeStyleMap.string, children: [
18839
- '"',
18840
- value,
18841
- '"'
18842
- ] })
18999
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
19000
+ "pre",
19001
+ {
19002
+ className: clsx(
19003
+ typeStyleMap.string,
19004
+ "break-all whitespace-pre-wrap"
19005
+ ),
19006
+ children: [
19007
+ '"',
19008
+ value,
19009
+ '"'
19010
+ ]
19011
+ }
19012
+ )
18843
19013
  ] });
18844
19014
  }
18845
19015
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex mr-1 rounded group hover:bg-gray-800/20", children: [
@@ -18851,8 +19021,8 @@ const JsonNode = reactExports.memo(
18851
19021
  "pre",
18852
19022
  {
18853
19023
  className: clsx(
18854
- typeStyleMap.string,
18855
- "cursor-pointer group-hover:text-green-500"
19024
+ isError ? typeStyleMap.error : typeStyleMap.string,
19025
+ "cursor-pointer break-all whitespace-pre-wrap"
18856
19026
  ),
18857
19027
  onClick: () => setIsExpanded(!isExpanded),
18858
19028
  title: isExpanded ? "Click to collapse" : "Click to expand",
@@ -18983,14 +19153,14 @@ const HistoryAndNotifications = ({
18983
19153
  ] });
18984
19154
  };
18985
19155
  const PingTab = ({ onPingClick }) => {
18986
- return /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "ping", className: "grid grid-cols-2 gap-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "col-span-2 flex justify-center items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
19156
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "ping", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-2 gap-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "col-span-2 flex justify-center items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
18987
19157
  Button,
18988
19158
  {
18989
19159
  onClick: onPingClick,
18990
19160
  className: "font-bold py-6 px-12 rounded-full",
18991
19161
  children: "Ping Server"
18992
19162
  }
18993
- ) }) });
19163
+ ) }) }) });
18994
19164
  };
18995
19165
  const alertVariants = cva(
18996
19166
  "relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
@@ -20126,6 +20296,7 @@ var DialogOverlay$1 = reactExports.forwardRef(
20126
20296
  }
20127
20297
  );
20128
20298
  DialogOverlay$1.displayName = OVERLAY_NAME;
20299
+ var Slot$2 = /* @__PURE__ */ createSlot("DialogOverlay.RemoveScroll");
20129
20300
  var DialogOverlayImpl = reactExports.forwardRef(
20130
20301
  (props, forwardedRef) => {
20131
20302
  const { __scopeDialog, ...overlayProps } = props;
@@ -20133,7 +20304,7 @@ var DialogOverlayImpl = reactExports.forwardRef(
20133
20304
  return (
20134
20305
  // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
20135
20306
  // ie. when `Overlay` and `Content` are siblings
20136
- /* @__PURE__ */ jsxRuntimeExports.jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
20307
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ReactRemoveScroll, { as: Slot$2, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
20137
20308
  Primitive.div,
20138
20309
  {
20139
20310
  "data-state": getState$2(context.open),
@@ -23039,6 +23210,7 @@ var PopoverContent$1 = reactExports.forwardRef(
23039
23210
  }
23040
23211
  );
23041
23212
  PopoverContent$1.displayName = CONTENT_NAME$2;
23213
+ var Slot$1 = /* @__PURE__ */ createSlot("PopoverContent.RemoveScroll");
23042
23214
  var PopoverContentModal = reactExports.forwardRef(
23043
23215
  (props, forwardedRef) => {
23044
23216
  const context = usePopoverContext(CONTENT_NAME$2, props.__scopePopover);
@@ -23049,7 +23221,7 @@ var PopoverContentModal = reactExports.forwardRef(
23049
23221
  const content = contentRef.current;
23050
23222
  if (content) return hideOthers(content);
23051
23223
  }, []);
23052
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
23224
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ReactRemoveScroll, { as: Slot$1, allowPinchZoom: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
23053
23225
  PopoverContentImpl,
23054
23226
  {
23055
23227
  ...props,
@@ -23346,7 +23518,7 @@ const ListPane = ({
23346
23518
  buttonText,
23347
23519
  isButtonDisabled
23348
23520
  }) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-card rounded-lg shadow", children: [
23349
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-semibold dark:text-white", children: title }) }),
23521
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 border-b border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-semibold dark:text-white", children: title }) }),
23350
23522
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-4", children: [
23351
23523
  /* @__PURE__ */ jsxRuntimeExports.jsx(
23352
23524
  Button,
@@ -23381,9 +23553,11 @@ const ListPane = ({
23381
23553
  ] });
23382
23554
  function debounce(func, wait) {
23383
23555
  let timeout;
23384
- return function(...args) {
23556
+ return (...args) => {
23385
23557
  clearTimeout(timeout);
23386
- timeout = setTimeout(() => func(...args), wait);
23558
+ timeout = setTimeout(() => {
23559
+ void func(...args);
23560
+ }, wait);
23387
23561
  };
23388
23562
  }
23389
23563
  function useCompletionState(handleCompletion, completionsSupported = true, debounceMs = 300) {
@@ -23408,8 +23582,8 @@ function useCompletionState(handleCompletion, completionsSupported = true, debou
23408
23582
  loading: {}
23409
23583
  });
23410
23584
  }, [cleanup]);
23411
- const requestCompletions = reactExports.useCallback(
23412
- debounce(
23585
+ const requestCompletions = reactExports.useMemo(() => {
23586
+ return debounce(
23413
23587
  async (ref, argName, value) => {
23414
23588
  if (!completionsSupported) {
23415
23589
  return;
@@ -23435,7 +23609,7 @@ function useCompletionState(handleCompletion, completionsSupported = true, debou
23435
23609
  loading: { ...prev.loading, [argName]: false }
23436
23610
  }));
23437
23611
  }
23438
- } catch (err) {
23612
+ } catch {
23439
23613
  if (!abortController.signal.aborted) {
23440
23614
  setState((prev) => ({
23441
23615
  ...prev,
@@ -23449,9 +23623,8 @@ function useCompletionState(handleCompletion, completionsSupported = true, debou
23449
23623
  }
23450
23624
  },
23451
23625
  debounceMs
23452
- ),
23453
- [handleCompletion, completionsSupported, cleanup, debounceMs]
23454
- );
23626
+ );
23627
+ }, [handleCompletion, completionsSupported, cleanup, debounceMs]);
23455
23628
  reactExports.useEffect(() => {
23456
23629
  if (!completionsSupported) {
23457
23630
  clearCompletions();
@@ -23501,7 +23674,7 @@ const PromptsTab = ({
23501
23674
  getPrompt(selectedPrompt.name, promptArgs);
23502
23675
  }
23503
23676
  };
23504
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsContent, { value: "prompts", className: "grid grid-cols-2 gap-4", children: [
23677
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "prompts", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
23505
23678
  /* @__PURE__ */ jsxRuntimeExports.jsx(
23506
23679
  ListPane,
23507
23680
  {
@@ -23522,7 +23695,7 @@ const PromptsTab = ({
23522
23695
  }
23523
23696
  ),
23524
23697
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-card rounded-lg shadow", children: [
23525
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-semibold", children: selectedPrompt ? selectedPrompt.name : "Select a prompt" }) }),
23698
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 border-b border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-semibold", children: selectedPrompt ? selectedPrompt.name : "Select a prompt" }) }),
23526
23699
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4", children: error ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Alert, { variant: "destructive", children: [
23527
23700
  /* @__PURE__ */ jsxRuntimeExports.jsx(CircleAlert, { className: "h-4 w-4" }),
23528
23701
  /* @__PURE__ */ jsxRuntimeExports.jsx(AlertTitle, { children: "Error" }),
@@ -23551,7 +23724,7 @@ const PromptsTab = ({
23551
23724
  promptContent && /* @__PURE__ */ jsxRuntimeExports.jsx(JsonView, { data: promptContent, withCopyButton: false })
23552
23725
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(AlertDescription, { children: "Select a prompt from the list to view and use it" }) }) })
23553
23726
  ] })
23554
- ] });
23727
+ ] }) });
23555
23728
  };
23556
23729
  const ResourcesTab = ({
23557
23730
  resources,
@@ -23610,7 +23783,7 @@ const ResourcesTab = ({
23610
23783
  setSelectedResource({ uri, name: uri });
23611
23784
  }
23612
23785
  };
23613
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsContent, { value: "resources", className: "grid grid-cols-3 gap-4", children: [
23786
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "resources", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-3 gap-4", children: [
23614
23787
  /* @__PURE__ */ jsxRuntimeExports.jsx(
23615
23788
  ListPane,
23616
23789
  {
@@ -23654,7 +23827,7 @@ const ResourcesTab = ({
23654
23827
  }
23655
23828
  ),
23656
23829
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-card rounded-lg shadow", children: [
23657
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-4 border-b border-gray-200 flex justify-between items-center", children: [
23830
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-4 border-b border-gray-200 dark:border-gray-800 flex justify-between items-center", children: [
23658
23831
  /* @__PURE__ */ jsxRuntimeExports.jsx(
23659
23832
  "h3",
23660
23833
  {
@@ -23735,7 +23908,7 @@ const ResourcesTab = ({
23735
23908
  )
23736
23909
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(AlertDescription, { children: "Select a resource or template from the list to view its contents" }) }) })
23737
23910
  ] })
23738
- ] });
23911
+ ] }) });
23739
23912
  };
23740
23913
  const Input = reactExports.forwardRef(
23741
23914
  ({ className: className2, type, ...props }, ref) => {
@@ -23775,7 +23948,7 @@ const RootsTab = ({
23775
23948
  const handleSave = () => {
23776
23949
  onRootsChange();
23777
23950
  };
23778
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsContent, { value: "roots", className: "space-y-4", children: [
23951
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "roots", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
23779
23952
  /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(AlertDescription, { children: "Configure the root directories that the server can access" }) }),
23780
23953
  roots.map((root, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [
23781
23954
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -23807,7 +23980,7 @@ const RootsTab = ({
23807
23980
  "Save Changes"
23808
23981
  ] })
23809
23982
  ] })
23810
- ] });
23983
+ ] }) });
23811
23984
  };
23812
23985
  const SamplingTab = ({ pendingRequests, onApprove, onReject }) => {
23813
23986
  const handleApprove = (id2) => {
@@ -23821,7 +23994,7 @@ const SamplingTab = ({ pendingRequests, onApprove, onReject }) => {
23821
23994
  }
23822
23995
  });
23823
23996
  };
23824
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsContent, { value: "sampling", className: "h-96", children: [
23997
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "sampling", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-96", children: [
23825
23998
  /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(AlertDescription, { children: "When the server requests LLM sampling, requests will appear here for approval." }) }),
23826
23999
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 space-y-4", children: [
23827
24000
  /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-lg font-semibold", children: "Recent Requests" }),
@@ -23840,7 +24013,7 @@ const SamplingTab = ({ pendingRequests, onApprove, onReject }) => {
23840
24013
  ] }, request.id)),
23841
24014
  pendingRequests.length === 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-gray-500", children: "No pending requests" })
23842
24015
  ] })
23843
- ] });
24016
+ ] }) });
23844
24017
  };
23845
24018
  function clamp(value, [min2, max2]) {
23846
24019
  return Math.min(max2, Math.max(min2, value));
@@ -24099,6 +24272,7 @@ SelectContent$1.displayName = CONTENT_NAME$1;
24099
24272
  var CONTENT_MARGIN = 10;
24100
24273
  var [SelectContentProvider, useSelectContentContext] = createSelectContext(CONTENT_NAME$1);
24101
24274
  var CONTENT_IMPL_NAME = "SelectContentImpl";
24275
+ var Slot = /* @__PURE__ */ createSlot("SelectContent.RemoveScroll");
24102
24276
  var SelectContentImpl = reactExports.forwardRef(
24103
24277
  (props, forwardedRef) => {
24104
24278
  const {
@@ -25124,9 +25298,12 @@ const useTheme = () => {
25124
25298
  document.documentElement.classList.toggle("dark", newTheme === "dark");
25125
25299
  }
25126
25300
  }, []);
25127
- return reactExports.useMemo(() => [theme, setThemeWithSideEffect], [theme]);
25301
+ return reactExports.useMemo(
25302
+ () => [theme, setThemeWithSideEffect],
25303
+ [theme, setThemeWithSideEffect]
25304
+ );
25128
25305
  };
25129
- const version = "0.8.1";
25306
+ const version = "0.9.0";
25130
25307
  var [createTooltipContext, createTooltipScope] = createContextScope("Tooltip", [
25131
25308
  createPopperScope
25132
25309
  ]);
@@ -25143,7 +25320,7 @@ var TooltipProvider$1 = (props) => {
25143
25320
  disableHoverableContent = false,
25144
25321
  children
25145
25322
  } = props;
25146
- const [isOpenDelayed, setIsOpenDelayed] = reactExports.useState(true);
25323
+ const isOpenDelayedRef = reactExports.useRef(true);
25147
25324
  const isPointerInTransitRef = reactExports.useRef(false);
25148
25325
  const skipDelayTimerRef = reactExports.useRef(0);
25149
25326
  reactExports.useEffect(() => {
@@ -25154,16 +25331,16 @@ var TooltipProvider$1 = (props) => {
25154
25331
  TooltipProviderContextProvider,
25155
25332
  {
25156
25333
  scope: __scopeTooltip,
25157
- isOpenDelayed,
25334
+ isOpenDelayedRef,
25158
25335
  delayDuration,
25159
25336
  onOpen: reactExports.useCallback(() => {
25160
25337
  window.clearTimeout(skipDelayTimerRef.current);
25161
- setIsOpenDelayed(false);
25338
+ isOpenDelayedRef.current = false;
25162
25339
  }, []),
25163
25340
  onClose: reactExports.useCallback(() => {
25164
25341
  window.clearTimeout(skipDelayTimerRef.current);
25165
25342
  skipDelayTimerRef.current = window.setTimeout(
25166
- () => setIsOpenDelayed(true),
25343
+ () => isOpenDelayedRef.current = true,
25167
25344
  skipDelayDuration
25168
25345
  );
25169
25346
  }, [skipDelayDuration]),
@@ -25250,9 +25427,9 @@ var Tooltip$1 = (props) => {
25250
25427
  trigger,
25251
25428
  onTriggerChange: setTrigger,
25252
25429
  onTriggerEnter: reactExports.useCallback(() => {
25253
- if (providerContext.isOpenDelayed) handleDelayedOpen();
25430
+ if (providerContext.isOpenDelayedRef.current) handleDelayedOpen();
25254
25431
  else handleOpen();
25255
- }, [providerContext.isOpenDelayed, handleDelayedOpen, handleOpen]),
25432
+ }, [providerContext.isOpenDelayedRef, handleDelayedOpen, handleOpen]),
25256
25433
  onTriggerLeave: reactExports.useCallback(() => {
25257
25434
  if (disableHoverableContent) {
25258
25435
  handleClose();
@@ -25303,6 +25480,9 @@ var TooltipTrigger$1 = reactExports.forwardRef(
25303
25480
  hasPointerMoveOpenedRef.current = false;
25304
25481
  }),
25305
25482
  onPointerDown: composeEventHandlers(props.onPointerDown, () => {
25483
+ if (context.open) {
25484
+ context.onClose();
25485
+ }
25306
25486
  isPointerDownRef.current = true;
25307
25487
  document.addEventListener("pointerup", handlePointerUp, { once: true });
25308
25488
  }),
@@ -25391,6 +25571,7 @@ var TooltipContentHoverable = reactExports.forwardRef((props, forwardedRef) => {
25391
25571
  return /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContentImpl, { ...props, ref: composedRefs });
25392
25572
  });
25393
25573
  var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
25574
+ var Slottable = /* @__PURE__ */ createSlottable("TooltipContent");
25394
25575
  var TooltipContentImpl = reactExports.forwardRef(
25395
25576
  (props, forwardedRef) => {
25396
25577
  const {
@@ -25631,20 +25812,27 @@ const Sidebar = ({
25631
25812
  const [showConfig, setShowConfig] = reactExports.useState(false);
25632
25813
  const [shownEnvVars, setShownEnvVars] = reactExports.useState(/* @__PURE__ */ new Set());
25633
25814
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-80 bg-card border-r border-border flex flex-col h-full", children: [
25634
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("h1", { className: "ml-2 text-lg font-semibold", children: [
25815
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("h1", { className: "ml-2 text-lg font-semibold", children: [
25635
25816
  "MCP Inspector v",
25636
25817
  version
25637
25818
  ] }) }) }),
25638
25819
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 flex-1 overflow-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
25639
25820
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
25640
- /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "text-sm font-medium", children: "Transport Type" }),
25821
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
25822
+ "label",
25823
+ {
25824
+ className: "text-sm font-medium",
25825
+ htmlFor: "transport-type-select",
25826
+ children: "Transport Type"
25827
+ }
25828
+ ),
25641
25829
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
25642
25830
  Select,
25643
25831
  {
25644
25832
  value: transportType,
25645
25833
  onValueChange: (value) => setTransportType(value),
25646
25834
  children: [
25647
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select transport type" }) }),
25835
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { id: "transport-type-select", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select transport type" }) }),
25648
25836
  /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
25649
25837
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "stdio", children: "STDIO" }),
25650
25838
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "sse", children: "SSE" })
@@ -25655,10 +25843,11 @@ const Sidebar = ({
25655
25843
  ] }),
25656
25844
  transportType === "stdio" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
25657
25845
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
25658
- /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "text-sm font-medium", children: "Command" }),
25846
+ /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "text-sm font-medium", htmlFor: "command-input", children: "Command" }),
25659
25847
  /* @__PURE__ */ jsxRuntimeExports.jsx(
25660
25848
  Input,
25661
25849
  {
25850
+ id: "command-input",
25662
25851
  placeholder: "Command",
25663
25852
  value: command,
25664
25853
  onChange: (e) => setCommand(e.target.value),
@@ -25667,10 +25856,18 @@ const Sidebar = ({
25667
25856
  )
25668
25857
  ] }),
25669
25858
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
25670
- /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "text-sm font-medium", children: "Arguments" }),
25859
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
25860
+ "label",
25861
+ {
25862
+ className: "text-sm font-medium",
25863
+ htmlFor: "arguments-input",
25864
+ children: "Arguments"
25865
+ }
25866
+ ),
25671
25867
  /* @__PURE__ */ jsxRuntimeExports.jsx(
25672
25868
  Input,
25673
25869
  {
25870
+ id: "arguments-input",
25674
25871
  placeholder: "Arguments (space-separated)",
25675
25872
  value: args,
25676
25873
  onChange: (e) => setArgs(e.target.value),
@@ -25680,10 +25877,11 @@ const Sidebar = ({
25680
25877
  ] })
25681
25878
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
25682
25879
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
25683
- /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "text-sm font-medium", children: "URL" }),
25880
+ /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "text-sm font-medium", htmlFor: "sse-url-input", children: "URL" }),
25684
25881
  /* @__PURE__ */ jsxRuntimeExports.jsx(
25685
25882
  Input,
25686
25883
  {
25884
+ id: "sse-url-input",
25687
25885
  placeholder: "URL",
25688
25886
  value: sseUrl,
25689
25887
  onChange: (e) => setSseUrl(e.target.value),
@@ -25698,6 +25896,7 @@ const Sidebar = ({
25698
25896
  variant: "outline",
25699
25897
  onClick: () => setShowBearerToken(!showBearerToken),
25700
25898
  className: "flex items-center w-full",
25899
+ "aria-expanded": showBearerToken,
25701
25900
  children: [
25702
25901
  showBearerToken ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "w-4 h-4 mr-2" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "w-4 h-4 mr-2" }),
25703
25902
  "Authentication"
@@ -25705,10 +25904,18 @@ const Sidebar = ({
25705
25904
  }
25706
25905
  ),
25707
25906
  showBearerToken && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
25708
- /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "text-sm font-medium", children: "Bearer Token" }),
25907
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
25908
+ "label",
25909
+ {
25910
+ className: "text-sm font-medium",
25911
+ htmlFor: "bearer-token-input",
25912
+ children: "Bearer Token"
25913
+ }
25914
+ ),
25709
25915
  /* @__PURE__ */ jsxRuntimeExports.jsx(
25710
25916
  Input,
25711
25917
  {
25918
+ id: "bearer-token-input",
25712
25919
  placeholder: "Bearer Token",
25713
25920
  value: bearerToken,
25714
25921
  onChange: (e) => setBearerToken(e.target.value),
@@ -25727,6 +25934,7 @@ const Sidebar = ({
25727
25934
  onClick: () => setShowEnvVars(!showEnvVars),
25728
25935
  className: "flex items-center w-full",
25729
25936
  "data-testid": "env-vars-button",
25937
+ "aria-expanded": showEnvVars,
25730
25938
  children: [
25731
25939
  showEnvVars ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "w-4 h-4 mr-2" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "w-4 h-4 mr-2" }),
25732
25940
  "Environment Variables"
@@ -25739,6 +25947,7 @@ const Sidebar = ({
25739
25947
  /* @__PURE__ */ jsxRuntimeExports.jsx(
25740
25948
  Input,
25741
25949
  {
25950
+ "aria-label": `Environment variable key ${idx + 1}`,
25742
25951
  placeholder: "Key",
25743
25952
  value: key,
25744
25953
  onChange: (e) => {
@@ -25785,6 +25994,7 @@ const Sidebar = ({
25785
25994
  /* @__PURE__ */ jsxRuntimeExports.jsx(
25786
25995
  Input,
25787
25996
  {
25997
+ "aria-label": `Environment variable value ${idx + 1}`,
25788
25998
  type: shownEnvVars.has(key) ? "text" : "password",
25789
25999
  placeholder: "Value",
25790
26000
  value,
@@ -25845,6 +26055,7 @@ const Sidebar = ({
25845
26055
  onClick: () => setShowConfig(!showConfig),
25846
26056
  className: "flex items-center w-full",
25847
26057
  "data-testid": "config-button",
26058
+ "aria-expanded": showConfig,
25848
26059
  children: [
25849
26060
  showConfig ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "w-4 h-4 mr-2" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "w-4 h-4 mr-2" }),
25850
26061
  /* @__PURE__ */ jsxRuntimeExports.jsx(Settings, { className: "w-4 h-4 mr-2" }),
@@ -25856,7 +26067,14 @@ const Sidebar = ({
25856
26067
  const configKey = key;
25857
26068
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
25858
26069
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
25859
- /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "text-sm font-medium text-green-600", children: configKey }),
26070
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
26071
+ "label",
26072
+ {
26073
+ className: "text-sm font-medium text-green-600 break-all",
26074
+ htmlFor: `${configKey}-input`,
26075
+ children: configItem.label
26076
+ }
26077
+ ),
25860
26078
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
25861
26079
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CircleHelp, { className: "h-4 w-4 text-muted-foreground" }) }),
25862
26080
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: configItem.description })
@@ -25865,6 +26083,7 @@ const Sidebar = ({
25865
26083
  typeof configItem.value === "number" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
25866
26084
  Input,
25867
26085
  {
26086
+ id: `${configKey}-input`,
25868
26087
  type: "number",
25869
26088
  "data-testid": `${configKey}-input`,
25870
26089
  value: configItem.value,
@@ -25892,7 +26111,7 @@ const Sidebar = ({
25892
26111
  setConfig(newConfig);
25893
26112
  },
25894
26113
  children: [
25895
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, {}) }),
26114
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { id: `${configKey}-input`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, {}) }),
25896
26115
  /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
25897
26116
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "true", children: "True" }),
25898
26117
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "false", children: "False" })
@@ -25902,6 +26121,7 @@ const Sidebar = ({
25902
26121
  ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
25903
26122
  Input,
25904
26123
  {
26124
+ id: `${configKey}-input`,
25905
26125
  "data-testid": `${configKey}-input`,
25906
26126
  value: configItem.value,
25907
26127
  onChange: (e) => {
@@ -25920,10 +26140,20 @@ const Sidebar = ({
25920
26140
  ] }),
25921
26141
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
25922
26142
  connectionStatus === "connected" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
25923
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { "data-testid": "connect-button", onClick: onConnect, children: [
25924
- /* @__PURE__ */ jsxRuntimeExports.jsx(RotateCcw, { className: "w-4 h-4 mr-2" }),
25925
- transportType === "stdio" ? "Restart" : "Reconnect"
25926
- ] }),
26143
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
26144
+ Button,
26145
+ {
26146
+ "data-testid": "connect-button",
26147
+ onClick: () => {
26148
+ onDisconnect();
26149
+ onConnect();
26150
+ },
26151
+ children: [
26152
+ /* @__PURE__ */ jsxRuntimeExports.jsx(RotateCcw, { className: "w-4 h-4 mr-2" }),
26153
+ transportType === "stdio" ? "Restart" : "Reconnect"
26154
+ ]
26155
+ }
26156
+ ),
25927
26157
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { onClick: onDisconnect, children: [
25928
26158
  /* @__PURE__ */ jsxRuntimeExports.jsx(RefreshCwOff, { className: "w-4 h-4 mr-2" }),
25929
26159
  "Disconnect"
@@ -25965,14 +26195,21 @@ const Sidebar = ({
25965
26195
  })() })
25966
26196
  ] }),
25967
26197
  loggingSupported && connectionStatus === "connected" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
25968
- /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "text-sm font-medium", children: "Logging Level" }),
26198
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
26199
+ "label",
26200
+ {
26201
+ className: "text-sm font-medium",
26202
+ htmlFor: "logging-level-select",
26203
+ children: "Logging Level"
26204
+ }
26205
+ ),
25969
26206
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
25970
26207
  Select,
25971
26208
  {
25972
26209
  value: logLevel,
25973
26210
  onValueChange: (value) => sendLogLevelRequest(value),
25974
26211
  children: [
25975
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select logging level" }) }),
26212
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { id: "logging-level-select", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select logging level" }) }),
25976
26213
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectContent, { children: Object.values(LoggingLevelSchema.enum).map((level) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: level, children: level })) })
25977
26214
  ]
25978
26215
  }
@@ -28145,73 +28382,6 @@ const JsonEditor = ({
28145
28382
  displayError && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-red-500 mt-1", children: displayError })
28146
28383
  ] });
28147
28384
  };
28148
- function updateValueAtPath(obj, path, value) {
28149
- if (path.length === 0) return value;
28150
- if (obj === null || obj === void 0) {
28151
- obj = !isNaN(Number(path[0])) ? [] : {};
28152
- }
28153
- if (Array.isArray(obj)) {
28154
- return updateArray(obj, path, value);
28155
- } else if (typeof obj === "object" && obj !== null) {
28156
- return updateObject(obj, path, value);
28157
- } else {
28158
- console.error(
28159
- `Cannot update path ${path.join(".")} in non-object/array value:`,
28160
- obj
28161
- );
28162
- return obj;
28163
- }
28164
- }
28165
- function updateArray(array, path, value) {
28166
- const [index2, ...restPath] = path;
28167
- const arrayIndex = Number(index2);
28168
- if (isNaN(arrayIndex)) {
28169
- console.error(`Invalid array index: ${index2}`);
28170
- return array;
28171
- }
28172
- if (arrayIndex < 0) {
28173
- console.error(`Array index out of bounds: ${arrayIndex} < 0`);
28174
- return array;
28175
- }
28176
- let newArray = [];
28177
- for (let i = 0; i < array.length; i++) {
28178
- newArray[i] = i in array ? array[i] : null;
28179
- }
28180
- if (arrayIndex >= newArray.length) {
28181
- const extendedArray = new Array(arrayIndex).fill(null);
28182
- for (let i = 0; i < newArray.length; i++) {
28183
- extendedArray[i] = newArray[i];
28184
- }
28185
- newArray = extendedArray;
28186
- }
28187
- if (restPath.length === 0) {
28188
- newArray[arrayIndex] = value;
28189
- } else {
28190
- newArray[arrayIndex] = updateValueAtPath(
28191
- newArray[arrayIndex],
28192
- restPath,
28193
- value
28194
- );
28195
- }
28196
- return newArray;
28197
- }
28198
- function updateObject(obj, path, value) {
28199
- const [key, ...restPath] = path;
28200
- if (typeof key !== "string") {
28201
- console.error(`Invalid object key: ${key}`);
28202
- return obj;
28203
- }
28204
- const newObj = { ...obj };
28205
- if (restPath.length === 0) {
28206
- newObj[key] = value;
28207
- } else {
28208
- if (!(key in newObj)) {
28209
- newObj[key] = {};
28210
- }
28211
- newObj[key] = updateValueAtPath(newObj[key], restPath, value);
28212
- }
28213
- return newObj;
28214
- }
28215
28385
  function generateDefaultValue(schema) {
28216
28386
  if ("default" in schema) {
28217
28387
  return schema.default;
@@ -28548,6 +28718,7 @@ const ToolsTab = ({
28548
28718
  nextCursor
28549
28719
  }) => {
28550
28720
  const [params2, setParams] = reactExports.useState({});
28721
+ const [isToolRunning, setIsToolRunning] = reactExports.useState(false);
28551
28722
  reactExports.useEffect(() => {
28552
28723
  setParams({});
28553
28724
  }, [selectedTool]);
@@ -28567,13 +28738,14 @@ const ToolsTab = ({
28567
28738
  const isError = structuredResult.isError ?? false;
28568
28739
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
28569
28740
  /* @__PURE__ */ jsxRuntimeExports.jsxs("h4", { className: "font-semibold mb-2", children: [
28570
- "Tool Result: ",
28571
- isError ? "Error" : "Success"
28741
+ "Tool Result:",
28742
+ " ",
28743
+ isError ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-red-600 font-semibold", children: "Error" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-green-600 font-semibold", children: "Success" })
28572
28744
  ] }),
28573
28745
  structuredResult.content.map((item, index2) => {
28574
28746
  var _a, _b;
28575
28747
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-2", children: [
28576
- item.type === "text" && /* @__PURE__ */ jsxRuntimeExports.jsx(JsonView, { data: item.text }),
28748
+ item.type === "text" && /* @__PURE__ */ jsxRuntimeExports.jsx(JsonView, { data: item.text, isError }),
28577
28749
  item.type === "image" && /* @__PURE__ */ jsxRuntimeExports.jsx(
28578
28750
  "img",
28579
28751
  {
@@ -28601,7 +28773,7 @@ const ToolsTab = ({
28601
28773
  ] });
28602
28774
  }
28603
28775
  };
28604
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsContent, { value: "tools", className: "grid grid-cols-2 gap-4", children: [
28776
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "tools", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
28605
28777
  /* @__PURE__ */ jsxRuntimeExports.jsx(
28606
28778
  ListPane,
28607
28779
  {
@@ -28622,7 +28794,7 @@ const ToolsTab = ({
28622
28794
  }
28623
28795
  ),
28624
28796
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-card rounded-lg shadow", children: [
28625
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-semibold", children: selectedTool ? selectedTool.name : "Select a tool" }) }),
28797
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 border-b border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-semibold", children: selectedTool ? selectedTool.name : "Select a tool" }) }),
28626
28798
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4", children: selectedTool ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
28627
28799
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-600", children: selectedTool.description }),
28628
28800
  Object.entries(selectedTool.inputSchema.properties ?? []).map(
@@ -28706,24 +28878,31 @@ const ToolsTab = ({
28706
28878
  ] }, key);
28707
28879
  }
28708
28880
  ),
28709
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { onClick: () => callTool(selectedTool.name, params2), children: [
28710
- /* @__PURE__ */ jsxRuntimeExports.jsx(Send, { className: "w-4 h-4 mr-2" }),
28711
- "Run Tool"
28712
- ] }),
28881
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
28882
+ Button,
28883
+ {
28884
+ onClick: async () => {
28885
+ try {
28886
+ setIsToolRunning(true);
28887
+ await callTool(selectedTool.name, params2);
28888
+ } finally {
28889
+ setIsToolRunning(false);
28890
+ }
28891
+ },
28892
+ disabled: isToolRunning,
28893
+ children: isToolRunning ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
28894
+ /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "w-4 h-4 mr-2 animate-spin" }),
28895
+ "Running..."
28896
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
28897
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Send, { className: "w-4 h-4 mr-2" }),
28898
+ "Run Tool"
28899
+ ] })
28900
+ }
28901
+ ),
28713
28902
  toolResult && renderToolResult()
28714
28903
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(AlertDescription, { children: "Select a tool from the list to view its details and run it" }) }) })
28715
28904
  ] })
28716
- ] });
28717
- };
28718
- const getMCPProxyAddress = (config) => {
28719
- const proxyFullAddress = config.MCP_PROXY_FULL_ADDRESS.value;
28720
- if (proxyFullAddress) {
28721
- return proxyFullAddress;
28722
- }
28723
- return `${window.location.protocol}//${window.location.hostname}:${DEFAULT_MCP_PROXY_LISTEN_PORT}`;
28724
- };
28725
- const getMCPServerRequestTimeout = (config) => {
28726
- return config.MCP_SERVER_REQUEST_TIMEOUT.value;
28905
+ ] }) });
28727
28906
  };
28728
28907
  const params = new URLSearchParams(window.location.search);
28729
28908
  const CONFIG_LOCAL_STORAGE_KEY = "inspectorConfig_v1";
@@ -28762,10 +28941,17 @@ const App = () => {
28762
28941
  const [config, setConfig] = reactExports.useState(() => {
28763
28942
  const savedConfig = localStorage.getItem(CONFIG_LOCAL_STORAGE_KEY);
28764
28943
  if (savedConfig) {
28765
- return {
28944
+ const mergedConfig = {
28766
28945
  ...DEFAULT_INSPECTOR_CONFIG,
28767
28946
  ...JSON.parse(savedConfig)
28768
28947
  };
28948
+ Object.entries(mergedConfig).forEach(([key, value]) => {
28949
+ mergedConfig[key] = {
28950
+ ...value,
28951
+ label: DEFAULT_INSPECTOR_CONFIG[key].label
28952
+ };
28953
+ });
28954
+ return mergedConfig;
28769
28955
  }
28770
28956
  return DEFAULT_INSPECTOR_CONFIG;
28771
28957
  });
@@ -28792,7 +28978,7 @@ const App = () => {
28792
28978
  serverCapabilities,
28793
28979
  mcpClient,
28794
28980
  requestHistory,
28795
- makeRequest: makeConnectionRequest,
28981
+ makeRequest,
28796
28982
  sendNotification,
28797
28983
  handleCompletion,
28798
28984
  completionsSupported,
@@ -28805,8 +28991,7 @@ const App = () => {
28805
28991
  sseUrl,
28806
28992
  env,
28807
28993
  bearerToken,
28808
- proxyServerUrl: getMCPProxyAddress(config),
28809
- requestTimeout: getMCPServerRequestTimeout(config),
28994
+ config,
28810
28995
  onNotification: (notification) => {
28811
28996
  setNotifications((prev) => [...prev, notification]);
28812
28997
  },
@@ -28900,9 +29085,9 @@ const App = () => {
28900
29085
  const clearError = (tabKey) => {
28901
29086
  setErrors((prev) => ({ ...prev, [tabKey]: null }));
28902
29087
  };
28903
- const makeRequest = async (request, schema, tabKey) => {
29088
+ const sendMCPRequest = async (request, schema, tabKey) => {
28904
29089
  try {
28905
- const response = await makeConnectionRequest(request, schema);
29090
+ const response = await makeRequest(request, schema);
28906
29091
  if (tabKey !== void 0) {
28907
29092
  clearError(tabKey);
28908
29093
  }
@@ -28919,7 +29104,7 @@ const App = () => {
28919
29104
  }
28920
29105
  };
28921
29106
  const listResources = async () => {
28922
- const response = await makeRequest(
29107
+ const response = await sendMCPRequest(
28923
29108
  {
28924
29109
  method: "resources/list",
28925
29110
  params: nextResourceCursor ? { cursor: nextResourceCursor } : {}
@@ -28931,7 +29116,7 @@ const App = () => {
28931
29116
  setNextResourceCursor(response.nextCursor);
28932
29117
  };
28933
29118
  const listResourceTemplates = async () => {
28934
- const response = await makeRequest(
29119
+ const response = await sendMCPRequest(
28935
29120
  {
28936
29121
  method: "resources/templates/list",
28937
29122
  params: nextResourceTemplateCursor ? { cursor: nextResourceTemplateCursor } : {}
@@ -28945,7 +29130,7 @@ const App = () => {
28945
29130
  setNextResourceTemplateCursor(response.nextCursor);
28946
29131
  };
28947
29132
  const readResource = async (uri) => {
28948
- const response = await makeRequest(
29133
+ const response = await sendMCPRequest(
28949
29134
  {
28950
29135
  method: "resources/read",
28951
29136
  params: { uri }
@@ -28957,7 +29142,7 @@ const App = () => {
28957
29142
  };
28958
29143
  const subscribeToResource = async (uri) => {
28959
29144
  if (!resourceSubscriptions.has(uri)) {
28960
- await makeRequest(
29145
+ await sendMCPRequest(
28961
29146
  {
28962
29147
  method: "resources/subscribe",
28963
29148
  params: { uri }
@@ -28972,7 +29157,7 @@ const App = () => {
28972
29157
  };
28973
29158
  const unsubscribeFromResource = async (uri) => {
28974
29159
  if (resourceSubscriptions.has(uri)) {
28975
- await makeRequest(
29160
+ await sendMCPRequest(
28976
29161
  {
28977
29162
  method: "resources/unsubscribe",
28978
29163
  params: { uri }
@@ -28986,7 +29171,7 @@ const App = () => {
28986
29171
  }
28987
29172
  };
28988
29173
  const listPrompts = async () => {
28989
- const response = await makeRequest(
29174
+ const response = await sendMCPRequest(
28990
29175
  {
28991
29176
  method: "prompts/list",
28992
29177
  params: nextPromptCursor ? { cursor: nextPromptCursor } : {}
@@ -28998,7 +29183,7 @@ const App = () => {
28998
29183
  setNextPromptCursor(response.nextCursor);
28999
29184
  };
29000
29185
  const getPrompt = async (name, args2 = {}) => {
29001
- const response = await makeRequest(
29186
+ const response = await sendMCPRequest(
29002
29187
  {
29003
29188
  method: "prompts/get",
29004
29189
  params: { name, arguments: args2 }
@@ -29009,7 +29194,7 @@ const App = () => {
29009
29194
  setPromptContent(JSON.stringify(response, null, 2));
29010
29195
  };
29011
29196
  const listTools = async () => {
29012
- const response = await makeRequest(
29197
+ const response = await sendMCPRequest(
29013
29198
  {
29014
29199
  method: "tools/list",
29015
29200
  params: nextToolCursor ? { cursor: nextToolCursor } : {}
@@ -29021,27 +29206,40 @@ const App = () => {
29021
29206
  setNextToolCursor(response.nextCursor);
29022
29207
  };
29023
29208
  const callTool = async (name, params2) => {
29024
- const response = await makeRequest(
29025
- {
29026
- method: "tools/call",
29027
- params: {
29028
- name,
29029
- arguments: params2,
29030
- _meta: {
29031
- progressToken: progressTokenRef.current++
29209
+ try {
29210
+ const response = await sendMCPRequest(
29211
+ {
29212
+ method: "tools/call",
29213
+ params: {
29214
+ name,
29215
+ arguments: params2,
29216
+ _meta: {
29217
+ progressToken: progressTokenRef.current++
29218
+ }
29032
29219
  }
29033
- }
29034
- },
29035
- CompatibilityCallToolResultSchema,
29036
- "tools"
29037
- );
29038
- setToolResult(response);
29220
+ },
29221
+ CompatibilityCallToolResultSchema,
29222
+ "tools"
29223
+ );
29224
+ setToolResult(response);
29225
+ } catch (e) {
29226
+ const toolResult2 = {
29227
+ content: [
29228
+ {
29229
+ type: "text",
29230
+ text: e.message ?? String(e)
29231
+ }
29232
+ ],
29233
+ isError: true
29234
+ };
29235
+ setToolResult(toolResult2);
29236
+ }
29039
29237
  };
29040
29238
  const handleRootsChange = async () => {
29041
29239
  await sendNotification({ method: "notifications/roots/list_changed" });
29042
29240
  };
29043
29241
  const sendLogLevelRequest = async (level) => {
29044
- await makeRequest(
29242
+ await sendMCPRequest(
29045
29243
  {
29046
29244
  method: "logging/setLevel",
29047
29245
  params: { level }
@@ -29052,7 +29250,7 @@ const App = () => {
29052
29250
  };
29053
29251
  if (window.location.pathname === "/oauth/callback") {
29054
29252
  const OAuthCallback = React$1.lazy(
29055
- () => __vitePreload(() => import("./OAuthCallback-C-gED7Cw.js"), true ? [] : void 0)
29253
+ () => __vitePreload(() => import("./OAuthCallback-C3r8TjnW.js"), true ? [] : void 0)
29056
29254
  );
29057
29255
  return /* @__PURE__ */ jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(OAuthCallback, {}) });
29058
29256
  }
@@ -29230,9 +29428,10 @@ const App = () => {
29230
29428
  setTools([]);
29231
29429
  setNextToolCursor(void 0);
29232
29430
  },
29233
- callTool: (name, params2) => {
29431
+ callTool: async (name, params2) => {
29234
29432
  clearError("tools");
29235
- callTool(name, params2);
29433
+ setToolResult(null);
29434
+ await callTool(name, params2);
29236
29435
  },
29237
29436
  selectedTool,
29238
29437
  setSelectedTool: (tool) => {
@@ -29250,7 +29449,7 @@ const App = () => {
29250
29449
  PingTab,
29251
29450
  {
29252
29451
  onPingClick: () => {
29253
- void makeRequest(
29452
+ void sendMCPRequest(
29254
29453
  {
29255
29454
  method: "ping"
29256
29455
  },