@sisense/mcp-server 0.2.8 → 0.2.9

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.
@@ -17,9 +17,9 @@ import {
17
17
  } from "./index-bgbnagw5.js";
18
18
  import"./index-6vz3bc2n.js";
19
19
  import {
20
- Kn
21
- } from "./sse-server-tg36wntb.js";
22
- import"./sse-server-xfrv5734.js";
20
+ ni
21
+ } from "./sse-server-f7drtvty.js";
22
+ import"./sse-server-r50cemee.js";
23
23
  import"./sse-server-gcjj2741.js";
24
24
  import"./sse-server-wb2h6nz7.js";
25
25
  import"./sse-server-zmcz2c17.js";
@@ -522,17 +522,17 @@ var require_codegen = __commonJS((exports) => {
522
522
  this.nodes = nodes;
523
523
  }
524
524
  render(opts) {
525
- return this.nodes.reduce((code, n) => code + n.render(opts), "");
525
+ return this.nodes.reduce((code, n2) => code + n2.render(opts), "");
526
526
  }
527
527
  optimizeNodes() {
528
528
  const { nodes } = this;
529
529
  let i2 = nodes.length;
530
530
  while (i2--) {
531
- const n = nodes[i2].optimizeNodes();
532
- if (Array.isArray(n))
533
- nodes.splice(i2, 1, ...n);
534
- else if (n)
535
- nodes[i2] = n;
531
+ const n2 = nodes[i2].optimizeNodes();
532
+ if (Array.isArray(n2))
533
+ nodes.splice(i2, 1, ...n2);
534
+ else if (n2)
535
+ nodes[i2] = n2;
536
536
  else
537
537
  nodes.splice(i2, 1);
538
538
  }
@@ -542,16 +542,16 @@ var require_codegen = __commonJS((exports) => {
542
542
  const { nodes } = this;
543
543
  let i2 = nodes.length;
544
544
  while (i2--) {
545
- const n = nodes[i2];
546
- if (n.optimizeNames(names, constants))
545
+ const n2 = nodes[i2];
546
+ if (n2.optimizeNames(names, constants))
547
547
  continue;
548
- subtractNames(names, n.names);
548
+ subtractNames(names, n2.names);
549
549
  nodes.splice(i2, 1);
550
550
  }
551
551
  return nodes.length > 0 ? this : undefined;
552
552
  }
553
553
  get names() {
554
- return this.nodes.reduce((names, n) => addNames(names, n.names), {});
554
+ return this.nodes.reduce((names, n2) => addNames(names, n2.names), {});
555
555
  }
556
556
  }
557
557
 
@@ -946,8 +946,8 @@ var require_codegen = __commonJS((exports) => {
946
946
  endFunc() {
947
947
  return this._endBlockNode(Func);
948
948
  }
949
- optimize(n = 1) {
950
- while (n-- > 0) {
949
+ optimize(n2 = 1) {
950
+ while (n2-- > 0) {
951
951
  this._root.optimizeNodes();
952
952
  this._root.optimizeNames(this._root.names, this._constants);
953
953
  }
@@ -961,19 +961,19 @@ var require_codegen = __commonJS((exports) => {
961
961
  this._nodes.push(node);
962
962
  }
963
963
  _endBlockNode(N1, N2) {
964
- const n = this._currNode;
965
- if (n instanceof N1 || N2 && n instanceof N2) {
964
+ const n2 = this._currNode;
965
+ if (n2 instanceof N1 || N2 && n2 instanceof N2) {
966
966
  this._nodes.pop();
967
967
  return this;
968
968
  }
969
969
  throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`);
970
970
  }
971
971
  _elseNode(node) {
972
- const n = this._currNode;
973
- if (!(n instanceof If)) {
972
+ const n2 = this._currNode;
973
+ if (!(n2 instanceof If)) {
974
974
  throw new Error('CodeGen: "else" without "if"');
975
975
  }
976
- this._currNode = n.else = node;
976
+ this._currNode = n2.else = node;
977
977
  return this;
978
978
  }
979
979
  get _root() {
@@ -990,8 +990,8 @@ var require_codegen = __commonJS((exports) => {
990
990
  }
991
991
  exports.CodeGen = CodeGen;
992
992
  function addNames(names, from) {
993
- for (const n in from)
994
- names[n] = (names[n] || 0) + (from[n] || 0);
993
+ for (const n2 in from)
994
+ names[n2] = (names[n2] || 0) + (from[n2] || 0);
995
995
  return names;
996
996
  }
997
997
  function addExprNames(names, from) {
@@ -1011,11 +1011,11 @@ var require_codegen = __commonJS((exports) => {
1011
1011
  items.push(c);
1012
1012
  return items;
1013
1013
  }, []));
1014
- function replaceName(n) {
1015
- const c = constants[n.str];
1016
- if (c === undefined || names[n.str] !== 1)
1017
- return n;
1018
- delete names[n.str];
1014
+ function replaceName(n2) {
1015
+ const c = constants[n2.str];
1016
+ if (c === undefined || names[n2.str] !== 1)
1017
+ return n2;
1018
+ delete names[n2.str];
1019
1019
  return c;
1020
1020
  }
1021
1021
  function canOptimize(e2) {
@@ -1023,8 +1023,8 @@ var require_codegen = __commonJS((exports) => {
1023
1023
  }
1024
1024
  }
1025
1025
  function subtractNames(names, from) {
1026
- for (const n in from)
1027
- names[n] = (names[n] || 0) - (from[n] || 0);
1026
+ for (const n2 in from)
1027
+ names[n2] = (names[n2] || 0) - (from[n2] || 0);
1028
1028
  }
1029
1029
  function not(x) {
1030
1030
  return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._)`!${par(x)}`;
@@ -6886,17 +6886,17 @@ var require_codegen2 = __commonJS((exports) => {
6886
6886
  this.nodes = nodes;
6887
6887
  }
6888
6888
  render(opts) {
6889
- return this.nodes.reduce((code, n) => code + n.render(opts), "");
6889
+ return this.nodes.reduce((code, n2) => code + n2.render(opts), "");
6890
6890
  }
6891
6891
  optimizeNodes() {
6892
6892
  const { nodes } = this;
6893
6893
  let i2 = nodes.length;
6894
6894
  while (i2--) {
6895
- const n = nodes[i2].optimizeNodes();
6896
- if (Array.isArray(n))
6897
- nodes.splice(i2, 1, ...n);
6898
- else if (n)
6899
- nodes[i2] = n;
6895
+ const n2 = nodes[i2].optimizeNodes();
6896
+ if (Array.isArray(n2))
6897
+ nodes.splice(i2, 1, ...n2);
6898
+ else if (n2)
6899
+ nodes[i2] = n2;
6900
6900
  else
6901
6901
  nodes.splice(i2, 1);
6902
6902
  }
@@ -6906,16 +6906,16 @@ var require_codegen2 = __commonJS((exports) => {
6906
6906
  const { nodes } = this;
6907
6907
  let i2 = nodes.length;
6908
6908
  while (i2--) {
6909
- const n = nodes[i2];
6910
- if (n.optimizeNames(names, constants))
6909
+ const n2 = nodes[i2];
6910
+ if (n2.optimizeNames(names, constants))
6911
6911
  continue;
6912
- subtractNames(names, n.names);
6912
+ subtractNames(names, n2.names);
6913
6913
  nodes.splice(i2, 1);
6914
6914
  }
6915
6915
  return nodes.length > 0 ? this : undefined;
6916
6916
  }
6917
6917
  get names() {
6918
- return this.nodes.reduce((names, n) => addNames(names, n.names), {});
6918
+ return this.nodes.reduce((names, n2) => addNames(names, n2.names), {});
6919
6919
  }
6920
6920
  }
6921
6921
 
@@ -7310,8 +7310,8 @@ var require_codegen2 = __commonJS((exports) => {
7310
7310
  endFunc() {
7311
7311
  return this._endBlockNode(Func);
7312
7312
  }
7313
- optimize(n = 1) {
7314
- while (n-- > 0) {
7313
+ optimize(n2 = 1) {
7314
+ while (n2-- > 0) {
7315
7315
  this._root.optimizeNodes();
7316
7316
  this._root.optimizeNames(this._root.names, this._constants);
7317
7317
  }
@@ -7325,19 +7325,19 @@ var require_codegen2 = __commonJS((exports) => {
7325
7325
  this._nodes.push(node);
7326
7326
  }
7327
7327
  _endBlockNode(N1, N2) {
7328
- const n = this._currNode;
7329
- if (n instanceof N1 || N2 && n instanceof N2) {
7328
+ const n2 = this._currNode;
7329
+ if (n2 instanceof N1 || N2 && n2 instanceof N2) {
7330
7330
  this._nodes.pop();
7331
7331
  return this;
7332
7332
  }
7333
7333
  throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`);
7334
7334
  }
7335
7335
  _elseNode(node) {
7336
- const n = this._currNode;
7337
- if (!(n instanceof If)) {
7336
+ const n2 = this._currNode;
7337
+ if (!(n2 instanceof If)) {
7338
7338
  throw new Error('CodeGen: "else" without "if"');
7339
7339
  }
7340
- this._currNode = n.else = node;
7340
+ this._currNode = n2.else = node;
7341
7341
  return this;
7342
7342
  }
7343
7343
  get _root() {
@@ -7354,8 +7354,8 @@ var require_codegen2 = __commonJS((exports) => {
7354
7354
  }
7355
7355
  exports.CodeGen = CodeGen;
7356
7356
  function addNames(names, from) {
7357
- for (const n in from)
7358
- names[n] = (names[n] || 0) + (from[n] || 0);
7357
+ for (const n2 in from)
7358
+ names[n2] = (names[n2] || 0) + (from[n2] || 0);
7359
7359
  return names;
7360
7360
  }
7361
7361
  function addExprNames(names, from) {
@@ -7375,11 +7375,11 @@ var require_codegen2 = __commonJS((exports) => {
7375
7375
  items.push(c);
7376
7376
  return items;
7377
7377
  }, []));
7378
- function replaceName(n) {
7379
- const c = constants[n.str];
7380
- if (c === undefined || names[n.str] !== 1)
7381
- return n;
7382
- delete names[n.str];
7378
+ function replaceName(n2) {
7379
+ const c = constants[n2.str];
7380
+ if (c === undefined || names[n2.str] !== 1)
7381
+ return n2;
7382
+ delete names[n2.str];
7383
7383
  return c;
7384
7384
  }
7385
7385
  function canOptimize(e2) {
@@ -7387,8 +7387,8 @@ var require_codegen2 = __commonJS((exports) => {
7387
7387
  }
7388
7388
  }
7389
7389
  function subtractNames(names, from) {
7390
- for (const n in from)
7391
- names[n] = (names[n] || 0) - (from[n] || 0);
7390
+ for (const n2 in from)
7391
+ names[n2] = (names[n2] || 0) - (from[n2] || 0);
7392
7392
  }
7393
7393
  function not(x) {
7394
7394
  return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._)`!${par(x)}`;
@@ -23564,7 +23564,7 @@ var AssertObjectSchema = custom((v) => v !== null && (typeof v === "object" || t
23564
23564
  var ProgressTokenSchema = union([string2(), number2().int()]);
23565
23565
  var CursorSchema = string2();
23566
23566
  var TaskCreationParamsSchema = looseObject({
23567
- ttl: union([number2(), _null3()]).optional(),
23567
+ ttl: number2().optional(),
23568
23568
  pollInterval: number2().optional()
23569
23569
  });
23570
23570
  var TaskMetadataSchema = object({
@@ -23718,7 +23718,8 @@ var ClientCapabilitiesSchema = object({
23718
23718
  roots: object({
23719
23719
  listChanged: boolean2().optional()
23720
23720
  }).optional(),
23721
- tasks: ClientTasksCapabilitySchema.optional()
23721
+ tasks: ClientTasksCapabilitySchema.optional(),
23722
+ extensions: record(string2(), AssertObjectSchema).optional()
23722
23723
  });
23723
23724
  var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
23724
23725
  protocolVersion: string2(),
@@ -23744,7 +23745,8 @@ var ServerCapabilitiesSchema = object({
23744
23745
  tools: object({
23745
23746
  listChanged: boolean2().optional()
23746
23747
  }).optional(),
23747
- tasks: ServerTasksCapabilitySchema.optional()
23748
+ tasks: ServerTasksCapabilitySchema.optional(),
23749
+ extensions: record(string2(), AssertObjectSchema).optional()
23748
23750
  });
23749
23751
  var InitializeResultSchema = ResultSchema.extend({
23750
23752
  protocolVersion: string2(),
@@ -23859,6 +23861,7 @@ var ResourceSchema = object({
23859
23861
  uri: string2(),
23860
23862
  description: optional(string2()),
23861
23863
  mimeType: optional(string2()),
23864
+ size: optional(number2()),
23862
23865
  annotations: AnnotationsSchema.optional(),
23863
23866
  _meta: optional(looseObject({}))
23864
23867
  });
@@ -26859,6 +26862,10 @@ class Protocol {
26859
26862
  this._progressHandlers.clear();
26860
26863
  this._taskProgressTokens.clear();
26861
26864
  this._pendingDebouncedNotifications.clear();
26865
+ for (const info of this._timeoutInfo.values()) {
26866
+ clearTimeout(info.timeoutId);
26867
+ }
26868
+ this._timeoutInfo.clear();
26862
26869
  for (const controller of this._requestHandlerAbortControllers.values()) {
26863
26870
  controller.abort();
26864
26871
  }
@@ -26989,7 +26996,9 @@ class Protocol {
26989
26996
  await capturedTransport?.send(errorResponse);
26990
26997
  }
26991
26998
  }).catch((error40) => this._onerror(new Error(`Failed to send response: ${error40}`))).finally(() => {
26992
- this._requestHandlerAbortControllers.delete(request.id);
26999
+ if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
27000
+ this._requestHandlerAbortControllers.delete(request.id);
27001
+ }
26993
27002
  });
26994
27003
  }
26995
27004
  _onprogress(notification) {
@@ -27491,10 +27500,74 @@ function mergeCapabilities(base, additional) {
27491
27500
  }
27492
27501
 
27493
27502
  // node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.js
27503
+ class j extends Protocol {
27504
+ _registeredMethods = new Set;
27505
+ _eventSlots = new Map;
27506
+ onEventDispatch(Z, $) {}
27507
+ _ensureEventSlot(Z) {
27508
+ let $ = this._eventSlots.get(Z);
27509
+ if (!$) {
27510
+ let J = this.eventSchemas[Z];
27511
+ if (!J)
27512
+ throw Error(`Unknown event: ${String(Z)}`);
27513
+ $ = { listeners: [] }, this._eventSlots.set(Z, $);
27514
+ let X = J.shape.method.value;
27515
+ this._registeredMethods.add(X);
27516
+ let V = $;
27517
+ super.setNotificationHandler(J, (D) => {
27518
+ let G = D.params;
27519
+ this.onEventDispatch(Z, G), V.onHandler?.(G);
27520
+ for (let L of [...V.listeners])
27521
+ L(G);
27522
+ });
27523
+ }
27524
+ return $;
27525
+ }
27526
+ setEventHandler(Z, $) {
27527
+ let J = this._ensureEventSlot(Z);
27528
+ if (J.onHandler && $)
27529
+ console.warn(`[MCP Apps] on${String(Z)} handler replaced. Use addEventListener("${String(Z)}", …) to add multiple listeners without replacing.`);
27530
+ J.onHandler = $;
27531
+ }
27532
+ getEventHandler(Z) {
27533
+ return this._eventSlots.get(Z)?.onHandler;
27534
+ }
27535
+ addEventListener(Z, $) {
27536
+ this._ensureEventSlot(Z).listeners.push($);
27537
+ }
27538
+ removeEventListener(Z, $) {
27539
+ let J = this._eventSlots.get(Z);
27540
+ if (!J)
27541
+ return;
27542
+ let X = J.listeners.indexOf($);
27543
+ if (X !== -1)
27544
+ J.listeners.splice(X, 1);
27545
+ }
27546
+ setRequestHandler = (Z, $) => {
27547
+ this._assertMethodNotRegistered(Z, "setRequestHandler"), super.setRequestHandler(Z, $);
27548
+ };
27549
+ setNotificationHandler = (Z, $) => {
27550
+ this._assertMethodNotRegistered(Z, "setNotificationHandler"), super.setNotificationHandler(Z, $);
27551
+ };
27552
+ warnIfRequestHandlerReplaced(Z, $, J) {
27553
+ if ($ && J)
27554
+ console.warn(`[MCP Apps] ${Z} handler replaced. Previous handler will no longer be called.`);
27555
+ }
27556
+ replaceRequestHandler = (Z, $) => {
27557
+ let J = Z.shape.method.value;
27558
+ this._registeredMethods.add(J), super.setRequestHandler(Z, $);
27559
+ };
27560
+ _assertMethodNotRegistered(Z, $) {
27561
+ let J = Z.shape.method.value;
27562
+ if (this._registeredMethods.has(J))
27563
+ throw Error(`Handler for "${J}" already registered (via ${$}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);
27564
+ this._registeredMethods.add(J);
27565
+ }
27566
+ }
27494
27567
  var F = "2026-01-26";
27495
27568
  var z = "ui/notifications/tool-input-partial";
27496
27569
 
27497
- class j {
27570
+ class B {
27498
27571
  eventTarget;
27499
27572
  eventSource;
27500
27573
  messageListener;
@@ -27532,10 +27605,10 @@ class j {
27532
27605
  sessionId;
27533
27606
  setProtocolVersion;
27534
27607
  }
27535
- var b = exports_external2.union([exports_external2.literal("light"), exports_external2.literal("dark")]).describe("Color theme preference for the host environment.");
27536
- var L = exports_external2.union([exports_external2.literal("inline"), exports_external2.literal("fullscreen"), exports_external2.literal("pip")]).describe("Display mode for UI presentation.");
27608
+ var S = exports_external2.union([exports_external2.literal("light"), exports_external2.literal("dark")]).describe("Color theme preference for the host environment.");
27609
+ var W = exports_external2.union([exports_external2.literal("inline"), exports_external2.literal("fullscreen"), exports_external2.literal("pip")]).describe("Display mode for UI presentation.");
27537
27610
  var i = exports_external2.union([exports_external2.literal("--color-background-primary"), exports_external2.literal("--color-background-secondary"), exports_external2.literal("--color-background-tertiary"), exports_external2.literal("--color-background-inverse"), exports_external2.literal("--color-background-ghost"), exports_external2.literal("--color-background-info"), exports_external2.literal("--color-background-danger"), exports_external2.literal("--color-background-success"), exports_external2.literal("--color-background-warning"), exports_external2.literal("--color-background-disabled"), exports_external2.literal("--color-text-primary"), exports_external2.literal("--color-text-secondary"), exports_external2.literal("--color-text-tertiary"), exports_external2.literal("--color-text-inverse"), exports_external2.literal("--color-text-ghost"), exports_external2.literal("--color-text-info"), exports_external2.literal("--color-text-danger"), exports_external2.literal("--color-text-success"), exports_external2.literal("--color-text-warning"), exports_external2.literal("--color-text-disabled"), exports_external2.literal("--color-border-primary"), exports_external2.literal("--color-border-secondary"), exports_external2.literal("--color-border-tertiary"), exports_external2.literal("--color-border-inverse"), exports_external2.literal("--color-border-ghost"), exports_external2.literal("--color-border-info"), exports_external2.literal("--color-border-danger"), exports_external2.literal("--color-border-success"), exports_external2.literal("--color-border-warning"), exports_external2.literal("--color-border-disabled"), exports_external2.literal("--color-ring-primary"), exports_external2.literal("--color-ring-secondary"), exports_external2.literal("--color-ring-inverse"), exports_external2.literal("--color-ring-info"), exports_external2.literal("--color-ring-danger"), exports_external2.literal("--color-ring-success"), exports_external2.literal("--color-ring-warning"), exports_external2.literal("--font-sans"), exports_external2.literal("--font-mono"), exports_external2.literal("--font-weight-normal"), exports_external2.literal("--font-weight-medium"), exports_external2.literal("--font-weight-semibold"), exports_external2.literal("--font-weight-bold"), exports_external2.literal("--font-text-xs-size"), exports_external2.literal("--font-text-sm-size"), exports_external2.literal("--font-text-md-size"), exports_external2.literal("--font-text-lg-size"), exports_external2.literal("--font-heading-xs-size"), exports_external2.literal("--font-heading-sm-size"), exports_external2.literal("--font-heading-md-size"), exports_external2.literal("--font-heading-lg-size"), exports_external2.literal("--font-heading-xl-size"), exports_external2.literal("--font-heading-2xl-size"), exports_external2.literal("--font-heading-3xl-size"), exports_external2.literal("--font-text-xs-line-height"), exports_external2.literal("--font-text-sm-line-height"), exports_external2.literal("--font-text-md-line-height"), exports_external2.literal("--font-text-lg-line-height"), exports_external2.literal("--font-heading-xs-line-height"), exports_external2.literal("--font-heading-sm-line-height"), exports_external2.literal("--font-heading-md-line-height"), exports_external2.literal("--font-heading-lg-line-height"), exports_external2.literal("--font-heading-xl-line-height"), exports_external2.literal("--font-heading-2xl-line-height"), exports_external2.literal("--font-heading-3xl-line-height"), exports_external2.literal("--border-radius-xs"), exports_external2.literal("--border-radius-sm"), exports_external2.literal("--border-radius-md"), exports_external2.literal("--border-radius-lg"), exports_external2.literal("--border-radius-xl"), exports_external2.literal("--border-radius-full"), exports_external2.literal("--border-width-regular"), exports_external2.literal("--shadow-hairline"), exports_external2.literal("--shadow-sm"), exports_external2.literal("--shadow-md"), exports_external2.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming.");
27538
- var o = exports_external2.record(i.describe(`Style variables for theming MCP apps.
27611
+ var n = exports_external2.record(i.describe(`Style variables for theming MCP apps.
27539
27612
 
27540
27613
  Individual style keys are optional - hosts may provide any subset of these values.
27541
27614
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
@@ -27554,29 +27627,30 @@ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
27554
27627
 
27555
27628
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
27556
27629
  for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);
27557
- var a = exports_external2.object({ method: exports_external2.literal("ui/open-link"), params: exports_external2.object({ url: exports_external2.string().describe("URL to open in the host's browser") }) });
27630
+ var o = exports_external2.object({ method: exports_external2.literal("ui/open-link"), params: exports_external2.object({ url: exports_external2.string().describe("URL to open in the host's browser") }) });
27558
27631
  var O = exports_external2.object({ isError: exports_external2.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).") }).passthrough();
27559
27632
  var I = exports_external2.object({ isError: exports_external2.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).") }).passthrough();
27560
27633
  var w = exports_external2.object({ isError: exports_external2.boolean().optional().describe("True if the host rejected or failed to deliver the message.") }).passthrough();
27561
- var s = exports_external2.object({ method: exports_external2.literal("ui/notifications/sandbox-proxy-ready"), params: exports_external2.object({}) });
27562
- var B = exports_external2.object({ connectDomains: exports_external2.array(exports_external2.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
27634
+ var a = exports_external2.object({ method: exports_external2.literal("ui/notifications/sandbox-proxy-ready"), params: exports_external2.object({}) });
27635
+ var K = exports_external2.object({ connectDomains: exports_external2.array(exports_external2.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
27563
27636
 
27564
27637
  - Maps to CSP \`connect-src\` directive
27565
27638
  - Empty or omitted → no network connections (secure default)`), resourceDomains: exports_external2.array(exports_external2.string()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"), frameDomains: exports_external2.array(exports_external2.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"), baseUriDomains: exports_external2.array(exports_external2.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)") });
27566
- var K = exports_external2.object({ camera: exports_external2.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."), microphone: exports_external2.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."), geolocation: exports_external2.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."), clipboardWrite: exports_external2.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.") });
27567
- var t = exports_external2.object({ method: exports_external2.literal("ui/notifications/size-changed"), params: exports_external2.object({ width: exports_external2.number().optional().describe("New width in pixels."), height: exports_external2.number().optional().describe("New height in pixels.") }) });
27639
+ var N = exports_external2.object({ camera: exports_external2.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."), microphone: exports_external2.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."), geolocation: exports_external2.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."), clipboardWrite: exports_external2.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.") });
27640
+ var s = exports_external2.object({ method: exports_external2.literal("ui/notifications/size-changed"), params: exports_external2.object({ width: exports_external2.number().optional().describe("New width in pixels."), height: exports_external2.number().optional().describe("New height in pixels.") }) });
27568
27641
  var A = exports_external2.object({ method: exports_external2.literal("ui/notifications/tool-input"), params: exports_external2.object({ arguments: exports_external2.record(exports_external2.string(), exports_external2.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.") }) });
27569
27642
  var P = exports_external2.object({ method: exports_external2.literal("ui/notifications/tool-input-partial"), params: exports_external2.object({ arguments: exports_external2.record(exports_external2.string(), exports_external2.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).") }) });
27570
27643
  var H = exports_external2.object({ method: exports_external2.literal("ui/notifications/tool-cancelled"), params: exports_external2.object({ reason: exports_external2.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").') }) });
27571
- var g = exports_external2.object({ fonts: exports_external2.string().optional() });
27572
- var C = exports_external2.object({ variables: o.optional().describe("CSS variables for theming the app."), css: g.optional().describe("CSS blocks that apps can inject.") });
27644
+ var b = exports_external2.object({ fonts: exports_external2.string().optional() });
27645
+ var C = exports_external2.object({ variables: n.optional().describe("CSS variables for theming the app."), css: b.optional().describe("CSS blocks that apps can inject.") });
27573
27646
  var _ = exports_external2.object({ method: exports_external2.literal("ui/resource-teardown"), params: exports_external2.object({}) });
27574
- var e = exports_external2.record(exports_external2.string(), exports_external2.unknown());
27647
+ var t = exports_external2.record(exports_external2.string(), exports_external2.unknown());
27575
27648
  var q = exports_external2.object({ text: exports_external2.object({}).optional().describe("Host supports text content blocks."), image: exports_external2.object({}).optional().describe("Host supports image content blocks."), audio: exports_external2.object({}).optional().describe("Host supports audio content blocks."), resource: exports_external2.object({}).optional().describe("Host supports resource content blocks."), resourceLink: exports_external2.object({}).optional().describe("Host supports resource link content blocks."), structuredContent: exports_external2.object({}).optional().describe("Host supports structured content.") });
27576
- var y = exports_external2.object({ experimental: exports_external2.object({}).optional().describe("Experimental features (structure TBD)."), openLinks: exports_external2.object({}).optional().describe("Host supports opening external URLs."), downloadFile: exports_external2.object({}).optional().describe("Host supports file downloads via ui/download-file."), serverTools: exports_external2.object({ listChanged: exports_external2.boolean().optional().describe("Host supports tools/list_changed notifications.") }).optional().describe("Host can proxy tool calls to the MCP server."), serverResources: exports_external2.object({ listChanged: exports_external2.boolean().optional().describe("Host supports resources/list_changed notifications.") }).optional().describe("Host can proxy resource reads to the MCP server."), logging: exports_external2.object({}).optional().describe("Host accepts log messages."), sandbox: exports_external2.object({ permissions: K.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."), csp: B.optional().describe("CSP domains approved by the host.") }).optional().describe("Sandbox configuration applied by the host."), updateModelContext: q.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."), message: q.optional().describe("Host supports receiving content messages (ui/message) from the view.") });
27577
- var u = exports_external2.object({ experimental: exports_external2.object({}).optional().describe("Experimental features (structure TBD)."), tools: exports_external2.object({ listChanged: exports_external2.boolean().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."), availableDisplayModes: exports_external2.array(L).optional().describe("Display modes the app supports.") });
27649
+ var e = exports_external2.object({ method: exports_external2.literal("ui/notifications/request-teardown"), params: exports_external2.object({}).optional() });
27650
+ var y = exports_external2.object({ experimental: exports_external2.object({}).optional().describe("Experimental features (structure TBD)."), openLinks: exports_external2.object({}).optional().describe("Host supports opening external URLs."), downloadFile: exports_external2.object({}).optional().describe("Host supports file downloads via ui/download-file."), serverTools: exports_external2.object({ listChanged: exports_external2.boolean().optional().describe("Host supports tools/list_changed notifications.") }).optional().describe("Host can proxy tool calls to the MCP server."), serverResources: exports_external2.object({ listChanged: exports_external2.boolean().optional().describe("Host supports resources/list_changed notifications.") }).optional().describe("Host can proxy resource reads to the MCP server."), logging: exports_external2.object({}).optional().describe("Host accepts log messages."), sandbox: exports_external2.object({ permissions: N.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."), csp: K.optional().describe("CSP domains approved by the host.") }).optional().describe("Sandbox configuration applied by the host."), updateModelContext: q.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."), message: q.optional().describe("Host supports receiving content messages (ui/message) from the view.") });
27651
+ var v = exports_external2.object({ experimental: exports_external2.object({}).optional().describe("Experimental features (structure TBD)."), tools: exports_external2.object({ listChanged: exports_external2.boolean().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."), availableDisplayModes: exports_external2.array(W).optional().describe("Display modes the app supports.") });
27578
27652
  var QQ = exports_external2.object({ method: exports_external2.literal("ui/notifications/initialized"), params: exports_external2.object({}).optional() });
27579
- var ZQ = exports_external2.object({ csp: B.optional().describe("Content Security Policy configuration for UI resources."), permissions: K.optional().describe("Sandbox permissions requested by the UI resource."), domain: exports_external2.string().optional().describe(`Dedicated origin for view sandbox.
27653
+ var ZQ = exports_external2.object({ csp: K.optional().describe("Content Security Policy configuration for UI resources."), permissions: N.optional().describe("Sandbox permissions requested by the UI resource."), domain: exports_external2.string().optional().describe(`Dedicated origin for view sandbox.
27580
27654
 
27581
27655
  Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
27582
27656
 
@@ -27591,33 +27665,38 @@ Boolean requesting whether a visible border and background is provided by the ho
27591
27665
  - \`true\`: request visible border + background
27592
27666
  - \`false\`: request no visible border + background
27593
27667
  - omitted: host decides border`) });
27594
- var $Q = exports_external2.object({ method: exports_external2.literal("ui/request-display-mode"), params: exports_external2.object({ mode: L.describe("The display mode being requested.") }) });
27595
- var T = exports_external2.object({ mode: L.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough();
27668
+ var $Q = exports_external2.object({ method: exports_external2.literal("ui/request-display-mode"), params: exports_external2.object({ mode: W.describe("The display mode being requested.") }) });
27669
+ var T = exports_external2.object({ mode: W.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough();
27596
27670
  var f = exports_external2.union([exports_external2.literal("model"), exports_external2.literal("app")]).describe("Tool visibility scope - who can access the tool.");
27597
27671
  var JQ = exports_external2.object({ resourceUri: exports_external2.string().optional(), visibility: exports_external2.array(f).optional().describe(`Who can access this tool. Default: ["model", "app"]
27598
27672
  - "model": Tool visible to and callable by the agent
27599
27673
  - "app": Tool callable by the app from this server only`) });
27600
- var kQ = exports_external2.object({ mimeTypes: exports_external2.array(exports_external2.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.') });
27674
+ var UQ = exports_external2.object({ mimeTypes: exports_external2.array(exports_external2.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.') });
27601
27675
  var XQ = exports_external2.object({ method: exports_external2.literal("ui/download-file"), params: exports_external2.object({ contents: exports_external2.array(exports_external2.union([EmbeddedResourceSchema, ResourceLinkSchema])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.") }) });
27602
27676
  var VQ = exports_external2.object({ method: exports_external2.literal("ui/message"), params: exports_external2.object({ role: exports_external2.literal("user").describe('Message role, currently only "user" is supported.'), content: exports_external2.array(ContentBlockSchema).describe("Message content blocks (text, image, etc.).") }) });
27603
- var DQ = exports_external2.object({ method: exports_external2.literal("ui/notifications/sandbox-resource-ready"), params: exports_external2.object({ html: exports_external2.string().describe("HTML content to load into the inner iframe."), sandbox: exports_external2.string().optional().describe("Optional override for the inner iframe's sandbox attribute."), csp: B.optional().describe("CSP configuration from resource metadata."), permissions: K.optional().describe("Sandbox permissions from resource metadata.") }) });
27604
- var U = exports_external2.object({ method: exports_external2.literal("ui/notifications/tool-result"), params: CallToolResultSchema.describe("Standard MCP tool execution result.") });
27605
- var k = exports_external2.object({ toolInfo: exports_external2.object({ id: RequestIdSchema.optional().describe("JSON-RPC id of the tools/call request."), tool: ToolSchema.describe("Tool definition including name, inputSchema, etc.") }).optional().describe("Metadata of the tool call that instantiated this App."), theme: b.optional().describe("Current color theme preference."), styles: C.optional().describe("Style configuration for theming the app."), displayMode: L.optional().describe("How the UI is currently displayed."), availableDisplayModes: exports_external2.array(L).optional().describe("Display modes the host supports."), containerDimensions: exports_external2.union([exports_external2.object({ height: exports_external2.number().describe("Fixed container height in pixels.") }), exports_external2.object({ maxHeight: exports_external2.union([exports_external2.number(), exports_external2.undefined()]).optional().describe("Maximum container height in pixels.") })]).and(exports_external2.union([exports_external2.object({ width: exports_external2.number().describe("Fixed container width in pixels.") }), exports_external2.object({ maxWidth: exports_external2.union([exports_external2.number(), exports_external2.undefined()]).optional().describe("Maximum container width in pixels.") })])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
27677
+ var DQ = exports_external2.object({ method: exports_external2.literal("ui/notifications/sandbox-resource-ready"), params: exports_external2.object({ html: exports_external2.string().describe("HTML content to load into the inner iframe."), sandbox: exports_external2.string().optional().describe("Optional override for the inner iframe's sandbox attribute."), csp: K.optional().describe("CSP configuration from resource metadata."), permissions: N.optional().describe("Sandbox permissions from resource metadata.") }) });
27678
+ var R = exports_external2.object({ method: exports_external2.literal("ui/notifications/tool-result"), params: CallToolResultSchema.describe("Standard MCP tool execution result.") });
27679
+ var E = exports_external2.object({ toolInfo: exports_external2.object({ id: RequestIdSchema.optional().describe("JSON-RPC id of the tools/call request."), tool: ToolSchema.describe("Tool definition including name, inputSchema, etc.") }).optional().describe("Metadata of the tool call that instantiated this App."), theme: S.optional().describe("Current color theme preference."), styles: C.optional().describe("Style configuration for theming the app."), displayMode: W.optional().describe("How the UI is currently displayed."), availableDisplayModes: exports_external2.array(W).optional().describe("Display modes the host supports."), containerDimensions: exports_external2.union([exports_external2.object({ height: exports_external2.number().describe("Fixed container height in pixels.") }), exports_external2.object({ maxHeight: exports_external2.union([exports_external2.number(), exports_external2.undefined()]).optional().describe("Maximum container height in pixels.") })]).and(exports_external2.union([exports_external2.object({ width: exports_external2.number().describe("Fixed container width in pixels.") }), exports_external2.object({ maxWidth: exports_external2.union([exports_external2.number(), exports_external2.undefined()]).optional().describe("Maximum container width in pixels.") })])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
27606
27680
  container holding the app. Specify either width or maxWidth, and either height or maxHeight.`), locale: exports_external2.string().optional().describe("User's language and region preference in BCP 47 format."), timeZone: exports_external2.string().optional().describe("User's timezone in IANA format."), userAgent: exports_external2.string().optional().describe("Host application identifier."), platform: exports_external2.union([exports_external2.literal("web"), exports_external2.literal("desktop"), exports_external2.literal("mobile")]).optional().describe("Platform type for responsive design decisions."), deviceCapabilities: exports_external2.object({ touch: exports_external2.boolean().optional().describe("Whether the device supports touch input."), hover: exports_external2.boolean().optional().describe("Whether the device supports hover interactions.") }).optional().describe("Device input capabilities."), safeAreaInsets: exports_external2.object({ top: exports_external2.number().describe("Top safe area inset in pixels."), right: exports_external2.number().describe("Right safe area inset in pixels."), bottom: exports_external2.number().describe("Bottom safe area inset in pixels."), left: exports_external2.number().describe("Left safe area inset in pixels.") }).optional().describe("Mobile safe area boundaries in pixels.") }).passthrough();
27607
- var E = exports_external2.object({ method: exports_external2.literal("ui/notifications/host-context-changed"), params: k.describe("Partial context update containing only changed fields.") });
27608
- var LQ = exports_external2.object({ method: exports_external2.literal("ui/update-model-context"), params: exports_external2.object({ content: exports_external2.array(ContentBlockSchema).optional().describe("Context content blocks (text, image, etc.)."), structuredContent: exports_external2.record(exports_external2.string(), exports_external2.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.") }) });
27609
- var GQ = exports_external2.object({ method: exports_external2.literal("ui/initialize"), params: exports_external2.object({ appInfo: ImplementationSchema.describe("App identification (name and version)."), appCapabilities: u.describe("Features and capabilities this app provides."), protocolVersion: exports_external2.string().describe("Protocol version this app supports.") }) });
27610
- var R = exports_external2.object({ protocolVersion: exports_external2.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'), hostInfo: ImplementationSchema.describe("Host application identification and version."), hostCapabilities: y.describe("Features and capabilities provided by the host."), hostContext: k.describe("Rich context about the host environment.") }).passthrough();
27611
- var v = "ui/resourceUri";
27612
- var d = "text/html;profile=mcp-app";
27613
-
27614
- class qQ extends Protocol {
27681
+ var U = exports_external2.object({ method: exports_external2.literal("ui/notifications/host-context-changed"), params: E.describe("Partial context update containing only changed fields.") });
27682
+ var GQ = exports_external2.object({ method: exports_external2.literal("ui/update-model-context"), params: exports_external2.object({ content: exports_external2.array(ContentBlockSchema).optional().describe("Context content blocks (text, image, etc.)."), structuredContent: exports_external2.record(exports_external2.string(), exports_external2.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.") }) });
27683
+ var LQ = exports_external2.object({ method: exports_external2.literal("ui/initialize"), params: exports_external2.object({ appInfo: ImplementationSchema.describe("App identification (name and version)."), appCapabilities: v.describe("Features and capabilities this app provides."), protocolVersion: exports_external2.string().describe("Protocol version this app supports.") }) });
27684
+ var k = exports_external2.object({ protocolVersion: exports_external2.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'), hostInfo: ImplementationSchema.describe("Host application identification and version."), hostCapabilities: y.describe("Features and capabilities provided by the host."), hostContext: E.describe("Rich context about the host environment.") }).passthrough();
27685
+ var M = "ui/resourceUri";
27686
+ var u = "text/html;profile=mcp-app";
27687
+
27688
+ class zQ extends j {
27615
27689
  _appInfo;
27616
27690
  _capabilities;
27617
27691
  options;
27618
27692
  _hostCapabilities;
27619
27693
  _hostInfo;
27620
27694
  _hostContext;
27695
+ eventSchemas = { toolinput: A, toolinputpartial: P, toolresult: R, toolcancelled: H, hostcontextchanged: U };
27696
+ onEventDispatch(Z, $) {
27697
+ if (Z === "hostcontextchanged")
27698
+ this._hostContext = { ...this._hostContext, ...$ };
27699
+ }
27621
27700
  constructor(Z, $ = {}, J = { autoResize: true }) {
27622
27701
  super(J);
27623
27702
  this._appInfo = Z;
@@ -27625,7 +27704,7 @@ class qQ extends Protocol {
27625
27704
  this.options = J;
27626
27705
  this.setRequestHandler(PingRequestSchema, (X) => {
27627
27706
  return console.log("Received ping:", X.params), {};
27628
- }), this.onhostcontextchanged = () => {};
27707
+ }), this.setEventHandler("hostcontextchanged", undefined);
27629
27708
  }
27630
27709
  getHostCapabilities() {
27631
27710
  return this._hostCapabilities;
@@ -27636,31 +27715,68 @@ class qQ extends Protocol {
27636
27715
  getHostContext() {
27637
27716
  return this._hostContext;
27638
27717
  }
27718
+ get ontoolinput() {
27719
+ return this.getEventHandler("toolinput");
27720
+ }
27639
27721
  set ontoolinput(Z) {
27640
- this.setNotificationHandler(A, ($) => Z($.params));
27722
+ this.setEventHandler("toolinput", Z);
27723
+ }
27724
+ get ontoolinputpartial() {
27725
+ return this.getEventHandler("toolinputpartial");
27641
27726
  }
27642
27727
  set ontoolinputpartial(Z) {
27643
- this.setNotificationHandler(P, ($) => Z($.params));
27728
+ this.setEventHandler("toolinputpartial", Z);
27729
+ }
27730
+ get ontoolresult() {
27731
+ return this.getEventHandler("toolresult");
27644
27732
  }
27645
27733
  set ontoolresult(Z) {
27646
- this.setNotificationHandler(U, ($) => Z($.params));
27734
+ this.setEventHandler("toolresult", Z);
27735
+ }
27736
+ get ontoolcancelled() {
27737
+ return this.getEventHandler("toolcancelled");
27647
27738
  }
27648
27739
  set ontoolcancelled(Z) {
27649
- this.setNotificationHandler(H, ($) => Z($.params));
27740
+ this.setEventHandler("toolcancelled", Z);
27741
+ }
27742
+ get onhostcontextchanged() {
27743
+ return this.getEventHandler("hostcontextchanged");
27650
27744
  }
27651
27745
  set onhostcontextchanged(Z) {
27652
- this.setNotificationHandler(E, ($) => {
27653
- this._hostContext = { ...this._hostContext, ...$.params }, Z($.params);
27654
- });
27746
+ this.setEventHandler("hostcontextchanged", Z);
27747
+ }
27748
+ _onteardown;
27749
+ get onteardown() {
27750
+ return this._onteardown;
27655
27751
  }
27656
27752
  set onteardown(Z) {
27657
- this.setRequestHandler(_, ($, J) => Z($.params, J));
27753
+ this.warnIfRequestHandlerReplaced("onteardown", this._onteardown, Z), this._onteardown = Z, this.replaceRequestHandler(_, ($, J) => {
27754
+ if (!this._onteardown)
27755
+ throw Error("No onteardown handler set");
27756
+ return this._onteardown($.params, J);
27757
+ });
27758
+ }
27759
+ _oncalltool;
27760
+ get oncalltool() {
27761
+ return this._oncalltool;
27658
27762
  }
27659
27763
  set oncalltool(Z) {
27660
- this.setRequestHandler(CallToolRequestSchema, ($, J) => Z($.params, J));
27764
+ this.warnIfRequestHandlerReplaced("oncalltool", this._oncalltool, Z), this._oncalltool = Z, this.replaceRequestHandler(CallToolRequestSchema, ($, J) => {
27765
+ if (!this._oncalltool)
27766
+ throw Error("No oncalltool handler set");
27767
+ return this._oncalltool($.params, J);
27768
+ });
27769
+ }
27770
+ _onlisttools;
27771
+ get onlisttools() {
27772
+ return this._onlisttools;
27661
27773
  }
27662
27774
  set onlisttools(Z) {
27663
- this.setRequestHandler(ListToolsRequestSchema, ($, J) => Z($.params, J));
27775
+ this.warnIfRequestHandlerReplaced("onlisttools", this._onlisttools, Z), this._onlisttools = Z, this.replaceRequestHandler(ListToolsRequestSchema, ($, J) => {
27776
+ if (!this._onlisttools)
27777
+ throw Error("No onlisttools handler set");
27778
+ return this._onlisttools($.params, J);
27779
+ });
27664
27780
  }
27665
27781
  assertCapabilityForMethod(Z) {}
27666
27782
  assertRequestHandlerCapability(Z) {
@@ -27711,6 +27827,9 @@ class qQ extends Protocol {
27711
27827
  downloadFile(Z, $) {
27712
27828
  return this.request({ method: "ui/download-file", params: Z }, I, $);
27713
27829
  }
27830
+ requestTeardown(Z = {}) {
27831
+ return this.notification({ method: "ui/notifications/request-teardown", params: Z });
27832
+ }
27714
27833
  requestDisplayMode(Z, $) {
27715
27834
  return this.request({ method: "ui/request-display-mode", params: Z }, T, $);
27716
27835
  }
@@ -27723,25 +27842,25 @@ class qQ extends Protocol {
27723
27842
  return;
27724
27843
  Z = true, requestAnimationFrame(() => {
27725
27844
  Z = false;
27726
- let V = document.documentElement, G = V.style.width, W = V.style.height;
27727
- V.style.width = "fit-content", V.style.height = "max-content";
27728
- let M = V.getBoundingClientRect();
27729
- V.style.width = G, V.style.height = W;
27730
- let h = window.innerWidth - V.clientWidth, N = Math.ceil(M.width + h), Y = Math.ceil(M.height);
27731
- if (N !== $ || Y !== J)
27732
- $ = N, J = Y, this.sendSizeChanged({ width: N, height: Y });
27845
+ let D = document.documentElement, G = D.style.height;
27846
+ D.style.height = "max-content";
27847
+ let L = Math.ceil(D.getBoundingClientRect().height);
27848
+ D.style.height = G;
27849
+ let Y = Math.ceil(window.innerWidth);
27850
+ if (Y !== $ || L !== J)
27851
+ $ = Y, J = L, this.sendSizeChanged({ width: Y, height: L });
27733
27852
  });
27734
27853
  };
27735
27854
  X();
27736
- let D = new ResizeObserver(X);
27737
- return D.observe(document.documentElement), D.observe(document.body), () => D.disconnect();
27855
+ let V = new ResizeObserver(X);
27856
+ return V.observe(document.documentElement), V.observe(document.body), () => V.disconnect();
27738
27857
  }
27739
- async connect(Z = new j(window.parent, window.parent), $) {
27858
+ async connect(Z = new B(window.parent, window.parent), $) {
27740
27859
  if (this.transport)
27741
27860
  throw Error("App is already connected. Call close() before connecting again.");
27742
27861
  await super.connect(Z);
27743
27862
  try {
27744
- let J = await this.request({ method: "ui/initialize", params: { appCapabilities: this._capabilities, appInfo: this._appInfo, protocolVersion: F } }, R, $);
27863
+ let J = await this.request({ method: "ui/initialize", params: { appCapabilities: this._capabilities, appInfo: this._appInfo, protocolVersion: F } }, k, $);
27745
27864
  if (J === undefined)
27746
27865
  throw Error(`Server sent invalid initialize result: ${J}`);
27747
27866
  if (this._hostCapabilities = J.hostCapabilities, this._hostInfo = J.hostInfo, this._hostContext = J.hostContext, await this.notification({ method: "ui/notifications/initialized" }), this.options?.autoResize)
@@ -27751,16 +27870,16 @@ class qQ extends Protocol {
27751
27870
  }
27752
27871
  }
27753
27872
  }
27754
- function uZ(Z, $, J, X) {
27755
- let D = J._meta, V = D.ui, G = D[v], W = D;
27756
- if (V?.resourceUri && !G)
27757
- W = { ...D, [v]: V.resourceUri };
27758
- else if (G && !V?.resourceUri)
27759
- W = { ...D, ui: { ...V, resourceUri: G } };
27760
- return Z.registerTool($, { ...J, _meta: W }, X);
27873
+ function hZ(Z, $, J, X) {
27874
+ let V = J._meta, D = V.ui, G = V[M], L = V;
27875
+ if (D?.resourceUri && !G)
27876
+ L = { ...V, [M]: D.resourceUri };
27877
+ else if (G && !D?.resourceUri)
27878
+ L = { ...V, ui: { ...D, resourceUri: G } };
27879
+ return Z.registerTool($, { ...J, _meta: L }, X);
27761
27880
  }
27762
- function fZ(Z, $, J, X, D) {
27763
- return Z.registerResource($, J, { mimeType: d, ...X }, D);
27881
+ function mZ(Z, $, J, X, V) {
27882
+ return Z.registerResource($, J, { mimeType: u, ...X }, V);
27764
27883
  }
27765
27884
 
27766
27885
  // node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
@@ -28263,6 +28382,224 @@ var McpZodTypeKind;
28263
28382
  McpZodTypeKind2["Completable"] = "McpCompletable";
28264
28383
  })(McpZodTypeKind || (McpZodTypeKind = {}));
28265
28384
 
28385
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js
28386
+ var MAX_TEMPLATE_LENGTH = 1e6;
28387
+ var MAX_VARIABLE_LENGTH = 1e6;
28388
+ var MAX_TEMPLATE_EXPRESSIONS = 1e4;
28389
+ var MAX_REGEX_LENGTH = 1e6;
28390
+
28391
+ class UriTemplate {
28392
+ static isTemplate(str) {
28393
+ return /\{[^}\s]+\}/.test(str);
28394
+ }
28395
+ static validateLength(str, max, context) {
28396
+ if (str.length > max) {
28397
+ throw new Error(`${context} exceeds maximum length of ${max} characters (got ${str.length})`);
28398
+ }
28399
+ }
28400
+ get variableNames() {
28401
+ return this.parts.flatMap((part) => typeof part === "string" ? [] : part.names);
28402
+ }
28403
+ constructor(template) {
28404
+ UriTemplate.validateLength(template, MAX_TEMPLATE_LENGTH, "Template");
28405
+ this.template = template;
28406
+ this.parts = this.parse(template);
28407
+ }
28408
+ toString() {
28409
+ return this.template;
28410
+ }
28411
+ parse(template) {
28412
+ const parts = [];
28413
+ let currentText = "";
28414
+ let i2 = 0;
28415
+ let expressionCount = 0;
28416
+ while (i2 < template.length) {
28417
+ if (template[i2] === "{") {
28418
+ if (currentText) {
28419
+ parts.push(currentText);
28420
+ currentText = "";
28421
+ }
28422
+ const end = template.indexOf("}", i2);
28423
+ if (end === -1)
28424
+ throw new Error("Unclosed template expression");
28425
+ expressionCount++;
28426
+ if (expressionCount > MAX_TEMPLATE_EXPRESSIONS) {
28427
+ throw new Error(`Template contains too many expressions (max ${MAX_TEMPLATE_EXPRESSIONS})`);
28428
+ }
28429
+ const expr = template.slice(i2 + 1, end);
28430
+ const operator = this.getOperator(expr);
28431
+ const exploded = expr.includes("*");
28432
+ const names = this.getNames(expr);
28433
+ const name = names[0];
28434
+ for (const name2 of names) {
28435
+ UriTemplate.validateLength(name2, MAX_VARIABLE_LENGTH, "Variable name");
28436
+ }
28437
+ parts.push({ name, operator, names, exploded });
28438
+ i2 = end + 1;
28439
+ } else {
28440
+ currentText += template[i2];
28441
+ i2++;
28442
+ }
28443
+ }
28444
+ if (currentText) {
28445
+ parts.push(currentText);
28446
+ }
28447
+ return parts;
28448
+ }
28449
+ getOperator(expr) {
28450
+ const operators = ["+", "#", ".", "/", "?", "&"];
28451
+ return operators.find((op) => expr.startsWith(op)) || "";
28452
+ }
28453
+ getNames(expr) {
28454
+ const operator = this.getOperator(expr);
28455
+ return expr.slice(operator.length).split(",").map((name) => name.replace("*", "").trim()).filter((name) => name.length > 0);
28456
+ }
28457
+ encodeValue(value, operator) {
28458
+ UriTemplate.validateLength(value, MAX_VARIABLE_LENGTH, "Variable value");
28459
+ if (operator === "+" || operator === "#") {
28460
+ return encodeURI(value);
28461
+ }
28462
+ return encodeURIComponent(value);
28463
+ }
28464
+ expandPart(part, variables) {
28465
+ if (part.operator === "?" || part.operator === "&") {
28466
+ const pairs = part.names.map((name) => {
28467
+ const value2 = variables[name];
28468
+ if (value2 === undefined)
28469
+ return "";
28470
+ const encoded2 = Array.isArray(value2) ? value2.map((v2) => this.encodeValue(v2, part.operator)).join(",") : this.encodeValue(value2.toString(), part.operator);
28471
+ return `${name}=${encoded2}`;
28472
+ }).filter((pair) => pair.length > 0);
28473
+ if (pairs.length === 0)
28474
+ return "";
28475
+ const separator = part.operator === "?" ? "?" : "&";
28476
+ return separator + pairs.join("&");
28477
+ }
28478
+ if (part.names.length > 1) {
28479
+ const values2 = part.names.map((name) => variables[name]).filter((v2) => v2 !== undefined);
28480
+ if (values2.length === 0)
28481
+ return "";
28482
+ return values2.map((v2) => Array.isArray(v2) ? v2[0] : v2).join(",");
28483
+ }
28484
+ const value = variables[part.name];
28485
+ if (value === undefined)
28486
+ return "";
28487
+ const values = Array.isArray(value) ? value : [value];
28488
+ const encoded = values.map((v2) => this.encodeValue(v2, part.operator));
28489
+ switch (part.operator) {
28490
+ case "":
28491
+ return encoded.join(",");
28492
+ case "+":
28493
+ return encoded.join(",");
28494
+ case "#":
28495
+ return "#" + encoded.join(",");
28496
+ case ".":
28497
+ return "." + encoded.join(".");
28498
+ case "/":
28499
+ return "/" + encoded.join("/");
28500
+ default:
28501
+ return encoded.join(",");
28502
+ }
28503
+ }
28504
+ expand(variables) {
28505
+ let result = "";
28506
+ let hasQueryParam = false;
28507
+ for (const part of this.parts) {
28508
+ if (typeof part === "string") {
28509
+ result += part;
28510
+ continue;
28511
+ }
28512
+ const expanded = this.expandPart(part, variables);
28513
+ if (!expanded)
28514
+ continue;
28515
+ if ((part.operator === "?" || part.operator === "&") && hasQueryParam) {
28516
+ result += expanded.replace("?", "&");
28517
+ } else {
28518
+ result += expanded;
28519
+ }
28520
+ if (part.operator === "?" || part.operator === "&") {
28521
+ hasQueryParam = true;
28522
+ }
28523
+ }
28524
+ return result;
28525
+ }
28526
+ escapeRegExp(str) {
28527
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
28528
+ }
28529
+ partToRegExp(part) {
28530
+ const patterns = [];
28531
+ for (const name2 of part.names) {
28532
+ UriTemplate.validateLength(name2, MAX_VARIABLE_LENGTH, "Variable name");
28533
+ }
28534
+ if (part.operator === "?" || part.operator === "&") {
28535
+ for (let i2 = 0;i2 < part.names.length; i2++) {
28536
+ const name2 = part.names[i2];
28537
+ const prefix = i2 === 0 ? "\\" + part.operator : "&";
28538
+ patterns.push({
28539
+ pattern: prefix + this.escapeRegExp(name2) + "=([^&]+)",
28540
+ name: name2
28541
+ });
28542
+ }
28543
+ return patterns;
28544
+ }
28545
+ let pattern;
28546
+ const name = part.name;
28547
+ switch (part.operator) {
28548
+ case "":
28549
+ pattern = part.exploded ? "([^/,]+(?:,[^/,]+)*)" : "([^/,]+)";
28550
+ break;
28551
+ case "+":
28552
+ case "#":
28553
+ pattern = "(.+)";
28554
+ break;
28555
+ case ".":
28556
+ pattern = "\\.([^/,]+)";
28557
+ break;
28558
+ case "/":
28559
+ pattern = "/" + (part.exploded ? "([^/,]+(?:,[^/,]+)*)" : "([^/,]+)");
28560
+ break;
28561
+ default:
28562
+ pattern = "([^/]+)";
28563
+ }
28564
+ patterns.push({ pattern, name });
28565
+ return patterns;
28566
+ }
28567
+ match(uri) {
28568
+ UriTemplate.validateLength(uri, MAX_TEMPLATE_LENGTH, "URI");
28569
+ let pattern = "^";
28570
+ const names = [];
28571
+ for (const part of this.parts) {
28572
+ if (typeof part === "string") {
28573
+ pattern += this.escapeRegExp(part);
28574
+ } else {
28575
+ const patterns = this.partToRegExp(part);
28576
+ for (const { pattern: partPattern, name } of patterns) {
28577
+ pattern += partPattern;
28578
+ names.push({ name, exploded: part.exploded });
28579
+ }
28580
+ }
28581
+ }
28582
+ pattern += "$";
28583
+ UriTemplate.validateLength(pattern, MAX_REGEX_LENGTH, "Generated regex pattern");
28584
+ const regex = new RegExp(pattern);
28585
+ const match = uri.match(regex);
28586
+ if (!match)
28587
+ return null;
28588
+ const result = {};
28589
+ for (let i2 = 0;i2 < names.length; i2++) {
28590
+ const { name, exploded } = names[i2];
28591
+ const value = match[i2 + 1];
28592
+ const cleanName = name.replace("*", "");
28593
+ if (exploded && value.includes(",")) {
28594
+ result[cleanName] = value.split(",");
28595
+ } else {
28596
+ result[cleanName] = value;
28597
+ }
28598
+ }
28599
+ return result;
28600
+ }
28601
+ }
28602
+
28266
28603
  // node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
28267
28604
  var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
28268
28605
  function validateToolName(name) {
@@ -28920,6 +29257,9 @@ class McpServer {
28920
29257
  annotations = rest.shift();
28921
29258
  }
28922
29259
  } else if (typeof firstArg === "object" && firstArg !== null) {
29260
+ if (Object.values(firstArg).some((v2) => typeof v2 === "object" && v2 !== null)) {
29261
+ throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
29262
+ }
28923
29263
  annotations = rest.shift();
28924
29264
  }
28925
29265
  }
@@ -28983,6 +29323,22 @@ class McpServer {
28983
29323
  }
28984
29324
  }
28985
29325
  }
29326
+
29327
+ class ResourceTemplate {
29328
+ constructor(uriTemplate, _callbacks) {
29329
+ this._callbacks = _callbacks;
29330
+ this._uriTemplate = typeof uriTemplate === "string" ? new UriTemplate(uriTemplate) : uriTemplate;
29331
+ }
29332
+ get uriTemplate() {
29333
+ return this._uriTemplate;
29334
+ }
29335
+ get listCallback() {
29336
+ return this._callbacks.list;
29337
+ }
29338
+ completeCallback(variable) {
29339
+ return this._callbacks.complete?.[variable];
29340
+ }
29341
+ }
28986
29342
  var EMPTY_OBJECT_JSON_SCHEMA = {
28987
29343
  type: "object",
28988
29344
  properties: {}
@@ -29012,6 +29368,9 @@ function getZodSchemaObject(schema) {
29012
29368
  if (isZodRawShapeCompat(schema)) {
29013
29369
  return objectFromShape(schema);
29014
29370
  }
29371
+ if (!isZodSchemaInstance(schema)) {
29372
+ throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
29373
+ }
29015
29374
  return schema;
29016
29375
  }
29017
29376
  function promptArgumentsFromSchema(schema) {
@@ -29061,6 +29420,45 @@ import { readFile } from "node:fs/promises";
29061
29420
  import path from "node:path";
29062
29421
  import { fileURLToPath } from "node:url";
29063
29422
 
29423
+ // src/utils/sisense-session.ts
29424
+ var MISSING_SISENSE_SESSION_MESSAGE = "Sisense credentials not found in this session. Provide sisenseUrl and sisenseToken as URL query parameters when connecting, or set SISENSE_URL and SISENSE_TOKEN in the server environment.";
29425
+ var MISSING_BASE_URL_SESSION_MESSAGE = "Base URL not found in session.";
29426
+ function getSessionHttpClient(sessionState) {
29427
+ const client = sessionState?.get("httpClient");
29428
+ if (!client) {
29429
+ throw new Error(MISSING_SISENSE_SESSION_MESSAGE);
29430
+ }
29431
+ return client;
29432
+ }
29433
+ function getSessionOpenAIClient(sessionState) {
29434
+ const client = sessionState?.get("openAIClient");
29435
+ if (!client) {
29436
+ throw new Error(MISSING_SISENSE_SESSION_MESSAGE);
29437
+ }
29438
+ return client;
29439
+ }
29440
+ function getSessionSisenseUrl(sessionState) {
29441
+ const url2 = sessionState?.get("sisenseUrl");
29442
+ if (!url2) {
29443
+ throw new Error(MISSING_SISENSE_SESSION_MESSAGE);
29444
+ }
29445
+ return url2;
29446
+ }
29447
+ function getSessionSisenseToken(sessionState) {
29448
+ const token = sessionState?.get("sisenseToken");
29449
+ if (!token) {
29450
+ throw new Error(MISSING_SISENSE_SESSION_MESSAGE);
29451
+ }
29452
+ return token;
29453
+ }
29454
+ function getSessionBaseUrl(sessionState) {
29455
+ const baseUrl = sessionState?.get("baseUrl");
29456
+ if (!baseUrl) {
29457
+ throw new Error(MISSING_BASE_URL_SESSION_MESSAGE);
29458
+ }
29459
+ return baseUrl;
29460
+ }
29461
+
29064
29462
  // src/tools/build-chart.ts
29065
29463
  function isMcpAppEnabled() {
29066
29464
  return process.env.TOOL_CHART_BUILDER_MCP_APP_ENABLED !== "false" && process.env.TOOL_CHART_BUILDER_MCP_APP_ENABLED !== "0";
@@ -29092,10 +29490,12 @@ function addChartSummary(sessionState, summary) {
29092
29490
  async function buildChart(args, sessionState, requestId) {
29093
29491
  try {
29094
29492
  const { dataSourceTitle, userPrompt } = args;
29493
+ const httpClient = getSessionHttpClient(sessionState);
29494
+ const openAIClient = getSessionOpenAIClient(sessionState);
29095
29495
  const toolCallId = String(requestId ? `chart-${requestId}` : `chart-${Date.now()}`);
29096
29496
  const result = await csdkBrowserMock.withBrowserEnvironment(async () => {
29097
- const { buildChartEngine, runWithUserAction } = await import("./index-c0zk3ctc.js");
29098
- const { renderChartWidget } = await import("./widget-renderer-56n3m26y.js");
29497
+ const { buildChartEngine, runWithUserAction } = await import("./index-8027b2t7.js");
29498
+ const { renderChartWidget } = await import("./widget-renderer-9rr9sfh8.js");
29099
29499
  const buildChartContext = {
29100
29500
  toolCallId,
29101
29501
  dataSourceTitle,
@@ -29103,32 +29503,24 @@ async function buildChart(args, sessionState, requestId) {
29103
29503
  retrieveChart: (id) => sessionState?.get(id) ?? null,
29104
29504
  saveChart: (id, props) => sessionState?.set(id, props),
29105
29505
  isNlqV3Enabled: true,
29106
- httpClient: sessionState?.get("httpClient"),
29107
- openAIClient: sessionState?.get("openAIClient")
29506
+ httpClient,
29507
+ openAIClient
29108
29508
  };
29109
29509
  const chartSummary2 = await runWithUserAction("MCP", "ASSISTANT", () => buildChartEngine({ dataSourceTitle, userPrompt }, buildChartContext));
29110
29510
  console.info(">>> CHART SUMMARY", chartSummary2);
29111
29511
  addChartSummary(sessionState, chartSummary2);
29112
29512
  const savedProps = sessionState?.get(chartSummary2.chartId);
29113
29513
  if (savedProps) {
29114
- const sisenseUrl2 = sessionState?.get("sisenseUrl");
29115
- const sisenseToken2 = sessionState?.get("sisenseToken");
29116
- const baseUrl = sessionState?.get("baseUrl");
29117
- const httpClient = sessionState?.get("httpClient");
29118
- if (!sisenseUrl2 || !sisenseToken2) {
29119
- throw new Error("Sisense credentials not found in session. Provide sisenseUrl and sisenseToken as URL params.");
29120
- }
29121
- if (!baseUrl) {
29122
- throw new Error("Base URL not found in session.");
29123
- }
29514
+ const sisenseUrl = getSessionSisenseUrl(sessionState);
29515
+ const sisenseToken = getSessionSisenseToken(sessionState);
29124
29516
  const narrativeEnabled = isNarrativeEnabled();
29125
- const { getNlgInsightsFromWidget } = await import("./ai-3wz11tv8.js");
29517
+ const { getNlgInsightsFromWidget } = await import("./ai-w2gkxdn7.js");
29126
29518
  const insightsPromise = narrativeEnabled && httpClient ? getNlgInsightsFromWidget(savedProps, httpClient, { verbosity: "High" }) : Promise.resolve(undefined);
29127
29519
  const renderPromise = isMcpAppEnabled() ? Promise.resolve(null) : renderChartWidget({
29128
29520
  widgetProps: savedProps,
29129
- sisenseUrl: sisenseUrl2,
29130
- sisenseToken: sisenseToken2,
29131
- baseUrl
29521
+ sisenseUrl,
29522
+ sisenseToken,
29523
+ baseUrl: getSessionBaseUrl(sessionState)
29132
29524
  });
29133
29525
  const [insightsResult, renderResult] = await Promise.allSettled([
29134
29526
  insightsPromise,
@@ -29148,13 +29540,21 @@ async function buildChart(args, sessionState, requestId) {
29148
29540
  const sanitized = sanitizeError(renderResult.reason);
29149
29541
  console.warn("Failed to render chart widget:", sanitized.message);
29150
29542
  }
29543
+ const serializedWidgetProps = ni.serialize(savedProps);
29544
+ if (isMcpAppEnabled() && sisenseUrl && sisenseToken) {
29545
+ sessionState?.set(`chart:payload:${chartSummary2.chartId}`, {
29546
+ sisenseUrl,
29547
+ sisenseToken,
29548
+ serializedWidgetProps
29549
+ });
29550
+ }
29151
29551
  return {
29152
29552
  chartSummary: chartSummary2,
29153
29553
  imageUrl: imageUrl2,
29154
29554
  insights: insights2,
29155
- sisenseUrl: sisenseUrl2,
29156
- sisenseToken: sisenseToken2,
29157
- serializedWidgetProps: Kn.serialize(savedProps)
29555
+ sisenseUrl,
29556
+ sisenseToken,
29557
+ serializedWidgetProps
29158
29558
  };
29159
29559
  }
29160
29560
  console.warn("No saved props found for chartId:", chartSummary2.chartId);
@@ -29166,7 +29566,7 @@ async function buildChart(args, sessionState, requestId) {
29166
29566
  sisenseToken: undefined
29167
29567
  };
29168
29568
  });
29169
- const { chartSummary, imageUrl, insights, sisenseUrl, sisenseToken, serializedWidgetProps } = result;
29569
+ const { chartSummary, imageUrl, insights } = result;
29170
29570
  const output = {
29171
29571
  success: true,
29172
29572
  chartId: chartSummary.chartId,
@@ -29181,14 +29581,7 @@ async function buildChart(args, sessionState, requestId) {
29181
29581
  text: JSON.stringify(output, null, 2)
29182
29582
  }
29183
29583
  ],
29184
- structuredContent: output,
29185
- ...isMcpAppEnabled() ? {
29186
- _meta: {
29187
- sisenseUrl,
29188
- sisenseToken,
29189
- serializedWidgetProps
29190
- }
29191
- } : {}
29584
+ structuredContent: output
29192
29585
  };
29193
29586
  return finalOutput;
29194
29587
  } catch (error40) {
@@ -29219,10 +29612,11 @@ var getDataSourcesOutputSchema = {
29219
29612
  };
29220
29613
  async function getDataSources(_args, sessionState) {
29221
29614
  try {
29222
- const { getDataSourcesEngine } = await import("./index-c0zk3ctc.js");
29615
+ const httpClient = getSessionHttpClient(sessionState);
29616
+ const { getDataSourcesEngine } = await import("./index-8027b2t7.js");
29223
29617
  const getDataSourcesContext = {
29224
29618
  toolCallId: "get-data-sources",
29225
- httpClient: sessionState?.get("httpClient")
29619
+ httpClient
29226
29620
  };
29227
29621
  const result = await getDataSourcesEngine({}, getDataSourcesContext);
29228
29622
  return {
@@ -29262,10 +29656,11 @@ var getDataSourceFieldsOutputSchema = {
29262
29656
  async function getDataSourceFields(args, sessionState) {
29263
29657
  const { dataSourceTitle } = args;
29264
29658
  try {
29265
- const { getDataSourceFieldsEngine } = await import("./index-c0zk3ctc.js");
29659
+ const httpClient = getSessionHttpClient(sessionState);
29660
+ const { getDataSourceFieldsEngine } = await import("./index-8027b2t7.js");
29266
29661
  const getDataSourceFieldsContext = {
29267
29662
  toolCallId: "get-data-source-fields",
29268
- httpClient: sessionState?.get("httpClient")
29663
+ httpClient
29269
29664
  };
29270
29665
  const result = await getDataSourceFieldsEngine({ dataSourceTitle }, getDataSourceFieldsContext);
29271
29666
  return {
@@ -29559,7 +29954,7 @@ async function setupMcpServer(sessionState) {
29559
29954
  getDataSourcesSchema,
29560
29955
  getDataSourceFieldsSchema,
29561
29956
  buildChartSchema
29562
- } = await import("./index-c0zk3ctc.js");
29957
+ } = await import("./index-8027b2t7.js");
29563
29958
  const server = new McpServer({
29564
29959
  name: "sisense-mcp-server",
29565
29960
  version: "1.0.0"
@@ -29584,7 +29979,7 @@ async function setupMcpServer(sessionState) {
29584
29979
  });
29585
29980
  const buildChartOutputSchema = getBuildChartOutputSchema();
29586
29981
  if (isMcpAppEnabled2()) {
29587
- uZ(server, TOOL_NAME_CHART_BUILDER, {
29982
+ hZ(server, TOOL_NAME_CHART_BUILDER, {
29588
29983
  title: "Build Sisense Chart from User Prompt",
29589
29984
  description: "Build a chart from a Sisense data source using natural language user prompt. Chart type will be automatically determined by Sisense AI based on the user prompt.",
29590
29985
  inputSchema: buildChartSchema.shape,
@@ -29603,14 +29998,14 @@ async function setupMcpServer(sessionState) {
29603
29998
  return await buildChart(args, sessionState);
29604
29999
  });
29605
30000
  }
29606
- fZ(server, ANALYTICS_RESOURCE_URI, ANALYTICS_RESOURCE_URI, { mimeType: d }, async () => {
30001
+ mZ(server, ANALYTICS_RESOURCE_URI, ANALYTICS_RESOURCE_URI, { mimeType: u }, async () => {
29607
30002
  const html = await readFile(path.join(DIST_DIR, "view.html"), "utf-8");
29608
30003
  const meta = getCspMeta(sessionState);
29609
30004
  return {
29610
30005
  contents: [
29611
30006
  {
29612
30007
  uri: ANALYTICS_RESOURCE_URI,
29613
- mimeType: d,
30008
+ mimeType: u,
29614
30009
  text: html,
29615
30010
  _meta: meta
29616
30011
  }
@@ -29618,6 +30013,22 @@ async function setupMcpServer(sessionState) {
29618
30013
  };
29619
30014
  });
29620
30015
  registerPrompts(server);
30016
+ server.registerResource("chart-data", new ResourceTemplate("ui://sisense-analytics/chart/{chartId}", { list: undefined }), { mimeType: "application/json" }, async (uri, vars) => {
30017
+ const chartId = String(vars.chartId);
30018
+ const payload = sessionState?.get(`chart:payload:${chartId}`);
30019
+ if (!payload) {
30020
+ throw new Error(`Chart data not found for chartId: ${chartId}`);
30021
+ }
30022
+ return {
30023
+ contents: [
30024
+ {
30025
+ uri: uri.href,
30026
+ mimeType: "application/json",
30027
+ text: JSON.stringify(payload)
30028
+ }
30029
+ ]
30030
+ };
30031
+ });
29621
30032
  return server;
29622
30033
  } catch (error40) {
29623
30034
  console.error("Error setting up MCP server:", error40);
@@ -29759,7 +30170,7 @@ var server = createServer(async (req, res) => {
29759
30170
  createOpenAIClient,
29760
30171
  initializeHttpClient,
29761
30172
  initializeOpenAIClient
29762
- } = await import("./index-c0zk3ctc.js");
30173
+ } = await import("./index-8027b2t7.js");
29763
30174
  const httpClient = createHttpClientFromConfig({
29764
30175
  url: validatedUrl,
29765
30176
  token: validatedToken