@sisense/mcp-server 0.2.6 → 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.
- package/dist/{ai-qt2rw4p0.js → ai-w2gkxdn7.js} +415 -415
- package/dist/{index-mxkgxy04.js → index-8027b2t7.js} +27545 -23772
- package/dist/sse-server-f7drtvty.js +2996 -0
- package/dist/{sse-server-kpkj0hbc.js → sse-server-n5dmee25.js} +24603 -23532
- package/dist/sse-server-r50cemee.js +6429 -0
- package/dist/sse-server.js +579 -160
- package/dist/view.html +894 -837
- package/dist/{widget-renderer-wjrpnwpy.js → widget-renderer-9rr9sfh8.js} +6 -7
- package/package.json +6 -6
- package/dist/sse-server-22mq7fhc.js +0 -2254
- package/dist/sse-server-d3yx2z0r.js +0 -6296
package/dist/sse-server.js
CHANGED
|
@@ -17,9 +17,9 @@ import {
|
|
|
17
17
|
} from "./index-bgbnagw5.js";
|
|
18
18
|
import"./index-6vz3bc2n.js";
|
|
19
19
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./sse-server-
|
|
22
|
-
import"./sse-server-
|
|
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,
|
|
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
|
|
532
|
-
if (Array.isArray(
|
|
533
|
-
nodes.splice(i2, 1, ...
|
|
534
|
-
else if (
|
|
535
|
-
nodes[i2] =
|
|
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
|
|
546
|
-
if (
|
|
545
|
+
const n2 = nodes[i2];
|
|
546
|
+
if (n2.optimizeNames(names, constants))
|
|
547
547
|
continue;
|
|
548
|
-
subtractNames(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,
|
|
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(
|
|
950
|
-
while (
|
|
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
|
|
965
|
-
if (
|
|
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
|
|
973
|
-
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 =
|
|
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
|
|
994
|
-
names[
|
|
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(
|
|
1015
|
-
const c = constants[
|
|
1016
|
-
if (c === undefined || names[
|
|
1017
|
-
return
|
|
1018
|
-
delete names[
|
|
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
|
|
1027
|
-
names[
|
|
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,
|
|
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
|
|
6896
|
-
if (Array.isArray(
|
|
6897
|
-
nodes.splice(i2, 1, ...
|
|
6898
|
-
else if (
|
|
6899
|
-
nodes[i2] =
|
|
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
|
|
6910
|
-
if (
|
|
6909
|
+
const n2 = nodes[i2];
|
|
6910
|
+
if (n2.optimizeNames(names, constants))
|
|
6911
6911
|
continue;
|
|
6912
|
-
subtractNames(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,
|
|
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(
|
|
7314
|
-
while (
|
|
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
|
|
7329
|
-
if (
|
|
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
|
|
7337
|
-
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 =
|
|
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
|
|
7358
|
-
names[
|
|
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(
|
|
7379
|
-
const c = constants[
|
|
7380
|
-
if (c === undefined || names[
|
|
7381
|
-
return
|
|
7382
|
-
delete names[
|
|
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
|
|
7391
|
-
names[
|
|
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)}`;
|
|
@@ -11978,6 +11978,7 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
11978
11978
|
// src/sse-server.ts
|
|
11979
11979
|
import { createServer } from "node:http";
|
|
11980
11980
|
import { createHash, randomUUID } from "node:crypto";
|
|
11981
|
+
import { readFileSync } from "node:fs";
|
|
11981
11982
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
11982
11983
|
import { resolve, sep } from "node:path";
|
|
11983
11984
|
|
|
@@ -23563,7 +23564,7 @@ var AssertObjectSchema = custom((v) => v !== null && (typeof v === "object" || t
|
|
|
23563
23564
|
var ProgressTokenSchema = union([string2(), number2().int()]);
|
|
23564
23565
|
var CursorSchema = string2();
|
|
23565
23566
|
var TaskCreationParamsSchema = looseObject({
|
|
23566
|
-
ttl:
|
|
23567
|
+
ttl: number2().optional(),
|
|
23567
23568
|
pollInterval: number2().optional()
|
|
23568
23569
|
});
|
|
23569
23570
|
var TaskMetadataSchema = object({
|
|
@@ -23717,7 +23718,8 @@ var ClientCapabilitiesSchema = object({
|
|
|
23717
23718
|
roots: object({
|
|
23718
23719
|
listChanged: boolean2().optional()
|
|
23719
23720
|
}).optional(),
|
|
23720
|
-
tasks: ClientTasksCapabilitySchema.optional()
|
|
23721
|
+
tasks: ClientTasksCapabilitySchema.optional(),
|
|
23722
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
23721
23723
|
});
|
|
23722
23724
|
var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
23723
23725
|
protocolVersion: string2(),
|
|
@@ -23743,7 +23745,8 @@ var ServerCapabilitiesSchema = object({
|
|
|
23743
23745
|
tools: object({
|
|
23744
23746
|
listChanged: boolean2().optional()
|
|
23745
23747
|
}).optional(),
|
|
23746
|
-
tasks: ServerTasksCapabilitySchema.optional()
|
|
23748
|
+
tasks: ServerTasksCapabilitySchema.optional(),
|
|
23749
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
23747
23750
|
});
|
|
23748
23751
|
var InitializeResultSchema = ResultSchema.extend({
|
|
23749
23752
|
protocolVersion: string2(),
|
|
@@ -23858,6 +23861,7 @@ var ResourceSchema = object({
|
|
|
23858
23861
|
uri: string2(),
|
|
23859
23862
|
description: optional(string2()),
|
|
23860
23863
|
mimeType: optional(string2()),
|
|
23864
|
+
size: optional(number2()),
|
|
23861
23865
|
annotations: AnnotationsSchema.optional(),
|
|
23862
23866
|
_meta: optional(looseObject({}))
|
|
23863
23867
|
});
|
|
@@ -26858,6 +26862,10 @@ class Protocol {
|
|
|
26858
26862
|
this._progressHandlers.clear();
|
|
26859
26863
|
this._taskProgressTokens.clear();
|
|
26860
26864
|
this._pendingDebouncedNotifications.clear();
|
|
26865
|
+
for (const info of this._timeoutInfo.values()) {
|
|
26866
|
+
clearTimeout(info.timeoutId);
|
|
26867
|
+
}
|
|
26868
|
+
this._timeoutInfo.clear();
|
|
26861
26869
|
for (const controller of this._requestHandlerAbortControllers.values()) {
|
|
26862
26870
|
controller.abort();
|
|
26863
26871
|
}
|
|
@@ -26988,7 +26996,9 @@ class Protocol {
|
|
|
26988
26996
|
await capturedTransport?.send(errorResponse);
|
|
26989
26997
|
}
|
|
26990
26998
|
}).catch((error40) => this._onerror(new Error(`Failed to send response: ${error40}`))).finally(() => {
|
|
26991
|
-
this._requestHandlerAbortControllers.
|
|
26999
|
+
if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
|
|
27000
|
+
this._requestHandlerAbortControllers.delete(request.id);
|
|
27001
|
+
}
|
|
26992
27002
|
});
|
|
26993
27003
|
}
|
|
26994
27004
|
_onprogress(notification) {
|
|
@@ -27490,10 +27500,74 @@ function mergeCapabilities(base, additional) {
|
|
|
27490
27500
|
}
|
|
27491
27501
|
|
|
27492
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
|
+
}
|
|
27493
27567
|
var F = "2026-01-26";
|
|
27494
27568
|
var z = "ui/notifications/tool-input-partial";
|
|
27495
27569
|
|
|
27496
|
-
class
|
|
27570
|
+
class B {
|
|
27497
27571
|
eventTarget;
|
|
27498
27572
|
eventSource;
|
|
27499
27573
|
messageListener;
|
|
@@ -27531,10 +27605,10 @@ class j {
|
|
|
27531
27605
|
sessionId;
|
|
27532
27606
|
setProtocolVersion;
|
|
27533
27607
|
}
|
|
27534
|
-
var
|
|
27535
|
-
var
|
|
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.");
|
|
27536
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.");
|
|
27537
|
-
var
|
|
27611
|
+
var n = exports_external2.record(i.describe(`Style variables for theming MCP apps.
|
|
27538
27612
|
|
|
27539
27613
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
27540
27614
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
@@ -27553,29 +27627,30 @@ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
|
27553
27627
|
|
|
27554
27628
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
27555
27629
|
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);
|
|
27556
|
-
var
|
|
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") }) });
|
|
27557
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();
|
|
27558
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();
|
|
27559
27633
|
var w = exports_external2.object({ isError: exports_external2.boolean().optional().describe("True if the host rejected or failed to deliver the message.") }).passthrough();
|
|
27560
|
-
var
|
|
27561
|
-
var
|
|
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).
|
|
27562
27636
|
|
|
27563
27637
|
- Maps to CSP \`connect-src\` directive
|
|
27564
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'`)") });
|
|
27565
|
-
var
|
|
27566
|
-
var
|
|
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.") }) });
|
|
27567
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.") }) });
|
|
27568
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).") }) });
|
|
27569
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").') }) });
|
|
27570
|
-
var
|
|
27571
|
-
var C = exports_external2.object({ variables:
|
|
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.") });
|
|
27572
27646
|
var _ = exports_external2.object({ method: exports_external2.literal("ui/resource-teardown"), params: exports_external2.object({}) });
|
|
27573
|
-
var
|
|
27647
|
+
var t = exports_external2.record(exports_external2.string(), exports_external2.unknown());
|
|
27574
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.") });
|
|
27575
|
-
var
|
|
27576
|
-
var
|
|
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.") });
|
|
27577
27652
|
var QQ = exports_external2.object({ method: exports_external2.literal("ui/notifications/initialized"), params: exports_external2.object({}).optional() });
|
|
27578
|
-
var ZQ = exports_external2.object({ csp:
|
|
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.
|
|
27579
27654
|
|
|
27580
27655
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
27581
27656
|
|
|
@@ -27590,33 +27665,38 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
27590
27665
|
- \`true\`: request visible border + background
|
|
27591
27666
|
- \`false\`: request no visible border + background
|
|
27592
27667
|
- omitted: host decides border`) });
|
|
27593
|
-
var $Q = exports_external2.object({ method: exports_external2.literal("ui/request-display-mode"), params: exports_external2.object({ mode:
|
|
27594
|
-
var T = exports_external2.object({ mode:
|
|
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();
|
|
27595
27670
|
var f = exports_external2.union([exports_external2.literal("model"), exports_external2.literal("app")]).describe("Tool visibility scope - who can access the tool.");
|
|
27596
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"]
|
|
27597
27672
|
- "model": Tool visible to and callable by the agent
|
|
27598
27673
|
- "app": Tool callable by the app from this server only`) });
|
|
27599
|
-
var
|
|
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.') });
|
|
27600
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.") }) });
|
|
27601
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.).") }) });
|
|
27602
|
-
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:
|
|
27603
|
-
var
|
|
27604
|
-
var
|
|
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
|
|
27605
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();
|
|
27606
|
-
var
|
|
27607
|
-
var
|
|
27608
|
-
var
|
|
27609
|
-
var
|
|
27610
|
-
var
|
|
27611
|
-
var
|
|
27612
|
-
|
|
27613
|
-
class
|
|
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 {
|
|
27614
27689
|
_appInfo;
|
|
27615
27690
|
_capabilities;
|
|
27616
27691
|
options;
|
|
27617
27692
|
_hostCapabilities;
|
|
27618
27693
|
_hostInfo;
|
|
27619
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
|
+
}
|
|
27620
27700
|
constructor(Z, $ = {}, J = { autoResize: true }) {
|
|
27621
27701
|
super(J);
|
|
27622
27702
|
this._appInfo = Z;
|
|
@@ -27624,7 +27704,7 @@ class qQ extends Protocol {
|
|
|
27624
27704
|
this.options = J;
|
|
27625
27705
|
this.setRequestHandler(PingRequestSchema, (X) => {
|
|
27626
27706
|
return console.log("Received ping:", X.params), {};
|
|
27627
|
-
}), this.
|
|
27707
|
+
}), this.setEventHandler("hostcontextchanged", undefined);
|
|
27628
27708
|
}
|
|
27629
27709
|
getHostCapabilities() {
|
|
27630
27710
|
return this._hostCapabilities;
|
|
@@ -27635,31 +27715,68 @@ class qQ extends Protocol {
|
|
|
27635
27715
|
getHostContext() {
|
|
27636
27716
|
return this._hostContext;
|
|
27637
27717
|
}
|
|
27718
|
+
get ontoolinput() {
|
|
27719
|
+
return this.getEventHandler("toolinput");
|
|
27720
|
+
}
|
|
27638
27721
|
set ontoolinput(Z) {
|
|
27639
|
-
this.
|
|
27722
|
+
this.setEventHandler("toolinput", Z);
|
|
27723
|
+
}
|
|
27724
|
+
get ontoolinputpartial() {
|
|
27725
|
+
return this.getEventHandler("toolinputpartial");
|
|
27640
27726
|
}
|
|
27641
27727
|
set ontoolinputpartial(Z) {
|
|
27642
|
-
this.
|
|
27728
|
+
this.setEventHandler("toolinputpartial", Z);
|
|
27729
|
+
}
|
|
27730
|
+
get ontoolresult() {
|
|
27731
|
+
return this.getEventHandler("toolresult");
|
|
27643
27732
|
}
|
|
27644
27733
|
set ontoolresult(Z) {
|
|
27645
|
-
this.
|
|
27734
|
+
this.setEventHandler("toolresult", Z);
|
|
27735
|
+
}
|
|
27736
|
+
get ontoolcancelled() {
|
|
27737
|
+
return this.getEventHandler("toolcancelled");
|
|
27646
27738
|
}
|
|
27647
27739
|
set ontoolcancelled(Z) {
|
|
27648
|
-
this.
|
|
27740
|
+
this.setEventHandler("toolcancelled", Z);
|
|
27741
|
+
}
|
|
27742
|
+
get onhostcontextchanged() {
|
|
27743
|
+
return this.getEventHandler("hostcontextchanged");
|
|
27649
27744
|
}
|
|
27650
27745
|
set onhostcontextchanged(Z) {
|
|
27651
|
-
this.
|
|
27652
|
-
|
|
27653
|
-
|
|
27746
|
+
this.setEventHandler("hostcontextchanged", Z);
|
|
27747
|
+
}
|
|
27748
|
+
_onteardown;
|
|
27749
|
+
get onteardown() {
|
|
27750
|
+
return this._onteardown;
|
|
27654
27751
|
}
|
|
27655
27752
|
set onteardown(Z) {
|
|
27656
|
-
this.
|
|
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;
|
|
27657
27762
|
}
|
|
27658
27763
|
set oncalltool(Z) {
|
|
27659
|
-
this.
|
|
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;
|
|
27660
27773
|
}
|
|
27661
27774
|
set onlisttools(Z) {
|
|
27662
|
-
this.
|
|
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
|
+
});
|
|
27663
27780
|
}
|
|
27664
27781
|
assertCapabilityForMethod(Z) {}
|
|
27665
27782
|
assertRequestHandlerCapability(Z) {
|
|
@@ -27710,6 +27827,9 @@ class qQ extends Protocol {
|
|
|
27710
27827
|
downloadFile(Z, $) {
|
|
27711
27828
|
return this.request({ method: "ui/download-file", params: Z }, I, $);
|
|
27712
27829
|
}
|
|
27830
|
+
requestTeardown(Z = {}) {
|
|
27831
|
+
return this.notification({ method: "ui/notifications/request-teardown", params: Z });
|
|
27832
|
+
}
|
|
27713
27833
|
requestDisplayMode(Z, $) {
|
|
27714
27834
|
return this.request({ method: "ui/request-display-mode", params: Z }, T, $);
|
|
27715
27835
|
}
|
|
@@ -27722,25 +27842,25 @@ class qQ extends Protocol {
|
|
|
27722
27842
|
return;
|
|
27723
27843
|
Z = true, requestAnimationFrame(() => {
|
|
27724
27844
|
Z = false;
|
|
27725
|
-
let
|
|
27726
|
-
|
|
27727
|
-
let
|
|
27728
|
-
|
|
27729
|
-
let
|
|
27730
|
-
if (
|
|
27731
|
-
$ =
|
|
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 });
|
|
27732
27852
|
});
|
|
27733
27853
|
};
|
|
27734
27854
|
X();
|
|
27735
|
-
let
|
|
27736
|
-
return
|
|
27855
|
+
let V = new ResizeObserver(X);
|
|
27856
|
+
return V.observe(document.documentElement), V.observe(document.body), () => V.disconnect();
|
|
27737
27857
|
}
|
|
27738
|
-
async connect(Z = new
|
|
27858
|
+
async connect(Z = new B(window.parent, window.parent), $) {
|
|
27739
27859
|
if (this.transport)
|
|
27740
27860
|
throw Error("App is already connected. Call close() before connecting again.");
|
|
27741
27861
|
await super.connect(Z);
|
|
27742
27862
|
try {
|
|
27743
|
-
let J = await this.request({ method: "ui/initialize", params: { appCapabilities: this._capabilities, appInfo: this._appInfo, protocolVersion: F } },
|
|
27863
|
+
let J = await this.request({ method: "ui/initialize", params: { appCapabilities: this._capabilities, appInfo: this._appInfo, protocolVersion: F } }, k, $);
|
|
27744
27864
|
if (J === undefined)
|
|
27745
27865
|
throw Error(`Server sent invalid initialize result: ${J}`);
|
|
27746
27866
|
if (this._hostCapabilities = J.hostCapabilities, this._hostInfo = J.hostInfo, this._hostContext = J.hostContext, await this.notification({ method: "ui/notifications/initialized" }), this.options?.autoResize)
|
|
@@ -27750,16 +27870,16 @@ class qQ extends Protocol {
|
|
|
27750
27870
|
}
|
|
27751
27871
|
}
|
|
27752
27872
|
}
|
|
27753
|
-
function
|
|
27754
|
-
let
|
|
27755
|
-
if (
|
|
27756
|
-
|
|
27757
|
-
else if (G && !
|
|
27758
|
-
|
|
27759
|
-
return Z.registerTool($, { ...J, _meta:
|
|
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);
|
|
27760
27880
|
}
|
|
27761
|
-
function
|
|
27762
|
-
return Z.registerResource($, J, { mimeType:
|
|
27881
|
+
function mZ(Z, $, J, X, V) {
|
|
27882
|
+
return Z.registerResource($, J, { mimeType: u, ...X }, V);
|
|
27763
27883
|
}
|
|
27764
27884
|
|
|
27765
27885
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
|
|
@@ -28262,6 +28382,224 @@ var McpZodTypeKind;
|
|
|
28262
28382
|
McpZodTypeKind2["Completable"] = "McpCompletable";
|
|
28263
28383
|
})(McpZodTypeKind || (McpZodTypeKind = {}));
|
|
28264
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
|
+
|
|
28265
28603
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
|
|
28266
28604
|
var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
|
|
28267
28605
|
function validateToolName(name) {
|
|
@@ -28919,6 +29257,9 @@ class McpServer {
|
|
|
28919
29257
|
annotations = rest.shift();
|
|
28920
29258
|
}
|
|
28921
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
|
+
}
|
|
28922
29263
|
annotations = rest.shift();
|
|
28923
29264
|
}
|
|
28924
29265
|
}
|
|
@@ -28982,6 +29323,22 @@ class McpServer {
|
|
|
28982
29323
|
}
|
|
28983
29324
|
}
|
|
28984
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
|
+
}
|
|
28985
29342
|
var EMPTY_OBJECT_JSON_SCHEMA = {
|
|
28986
29343
|
type: "object",
|
|
28987
29344
|
properties: {}
|
|
@@ -29011,6 +29368,9 @@ function getZodSchemaObject(schema) {
|
|
|
29011
29368
|
if (isZodRawShapeCompat(schema)) {
|
|
29012
29369
|
return objectFromShape(schema);
|
|
29013
29370
|
}
|
|
29371
|
+
if (!isZodSchemaInstance(schema)) {
|
|
29372
|
+
throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
|
|
29373
|
+
}
|
|
29014
29374
|
return schema;
|
|
29015
29375
|
}
|
|
29016
29376
|
function promptArgumentsFromSchema(schema) {
|
|
@@ -29060,6 +29420,45 @@ import { readFile } from "node:fs/promises";
|
|
|
29060
29420
|
import path from "node:path";
|
|
29061
29421
|
import { fileURLToPath } from "node:url";
|
|
29062
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
|
+
|
|
29063
29462
|
// src/tools/build-chart.ts
|
|
29064
29463
|
function isMcpAppEnabled() {
|
|
29065
29464
|
return process.env.TOOL_CHART_BUILDER_MCP_APP_ENABLED !== "false" && process.env.TOOL_CHART_BUILDER_MCP_APP_ENABLED !== "0";
|
|
@@ -29091,10 +29490,12 @@ function addChartSummary(sessionState, summary) {
|
|
|
29091
29490
|
async function buildChart(args, sessionState, requestId) {
|
|
29092
29491
|
try {
|
|
29093
29492
|
const { dataSourceTitle, userPrompt } = args;
|
|
29493
|
+
const httpClient = getSessionHttpClient(sessionState);
|
|
29494
|
+
const openAIClient = getSessionOpenAIClient(sessionState);
|
|
29094
29495
|
const toolCallId = String(requestId ? `chart-${requestId}` : `chart-${Date.now()}`);
|
|
29095
29496
|
const result = await csdkBrowserMock.withBrowserEnvironment(async () => {
|
|
29096
|
-
const { buildChartEngine } = await import("./index-
|
|
29097
|
-
const { renderChartWidget } = await import("./widget-renderer-
|
|
29497
|
+
const { buildChartEngine, runWithUserAction } = await import("./index-8027b2t7.js");
|
|
29498
|
+
const { renderChartWidget } = await import("./widget-renderer-9rr9sfh8.js");
|
|
29098
29499
|
const buildChartContext = {
|
|
29099
29500
|
toolCallId,
|
|
29100
29501
|
dataSourceTitle,
|
|
@@ -29102,32 +29503,24 @@ async function buildChart(args, sessionState, requestId) {
|
|
|
29102
29503
|
retrieveChart: (id) => sessionState?.get(id) ?? null,
|
|
29103
29504
|
saveChart: (id, props) => sessionState?.set(id, props),
|
|
29104
29505
|
isNlqV3Enabled: true,
|
|
29105
|
-
httpClient
|
|
29106
|
-
openAIClient
|
|
29506
|
+
httpClient,
|
|
29507
|
+
openAIClient
|
|
29107
29508
|
};
|
|
29108
|
-
const chartSummary2 = await buildChartEngine({ dataSourceTitle, userPrompt }, buildChartContext);
|
|
29509
|
+
const chartSummary2 = await runWithUserAction("MCP", "ASSISTANT", () => buildChartEngine({ dataSourceTitle, userPrompt }, buildChartContext));
|
|
29109
29510
|
console.info(">>> CHART SUMMARY", chartSummary2);
|
|
29110
29511
|
addChartSummary(sessionState, chartSummary2);
|
|
29111
29512
|
const savedProps = sessionState?.get(chartSummary2.chartId);
|
|
29112
29513
|
if (savedProps) {
|
|
29113
|
-
const
|
|
29114
|
-
const
|
|
29115
|
-
const baseUrl = sessionState?.get("baseUrl");
|
|
29116
|
-
const httpClient = sessionState?.get("httpClient");
|
|
29117
|
-
if (!sisenseUrl2 || !sisenseToken2) {
|
|
29118
|
-
throw new Error("Sisense credentials not found in session. Provide sisenseUrl and sisenseToken as URL params.");
|
|
29119
|
-
}
|
|
29120
|
-
if (!baseUrl) {
|
|
29121
|
-
throw new Error("Base URL not found in session.");
|
|
29122
|
-
}
|
|
29514
|
+
const sisenseUrl = getSessionSisenseUrl(sessionState);
|
|
29515
|
+
const sisenseToken = getSessionSisenseToken(sessionState);
|
|
29123
29516
|
const narrativeEnabled = isNarrativeEnabled();
|
|
29124
|
-
const { getNlgInsightsFromWidget } = await import("./ai-
|
|
29517
|
+
const { getNlgInsightsFromWidget } = await import("./ai-w2gkxdn7.js");
|
|
29125
29518
|
const insightsPromise = narrativeEnabled && httpClient ? getNlgInsightsFromWidget(savedProps, httpClient, { verbosity: "High" }) : Promise.resolve(undefined);
|
|
29126
29519
|
const renderPromise = isMcpAppEnabled() ? Promise.resolve(null) : renderChartWidget({
|
|
29127
29520
|
widgetProps: savedProps,
|
|
29128
|
-
sisenseUrl
|
|
29129
|
-
sisenseToken
|
|
29130
|
-
baseUrl
|
|
29521
|
+
sisenseUrl,
|
|
29522
|
+
sisenseToken,
|
|
29523
|
+
baseUrl: getSessionBaseUrl(sessionState)
|
|
29131
29524
|
});
|
|
29132
29525
|
const [insightsResult, renderResult] = await Promise.allSettled([
|
|
29133
29526
|
insightsPromise,
|
|
@@ -29147,13 +29540,21 @@ async function buildChart(args, sessionState, requestId) {
|
|
|
29147
29540
|
const sanitized = sanitizeError(renderResult.reason);
|
|
29148
29541
|
console.warn("Failed to render chart widget:", sanitized.message);
|
|
29149
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
|
+
}
|
|
29150
29551
|
return {
|
|
29151
29552
|
chartSummary: chartSummary2,
|
|
29152
29553
|
imageUrl: imageUrl2,
|
|
29153
29554
|
insights: insights2,
|
|
29154
|
-
sisenseUrl
|
|
29155
|
-
sisenseToken
|
|
29156
|
-
serializedWidgetProps
|
|
29555
|
+
sisenseUrl,
|
|
29556
|
+
sisenseToken,
|
|
29557
|
+
serializedWidgetProps
|
|
29157
29558
|
};
|
|
29158
29559
|
}
|
|
29159
29560
|
console.warn("No saved props found for chartId:", chartSummary2.chartId);
|
|
@@ -29165,7 +29566,7 @@ async function buildChart(args, sessionState, requestId) {
|
|
|
29165
29566
|
sisenseToken: undefined
|
|
29166
29567
|
};
|
|
29167
29568
|
});
|
|
29168
|
-
const { chartSummary, imageUrl, insights
|
|
29569
|
+
const { chartSummary, imageUrl, insights } = result;
|
|
29169
29570
|
const output = {
|
|
29170
29571
|
success: true,
|
|
29171
29572
|
chartId: chartSummary.chartId,
|
|
@@ -29180,14 +29581,7 @@ async function buildChart(args, sessionState, requestId) {
|
|
|
29180
29581
|
text: JSON.stringify(output, null, 2)
|
|
29181
29582
|
}
|
|
29182
29583
|
],
|
|
29183
|
-
structuredContent: output
|
|
29184
|
-
...isMcpAppEnabled() ? {
|
|
29185
|
-
_meta: {
|
|
29186
|
-
sisenseUrl,
|
|
29187
|
-
sisenseToken,
|
|
29188
|
-
serializedWidgetProps
|
|
29189
|
-
}
|
|
29190
|
-
} : {}
|
|
29584
|
+
structuredContent: output
|
|
29191
29585
|
};
|
|
29192
29586
|
return finalOutput;
|
|
29193
29587
|
} catch (error40) {
|
|
@@ -29218,10 +29612,11 @@ var getDataSourcesOutputSchema = {
|
|
|
29218
29612
|
};
|
|
29219
29613
|
async function getDataSources(_args, sessionState) {
|
|
29220
29614
|
try {
|
|
29221
|
-
const
|
|
29615
|
+
const httpClient = getSessionHttpClient(sessionState);
|
|
29616
|
+
const { getDataSourcesEngine } = await import("./index-8027b2t7.js");
|
|
29222
29617
|
const getDataSourcesContext = {
|
|
29223
29618
|
toolCallId: "get-data-sources",
|
|
29224
|
-
httpClient
|
|
29619
|
+
httpClient
|
|
29225
29620
|
};
|
|
29226
29621
|
const result = await getDataSourcesEngine({}, getDataSourcesContext);
|
|
29227
29622
|
return {
|
|
@@ -29261,10 +29656,11 @@ var getDataSourceFieldsOutputSchema = {
|
|
|
29261
29656
|
async function getDataSourceFields(args, sessionState) {
|
|
29262
29657
|
const { dataSourceTitle } = args;
|
|
29263
29658
|
try {
|
|
29264
|
-
const
|
|
29659
|
+
const httpClient = getSessionHttpClient(sessionState);
|
|
29660
|
+
const { getDataSourceFieldsEngine } = await import("./index-8027b2t7.js");
|
|
29265
29661
|
const getDataSourceFieldsContext = {
|
|
29266
29662
|
toolCallId: "get-data-source-fields",
|
|
29267
|
-
httpClient
|
|
29663
|
+
httpClient
|
|
29268
29664
|
};
|
|
29269
29665
|
const result = await getDataSourceFieldsEngine({ dataSourceTitle }, getDataSourceFieldsContext);
|
|
29270
29666
|
return {
|
|
@@ -29558,7 +29954,7 @@ async function setupMcpServer(sessionState) {
|
|
|
29558
29954
|
getDataSourcesSchema,
|
|
29559
29955
|
getDataSourceFieldsSchema,
|
|
29560
29956
|
buildChartSchema
|
|
29561
|
-
} = await import("./index-
|
|
29957
|
+
} = await import("./index-8027b2t7.js");
|
|
29562
29958
|
const server = new McpServer({
|
|
29563
29959
|
name: "sisense-mcp-server",
|
|
29564
29960
|
version: "1.0.0"
|
|
@@ -29583,7 +29979,7 @@ async function setupMcpServer(sessionState) {
|
|
|
29583
29979
|
});
|
|
29584
29980
|
const buildChartOutputSchema = getBuildChartOutputSchema();
|
|
29585
29981
|
if (isMcpAppEnabled2()) {
|
|
29586
|
-
|
|
29982
|
+
hZ(server, TOOL_NAME_CHART_BUILDER, {
|
|
29587
29983
|
title: "Build Sisense Chart from User Prompt",
|
|
29588
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.",
|
|
29589
29985
|
inputSchema: buildChartSchema.shape,
|
|
@@ -29602,14 +29998,14 @@ async function setupMcpServer(sessionState) {
|
|
|
29602
29998
|
return await buildChart(args, sessionState);
|
|
29603
29999
|
});
|
|
29604
30000
|
}
|
|
29605
|
-
|
|
30001
|
+
mZ(server, ANALYTICS_RESOURCE_URI, ANALYTICS_RESOURCE_URI, { mimeType: u }, async () => {
|
|
29606
30002
|
const html = await readFile(path.join(DIST_DIR, "view.html"), "utf-8");
|
|
29607
30003
|
const meta = getCspMeta(sessionState);
|
|
29608
30004
|
return {
|
|
29609
30005
|
contents: [
|
|
29610
30006
|
{
|
|
29611
30007
|
uri: ANALYTICS_RESOURCE_URI,
|
|
29612
|
-
mimeType:
|
|
30008
|
+
mimeType: u,
|
|
29613
30009
|
text: html,
|
|
29614
30010
|
_meta: meta
|
|
29615
30011
|
}
|
|
@@ -29617,6 +30013,22 @@ async function setupMcpServer(sessionState) {
|
|
|
29617
30013
|
};
|
|
29618
30014
|
});
|
|
29619
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
|
+
});
|
|
29620
30032
|
return server;
|
|
29621
30033
|
} catch (error40) {
|
|
29622
30034
|
console.error("Error setting up MCP server:", error40);
|
|
@@ -29625,6 +30037,7 @@ async function setupMcpServer(sessionState) {
|
|
|
29625
30037
|
}
|
|
29626
30038
|
|
|
29627
30039
|
// src/sse-server.ts
|
|
30040
|
+
var PACKAGE_VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8")).version;
|
|
29628
30041
|
function createS3Client() {
|
|
29629
30042
|
if (!process.env.SCREENSHOTS_BUCKET) {
|
|
29630
30043
|
return null;
|
|
@@ -29648,6 +30061,7 @@ var server = createServer(async (req, res) => {
|
|
|
29648
30061
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
29649
30062
|
res.end(JSON.stringify({
|
|
29650
30063
|
status: "ok",
|
|
30064
|
+
version: PACKAGE_VERSION,
|
|
29651
30065
|
activeSessions: sessions.size
|
|
29652
30066
|
}));
|
|
29653
30067
|
return;
|
|
@@ -29655,6 +30069,11 @@ var server = createServer(async (req, res) => {
|
|
|
29655
30069
|
if (url2.pathname.startsWith("/screenshots/") && req.method === "GET") {
|
|
29656
30070
|
try {
|
|
29657
30071
|
const filename = url2.pathname.replace("/screenshots/", "");
|
|
30072
|
+
if (!filename) {
|
|
30073
|
+
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
30074
|
+
res.end("Screenshot not found");
|
|
30075
|
+
return;
|
|
30076
|
+
}
|
|
29658
30077
|
if (filename.includes("/") || filename.includes("..")) {
|
|
29659
30078
|
console.error("Invalid screenshot filename:", filename);
|
|
29660
30079
|
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
@@ -29751,11 +30170,11 @@ var server = createServer(async (req, res) => {
|
|
|
29751
30170
|
createOpenAIClient,
|
|
29752
30171
|
initializeHttpClient,
|
|
29753
30172
|
initializeOpenAIClient
|
|
29754
|
-
} = await import("./index-
|
|
30173
|
+
} = await import("./index-8027b2t7.js");
|
|
29755
30174
|
const httpClient = createHttpClientFromConfig({
|
|
29756
30175
|
url: validatedUrl,
|
|
29757
30176
|
token: validatedToken
|
|
29758
|
-
});
|
|
30177
|
+
}, { "x-sisense-origin": "mcp-server" });
|
|
29759
30178
|
if (initializeHttpClient) {
|
|
29760
30179
|
initializeHttpClient(httpClient);
|
|
29761
30180
|
}
|