@modelcontextprotocol/inspector 0.15.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OAuthCallback-CaW3Hcqw.js","assets/oauthUtils-DTcoXpSP.js","assets/OAuthDebugCallback-DiBt_oxh.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OAuthCallback-CaDIOg8Q.js","assets/oauthUtils-DTcoXpSP.js","assets/OAuthDebugCallback-Ccjj44Wa.js"])))=>i.map(i=>d[i]);
2
2
  function _mergeNamespaces(n, m2) {
3
3
  for (var i = 0; i < m2.length; i++) {
4
4
  const e = m2[i];
@@ -11612,8 +11612,9 @@ class ZodError extends Error {
11612
11612
  const formErrors = [];
11613
11613
  for (const sub of this.issues) {
11614
11614
  if (sub.path.length > 0) {
11615
- fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
11616
- fieldErrors[sub.path[0]].push(mapper(sub));
11615
+ const firstEl = sub.path[0];
11616
+ fieldErrors[firstEl] = fieldErrors[firstEl] || [];
11617
+ fieldErrors[firstEl].push(mapper(sub));
11617
11618
  } else {
11618
11619
  formErrors.push(mapper(sub));
11619
11620
  }
@@ -11689,6 +11690,8 @@ const errorMap = (issue, _ctx) => {
11689
11690
  message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
11690
11691
  else if (issue.type === "number")
11691
11692
  message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
11693
+ else if (issue.type === "bigint")
11694
+ message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
11692
11695
  else if (issue.type === "date")
11693
11696
  message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
11694
11697
  else
@@ -12241,6 +12244,8 @@ function isValidJWT(jwt, alg) {
12241
12244
  return false;
12242
12245
  try {
12243
12246
  const [header] = jwt.split(".");
12247
+ if (!header)
12248
+ return false;
12244
12249
  const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
12245
12250
  const decoded = JSON.parse(atob(base64));
12246
12251
  if (typeof decoded !== "object" || decoded === null)
@@ -15913,7 +15918,7 @@ const ElicitResultSchema = ResultSchema.extend({
15913
15918
  /**
15914
15919
  * The user's response action.
15915
15920
  */
15916
- action: enumType(["accept", "reject", "cancel"]),
15921
+ action: enumType(["accept", "decline", "cancel"]),
15917
15922
  /**
15918
15923
  * The collected user input content (only present if action is "accept").
15919
15924
  */
@@ -16370,6 +16375,54 @@ class UnauthorizedError extends Error {
16370
16375
  super(message !== null && message !== void 0 ? message : "Unauthorized");
16371
16376
  }
16372
16377
  }
16378
+ function selectClientAuthMethod(clientInformation, supportedMethods) {
16379
+ const hasClientSecret = clientInformation.client_secret !== void 0;
16380
+ if (supportedMethods.length === 0) {
16381
+ return hasClientSecret ? "client_secret_post" : "none";
16382
+ }
16383
+ if (hasClientSecret && supportedMethods.includes("client_secret_basic")) {
16384
+ return "client_secret_basic";
16385
+ }
16386
+ if (hasClientSecret && supportedMethods.includes("client_secret_post")) {
16387
+ return "client_secret_post";
16388
+ }
16389
+ if (supportedMethods.includes("none")) {
16390
+ return "none";
16391
+ }
16392
+ return hasClientSecret ? "client_secret_post" : "none";
16393
+ }
16394
+ function applyClientAuthentication(method, clientInformation, headers, params) {
16395
+ const { client_id, client_secret } = clientInformation;
16396
+ switch (method) {
16397
+ case "client_secret_basic":
16398
+ applyBasicAuth(client_id, client_secret, headers);
16399
+ return;
16400
+ case "client_secret_post":
16401
+ applyPostAuth(client_id, client_secret, params);
16402
+ return;
16403
+ case "none":
16404
+ applyPublicAuth(client_id, params);
16405
+ return;
16406
+ default:
16407
+ throw new Error(`Unsupported client authentication method: ${method}`);
16408
+ }
16409
+ }
16410
+ function applyBasicAuth(clientId, clientSecret, headers) {
16411
+ if (!clientSecret) {
16412
+ throw new Error("client_secret_basic authentication requires a client_secret");
16413
+ }
16414
+ const credentials = btoa(`${clientId}:${clientSecret}`);
16415
+ headers.set("Authorization", `Basic ${credentials}`);
16416
+ }
16417
+ function applyPostAuth(clientId, clientSecret, params) {
16418
+ params.set("client_id", clientId);
16419
+ if (clientSecret) {
16420
+ params.set("client_secret", clientSecret);
16421
+ }
16422
+ }
16423
+ function applyPublicAuth(clientId, params) {
16424
+ params.set("client_id", clientId);
16425
+ }
16373
16426
  async function auth(provider, { serverUrl, authorizationCode, scope, resourceMetadataUrl }) {
16374
16427
  let resourceMetadata;
16375
16428
  let authorizationServerUrl = serverUrl;
@@ -16381,7 +16434,9 @@ async function auth(provider, { serverUrl, authorizationCode, scope, resourceMet
16381
16434
  } catch (_a) {
16382
16435
  }
16383
16436
  const resource = await selectResourceURL(serverUrl, provider, resourceMetadata);
16384
- const metadata = await discoverOAuthMetadata(authorizationServerUrl);
16437
+ const metadata = await discoverOAuthMetadata(serverUrl, {
16438
+ authorizationServerUrl
16439
+ });
16385
16440
  let clientInformation = await Promise.resolve(provider.clientInformation());
16386
16441
  if (!clientInformation) {
16387
16442
  if (authorizationCode !== void 0) {
@@ -16405,7 +16460,8 @@ async function auth(provider, { serverUrl, authorizationCode, scope, resourceMet
16405
16460
  authorizationCode,
16406
16461
  codeVerifier: codeVerifier2,
16407
16462
  redirectUri: provider.redirectUrl,
16408
- resource
16463
+ resource,
16464
+ addClientAuthentication: provider.addClientAuthentication
16409
16465
  });
16410
16466
  await provider.saveTokens(tokens2);
16411
16467
  return "AUTHORIZED";
@@ -16417,7 +16473,8 @@ async function auth(provider, { serverUrl, authorizationCode, scope, resourceMet
16417
16473
  metadata,
16418
16474
  clientInformation,
16419
16475
  refreshToken: tokens.refresh_token,
16420
- resource
16476
+ resource,
16477
+ addClientAuthentication: provider.addClientAuthentication
16421
16478
  });
16422
16479
  await provider.saveTokens(newTokens);
16423
16480
  return "AUTHORIZED";
@@ -16471,28 +16528,11 @@ function extractResourceMetadataUrl(res) {
16471
16528
  }
16472
16529
  }
16473
16530
  async function discoverOAuthProtectedResourceMetadata(serverUrl, opts) {
16474
- var _a;
16475
- let url;
16476
- if (opts === null || opts === void 0 ? void 0 : opts.resourceMetadataUrl) {
16477
- url = new URL(opts === null || opts === void 0 ? void 0 : opts.resourceMetadataUrl);
16478
- } else {
16479
- url = new URL("/.well-known/oauth-protected-resource", serverUrl);
16480
- }
16481
- let response;
16482
- try {
16483
- response = await fetch(url, {
16484
- headers: {
16485
- "MCP-Protocol-Version": (_a = opts === null || opts === void 0 ? void 0 : opts.protocolVersion) !== null && _a !== void 0 ? _a : LATEST_PROTOCOL_VERSION
16486
- }
16487
- });
16488
- } catch (error) {
16489
- if (error instanceof TypeError) {
16490
- response = await fetch(url);
16491
- } else {
16492
- throw error;
16493
- }
16494
- }
16495
- if (response.status === 404) {
16531
+ const response = await discoverMetadataWithFallback(serverUrl, "oauth-protected-resource", {
16532
+ protocolVersion: opts === null || opts === void 0 ? void 0 : opts.protocolVersion,
16533
+ metadataUrl: opts === null || opts === void 0 ? void 0 : opts.resourceMetadataUrl
16534
+ });
16535
+ if (!response || response.status === 404) {
16496
16536
  throw new Error(`Resource server does not implement OAuth 2.0 Protected Resource Metadata.`);
16497
16537
  }
16498
16538
  if (!response.ok) {
@@ -16505,13 +16545,17 @@ async function fetchWithCorsRetry(url, headers) {
16505
16545
  return await fetch(url, { headers });
16506
16546
  } catch (error) {
16507
16547
  if (error instanceof TypeError) {
16508
- return await fetch(url);
16548
+ if (headers) {
16549
+ return fetchWithCorsRetry(url);
16550
+ } else {
16551
+ return void 0;
16552
+ }
16509
16553
  }
16510
16554
  throw error;
16511
16555
  }
16512
16556
  }
16513
- function buildWellKnownPath(pathname) {
16514
- let wellKnownPath = `/.well-known/oauth-authorization-server${pathname}`;
16557
+ function buildWellKnownPath(wellKnownPrefix, pathname) {
16558
+ let wellKnownPath = `/.well-known/${wellKnownPrefix}${pathname}`;
16515
16559
  if (pathname.endsWith("/")) {
16516
16560
  wellKnownPath = wellKnownPath.slice(0, -1);
16517
16561
  }
@@ -16524,26 +16568,43 @@ async function tryMetadataDiscovery(url, protocolVersion) {
16524
16568
  return await fetchWithCorsRetry(url, headers);
16525
16569
  }
16526
16570
  function shouldAttemptFallback(response, pathname) {
16527
- return response.status === 404 && pathname !== "/";
16571
+ return !response || response.status === 404 && pathname !== "/";
16528
16572
  }
16529
- async function discoverOAuthMetadata(authorizationServerUrl, opts) {
16530
- var _a;
16531
- const issuer = new URL(authorizationServerUrl);
16532
- const protocolVersion = (_a = void 0) !== null && _a !== void 0 ? _a : LATEST_PROTOCOL_VERSION;
16533
- const wellKnownPath = buildWellKnownPath(issuer.pathname);
16534
- const pathAwareUrl = new URL(wellKnownPath, issuer);
16535
- let response = await tryMetadataDiscovery(pathAwareUrl, protocolVersion);
16536
- if (shouldAttemptFallback(response, issuer.pathname)) {
16537
- try {
16538
- const rootUrl = new URL("/.well-known/oauth-authorization-server", issuer);
16539
- response = await tryMetadataDiscovery(rootUrl, protocolVersion);
16540
- if (response.status === 404) {
16541
- return void 0;
16542
- }
16543
- } catch (_b) {
16544
- return void 0;
16545
- }
16546
- } else if (response.status === 404) {
16573
+ async function discoverMetadataWithFallback(serverUrl, wellKnownType, opts) {
16574
+ var _a, _b;
16575
+ const issuer = new URL(serverUrl);
16576
+ const protocolVersion = (_a = opts === null || opts === void 0 ? void 0 : opts.protocolVersion) !== null && _a !== void 0 ? _a : LATEST_PROTOCOL_VERSION;
16577
+ let url;
16578
+ if (opts === null || opts === void 0 ? void 0 : opts.metadataUrl) {
16579
+ url = new URL(opts.metadataUrl);
16580
+ } else {
16581
+ const wellKnownPath = buildWellKnownPath(wellKnownType, issuer.pathname);
16582
+ url = new URL(wellKnownPath, (_b = opts === null || opts === void 0 ? void 0 : opts.metadataServerUrl) !== null && _b !== void 0 ? _b : issuer);
16583
+ url.search = issuer.search;
16584
+ }
16585
+ let response = await tryMetadataDiscovery(url, protocolVersion);
16586
+ if (!(opts === null || opts === void 0 ? void 0 : opts.metadataUrl) && shouldAttemptFallback(response, issuer.pathname)) {
16587
+ const rootUrl = new URL(`/.well-known/${wellKnownType}`, issuer);
16588
+ response = await tryMetadataDiscovery(rootUrl, protocolVersion);
16589
+ }
16590
+ return response;
16591
+ }
16592
+ async function discoverOAuthMetadata(issuer, { authorizationServerUrl, protocolVersion } = {}) {
16593
+ if (typeof issuer === "string") {
16594
+ issuer = new URL(issuer);
16595
+ }
16596
+ if (!authorizationServerUrl) {
16597
+ authorizationServerUrl = issuer;
16598
+ }
16599
+ if (typeof authorizationServerUrl === "string") {
16600
+ authorizationServerUrl = new URL(authorizationServerUrl);
16601
+ }
16602
+ protocolVersion !== null && protocolVersion !== void 0 ? protocolVersion : protocolVersion = LATEST_PROTOCOL_VERSION;
16603
+ const response = await discoverMetadataWithFallback(issuer, "oauth-authorization-server", {
16604
+ protocolVersion,
16605
+ metadataServerUrl: authorizationServerUrl
16606
+ });
16607
+ if (!response || response.status === 404) {
16547
16608
  return void 0;
16548
16609
  }
16549
16610
  if (!response.ok) {
@@ -16585,35 +16646,35 @@ async function startAuthorization(authorizationServerUrl, { metadata, clientInfo
16585
16646
  }
16586
16647
  return { authorizationUrl, codeVerifier };
16587
16648
  }
16588
- async function exchangeAuthorization(authorizationServerUrl, { metadata, clientInformation, authorizationCode, codeVerifier, redirectUri, resource }) {
16649
+ async function exchangeAuthorization(authorizationServerUrl, { metadata, clientInformation, authorizationCode, codeVerifier, redirectUri, resource, addClientAuthentication }) {
16650
+ var _a;
16589
16651
  const grantType = "authorization_code";
16590
- let tokenUrl;
16591
- if (metadata) {
16592
- tokenUrl = new URL(metadata.token_endpoint);
16593
- if (metadata.grant_types_supported && !metadata.grant_types_supported.includes(grantType)) {
16594
- throw new Error(`Incompatible auth server: does not support grant type ${grantType}`);
16595
- }
16596
- } else {
16597
- tokenUrl = new URL("/token", authorizationServerUrl);
16652
+ const tokenUrl = (metadata === null || metadata === void 0 ? void 0 : metadata.token_endpoint) ? new URL(metadata.token_endpoint) : new URL("/token", authorizationServerUrl);
16653
+ if ((metadata === null || metadata === void 0 ? void 0 : metadata.grant_types_supported) && !metadata.grant_types_supported.includes(grantType)) {
16654
+ throw new Error(`Incompatible auth server: does not support grant type ${grantType}`);
16598
16655
  }
16656
+ const headers = new Headers({
16657
+ "Content-Type": "application/x-www-form-urlencoded"
16658
+ });
16599
16659
  const params = new URLSearchParams({
16600
16660
  grant_type: grantType,
16601
- client_id: clientInformation.client_id,
16602
16661
  code: authorizationCode,
16603
16662
  code_verifier: codeVerifier,
16604
16663
  redirect_uri: String(redirectUri)
16605
16664
  });
16606
- if (clientInformation.client_secret) {
16607
- params.set("client_secret", clientInformation.client_secret);
16665
+ if (addClientAuthentication) {
16666
+ addClientAuthentication(headers, params, authorizationServerUrl, metadata);
16667
+ } else {
16668
+ const supportedMethods = (_a = metadata === null || metadata === void 0 ? void 0 : metadata.token_endpoint_auth_methods_supported) !== null && _a !== void 0 ? _a : [];
16669
+ const authMethod = selectClientAuthMethod(clientInformation, supportedMethods);
16670
+ applyClientAuthentication(authMethod, clientInformation, headers, params);
16608
16671
  }
16609
16672
  if (resource) {
16610
16673
  params.set("resource", resource.href);
16611
16674
  }
16612
16675
  const response = await fetch(tokenUrl, {
16613
16676
  method: "POST",
16614
- headers: {
16615
- "Content-Type": "application/x-www-form-urlencoded"
16616
- },
16677
+ headers,
16617
16678
  body: params
16618
16679
  });
16619
16680
  if (!response.ok) {
@@ -16621,7 +16682,8 @@ async function exchangeAuthorization(authorizationServerUrl, { metadata, clientI
16621
16682
  }
16622
16683
  return OAuthTokensSchema.parse(await response.json());
16623
16684
  }
16624
- async function refreshAuthorization(authorizationServerUrl, { metadata, clientInformation, refreshToken, resource }) {
16685
+ async function refreshAuthorization(authorizationServerUrl, { metadata, clientInformation, refreshToken, resource, addClientAuthentication }) {
16686
+ var _a;
16625
16687
  const grantType = "refresh_token";
16626
16688
  let tokenUrl;
16627
16689
  if (metadata) {
@@ -16632,22 +16694,26 @@ async function refreshAuthorization(authorizationServerUrl, { metadata, clientIn
16632
16694
  } else {
16633
16695
  tokenUrl = new URL("/token", authorizationServerUrl);
16634
16696
  }
16697
+ const headers = new Headers({
16698
+ "Content-Type": "application/x-www-form-urlencoded"
16699
+ });
16635
16700
  const params = new URLSearchParams({
16636
16701
  grant_type: grantType,
16637
- client_id: clientInformation.client_id,
16638
16702
  refresh_token: refreshToken
16639
16703
  });
16640
- if (clientInformation.client_secret) {
16641
- params.set("client_secret", clientInformation.client_secret);
16704
+ if (addClientAuthentication) {
16705
+ addClientAuthentication(headers, params, authorizationServerUrl, metadata);
16706
+ } else {
16707
+ const supportedMethods = (_a = metadata === null || metadata === void 0 ? void 0 : metadata.token_endpoint_auth_methods_supported) !== null && _a !== void 0 ? _a : [];
16708
+ const authMethod = selectClientAuthMethod(clientInformation, supportedMethods);
16709
+ applyClientAuthentication(authMethod, clientInformation, headers, params);
16642
16710
  }
16643
16711
  if (resource) {
16644
16712
  params.set("resource", resource.href);
16645
16713
  }
16646
16714
  const response = await fetch(tokenUrl, {
16647
16715
  method: "POST",
16648
- headers: {
16649
- "Content-Type": "application/x-www-form-urlencoded"
16650
- },
16716
+ headers,
16651
16717
  body: params
16652
16718
  });
16653
16719
  if (!response.ok) {
@@ -22908,38 +22974,44 @@ function validateToolOutput(toolName, structuredContent) {
22908
22974
  function hasOutputSchema(toolName) {
22909
22975
  return toolOutputValidators.has(toolName);
22910
22976
  }
22911
- function generateDefaultValue(schema) {
22912
- if ("default" in schema) {
22977
+ function generateDefaultValue(schema, propertyName, parentSchema) {
22978
+ if ("default" in schema && schema.default !== void 0) {
22913
22979
  return schema.default;
22914
22980
  }
22915
- if (!schema.required) {
22916
- if (schema.type === "array") return [];
22917
- if (schema.type === "object") return {};
22918
- return void 0;
22919
- }
22981
+ const isRequired = propertyName && parentSchema ? isPropertyRequired(propertyName, parentSchema) : false;
22920
22982
  switch (schema.type) {
22921
22983
  case "string":
22922
- return "";
22984
+ return isRequired ? "" : void 0;
22923
22985
  case "number":
22924
22986
  case "integer":
22925
- return 0;
22987
+ return isRequired ? 0 : void 0;
22926
22988
  case "boolean":
22927
- return false;
22989
+ return isRequired ? false : void 0;
22928
22990
  case "array":
22929
22991
  return [];
22930
22992
  case "object": {
22931
22993
  if (!schema.properties) return {};
22932
22994
  const obj = {};
22933
- Object.entries(schema.properties).filter(([, prop]) => prop.required).forEach(([key, prop]) => {
22934
- const value = generateDefaultValue(prop);
22935
- obj[key] = value;
22995
+ Object.entries(schema.properties).forEach(([key, prop]) => {
22996
+ if (isPropertyRequired(key, schema)) {
22997
+ const value = generateDefaultValue(prop, key, schema);
22998
+ if (value !== void 0) {
22999
+ obj[key] = value;
23000
+ }
23001
+ }
22936
23002
  });
22937
23003
  return obj;
22938
23004
  }
22939
- default:
23005
+ case "null":
22940
23006
  return null;
23007
+ default:
23008
+ return void 0;
22941
23009
  }
22942
23010
  }
23011
+ function isPropertyRequired(propertyName, schema) {
23012
+ var _a;
23013
+ return ((_a = schema.required) == null ? void 0 : _a.includes(propertyName)) ?? false;
23014
+ }
22943
23015
  const DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
22944
23016
  class Protocol {
22945
23017
  constructor(_options) {
@@ -23900,6 +23972,7 @@ class SSEClientTransport {
23900
23972
  this._eventSourceInit = opts === null || opts === void 0 ? void 0 : opts.eventSourceInit;
23901
23973
  this._requestInit = opts === null || opts === void 0 ? void 0 : opts.requestInit;
23902
23974
  this._authProvider = opts === null || opts === void 0 ? void 0 : opts.authProvider;
23975
+ this._fetch = opts === null || opts === void 0 ? void 0 : opts.fetch;
23903
23976
  }
23904
23977
  async _authThenStart() {
23905
23978
  var _a;
@@ -23920,9 +23993,7 @@ class SSEClientTransport {
23920
23993
  }
23921
23994
  async _commonHeaders() {
23922
23995
  var _a;
23923
- const headers = {
23924
- ...(_a = this._requestInit) === null || _a === void 0 ? void 0 : _a.headers
23925
- };
23996
+ const headers = {};
23926
23997
  if (this._authProvider) {
23927
23998
  const tokens = await this._authProvider.tokens();
23928
23999
  if (tokens) {
@@ -23932,22 +24003,20 @@ class SSEClientTransport {
23932
24003
  if (this._protocolVersion) {
23933
24004
  headers["mcp-protocol-version"] = this._protocolVersion;
23934
24005
  }
23935
- return headers;
24006
+ return new Headers({ ...headers, ...(_a = this._requestInit) === null || _a === void 0 ? void 0 : _a.headers });
23936
24007
  }
23937
24008
  _startOrAuth() {
23938
- var _a;
23939
- const fetchImpl = ((_a = this === null || this === void 0 ? void 0 : this._eventSourceInit) === null || _a === void 0 ? void 0 : _a.fetch) || fetch;
24009
+ var _a, _b, _c;
24010
+ const fetchImpl = (_c = (_b = (_a = this === null || this === void 0 ? void 0 : this._eventSourceInit) === null || _a === void 0 ? void 0 : _a.fetch) !== null && _b !== void 0 ? _b : this._fetch) !== null && _c !== void 0 ? _c : fetch;
23940
24011
  return new Promise((resolve, reject) => {
23941
24012
  this._eventSource = new EventSource(this._url.href, {
23942
24013
  ...this._eventSourceInit,
23943
24014
  fetch: async (url, init) => {
23944
24015
  const headers = await this._commonHeaders();
24016
+ headers.set("Accept", "text/event-stream");
23945
24017
  const response = await fetchImpl(url, {
23946
24018
  ...init,
23947
- headers: new Headers({
23948
- ...headers,
23949
- Accept: "text/event-stream"
23950
- })
24019
+ headers
23951
24020
  });
23952
24021
  if (response.status === 401 && response.headers.has("www-authenticate")) {
23953
24022
  this._resourceMetadataUrl = extractResourceMetadataUrl(response);
@@ -23985,7 +24054,7 @@ class SSEClientTransport {
23985
24054
  resolve();
23986
24055
  });
23987
24056
  this._eventSource.onmessage = (event) => {
23988
- var _a2, _b;
24057
+ var _a2, _b2;
23989
24058
  const messageEvent = event;
23990
24059
  let message;
23991
24060
  try {
@@ -23994,7 +24063,7 @@ class SSEClientTransport {
23994
24063
  (_a2 = this.onerror) === null || _a2 === void 0 ? void 0 : _a2.call(this, error);
23995
24064
  return;
23996
24065
  }
23997
- (_b = this.onmessage) === null || _b === void 0 ? void 0 : _b.call(this, message);
24066
+ (_b2 = this.onmessage) === null || _b2 === void 0 ? void 0 : _b2.call(this, message);
23998
24067
  };
23999
24068
  });
24000
24069
  }
@@ -24023,13 +24092,12 @@ class SSEClientTransport {
24023
24092
  (_c = this.onclose) === null || _c === void 0 ? void 0 : _c.call(this);
24024
24093
  }
24025
24094
  async send(message) {
24026
- var _a, _b;
24095
+ var _a, _b, _c;
24027
24096
  if (!this._endpoint) {
24028
24097
  throw new Error("Not connected");
24029
24098
  }
24030
24099
  try {
24031
- const commonHeaders = await this._commonHeaders();
24032
- const headers = new Headers(commonHeaders);
24100
+ const headers = await this._commonHeaders();
24033
24101
  headers.set("content-type", "application/json");
24034
24102
  const init = {
24035
24103
  ...this._requestInit,
@@ -24038,7 +24106,7 @@ class SSEClientTransport {
24038
24106
  body: JSON.stringify(message),
24039
24107
  signal: (_a = this._abortController) === null || _a === void 0 ? void 0 : _a.signal
24040
24108
  };
24041
- const response = await fetch(this._endpoint, init);
24109
+ const response = await ((_b = this._fetch) !== null && _b !== void 0 ? _b : fetch)(this._endpoint, init);
24042
24110
  if (!response.ok) {
24043
24111
  if (response.status === 401 && this._authProvider) {
24044
24112
  this._resourceMetadataUrl = extractResourceMetadataUrl(response);
@@ -24052,7 +24120,7 @@ class SSEClientTransport {
24052
24120
  throw new Error(`Error POSTing to endpoint (HTTP ${response.status}): ${text}`);
24053
24121
  }
24054
24122
  } catch (error) {
24055
- (_b = this.onerror) === null || _b === void 0 ? void 0 : _b.call(this, error);
24123
+ (_c = this.onerror) === null || _c === void 0 ? void 0 : _c.call(this, error);
24056
24124
  throw error;
24057
24125
  }
24058
24126
  }
@@ -24101,6 +24169,7 @@ class StreamableHTTPClientTransport {
24101
24169
  this._resourceMetadataUrl = void 0;
24102
24170
  this._requestInit = opts === null || opts === void 0 ? void 0 : opts.requestInit;
24103
24171
  this._authProvider = opts === null || opts === void 0 ? void 0 : opts.authProvider;
24172
+ this._fetch = opts === null || opts === void 0 ? void 0 : opts.fetch;
24104
24173
  this._sessionId = opts === null || opts === void 0 ? void 0 : opts.sessionId;
24105
24174
  this._reconnectionOptions = (_a = opts === null || opts === void 0 ? void 0 : opts.reconnectionOptions) !== null && _a !== void 0 ? _a : DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS;
24106
24175
  }
@@ -24136,10 +24205,14 @@ class StreamableHTTPClientTransport {
24136
24205
  if (this._protocolVersion) {
24137
24206
  headers["mcp-protocol-version"] = this._protocolVersion;
24138
24207
  }
24139
- return new Headers({ ...headers, ...(_a = this._requestInit) === null || _a === void 0 ? void 0 : _a.headers });
24208
+ const extraHeaders = this._normalizeHeaders((_a = this._requestInit) === null || _a === void 0 ? void 0 : _a.headers);
24209
+ return new Headers({
24210
+ ...headers,
24211
+ ...extraHeaders
24212
+ });
24140
24213
  }
24141
24214
  async _startOrAuthSse(options) {
24142
- var _a, _b;
24215
+ var _a, _b, _c;
24143
24216
  const { resumptionToken } = options;
24144
24217
  try {
24145
24218
  const headers = await this._commonHeaders();
@@ -24147,10 +24220,10 @@ class StreamableHTTPClientTransport {
24147
24220
  if (resumptionToken) {
24148
24221
  headers.set("last-event-id", resumptionToken);
24149
24222
  }
24150
- const response = await fetch(this._url, {
24223
+ const response = await ((_a = this._fetch) !== null && _a !== void 0 ? _a : fetch)(this._url, {
24151
24224
  method: "GET",
24152
24225
  headers,
24153
- signal: (_a = this._abortController) === null || _a === void 0 ? void 0 : _a.signal
24226
+ signal: (_b = this._abortController) === null || _b === void 0 ? void 0 : _b.signal
24154
24227
  });
24155
24228
  if (!response.ok) {
24156
24229
  if (response.status === 401 && this._authProvider) {
@@ -24163,7 +24236,7 @@ class StreamableHTTPClientTransport {
24163
24236
  }
24164
24237
  this._handleSseStream(response.body, options);
24165
24238
  } catch (error) {
24166
- (_b = this.onerror) === null || _b === void 0 ? void 0 : _b.call(this, error);
24239
+ (_c = this.onerror) === null || _c === void 0 ? void 0 : _c.call(this, error);
24167
24240
  throw error;
24168
24241
  }
24169
24242
  }
@@ -24179,6 +24252,17 @@ class StreamableHTTPClientTransport {
24179
24252
  const maxDelay = this._reconnectionOptions.maxReconnectionDelay;
24180
24253
  return Math.min(initialDelay * Math.pow(growFactor, attempt), maxDelay);
24181
24254
  }
24255
+ _normalizeHeaders(headers) {
24256
+ if (!headers)
24257
+ return {};
24258
+ if (headers instanceof Headers) {
24259
+ return Object.fromEntries(headers.entries());
24260
+ }
24261
+ if (Array.isArray(headers)) {
24262
+ return Object.fromEntries(headers);
24263
+ }
24264
+ return { ...headers };
24265
+ }
24182
24266
  /**
24183
24267
  * Schedule a reconnection attempt with exponential backoff
24184
24268
  *
@@ -24275,7 +24359,7 @@ class StreamableHTTPClientTransport {
24275
24359
  (_b = this.onclose) === null || _b === void 0 ? void 0 : _b.call(this);
24276
24360
  }
24277
24361
  async send(message, options) {
24278
- var _a, _b, _c;
24362
+ var _a, _b, _c, _d;
24279
24363
  try {
24280
24364
  const { resumptionToken, onresumptiontoken } = options || {};
24281
24365
  if (resumptionToken) {
@@ -24295,7 +24379,7 @@ class StreamableHTTPClientTransport {
24295
24379
  body: JSON.stringify(message),
24296
24380
  signal: (_a = this._abortController) === null || _a === void 0 ? void 0 : _a.signal
24297
24381
  };
24298
- const response = await fetch(this._url, init);
24382
+ const response = await ((_b = this._fetch) !== null && _b !== void 0 ? _b : fetch)(this._url, init);
24299
24383
  const sessionId = response.headers.get("mcp-session-id");
24300
24384
  if (sessionId) {
24301
24385
  this._sessionId = sessionId;
@@ -24331,14 +24415,14 @@ class StreamableHTTPClientTransport {
24331
24415
  const data2 = await response.json();
24332
24416
  const responseMessages = Array.isArray(data2) ? data2.map((msg) => JSONRPCMessageSchema.parse(msg)) : [JSONRPCMessageSchema.parse(data2)];
24333
24417
  for (const msg of responseMessages) {
24334
- (_b = this.onmessage) === null || _b === void 0 ? void 0 : _b.call(this, msg);
24418
+ (_c = this.onmessage) === null || _c === void 0 ? void 0 : _c.call(this, msg);
24335
24419
  }
24336
24420
  } else {
24337
24421
  throw new StreamableHTTPError(-1, `Unexpected content type: ${contentType}`);
24338
24422
  }
24339
24423
  }
24340
24424
  } catch (error) {
24341
- (_c = this.onerror) === null || _c === void 0 ? void 0 : _c.call(this, error);
24425
+ (_d = this.onerror) === null || _d === void 0 ? void 0 : _d.call(this, error);
24342
24426
  throw error;
24343
24427
  }
24344
24428
  }
@@ -24357,7 +24441,7 @@ class StreamableHTTPClientTransport {
24357
24441
  * the server does not allow clients to terminate sessions.
24358
24442
  */
24359
24443
  async terminateSession() {
24360
- var _a, _b;
24444
+ var _a, _b, _c;
24361
24445
  if (!this._sessionId) {
24362
24446
  return;
24363
24447
  }
@@ -24369,13 +24453,13 @@ class StreamableHTTPClientTransport {
24369
24453
  headers,
24370
24454
  signal: (_a = this._abortController) === null || _a === void 0 ? void 0 : _a.signal
24371
24455
  };
24372
- const response = await fetch(this._url, init);
24456
+ const response = await ((_b = this._fetch) !== null && _b !== void 0 ? _b : fetch)(this._url, init);
24373
24457
  if (!response.ok && response.status !== 405) {
24374
24458
  throw new StreamableHTTPError(response.status, `Failed to terminate session: ${response.statusText}`);
24375
24459
  }
24376
24460
  this._sessionId = void 0;
24377
24461
  } catch (error) {
24378
- (_b = this.onerror) === null || _b === void 0 ? void 0 : _b.call(this, error);
24462
+ (_c = this.onerror) === null || _c === void 0 ? void 0 : _c.call(this, error);
24379
24463
  throw error;
24380
24464
  }
24381
24465
  }
@@ -24395,16 +24479,26 @@ const StdErrNotificationSchema = NotificationSchema.extend({
24395
24479
  ClientNotificationSchema.or(
24396
24480
  StdErrNotificationSchema
24397
24481
  ).or(ServerNotificationSchema).or(NotificationSchema);
24398
- const version$1 = "0.15.0";
24482
+ const version$1 = "0.16.1";
24399
24483
  const packageJson = {
24400
24484
  version: version$1
24401
24485
  };
24486
+ const getSearchParam = (key) => {
24487
+ try {
24488
+ const url = new URL(window.location.href);
24489
+ return url.searchParams.get(key);
24490
+ } catch {
24491
+ return null;
24492
+ }
24493
+ };
24402
24494
  const getMCPProxyAddress = (config) => {
24403
- const proxyFullAddress = config.MCP_PROXY_FULL_ADDRESS.value;
24495
+ let proxyFullAddress = config.MCP_PROXY_FULL_ADDRESS.value;
24404
24496
  if (proxyFullAddress) {
24497
+ proxyFullAddress = proxyFullAddress.replace(/\/+$/, "");
24405
24498
  return proxyFullAddress;
24406
24499
  }
24407
- return `${window.location.protocol}//${window.location.hostname}:${DEFAULT_MCP_PROXY_LISTEN_PORT}`;
24500
+ const proxyPort = getSearchParam("MCP_PROXY_PORT") || DEFAULT_MCP_PROXY_LISTEN_PORT;
24501
+ return `${window.location.protocol}//${window.location.hostname}:${proxyPort}`;
24408
24502
  };
24409
24503
  const getMCPServerRequestTimeout = (config) => {
24410
24504
  return config.MCP_SERVER_REQUEST_TIMEOUT.value;
@@ -24421,14 +24515,6 @@ const getMCPProxyAuthToken = (config) => {
24421
24515
  header: "X-MCP-Proxy-Auth"
24422
24516
  };
24423
24517
  };
24424
- const getSearchParam = (key) => {
24425
- try {
24426
- const url = new URL(window.location.href);
24427
- return url.searchParams.get(key);
24428
- } catch {
24429
- return null;
24430
- }
24431
- };
24432
24518
  const getInitialTransportType = () => {
24433
24519
  const param = getSearchParam("transport");
24434
24520
  if (param === "stdio" || param === "sse" || param === "streamable-http") {
@@ -26864,7 +26950,9 @@ const HistoryAndNotifications = ({
26864
26950
  "div",
26865
26951
  {
26866
26952
  className: "flex justify-between items-center cursor-pointer",
26867
- onClick: () => toggleNotificationExpansion(index2),
26953
+ onClick: () => toggleNotificationExpansion(
26954
+ serverNotifications.length - 1 - index2
26955
+ ),
26868
26956
  children: [
26869
26957
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-mono", children: [
26870
26958
  serverNotifications.length - index2,
@@ -26872,11 +26960,11 @@ const HistoryAndNotifications = ({
26872
26960
  " ",
26873
26961
  notification.method
26874
26962
  ] }),
26875
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: expandedNotifications[index2] ? "▼" : "▶" })
26963
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: expandedNotifications[serverNotifications.length - 1 - index2] ? "▼" : "▶" })
26876
26964
  ]
26877
26965
  }
26878
26966
  ),
26879
- expandedNotifications[index2] && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2", children: [
26967
+ expandedNotifications[serverNotifications.length - 1 - index2] && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2", children: [
26880
26968
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between items-center mb-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-semibold text-purple-600", children: "Details:" }) }),
26881
26969
  /* @__PURE__ */ jsxRuntimeExports.jsx(
26882
26970
  JsonView,
@@ -31455,9 +31543,9 @@ const PromptsTab = ({
31455
31543
  setSelectedPrompt(prompt);
31456
31544
  setPromptArgs({});
31457
31545
  },
31458
- renderItem: (prompt) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
31546
+ renderItem: (prompt) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-start", children: [
31459
31547
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex-1", children: prompt.name }),
31460
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-500", children: prompt.description })
31548
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-500 text-left", children: prompt.description })
31461
31549
  ] }),
31462
31550
  title: "Prompts",
31463
31551
  buttonText: nextCursor ? "List More Prompts" : "List Prompts",
@@ -33916,10 +34004,37 @@ const JsonEditor = ({
33916
34004
  const isSimpleObject = (schema) => {
33917
34005
  const supportedTypes = ["string", "number", "integer", "boolean", "null"];
33918
34006
  if (supportedTypes.includes(schema.type)) return true;
33919
- if (schema.type !== "object") return false;
33920
- return Object.values(schema.properties ?? {}).every(
33921
- (prop) => supportedTypes.includes(prop.type)
33922
- );
34007
+ if (schema.type === "object") {
34008
+ return Object.values(schema.properties ?? {}).every(
34009
+ (prop) => supportedTypes.includes(prop.type)
34010
+ );
34011
+ }
34012
+ if (schema.type === "array") {
34013
+ return !!schema.items && isSimpleObject(schema.items);
34014
+ }
34015
+ return false;
34016
+ };
34017
+ const getArrayItemDefault = (schema) => {
34018
+ if ("default" in schema && schema.default !== void 0) {
34019
+ return schema.default;
34020
+ }
34021
+ switch (schema.type) {
34022
+ case "string":
34023
+ return "";
34024
+ case "number":
34025
+ case "integer":
34026
+ return 0;
34027
+ case "boolean":
34028
+ return false;
34029
+ case "array":
34030
+ return [];
34031
+ case "object":
34032
+ return {};
34033
+ case "null":
34034
+ return null;
34035
+ default:
34036
+ return null;
34037
+ }
33923
34038
  };
33924
34039
  const DynamicJsonForm = ({
33925
34040
  schema,
@@ -33930,6 +34045,8 @@ const DynamicJsonForm = ({
33930
34045
  const isOnlyJSON = !isSimpleObject(schema);
33931
34046
  const [isJsonMode, setIsJsonMode] = reactExports.useState(isOnlyJSON);
33932
34047
  const [jsonError, setJsonError] = reactExports.useState();
34048
+ const [copiedJson, setCopiedJson] = reactExports.useState(false);
34049
+ const { toast: toast2 } = useToast();
33933
34050
  const [rawJsonValue, setRawJsonValue] = reactExports.useState(
33934
34051
  JSON.stringify(value ?? generateDefaultValue(schema), null, 2)
33935
34052
  );
@@ -33987,13 +34104,14 @@ const DynamicJsonForm = ({
33987
34104
  setJsonError(err instanceof Error ? err.message : "Invalid JSON");
33988
34105
  }
33989
34106
  };
33990
- const renderFormFields = (propSchema, currentValue, path = [], depth = 0) => {
34107
+ const renderFormFields = (propSchema, currentValue, path = [], depth = 0, parentSchema, propertyName) => {
34108
+ var _a, _b, _c;
33991
34109
  if (depth >= maxDepth && (propSchema.type === "object" || propSchema.type === "array")) {
33992
34110
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
33993
34111
  JsonEditor,
33994
34112
  {
33995
34113
  value: JSON.stringify(
33996
- currentValue ?? generateDefaultValue(propSchema),
34114
+ currentValue ?? generateDefaultValue(propSchema, propertyName, parentSchema),
33997
34115
  null,
33998
34116
  2
33999
34117
  ),
@@ -34010,6 +34128,7 @@ const DynamicJsonForm = ({
34010
34128
  }
34011
34129
  );
34012
34130
  }
34131
+ const isRequired = ((_a = parentSchema == null ? void 0 : parentSchema.required) == null ? void 0 : _a.includes(propertyName || "")) ?? false;
34013
34132
  switch (propSchema.type) {
34014
34133
  case "string":
34015
34134
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -34019,14 +34138,10 @@ const DynamicJsonForm = ({
34019
34138
  value: currentValue ?? "",
34020
34139
  onChange: (e) => {
34021
34140
  const val = e.target.value;
34022
- if (!val && !propSchema.required) {
34023
- handleFieldChange(path, void 0);
34024
- } else {
34025
- handleFieldChange(path, val);
34026
- }
34141
+ handleFieldChange(path, val);
34027
34142
  },
34028
34143
  placeholder: propSchema.description,
34029
- required: propSchema.required
34144
+ required: isRequired
34030
34145
  }
34031
34146
  );
34032
34147
  case "number":
@@ -34037,7 +34152,7 @@ const DynamicJsonForm = ({
34037
34152
  value: (currentValue == null ? void 0 : currentValue.toString()) ?? "",
34038
34153
  onChange: (e) => {
34039
34154
  const val = e.target.value;
34040
- if (!val && !propSchema.required) {
34155
+ if (!val && !isRequired) {
34041
34156
  handleFieldChange(path, void 0);
34042
34157
  } else {
34043
34158
  const num = Number(val);
@@ -34047,7 +34162,7 @@ const DynamicJsonForm = ({
34047
34162
  }
34048
34163
  },
34049
34164
  placeholder: propSchema.description,
34050
- required: propSchema.required
34165
+ required: isRequired
34051
34166
  }
34052
34167
  );
34053
34168
  case "integer":
@@ -34059,7 +34174,7 @@ const DynamicJsonForm = ({
34059
34174
  value: (currentValue == null ? void 0 : currentValue.toString()) ?? "",
34060
34175
  onChange: (e) => {
34061
34176
  const val = e.target.value;
34062
- if (!val && !propSchema.required) {
34177
+ if (!val && !isRequired) {
34063
34178
  handleFieldChange(path, void 0);
34064
34179
  } else {
34065
34180
  const num = Number(val);
@@ -34069,7 +34184,7 @@ const DynamicJsonForm = ({
34069
34184
  }
34070
34185
  },
34071
34186
  placeholder: propSchema.description,
34072
- required: propSchema.required
34187
+ required: isRequired
34073
34188
  }
34074
34189
  );
34075
34190
  case "boolean":
@@ -34080,9 +34195,116 @@ const DynamicJsonForm = ({
34080
34195
  checked: currentValue ?? false,
34081
34196
  onChange: (e) => handleFieldChange(path, e.target.checked),
34082
34197
  className: "w-4 h-4",
34083
- required: propSchema.required
34198
+ required: isRequired
34084
34199
  }
34085
34200
  );
34201
+ case "object":
34202
+ if (!propSchema.properties) {
34203
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
34204
+ JsonEditor,
34205
+ {
34206
+ value: JSON.stringify(currentValue ?? {}, null, 2),
34207
+ onChange: (newValue) => {
34208
+ try {
34209
+ const parsed = JSON.parse(newValue);
34210
+ handleFieldChange(path, parsed);
34211
+ setJsonError(void 0);
34212
+ } catch (err) {
34213
+ setJsonError(
34214
+ err instanceof Error ? err.message : "Invalid JSON"
34215
+ );
34216
+ }
34217
+ },
34218
+ error: jsonError
34219
+ }
34220
+ );
34221
+ }
34222
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2 border rounded p-3", children: Object.entries(propSchema.properties).map(([key, subSchema]) => {
34223
+ var _a2;
34224
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
34225
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-sm font-medium mb-1", children: [
34226
+ key,
34227
+ ((_a2 = propSchema.required) == null ? void 0 : _a2.includes(key)) && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" })
34228
+ ] }),
34229
+ renderFormFields(
34230
+ subSchema,
34231
+ currentValue == null ? void 0 : currentValue[key],
34232
+ [...path, key],
34233
+ depth + 1,
34234
+ propSchema,
34235
+ key
34236
+ )
34237
+ ] }, key);
34238
+ }) });
34239
+ case "array": {
34240
+ const arrayValue = Array.isArray(currentValue) ? currentValue : [];
34241
+ if (!propSchema.items) return null;
34242
+ if (isSimpleObject(propSchema.items)) {
34243
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
34244
+ propSchema.description && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-600", children: propSchema.description }),
34245
+ ((_b = propSchema.items) == null ? void 0 : _b.description) && /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-sm text-gray-500", children: [
34246
+ "Items: ",
34247
+ propSchema.items.description
34248
+ ] }),
34249
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
34250
+ arrayValue.map((item, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
34251
+ renderFormFields(
34252
+ propSchema.items,
34253
+ item,
34254
+ [...path, index2.toString()],
34255
+ depth + 1
34256
+ ),
34257
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
34258
+ Button,
34259
+ {
34260
+ variant: "outline",
34261
+ size: "sm",
34262
+ onClick: () => {
34263
+ const newArray = [...arrayValue];
34264
+ newArray.splice(index2, 1);
34265
+ handleFieldChange(path, newArray);
34266
+ },
34267
+ children: "Remove"
34268
+ }
34269
+ )
34270
+ ] }, index2)),
34271
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
34272
+ Button,
34273
+ {
34274
+ variant: "outline",
34275
+ size: "sm",
34276
+ onClick: () => {
34277
+ const defaultValue = getArrayItemDefault(
34278
+ propSchema.items
34279
+ );
34280
+ handleFieldChange(path, [...arrayValue, defaultValue]);
34281
+ },
34282
+ title: ((_c = propSchema.items) == null ? void 0 : _c.description) ? `Add new ${propSchema.items.description}` : "Add new item",
34283
+ children: "Add Item"
34284
+ }
34285
+ )
34286
+ ] })
34287
+ ] });
34288
+ }
34289
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
34290
+ JsonEditor,
34291
+ {
34292
+ value: JSON.stringify(currentValue ?? [], null, 2),
34293
+ onChange: (newValue) => {
34294
+ try {
34295
+ const parsed = JSON.parse(newValue);
34296
+ handleFieldChange(path, parsed);
34297
+ setJsonError(void 0);
34298
+ } catch (err) {
34299
+ setJsonError(
34300
+ err instanceof Error ? err.message : "Invalid JSON"
34301
+ );
34302
+ }
34303
+ },
34304
+ error: jsonError
34305
+ }
34306
+ );
34307
+ }
34086
34308
  default:
34087
34309
  return null;
34088
34310
  }
@@ -34106,18 +34328,57 @@ const DynamicJsonForm = ({
34106
34328
  setIsJsonMode(true);
34107
34329
  }
34108
34330
  }, [shouldUseJsonMode, isJsonMode]);
34331
+ const handleCopyJson = reactExports.useCallback(() => {
34332
+ const copyToClipboard = async () => {
34333
+ try {
34334
+ await navigator.clipboard.writeText(
34335
+ JSON.stringify(value, null, 2) ?? "[]"
34336
+ );
34337
+ setCopiedJson(true);
34338
+ toast2({
34339
+ title: "JSON copied",
34340
+ description: "The JSON data has been successfully copied to your clipboard."
34341
+ });
34342
+ setTimeout(() => {
34343
+ setCopiedJson(false);
34344
+ }, 2e3);
34345
+ } catch (error) {
34346
+ toast2({
34347
+ title: "Error",
34348
+ description: `Failed to copy JSON: ${error instanceof Error ? error.message : String(error)}`,
34349
+ variant: "destructive"
34350
+ });
34351
+ }
34352
+ };
34353
+ copyToClipboard();
34354
+ }, [toast2, value]);
34109
34355
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
34110
34356
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-end space-x-2", children: [
34111
- isJsonMode && /* @__PURE__ */ jsxRuntimeExports.jsx(
34112
- Button,
34113
- {
34114
- type: "button",
34115
- variant: "outline",
34116
- size: "sm",
34117
- onClick: formatJson,
34118
- children: "Format JSON"
34119
- }
34120
- ),
34357
+ isJsonMode && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
34358
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
34359
+ Button,
34360
+ {
34361
+ type: "button",
34362
+ variant: "outline",
34363
+ size: "sm",
34364
+ onClick: handleCopyJson,
34365
+ children: [
34366
+ copiedJson ? /* @__PURE__ */ jsxRuntimeExports.jsx(CheckCheck, { className: "h-4 w-4 mr-2" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Copy, { className: "h-4 w-4 mr-2" }),
34367
+ "Copy JSON"
34368
+ ]
34369
+ }
34370
+ ),
34371
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
34372
+ Button,
34373
+ {
34374
+ type: "button",
34375
+ variant: "outline",
34376
+ size: "sm",
34377
+ onClick: formatJson,
34378
+ children: "Format JSON"
34379
+ }
34380
+ )
34381
+ ] }),
34121
34382
  !isOnlyJSON && /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "outline", size: "sm", onClick: handleSwitchToFormMode, children: isJsonMode ? "Switch to Form" : "Switch to JSON" })
34122
34383
  ] }),
34123
34384
  isJsonMode ? /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -35595,7 +35856,7 @@ const useTheme = () => {
35595
35856
  [theme, setThemeWithSideEffect]
35596
35857
  );
35597
35858
  };
35598
- const version = "0.15.0";
35859
+ const version = "0.16.1";
35599
35860
  var [createTooltipContext, createTooltipScope] = createContextScope("Tooltip", [
35600
35861
  createPopperScope
35601
35862
  ]);
@@ -37204,7 +37465,11 @@ const ToolsTab = ({
37204
37465
  (selectedTool == null ? void 0 : selectedTool.inputSchema.properties) ?? []
37205
37466
  ).map(([key, value]) => [
37206
37467
  key,
37207
- generateDefaultValue(value)
37468
+ generateDefaultValue(
37469
+ value,
37470
+ key,
37471
+ selectedTool == null ? void 0 : selectedTool.inputSchema
37472
+ )
37208
37473
  ]);
37209
37474
  setParams(Object.fromEntries(params2));
37210
37475
  }, [selectedTool]);
@@ -37235,13 +37500,18 @@ const ToolsTab = ({
37235
37500
  Object.entries(selectedTool.inputSchema.properties ?? []).map(
37236
37501
  ([key, value]) => {
37237
37502
  const prop = value;
37503
+ const inputSchema = selectedTool.inputSchema;
37504
+ const required2 = isPropertyRequired(key, inputSchema);
37238
37505
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
37239
- /* @__PURE__ */ jsxRuntimeExports.jsx(
37506
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
37240
37507
  Label$1,
37241
37508
  {
37242
37509
  htmlFor: key,
37243
37510
  className: "block text-sm font-medium text-gray-700 dark:text-gray-300",
37244
- children: key
37511
+ children: [
37512
+ key,
37513
+ required2 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" })
37514
+ ]
37245
37515
  }
37246
37516
  ),
37247
37517
  prop.type === "boolean" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-2 mt-2", children: [
@@ -37303,10 +37573,13 @@ const ToolsTab = ({
37303
37573
  name: key,
37304
37574
  placeholder: prop.description,
37305
37575
  value: params[key] ?? "",
37306
- onChange: (e) => setParams({
37307
- ...params,
37308
- [key]: Number(e.target.value)
37309
- }),
37576
+ onChange: (e) => {
37577
+ const value2 = e.target.value;
37578
+ setParams({
37579
+ ...params,
37580
+ [key]: value2 === "" ? "" : Number(value2)
37581
+ });
37582
+ },
37310
37583
  className: "mt-1"
37311
37584
  }
37312
37585
  ) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -37816,13 +38089,13 @@ const App = () => {
37816
38089
  ) });
37817
38090
  if (window.location.pathname === "/oauth/callback") {
37818
38091
  const OAuthCallback = React.lazy(
37819
- () => __vitePreload(() => import("./OAuthCallback-CaW3Hcqw.js"), true ? __vite__mapDeps([0,1]) : void 0)
38092
+ () => __vitePreload(() => import("./OAuthCallback-CaDIOg8Q.js"), true ? __vite__mapDeps([0,1]) : void 0)
37820
38093
  );
37821
38094
  return /* @__PURE__ */ jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(OAuthCallback, { onConnect: onOAuthConnect }) });
37822
38095
  }
37823
38096
  if (window.location.pathname === "/oauth/callback/debug") {
37824
38097
  const OAuthDebugCallback = React.lazy(
37825
- () => __vitePreload(() => import("./OAuthDebugCallback-DiBt_oxh.js"), true ? __vite__mapDeps([2,1]) : void 0)
38098
+ () => __vitePreload(() => import("./OAuthDebugCallback-Ccjj44Wa.js"), true ? __vite__mapDeps([2,1]) : void 0)
37826
38099
  );
37827
38100
  return /* @__PURE__ */ jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(OAuthDebugCallback, { onConnect: onOAuthDebugConnect }) });
37828
38101
  }