@sisense/mcp-server 0.2.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/dist/{ai-3wz11tv8.js → ai-w2gkxdn7.js} +188 -188
- package/dist/{index-c0zk3ctc.js → index-xxces5vh.js} +17344 -17162
- package/dist/{sse-server-tg36wntb.js → sse-server-f7drtvty.js} +970 -788
- package/dist/{sse-server-dkaznf2x.js → sse-server-n5dmee25.js} +11921 -11695
- package/dist/{sse-server-xfrv5734.js → sse-server-r50cemee.js} +39 -16
- package/dist/{sse-server-qhqncg7f.js → sse-server-yrjhgg0x.js} +4 -1
- package/dist/sse-server.js +714 -190
- package/dist/view.html +826 -822
- package/dist/{widget-renderer-56n3m26y.js → widget-renderer-hynpvfm9.js} +5 -5
- package/package.json +6 -6
package/dist/sse-server.js
CHANGED
|
@@ -5,21 +5,22 @@ import {
|
|
|
5
5
|
objectType
|
|
6
6
|
} from "./sse-server-ss0mydv4.js";
|
|
7
7
|
import {
|
|
8
|
+
generateArtifactId,
|
|
8
9
|
require_dist_cjs as require_dist_cjs2,
|
|
9
10
|
sanitizeError,
|
|
10
11
|
sanitizeForDescription,
|
|
11
12
|
sanitizeForText,
|
|
12
13
|
validateToken,
|
|
13
14
|
validateUrl
|
|
14
|
-
} from "./sse-server-
|
|
15
|
+
} from "./sse-server-yrjhgg0x.js";
|
|
15
16
|
import {
|
|
16
17
|
require_dist_cjs
|
|
17
18
|
} from "./index-bgbnagw5.js";
|
|
18
19
|
import"./index-6vz3bc2n.js";
|
|
19
20
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./sse-server-
|
|
22
|
-
import"./sse-server-
|
|
21
|
+
ni
|
|
22
|
+
} from "./sse-server-f7drtvty.js";
|
|
23
|
+
import"./sse-server-r50cemee.js";
|
|
23
24
|
import"./sse-server-gcjj2741.js";
|
|
24
25
|
import"./sse-server-wb2h6nz7.js";
|
|
25
26
|
import"./sse-server-zmcz2c17.js";
|
|
@@ -522,17 +523,17 @@ var require_codegen = __commonJS((exports) => {
|
|
|
522
523
|
this.nodes = nodes;
|
|
523
524
|
}
|
|
524
525
|
render(opts) {
|
|
525
|
-
return this.nodes.reduce((code,
|
|
526
|
+
return this.nodes.reduce((code, n2) => code + n2.render(opts), "");
|
|
526
527
|
}
|
|
527
528
|
optimizeNodes() {
|
|
528
529
|
const { nodes } = this;
|
|
529
530
|
let i2 = nodes.length;
|
|
530
531
|
while (i2--) {
|
|
531
|
-
const
|
|
532
|
-
if (Array.isArray(
|
|
533
|
-
nodes.splice(i2, 1, ...
|
|
534
|
-
else if (
|
|
535
|
-
nodes[i2] =
|
|
532
|
+
const n2 = nodes[i2].optimizeNodes();
|
|
533
|
+
if (Array.isArray(n2))
|
|
534
|
+
nodes.splice(i2, 1, ...n2);
|
|
535
|
+
else if (n2)
|
|
536
|
+
nodes[i2] = n2;
|
|
536
537
|
else
|
|
537
538
|
nodes.splice(i2, 1);
|
|
538
539
|
}
|
|
@@ -542,16 +543,16 @@ var require_codegen = __commonJS((exports) => {
|
|
|
542
543
|
const { nodes } = this;
|
|
543
544
|
let i2 = nodes.length;
|
|
544
545
|
while (i2--) {
|
|
545
|
-
const
|
|
546
|
-
if (
|
|
546
|
+
const n2 = nodes[i2];
|
|
547
|
+
if (n2.optimizeNames(names, constants))
|
|
547
548
|
continue;
|
|
548
|
-
subtractNames(names,
|
|
549
|
+
subtractNames(names, n2.names);
|
|
549
550
|
nodes.splice(i2, 1);
|
|
550
551
|
}
|
|
551
552
|
return nodes.length > 0 ? this : undefined;
|
|
552
553
|
}
|
|
553
554
|
get names() {
|
|
554
|
-
return this.nodes.reduce((names,
|
|
555
|
+
return this.nodes.reduce((names, n2) => addNames(names, n2.names), {});
|
|
555
556
|
}
|
|
556
557
|
}
|
|
557
558
|
|
|
@@ -946,8 +947,8 @@ var require_codegen = __commonJS((exports) => {
|
|
|
946
947
|
endFunc() {
|
|
947
948
|
return this._endBlockNode(Func);
|
|
948
949
|
}
|
|
949
|
-
optimize(
|
|
950
|
-
while (
|
|
950
|
+
optimize(n2 = 1) {
|
|
951
|
+
while (n2-- > 0) {
|
|
951
952
|
this._root.optimizeNodes();
|
|
952
953
|
this._root.optimizeNames(this._root.names, this._constants);
|
|
953
954
|
}
|
|
@@ -961,19 +962,19 @@ var require_codegen = __commonJS((exports) => {
|
|
|
961
962
|
this._nodes.push(node);
|
|
962
963
|
}
|
|
963
964
|
_endBlockNode(N1, N2) {
|
|
964
|
-
const
|
|
965
|
-
if (
|
|
965
|
+
const n2 = this._currNode;
|
|
966
|
+
if (n2 instanceof N1 || N2 && n2 instanceof N2) {
|
|
966
967
|
this._nodes.pop();
|
|
967
968
|
return this;
|
|
968
969
|
}
|
|
969
970
|
throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`);
|
|
970
971
|
}
|
|
971
972
|
_elseNode(node) {
|
|
972
|
-
const
|
|
973
|
-
if (!(
|
|
973
|
+
const n2 = this._currNode;
|
|
974
|
+
if (!(n2 instanceof If)) {
|
|
974
975
|
throw new Error('CodeGen: "else" without "if"');
|
|
975
976
|
}
|
|
976
|
-
this._currNode =
|
|
977
|
+
this._currNode = n2.else = node;
|
|
977
978
|
return this;
|
|
978
979
|
}
|
|
979
980
|
get _root() {
|
|
@@ -990,8 +991,8 @@ var require_codegen = __commonJS((exports) => {
|
|
|
990
991
|
}
|
|
991
992
|
exports.CodeGen = CodeGen;
|
|
992
993
|
function addNames(names, from) {
|
|
993
|
-
for (const
|
|
994
|
-
names[
|
|
994
|
+
for (const n2 in from)
|
|
995
|
+
names[n2] = (names[n2] || 0) + (from[n2] || 0);
|
|
995
996
|
return names;
|
|
996
997
|
}
|
|
997
998
|
function addExprNames(names, from) {
|
|
@@ -1011,11 +1012,11 @@ var require_codegen = __commonJS((exports) => {
|
|
|
1011
1012
|
items.push(c);
|
|
1012
1013
|
return items;
|
|
1013
1014
|
}, []));
|
|
1014
|
-
function replaceName(
|
|
1015
|
-
const c = constants[
|
|
1016
|
-
if (c === undefined || names[
|
|
1017
|
-
return
|
|
1018
|
-
delete names[
|
|
1015
|
+
function replaceName(n2) {
|
|
1016
|
+
const c = constants[n2.str];
|
|
1017
|
+
if (c === undefined || names[n2.str] !== 1)
|
|
1018
|
+
return n2;
|
|
1019
|
+
delete names[n2.str];
|
|
1019
1020
|
return c;
|
|
1020
1021
|
}
|
|
1021
1022
|
function canOptimize(e2) {
|
|
@@ -1023,8 +1024,8 @@ var require_codegen = __commonJS((exports) => {
|
|
|
1023
1024
|
}
|
|
1024
1025
|
}
|
|
1025
1026
|
function subtractNames(names, from) {
|
|
1026
|
-
for (const
|
|
1027
|
-
names[
|
|
1027
|
+
for (const n2 in from)
|
|
1028
|
+
names[n2] = (names[n2] || 0) - (from[n2] || 0);
|
|
1028
1029
|
}
|
|
1029
1030
|
function not(x) {
|
|
1030
1031
|
return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._)`!${par(x)}`;
|
|
@@ -6886,17 +6887,17 @@ var require_codegen2 = __commonJS((exports) => {
|
|
|
6886
6887
|
this.nodes = nodes;
|
|
6887
6888
|
}
|
|
6888
6889
|
render(opts) {
|
|
6889
|
-
return this.nodes.reduce((code,
|
|
6890
|
+
return this.nodes.reduce((code, n2) => code + n2.render(opts), "");
|
|
6890
6891
|
}
|
|
6891
6892
|
optimizeNodes() {
|
|
6892
6893
|
const { nodes } = this;
|
|
6893
6894
|
let i2 = nodes.length;
|
|
6894
6895
|
while (i2--) {
|
|
6895
|
-
const
|
|
6896
|
-
if (Array.isArray(
|
|
6897
|
-
nodes.splice(i2, 1, ...
|
|
6898
|
-
else if (
|
|
6899
|
-
nodes[i2] =
|
|
6896
|
+
const n2 = nodes[i2].optimizeNodes();
|
|
6897
|
+
if (Array.isArray(n2))
|
|
6898
|
+
nodes.splice(i2, 1, ...n2);
|
|
6899
|
+
else if (n2)
|
|
6900
|
+
nodes[i2] = n2;
|
|
6900
6901
|
else
|
|
6901
6902
|
nodes.splice(i2, 1);
|
|
6902
6903
|
}
|
|
@@ -6906,16 +6907,16 @@ var require_codegen2 = __commonJS((exports) => {
|
|
|
6906
6907
|
const { nodes } = this;
|
|
6907
6908
|
let i2 = nodes.length;
|
|
6908
6909
|
while (i2--) {
|
|
6909
|
-
const
|
|
6910
|
-
if (
|
|
6910
|
+
const n2 = nodes[i2];
|
|
6911
|
+
if (n2.optimizeNames(names, constants))
|
|
6911
6912
|
continue;
|
|
6912
|
-
subtractNames(names,
|
|
6913
|
+
subtractNames(names, n2.names);
|
|
6913
6914
|
nodes.splice(i2, 1);
|
|
6914
6915
|
}
|
|
6915
6916
|
return nodes.length > 0 ? this : undefined;
|
|
6916
6917
|
}
|
|
6917
6918
|
get names() {
|
|
6918
|
-
return this.nodes.reduce((names,
|
|
6919
|
+
return this.nodes.reduce((names, n2) => addNames(names, n2.names), {});
|
|
6919
6920
|
}
|
|
6920
6921
|
}
|
|
6921
6922
|
|
|
@@ -7310,8 +7311,8 @@ var require_codegen2 = __commonJS((exports) => {
|
|
|
7310
7311
|
endFunc() {
|
|
7311
7312
|
return this._endBlockNode(Func);
|
|
7312
7313
|
}
|
|
7313
|
-
optimize(
|
|
7314
|
-
while (
|
|
7314
|
+
optimize(n2 = 1) {
|
|
7315
|
+
while (n2-- > 0) {
|
|
7315
7316
|
this._root.optimizeNodes();
|
|
7316
7317
|
this._root.optimizeNames(this._root.names, this._constants);
|
|
7317
7318
|
}
|
|
@@ -7325,19 +7326,19 @@ var require_codegen2 = __commonJS((exports) => {
|
|
|
7325
7326
|
this._nodes.push(node);
|
|
7326
7327
|
}
|
|
7327
7328
|
_endBlockNode(N1, N2) {
|
|
7328
|
-
const
|
|
7329
|
-
if (
|
|
7329
|
+
const n2 = this._currNode;
|
|
7330
|
+
if (n2 instanceof N1 || N2 && n2 instanceof N2) {
|
|
7330
7331
|
this._nodes.pop();
|
|
7331
7332
|
return this;
|
|
7332
7333
|
}
|
|
7333
7334
|
throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`);
|
|
7334
7335
|
}
|
|
7335
7336
|
_elseNode(node) {
|
|
7336
|
-
const
|
|
7337
|
-
if (!(
|
|
7337
|
+
const n2 = this._currNode;
|
|
7338
|
+
if (!(n2 instanceof If)) {
|
|
7338
7339
|
throw new Error('CodeGen: "else" without "if"');
|
|
7339
7340
|
}
|
|
7340
|
-
this._currNode =
|
|
7341
|
+
this._currNode = n2.else = node;
|
|
7341
7342
|
return this;
|
|
7342
7343
|
}
|
|
7343
7344
|
get _root() {
|
|
@@ -7354,8 +7355,8 @@ var require_codegen2 = __commonJS((exports) => {
|
|
|
7354
7355
|
}
|
|
7355
7356
|
exports.CodeGen = CodeGen;
|
|
7356
7357
|
function addNames(names, from) {
|
|
7357
|
-
for (const
|
|
7358
|
-
names[
|
|
7358
|
+
for (const n2 in from)
|
|
7359
|
+
names[n2] = (names[n2] || 0) + (from[n2] || 0);
|
|
7359
7360
|
return names;
|
|
7360
7361
|
}
|
|
7361
7362
|
function addExprNames(names, from) {
|
|
@@ -7375,11 +7376,11 @@ var require_codegen2 = __commonJS((exports) => {
|
|
|
7375
7376
|
items.push(c);
|
|
7376
7377
|
return items;
|
|
7377
7378
|
}, []));
|
|
7378
|
-
function replaceName(
|
|
7379
|
-
const c = constants[
|
|
7380
|
-
if (c === undefined || names[
|
|
7381
|
-
return
|
|
7382
|
-
delete names[
|
|
7379
|
+
function replaceName(n2) {
|
|
7380
|
+
const c = constants[n2.str];
|
|
7381
|
+
if (c === undefined || names[n2.str] !== 1)
|
|
7382
|
+
return n2;
|
|
7383
|
+
delete names[n2.str];
|
|
7383
7384
|
return c;
|
|
7384
7385
|
}
|
|
7385
7386
|
function canOptimize(e2) {
|
|
@@ -7387,8 +7388,8 @@ var require_codegen2 = __commonJS((exports) => {
|
|
|
7387
7388
|
}
|
|
7388
7389
|
}
|
|
7389
7390
|
function subtractNames(names, from) {
|
|
7390
|
-
for (const
|
|
7391
|
-
names[
|
|
7391
|
+
for (const n2 in from)
|
|
7392
|
+
names[n2] = (names[n2] || 0) - (from[n2] || 0);
|
|
7392
7393
|
}
|
|
7393
7394
|
function not(x) {
|
|
7394
7395
|
return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._)`!${par(x)}`;
|
|
@@ -23564,7 +23565,7 @@ var AssertObjectSchema = custom((v) => v !== null && (typeof v === "object" || t
|
|
|
23564
23565
|
var ProgressTokenSchema = union([string2(), number2().int()]);
|
|
23565
23566
|
var CursorSchema = string2();
|
|
23566
23567
|
var TaskCreationParamsSchema = looseObject({
|
|
23567
|
-
ttl:
|
|
23568
|
+
ttl: number2().optional(),
|
|
23568
23569
|
pollInterval: number2().optional()
|
|
23569
23570
|
});
|
|
23570
23571
|
var TaskMetadataSchema = object({
|
|
@@ -23718,7 +23719,8 @@ var ClientCapabilitiesSchema = object({
|
|
|
23718
23719
|
roots: object({
|
|
23719
23720
|
listChanged: boolean2().optional()
|
|
23720
23721
|
}).optional(),
|
|
23721
|
-
tasks: ClientTasksCapabilitySchema.optional()
|
|
23722
|
+
tasks: ClientTasksCapabilitySchema.optional(),
|
|
23723
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
23722
23724
|
});
|
|
23723
23725
|
var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
23724
23726
|
protocolVersion: string2(),
|
|
@@ -23744,7 +23746,8 @@ var ServerCapabilitiesSchema = object({
|
|
|
23744
23746
|
tools: object({
|
|
23745
23747
|
listChanged: boolean2().optional()
|
|
23746
23748
|
}).optional(),
|
|
23747
|
-
tasks: ServerTasksCapabilitySchema.optional()
|
|
23749
|
+
tasks: ServerTasksCapabilitySchema.optional(),
|
|
23750
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
23748
23751
|
});
|
|
23749
23752
|
var InitializeResultSchema = ResultSchema.extend({
|
|
23750
23753
|
protocolVersion: string2(),
|
|
@@ -23859,6 +23862,7 @@ var ResourceSchema = object({
|
|
|
23859
23862
|
uri: string2(),
|
|
23860
23863
|
description: optional(string2()),
|
|
23861
23864
|
mimeType: optional(string2()),
|
|
23865
|
+
size: optional(number2()),
|
|
23862
23866
|
annotations: AnnotationsSchema.optional(),
|
|
23863
23867
|
_meta: optional(looseObject({}))
|
|
23864
23868
|
});
|
|
@@ -26859,6 +26863,10 @@ class Protocol {
|
|
|
26859
26863
|
this._progressHandlers.clear();
|
|
26860
26864
|
this._taskProgressTokens.clear();
|
|
26861
26865
|
this._pendingDebouncedNotifications.clear();
|
|
26866
|
+
for (const info of this._timeoutInfo.values()) {
|
|
26867
|
+
clearTimeout(info.timeoutId);
|
|
26868
|
+
}
|
|
26869
|
+
this._timeoutInfo.clear();
|
|
26862
26870
|
for (const controller of this._requestHandlerAbortControllers.values()) {
|
|
26863
26871
|
controller.abort();
|
|
26864
26872
|
}
|
|
@@ -26989,7 +26997,9 @@ class Protocol {
|
|
|
26989
26997
|
await capturedTransport?.send(errorResponse);
|
|
26990
26998
|
}
|
|
26991
26999
|
}).catch((error40) => this._onerror(new Error(`Failed to send response: ${error40}`))).finally(() => {
|
|
26992
|
-
this._requestHandlerAbortControllers.
|
|
27000
|
+
if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
|
|
27001
|
+
this._requestHandlerAbortControllers.delete(request.id);
|
|
27002
|
+
}
|
|
26993
27003
|
});
|
|
26994
27004
|
}
|
|
26995
27005
|
_onprogress(notification) {
|
|
@@ -27491,10 +27501,74 @@ function mergeCapabilities(base, additional) {
|
|
|
27491
27501
|
}
|
|
27492
27502
|
|
|
27493
27503
|
// node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.js
|
|
27504
|
+
class j extends Protocol {
|
|
27505
|
+
_registeredMethods = new Set;
|
|
27506
|
+
_eventSlots = new Map;
|
|
27507
|
+
onEventDispatch(Z, $) {}
|
|
27508
|
+
_ensureEventSlot(Z) {
|
|
27509
|
+
let $ = this._eventSlots.get(Z);
|
|
27510
|
+
if (!$) {
|
|
27511
|
+
let J = this.eventSchemas[Z];
|
|
27512
|
+
if (!J)
|
|
27513
|
+
throw Error(`Unknown event: ${String(Z)}`);
|
|
27514
|
+
$ = { listeners: [] }, this._eventSlots.set(Z, $);
|
|
27515
|
+
let X = J.shape.method.value;
|
|
27516
|
+
this._registeredMethods.add(X);
|
|
27517
|
+
let V = $;
|
|
27518
|
+
super.setNotificationHandler(J, (D) => {
|
|
27519
|
+
let G = D.params;
|
|
27520
|
+
this.onEventDispatch(Z, G), V.onHandler?.(G);
|
|
27521
|
+
for (let L of [...V.listeners])
|
|
27522
|
+
L(G);
|
|
27523
|
+
});
|
|
27524
|
+
}
|
|
27525
|
+
return $;
|
|
27526
|
+
}
|
|
27527
|
+
setEventHandler(Z, $) {
|
|
27528
|
+
let J = this._ensureEventSlot(Z);
|
|
27529
|
+
if (J.onHandler && $)
|
|
27530
|
+
console.warn(`[MCP Apps] on${String(Z)} handler replaced. Use addEventListener("${String(Z)}", …) to add multiple listeners without replacing.`);
|
|
27531
|
+
J.onHandler = $;
|
|
27532
|
+
}
|
|
27533
|
+
getEventHandler(Z) {
|
|
27534
|
+
return this._eventSlots.get(Z)?.onHandler;
|
|
27535
|
+
}
|
|
27536
|
+
addEventListener(Z, $) {
|
|
27537
|
+
this._ensureEventSlot(Z).listeners.push($);
|
|
27538
|
+
}
|
|
27539
|
+
removeEventListener(Z, $) {
|
|
27540
|
+
let J = this._eventSlots.get(Z);
|
|
27541
|
+
if (!J)
|
|
27542
|
+
return;
|
|
27543
|
+
let X = J.listeners.indexOf($);
|
|
27544
|
+
if (X !== -1)
|
|
27545
|
+
J.listeners.splice(X, 1);
|
|
27546
|
+
}
|
|
27547
|
+
setRequestHandler = (Z, $) => {
|
|
27548
|
+
this._assertMethodNotRegistered(Z, "setRequestHandler"), super.setRequestHandler(Z, $);
|
|
27549
|
+
};
|
|
27550
|
+
setNotificationHandler = (Z, $) => {
|
|
27551
|
+
this._assertMethodNotRegistered(Z, "setNotificationHandler"), super.setNotificationHandler(Z, $);
|
|
27552
|
+
};
|
|
27553
|
+
warnIfRequestHandlerReplaced(Z, $, J) {
|
|
27554
|
+
if ($ && J)
|
|
27555
|
+
console.warn(`[MCP Apps] ${Z} handler replaced. Previous handler will no longer be called.`);
|
|
27556
|
+
}
|
|
27557
|
+
replaceRequestHandler = (Z, $) => {
|
|
27558
|
+
let J = Z.shape.method.value;
|
|
27559
|
+
this._registeredMethods.add(J), super.setRequestHandler(Z, $);
|
|
27560
|
+
};
|
|
27561
|
+
_assertMethodNotRegistered(Z, $) {
|
|
27562
|
+
let J = Z.shape.method.value;
|
|
27563
|
+
if (this._registeredMethods.has(J))
|
|
27564
|
+
throw Error(`Handler for "${J}" already registered (via ${$}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);
|
|
27565
|
+
this._registeredMethods.add(J);
|
|
27566
|
+
}
|
|
27567
|
+
}
|
|
27494
27568
|
var F = "2026-01-26";
|
|
27495
27569
|
var z = "ui/notifications/tool-input-partial";
|
|
27496
27570
|
|
|
27497
|
-
class
|
|
27571
|
+
class B {
|
|
27498
27572
|
eventTarget;
|
|
27499
27573
|
eventSource;
|
|
27500
27574
|
messageListener;
|
|
@@ -27532,10 +27606,10 @@ class j {
|
|
|
27532
27606
|
sessionId;
|
|
27533
27607
|
setProtocolVersion;
|
|
27534
27608
|
}
|
|
27535
|
-
var
|
|
27536
|
-
var
|
|
27609
|
+
var S = exports_external2.union([exports_external2.literal("light"), exports_external2.literal("dark")]).describe("Color theme preference for the host environment.");
|
|
27610
|
+
var W = exports_external2.union([exports_external2.literal("inline"), exports_external2.literal("fullscreen"), exports_external2.literal("pip")]).describe("Display mode for UI presentation.");
|
|
27537
27611
|
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
|
|
27612
|
+
var n = exports_external2.record(i.describe(`Style variables for theming MCP apps.
|
|
27539
27613
|
|
|
27540
27614
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
27541
27615
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
@@ -27554,29 +27628,30 @@ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
|
27554
27628
|
|
|
27555
27629
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
27556
27630
|
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);
|
|
27557
|
-
var
|
|
27631
|
+
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
27632
|
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
27633
|
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
27634
|
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
|
|
27562
|
-
var
|
|
27635
|
+
var a = exports_external2.object({ method: exports_external2.literal("ui/notifications/sandbox-proxy-ready"), params: exports_external2.object({}) });
|
|
27636
|
+
var K = exports_external2.object({ connectDomains: exports_external2.array(exports_external2.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
27563
27637
|
|
|
27564
27638
|
- Maps to CSP \`connect-src\` directive
|
|
27565
27639
|
- 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
|
|
27567
|
-
var
|
|
27640
|
+
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.") });
|
|
27641
|
+
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
27642
|
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
27643
|
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
27644
|
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
|
|
27572
|
-
var C = exports_external2.object({ variables:
|
|
27645
|
+
var b = exports_external2.object({ fonts: exports_external2.string().optional() });
|
|
27646
|
+
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
27647
|
var _ = exports_external2.object({ method: exports_external2.literal("ui/resource-teardown"), params: exports_external2.object({}) });
|
|
27574
|
-
var
|
|
27648
|
+
var t = exports_external2.record(exports_external2.string(), exports_external2.unknown());
|
|
27575
27649
|
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
|
|
27577
|
-
var
|
|
27650
|
+
var e = exports_external2.object({ method: exports_external2.literal("ui/notifications/request-teardown"), params: exports_external2.object({}).optional() });
|
|
27651
|
+
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.") });
|
|
27652
|
+
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
27653
|
var QQ = exports_external2.object({ method: exports_external2.literal("ui/notifications/initialized"), params: exports_external2.object({}).optional() });
|
|
27579
|
-
var ZQ = exports_external2.object({ csp:
|
|
27654
|
+
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
27655
|
|
|
27581
27656
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
27582
27657
|
|
|
@@ -27591,33 +27666,38 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
27591
27666
|
- \`true\`: request visible border + background
|
|
27592
27667
|
- \`false\`: request no visible border + background
|
|
27593
27668
|
- omitted: host decides border`) });
|
|
27594
|
-
var $Q = exports_external2.object({ method: exports_external2.literal("ui/request-display-mode"), params: exports_external2.object({ mode:
|
|
27595
|
-
var T = exports_external2.object({ mode:
|
|
27669
|
+
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.") }) });
|
|
27670
|
+
var T = exports_external2.object({ mode: W.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough();
|
|
27596
27671
|
var f = exports_external2.union([exports_external2.literal("model"), exports_external2.literal("app")]).describe("Tool visibility scope - who can access the tool.");
|
|
27597
27672
|
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
27673
|
- "model": Tool visible to and callable by the agent
|
|
27599
27674
|
- "app": Tool callable by the app from this server only`) });
|
|
27600
|
-
var
|
|
27675
|
+
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
27676
|
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
27677
|
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:
|
|
27604
|
-
var
|
|
27605
|
-
var
|
|
27678
|
+
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.") }) });
|
|
27679
|
+
var R = exports_external2.object({ method: exports_external2.literal("ui/notifications/tool-result"), params: CallToolResultSchema.describe("Standard MCP tool execution result.") });
|
|
27680
|
+
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
27681
|
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
|
|
27608
|
-
var
|
|
27609
|
-
var
|
|
27610
|
-
var
|
|
27611
|
-
var
|
|
27612
|
-
var
|
|
27613
|
-
|
|
27614
|
-
class
|
|
27682
|
+
var U = exports_external2.object({ method: exports_external2.literal("ui/notifications/host-context-changed"), params: E.describe("Partial context update containing only changed fields.") });
|
|
27683
|
+
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.") }) });
|
|
27684
|
+
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.") }) });
|
|
27685
|
+
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();
|
|
27686
|
+
var M = "ui/resourceUri";
|
|
27687
|
+
var u = "text/html;profile=mcp-app";
|
|
27688
|
+
|
|
27689
|
+
class zQ extends j {
|
|
27615
27690
|
_appInfo;
|
|
27616
27691
|
_capabilities;
|
|
27617
27692
|
options;
|
|
27618
27693
|
_hostCapabilities;
|
|
27619
27694
|
_hostInfo;
|
|
27620
27695
|
_hostContext;
|
|
27696
|
+
eventSchemas = { toolinput: A, toolinputpartial: P, toolresult: R, toolcancelled: H, hostcontextchanged: U };
|
|
27697
|
+
onEventDispatch(Z, $) {
|
|
27698
|
+
if (Z === "hostcontextchanged")
|
|
27699
|
+
this._hostContext = { ...this._hostContext, ...$ };
|
|
27700
|
+
}
|
|
27621
27701
|
constructor(Z, $ = {}, J = { autoResize: true }) {
|
|
27622
27702
|
super(J);
|
|
27623
27703
|
this._appInfo = Z;
|
|
@@ -27625,7 +27705,7 @@ class qQ extends Protocol {
|
|
|
27625
27705
|
this.options = J;
|
|
27626
27706
|
this.setRequestHandler(PingRequestSchema, (X) => {
|
|
27627
27707
|
return console.log("Received ping:", X.params), {};
|
|
27628
|
-
}), this.
|
|
27708
|
+
}), this.setEventHandler("hostcontextchanged", undefined);
|
|
27629
27709
|
}
|
|
27630
27710
|
getHostCapabilities() {
|
|
27631
27711
|
return this._hostCapabilities;
|
|
@@ -27636,31 +27716,68 @@ class qQ extends Protocol {
|
|
|
27636
27716
|
getHostContext() {
|
|
27637
27717
|
return this._hostContext;
|
|
27638
27718
|
}
|
|
27719
|
+
get ontoolinput() {
|
|
27720
|
+
return this.getEventHandler("toolinput");
|
|
27721
|
+
}
|
|
27639
27722
|
set ontoolinput(Z) {
|
|
27640
|
-
this.
|
|
27723
|
+
this.setEventHandler("toolinput", Z);
|
|
27724
|
+
}
|
|
27725
|
+
get ontoolinputpartial() {
|
|
27726
|
+
return this.getEventHandler("toolinputpartial");
|
|
27641
27727
|
}
|
|
27642
27728
|
set ontoolinputpartial(Z) {
|
|
27643
|
-
this.
|
|
27729
|
+
this.setEventHandler("toolinputpartial", Z);
|
|
27730
|
+
}
|
|
27731
|
+
get ontoolresult() {
|
|
27732
|
+
return this.getEventHandler("toolresult");
|
|
27644
27733
|
}
|
|
27645
27734
|
set ontoolresult(Z) {
|
|
27646
|
-
this.
|
|
27735
|
+
this.setEventHandler("toolresult", Z);
|
|
27736
|
+
}
|
|
27737
|
+
get ontoolcancelled() {
|
|
27738
|
+
return this.getEventHandler("toolcancelled");
|
|
27647
27739
|
}
|
|
27648
27740
|
set ontoolcancelled(Z) {
|
|
27649
|
-
this.
|
|
27741
|
+
this.setEventHandler("toolcancelled", Z);
|
|
27742
|
+
}
|
|
27743
|
+
get onhostcontextchanged() {
|
|
27744
|
+
return this.getEventHandler("hostcontextchanged");
|
|
27650
27745
|
}
|
|
27651
27746
|
set onhostcontextchanged(Z) {
|
|
27652
|
-
this.
|
|
27653
|
-
|
|
27654
|
-
|
|
27747
|
+
this.setEventHandler("hostcontextchanged", Z);
|
|
27748
|
+
}
|
|
27749
|
+
_onteardown;
|
|
27750
|
+
get onteardown() {
|
|
27751
|
+
return this._onteardown;
|
|
27655
27752
|
}
|
|
27656
27753
|
set onteardown(Z) {
|
|
27657
|
-
this.
|
|
27754
|
+
this.warnIfRequestHandlerReplaced("onteardown", this._onteardown, Z), this._onteardown = Z, this.replaceRequestHandler(_, ($, J) => {
|
|
27755
|
+
if (!this._onteardown)
|
|
27756
|
+
throw Error("No onteardown handler set");
|
|
27757
|
+
return this._onteardown($.params, J);
|
|
27758
|
+
});
|
|
27759
|
+
}
|
|
27760
|
+
_oncalltool;
|
|
27761
|
+
get oncalltool() {
|
|
27762
|
+
return this._oncalltool;
|
|
27658
27763
|
}
|
|
27659
27764
|
set oncalltool(Z) {
|
|
27660
|
-
this.
|
|
27765
|
+
this.warnIfRequestHandlerReplaced("oncalltool", this._oncalltool, Z), this._oncalltool = Z, this.replaceRequestHandler(CallToolRequestSchema, ($, J) => {
|
|
27766
|
+
if (!this._oncalltool)
|
|
27767
|
+
throw Error("No oncalltool handler set");
|
|
27768
|
+
return this._oncalltool($.params, J);
|
|
27769
|
+
});
|
|
27770
|
+
}
|
|
27771
|
+
_onlisttools;
|
|
27772
|
+
get onlisttools() {
|
|
27773
|
+
return this._onlisttools;
|
|
27661
27774
|
}
|
|
27662
27775
|
set onlisttools(Z) {
|
|
27663
|
-
this.
|
|
27776
|
+
this.warnIfRequestHandlerReplaced("onlisttools", this._onlisttools, Z), this._onlisttools = Z, this.replaceRequestHandler(ListToolsRequestSchema, ($, J) => {
|
|
27777
|
+
if (!this._onlisttools)
|
|
27778
|
+
throw Error("No onlisttools handler set");
|
|
27779
|
+
return this._onlisttools($.params, J);
|
|
27780
|
+
});
|
|
27664
27781
|
}
|
|
27665
27782
|
assertCapabilityForMethod(Z) {}
|
|
27666
27783
|
assertRequestHandlerCapability(Z) {
|
|
@@ -27711,6 +27828,9 @@ class qQ extends Protocol {
|
|
|
27711
27828
|
downloadFile(Z, $) {
|
|
27712
27829
|
return this.request({ method: "ui/download-file", params: Z }, I, $);
|
|
27713
27830
|
}
|
|
27831
|
+
requestTeardown(Z = {}) {
|
|
27832
|
+
return this.notification({ method: "ui/notifications/request-teardown", params: Z });
|
|
27833
|
+
}
|
|
27714
27834
|
requestDisplayMode(Z, $) {
|
|
27715
27835
|
return this.request({ method: "ui/request-display-mode", params: Z }, T, $);
|
|
27716
27836
|
}
|
|
@@ -27723,25 +27843,25 @@ class qQ extends Protocol {
|
|
|
27723
27843
|
return;
|
|
27724
27844
|
Z = true, requestAnimationFrame(() => {
|
|
27725
27845
|
Z = false;
|
|
27726
|
-
let
|
|
27727
|
-
|
|
27728
|
-
let
|
|
27729
|
-
|
|
27730
|
-
let
|
|
27731
|
-
if (
|
|
27732
|
-
$ =
|
|
27846
|
+
let D = document.documentElement, G = D.style.height;
|
|
27847
|
+
D.style.height = "max-content";
|
|
27848
|
+
let L = Math.ceil(D.getBoundingClientRect().height);
|
|
27849
|
+
D.style.height = G;
|
|
27850
|
+
let Y = Math.ceil(window.innerWidth);
|
|
27851
|
+
if (Y !== $ || L !== J)
|
|
27852
|
+
$ = Y, J = L, this.sendSizeChanged({ width: Y, height: L });
|
|
27733
27853
|
});
|
|
27734
27854
|
};
|
|
27735
27855
|
X();
|
|
27736
|
-
let
|
|
27737
|
-
return
|
|
27856
|
+
let V = new ResizeObserver(X);
|
|
27857
|
+
return V.observe(document.documentElement), V.observe(document.body), () => V.disconnect();
|
|
27738
27858
|
}
|
|
27739
|
-
async connect(Z = new
|
|
27859
|
+
async connect(Z = new B(window.parent, window.parent), $) {
|
|
27740
27860
|
if (this.transport)
|
|
27741
27861
|
throw Error("App is already connected. Call close() before connecting again.");
|
|
27742
27862
|
await super.connect(Z);
|
|
27743
27863
|
try {
|
|
27744
|
-
let J = await this.request({ method: "ui/initialize", params: { appCapabilities: this._capabilities, appInfo: this._appInfo, protocolVersion: F } },
|
|
27864
|
+
let J = await this.request({ method: "ui/initialize", params: { appCapabilities: this._capabilities, appInfo: this._appInfo, protocolVersion: F } }, k, $);
|
|
27745
27865
|
if (J === undefined)
|
|
27746
27866
|
throw Error(`Server sent invalid initialize result: ${J}`);
|
|
27747
27867
|
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 +27871,16 @@ class qQ extends Protocol {
|
|
|
27751
27871
|
}
|
|
27752
27872
|
}
|
|
27753
27873
|
}
|
|
27754
|
-
function
|
|
27755
|
-
let
|
|
27756
|
-
if (
|
|
27757
|
-
|
|
27758
|
-
else if (G && !
|
|
27759
|
-
|
|
27760
|
-
return Z.registerTool($, { ...J, _meta:
|
|
27874
|
+
function hZ(Z, $, J, X) {
|
|
27875
|
+
let V = J._meta, D = V.ui, G = V[M], L = V;
|
|
27876
|
+
if (D?.resourceUri && !G)
|
|
27877
|
+
L = { ...V, [M]: D.resourceUri };
|
|
27878
|
+
else if (G && !D?.resourceUri)
|
|
27879
|
+
L = { ...V, ui: { ...D, resourceUri: G } };
|
|
27880
|
+
return Z.registerTool($, { ...J, _meta: L }, X);
|
|
27761
27881
|
}
|
|
27762
|
-
function
|
|
27763
|
-
return Z.registerResource($, J, { mimeType:
|
|
27882
|
+
function mZ(Z, $, J, X, V) {
|
|
27883
|
+
return Z.registerResource($, J, { mimeType: u, ...X }, V);
|
|
27764
27884
|
}
|
|
27765
27885
|
|
|
27766
27886
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
|
|
@@ -28263,6 +28383,224 @@ var McpZodTypeKind;
|
|
|
28263
28383
|
McpZodTypeKind2["Completable"] = "McpCompletable";
|
|
28264
28384
|
})(McpZodTypeKind || (McpZodTypeKind = {}));
|
|
28265
28385
|
|
|
28386
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js
|
|
28387
|
+
var MAX_TEMPLATE_LENGTH = 1e6;
|
|
28388
|
+
var MAX_VARIABLE_LENGTH = 1e6;
|
|
28389
|
+
var MAX_TEMPLATE_EXPRESSIONS = 1e4;
|
|
28390
|
+
var MAX_REGEX_LENGTH = 1e6;
|
|
28391
|
+
|
|
28392
|
+
class UriTemplate {
|
|
28393
|
+
static isTemplate(str) {
|
|
28394
|
+
return /\{[^}\s]+\}/.test(str);
|
|
28395
|
+
}
|
|
28396
|
+
static validateLength(str, max, context) {
|
|
28397
|
+
if (str.length > max) {
|
|
28398
|
+
throw new Error(`${context} exceeds maximum length of ${max} characters (got ${str.length})`);
|
|
28399
|
+
}
|
|
28400
|
+
}
|
|
28401
|
+
get variableNames() {
|
|
28402
|
+
return this.parts.flatMap((part) => typeof part === "string" ? [] : part.names);
|
|
28403
|
+
}
|
|
28404
|
+
constructor(template) {
|
|
28405
|
+
UriTemplate.validateLength(template, MAX_TEMPLATE_LENGTH, "Template");
|
|
28406
|
+
this.template = template;
|
|
28407
|
+
this.parts = this.parse(template);
|
|
28408
|
+
}
|
|
28409
|
+
toString() {
|
|
28410
|
+
return this.template;
|
|
28411
|
+
}
|
|
28412
|
+
parse(template) {
|
|
28413
|
+
const parts = [];
|
|
28414
|
+
let currentText = "";
|
|
28415
|
+
let i2 = 0;
|
|
28416
|
+
let expressionCount = 0;
|
|
28417
|
+
while (i2 < template.length) {
|
|
28418
|
+
if (template[i2] === "{") {
|
|
28419
|
+
if (currentText) {
|
|
28420
|
+
parts.push(currentText);
|
|
28421
|
+
currentText = "";
|
|
28422
|
+
}
|
|
28423
|
+
const end = template.indexOf("}", i2);
|
|
28424
|
+
if (end === -1)
|
|
28425
|
+
throw new Error("Unclosed template expression");
|
|
28426
|
+
expressionCount++;
|
|
28427
|
+
if (expressionCount > MAX_TEMPLATE_EXPRESSIONS) {
|
|
28428
|
+
throw new Error(`Template contains too many expressions (max ${MAX_TEMPLATE_EXPRESSIONS})`);
|
|
28429
|
+
}
|
|
28430
|
+
const expr = template.slice(i2 + 1, end);
|
|
28431
|
+
const operator = this.getOperator(expr);
|
|
28432
|
+
const exploded = expr.includes("*");
|
|
28433
|
+
const names = this.getNames(expr);
|
|
28434
|
+
const name = names[0];
|
|
28435
|
+
for (const name2 of names) {
|
|
28436
|
+
UriTemplate.validateLength(name2, MAX_VARIABLE_LENGTH, "Variable name");
|
|
28437
|
+
}
|
|
28438
|
+
parts.push({ name, operator, names, exploded });
|
|
28439
|
+
i2 = end + 1;
|
|
28440
|
+
} else {
|
|
28441
|
+
currentText += template[i2];
|
|
28442
|
+
i2++;
|
|
28443
|
+
}
|
|
28444
|
+
}
|
|
28445
|
+
if (currentText) {
|
|
28446
|
+
parts.push(currentText);
|
|
28447
|
+
}
|
|
28448
|
+
return parts;
|
|
28449
|
+
}
|
|
28450
|
+
getOperator(expr) {
|
|
28451
|
+
const operators = ["+", "#", ".", "/", "?", "&"];
|
|
28452
|
+
return operators.find((op) => expr.startsWith(op)) || "";
|
|
28453
|
+
}
|
|
28454
|
+
getNames(expr) {
|
|
28455
|
+
const operator = this.getOperator(expr);
|
|
28456
|
+
return expr.slice(operator.length).split(",").map((name) => name.replace("*", "").trim()).filter((name) => name.length > 0);
|
|
28457
|
+
}
|
|
28458
|
+
encodeValue(value, operator) {
|
|
28459
|
+
UriTemplate.validateLength(value, MAX_VARIABLE_LENGTH, "Variable value");
|
|
28460
|
+
if (operator === "+" || operator === "#") {
|
|
28461
|
+
return encodeURI(value);
|
|
28462
|
+
}
|
|
28463
|
+
return encodeURIComponent(value);
|
|
28464
|
+
}
|
|
28465
|
+
expandPart(part, variables) {
|
|
28466
|
+
if (part.operator === "?" || part.operator === "&") {
|
|
28467
|
+
const pairs = part.names.map((name) => {
|
|
28468
|
+
const value2 = variables[name];
|
|
28469
|
+
if (value2 === undefined)
|
|
28470
|
+
return "";
|
|
28471
|
+
const encoded2 = Array.isArray(value2) ? value2.map((v2) => this.encodeValue(v2, part.operator)).join(",") : this.encodeValue(value2.toString(), part.operator);
|
|
28472
|
+
return `${name}=${encoded2}`;
|
|
28473
|
+
}).filter((pair) => pair.length > 0);
|
|
28474
|
+
if (pairs.length === 0)
|
|
28475
|
+
return "";
|
|
28476
|
+
const separator = part.operator === "?" ? "?" : "&";
|
|
28477
|
+
return separator + pairs.join("&");
|
|
28478
|
+
}
|
|
28479
|
+
if (part.names.length > 1) {
|
|
28480
|
+
const values2 = part.names.map((name) => variables[name]).filter((v2) => v2 !== undefined);
|
|
28481
|
+
if (values2.length === 0)
|
|
28482
|
+
return "";
|
|
28483
|
+
return values2.map((v2) => Array.isArray(v2) ? v2[0] : v2).join(",");
|
|
28484
|
+
}
|
|
28485
|
+
const value = variables[part.name];
|
|
28486
|
+
if (value === undefined)
|
|
28487
|
+
return "";
|
|
28488
|
+
const values = Array.isArray(value) ? value : [value];
|
|
28489
|
+
const encoded = values.map((v2) => this.encodeValue(v2, part.operator));
|
|
28490
|
+
switch (part.operator) {
|
|
28491
|
+
case "":
|
|
28492
|
+
return encoded.join(",");
|
|
28493
|
+
case "+":
|
|
28494
|
+
return encoded.join(",");
|
|
28495
|
+
case "#":
|
|
28496
|
+
return "#" + encoded.join(",");
|
|
28497
|
+
case ".":
|
|
28498
|
+
return "." + encoded.join(".");
|
|
28499
|
+
case "/":
|
|
28500
|
+
return "/" + encoded.join("/");
|
|
28501
|
+
default:
|
|
28502
|
+
return encoded.join(",");
|
|
28503
|
+
}
|
|
28504
|
+
}
|
|
28505
|
+
expand(variables) {
|
|
28506
|
+
let result = "";
|
|
28507
|
+
let hasQueryParam = false;
|
|
28508
|
+
for (const part of this.parts) {
|
|
28509
|
+
if (typeof part === "string") {
|
|
28510
|
+
result += part;
|
|
28511
|
+
continue;
|
|
28512
|
+
}
|
|
28513
|
+
const expanded = this.expandPart(part, variables);
|
|
28514
|
+
if (!expanded)
|
|
28515
|
+
continue;
|
|
28516
|
+
if ((part.operator === "?" || part.operator === "&") && hasQueryParam) {
|
|
28517
|
+
result += expanded.replace("?", "&");
|
|
28518
|
+
} else {
|
|
28519
|
+
result += expanded;
|
|
28520
|
+
}
|
|
28521
|
+
if (part.operator === "?" || part.operator === "&") {
|
|
28522
|
+
hasQueryParam = true;
|
|
28523
|
+
}
|
|
28524
|
+
}
|
|
28525
|
+
return result;
|
|
28526
|
+
}
|
|
28527
|
+
escapeRegExp(str) {
|
|
28528
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
28529
|
+
}
|
|
28530
|
+
partToRegExp(part) {
|
|
28531
|
+
const patterns = [];
|
|
28532
|
+
for (const name2 of part.names) {
|
|
28533
|
+
UriTemplate.validateLength(name2, MAX_VARIABLE_LENGTH, "Variable name");
|
|
28534
|
+
}
|
|
28535
|
+
if (part.operator === "?" || part.operator === "&") {
|
|
28536
|
+
for (let i2 = 0;i2 < part.names.length; i2++) {
|
|
28537
|
+
const name2 = part.names[i2];
|
|
28538
|
+
const prefix = i2 === 0 ? "\\" + part.operator : "&";
|
|
28539
|
+
patterns.push({
|
|
28540
|
+
pattern: prefix + this.escapeRegExp(name2) + "=([^&]+)",
|
|
28541
|
+
name: name2
|
|
28542
|
+
});
|
|
28543
|
+
}
|
|
28544
|
+
return patterns;
|
|
28545
|
+
}
|
|
28546
|
+
let pattern;
|
|
28547
|
+
const name = part.name;
|
|
28548
|
+
switch (part.operator) {
|
|
28549
|
+
case "":
|
|
28550
|
+
pattern = part.exploded ? "([^/,]+(?:,[^/,]+)*)" : "([^/,]+)";
|
|
28551
|
+
break;
|
|
28552
|
+
case "+":
|
|
28553
|
+
case "#":
|
|
28554
|
+
pattern = "(.+)";
|
|
28555
|
+
break;
|
|
28556
|
+
case ".":
|
|
28557
|
+
pattern = "\\.([^/,]+)";
|
|
28558
|
+
break;
|
|
28559
|
+
case "/":
|
|
28560
|
+
pattern = "/" + (part.exploded ? "([^/,]+(?:,[^/,]+)*)" : "([^/,]+)");
|
|
28561
|
+
break;
|
|
28562
|
+
default:
|
|
28563
|
+
pattern = "([^/]+)";
|
|
28564
|
+
}
|
|
28565
|
+
patterns.push({ pattern, name });
|
|
28566
|
+
return patterns;
|
|
28567
|
+
}
|
|
28568
|
+
match(uri) {
|
|
28569
|
+
UriTemplate.validateLength(uri, MAX_TEMPLATE_LENGTH, "URI");
|
|
28570
|
+
let pattern = "^";
|
|
28571
|
+
const names = [];
|
|
28572
|
+
for (const part of this.parts) {
|
|
28573
|
+
if (typeof part === "string") {
|
|
28574
|
+
pattern += this.escapeRegExp(part);
|
|
28575
|
+
} else {
|
|
28576
|
+
const patterns = this.partToRegExp(part);
|
|
28577
|
+
for (const { pattern: partPattern, name } of patterns) {
|
|
28578
|
+
pattern += partPattern;
|
|
28579
|
+
names.push({ name, exploded: part.exploded });
|
|
28580
|
+
}
|
|
28581
|
+
}
|
|
28582
|
+
}
|
|
28583
|
+
pattern += "$";
|
|
28584
|
+
UriTemplate.validateLength(pattern, MAX_REGEX_LENGTH, "Generated regex pattern");
|
|
28585
|
+
const regex = new RegExp(pattern);
|
|
28586
|
+
const match = uri.match(regex);
|
|
28587
|
+
if (!match)
|
|
28588
|
+
return null;
|
|
28589
|
+
const result = {};
|
|
28590
|
+
for (let i2 = 0;i2 < names.length; i2++) {
|
|
28591
|
+
const { name, exploded } = names[i2];
|
|
28592
|
+
const value = match[i2 + 1];
|
|
28593
|
+
const cleanName = name.replace("*", "");
|
|
28594
|
+
if (exploded && value.includes(",")) {
|
|
28595
|
+
result[cleanName] = value.split(",");
|
|
28596
|
+
} else {
|
|
28597
|
+
result[cleanName] = value;
|
|
28598
|
+
}
|
|
28599
|
+
}
|
|
28600
|
+
return result;
|
|
28601
|
+
}
|
|
28602
|
+
}
|
|
28603
|
+
|
|
28266
28604
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
|
|
28267
28605
|
var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
|
|
28268
28606
|
function validateToolName(name) {
|
|
@@ -28920,6 +29258,9 @@ class McpServer {
|
|
|
28920
29258
|
annotations = rest.shift();
|
|
28921
29259
|
}
|
|
28922
29260
|
} else if (typeof firstArg === "object" && firstArg !== null) {
|
|
29261
|
+
if (Object.values(firstArg).some((v2) => typeof v2 === "object" && v2 !== null)) {
|
|
29262
|
+
throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
|
|
29263
|
+
}
|
|
28923
29264
|
annotations = rest.shift();
|
|
28924
29265
|
}
|
|
28925
29266
|
}
|
|
@@ -28983,6 +29324,22 @@ class McpServer {
|
|
|
28983
29324
|
}
|
|
28984
29325
|
}
|
|
28985
29326
|
}
|
|
29327
|
+
|
|
29328
|
+
class ResourceTemplate {
|
|
29329
|
+
constructor(uriTemplate, _callbacks) {
|
|
29330
|
+
this._callbacks = _callbacks;
|
|
29331
|
+
this._uriTemplate = typeof uriTemplate === "string" ? new UriTemplate(uriTemplate) : uriTemplate;
|
|
29332
|
+
}
|
|
29333
|
+
get uriTemplate() {
|
|
29334
|
+
return this._uriTemplate;
|
|
29335
|
+
}
|
|
29336
|
+
get listCallback() {
|
|
29337
|
+
return this._callbacks.list;
|
|
29338
|
+
}
|
|
29339
|
+
completeCallback(variable) {
|
|
29340
|
+
return this._callbacks.complete?.[variable];
|
|
29341
|
+
}
|
|
29342
|
+
}
|
|
28986
29343
|
var EMPTY_OBJECT_JSON_SCHEMA = {
|
|
28987
29344
|
type: "object",
|
|
28988
29345
|
properties: {}
|
|
@@ -29012,6 +29369,9 @@ function getZodSchemaObject(schema) {
|
|
|
29012
29369
|
if (isZodRawShapeCompat(schema)) {
|
|
29013
29370
|
return objectFromShape(schema);
|
|
29014
29371
|
}
|
|
29372
|
+
if (!isZodSchemaInstance(schema)) {
|
|
29373
|
+
throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
|
|
29374
|
+
}
|
|
29015
29375
|
return schema;
|
|
29016
29376
|
}
|
|
29017
29377
|
function promptArgumentsFromSchema(schema) {
|
|
@@ -29061,13 +29421,83 @@ import { readFile } from "node:fs/promises";
|
|
|
29061
29421
|
import path from "node:path";
|
|
29062
29422
|
import { fileURLToPath } from "node:url";
|
|
29063
29423
|
|
|
29064
|
-
// src/
|
|
29065
|
-
|
|
29066
|
-
|
|
29424
|
+
// src/utils/sisense-session.ts
|
|
29425
|
+
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.";
|
|
29426
|
+
var MISSING_BASE_URL_SESSION_MESSAGE = "Base URL not found in session.";
|
|
29427
|
+
function getSessionHttpClient(sessionState) {
|
|
29428
|
+
const client = sessionState?.get("httpClient");
|
|
29429
|
+
if (!client) {
|
|
29430
|
+
throw new Error(MISSING_SISENSE_SESSION_MESSAGE);
|
|
29431
|
+
}
|
|
29432
|
+
return client;
|
|
29433
|
+
}
|
|
29434
|
+
function getSessionOpenAIClient(sessionState) {
|
|
29435
|
+
const client = sessionState?.get("openAIClient");
|
|
29436
|
+
if (!client) {
|
|
29437
|
+
throw new Error(MISSING_SISENSE_SESSION_MESSAGE);
|
|
29438
|
+
}
|
|
29439
|
+
return client;
|
|
29440
|
+
}
|
|
29441
|
+
function getSessionSisenseUrl(sessionState) {
|
|
29442
|
+
const url2 = sessionState?.get("sisenseUrl");
|
|
29443
|
+
if (!url2) {
|
|
29444
|
+
throw new Error(MISSING_SISENSE_SESSION_MESSAGE);
|
|
29445
|
+
}
|
|
29446
|
+
return url2;
|
|
29447
|
+
}
|
|
29448
|
+
function getSessionSisenseToken(sessionState) {
|
|
29449
|
+
const token = sessionState?.get("sisenseToken");
|
|
29450
|
+
if (!token) {
|
|
29451
|
+
throw new Error(MISSING_SISENSE_SESSION_MESSAGE);
|
|
29452
|
+
}
|
|
29453
|
+
return token;
|
|
29454
|
+
}
|
|
29455
|
+
function getSessionBaseUrl(sessionState) {
|
|
29456
|
+
const baseUrl = sessionState?.get("baseUrl");
|
|
29457
|
+
if (!baseUrl) {
|
|
29458
|
+
throw new Error(MISSING_BASE_URL_SESSION_MESSAGE);
|
|
29459
|
+
}
|
|
29460
|
+
return baseUrl;
|
|
29461
|
+
}
|
|
29462
|
+
|
|
29463
|
+
// src/utils/feature-flags.ts
|
|
29464
|
+
function parseBooleanParam(value) {
|
|
29465
|
+
if (value === null)
|
|
29466
|
+
return null;
|
|
29467
|
+
const trimmed = value.trim().toLowerCase();
|
|
29468
|
+
if (trimmed === "true" || trimmed === "1")
|
|
29469
|
+
return true;
|
|
29470
|
+
if (trimmed === "false" || trimmed === "0")
|
|
29471
|
+
return false;
|
|
29472
|
+
return null;
|
|
29473
|
+
}
|
|
29474
|
+
function resolveFeatureFlagsFromEnv() {
|
|
29475
|
+
return {
|
|
29476
|
+
mcpAppEnabled: process.env.MCP_APP_ENABLED !== "false" && process.env.MCP_APP_ENABLED !== "0",
|
|
29477
|
+
toolBuildQueryEnabled: process.env.TOOL_BUILD_QUERY_ENABLED === "true" || process.env.TOOL_BUILD_QUERY_ENABLED === "1",
|
|
29478
|
+
toolBuildChartNarrativeEnabled: process.env.TOOL_BUILD_CHART_NARRATIVE_ENABLED !== "false" && process.env.TOOL_BUILD_CHART_NARRATIVE_ENABLED !== "0"
|
|
29479
|
+
};
|
|
29067
29480
|
}
|
|
29068
|
-
function
|
|
29069
|
-
|
|
29481
|
+
function resolveFeatureFlagsFromUrl(url2) {
|
|
29482
|
+
const env = resolveFeatureFlagsFromEnv();
|
|
29483
|
+
return {
|
|
29484
|
+
mcpAppEnabled: parseBooleanParam(url2.searchParams.get("mcpAppEnabled")) ?? env.mcpAppEnabled,
|
|
29485
|
+
toolBuildQueryEnabled: parseBooleanParam(url2.searchParams.get("toolBuildQueryEnabled")) ?? env.toolBuildQueryEnabled,
|
|
29486
|
+
toolBuildChartNarrativeEnabled: parseBooleanParam(url2.searchParams.get("toolBuildChartNarrativeEnabled")) ?? env.toolBuildChartNarrativeEnabled
|
|
29487
|
+
};
|
|
29070
29488
|
}
|
|
29489
|
+
function applyFeatureFlagsToSession(url2, state) {
|
|
29490
|
+
state.set("featureFlags", resolveFeatureFlagsFromUrl(url2));
|
|
29491
|
+
}
|
|
29492
|
+
function getFeatureFlags(sessionState) {
|
|
29493
|
+
const stored = sessionState?.get("featureFlags");
|
|
29494
|
+
if (stored != null) {
|
|
29495
|
+
return stored;
|
|
29496
|
+
}
|
|
29497
|
+
return resolveFeatureFlagsFromEnv();
|
|
29498
|
+
}
|
|
29499
|
+
|
|
29500
|
+
// src/tools/build-chart.ts
|
|
29071
29501
|
var baseOutputSchema = exports_external.object({
|
|
29072
29502
|
success: exports_external.boolean(),
|
|
29073
29503
|
chartId: exports_external.string().optional(),
|
|
@@ -29078,8 +29508,8 @@ var buildChartOutputSchemaAppMode = baseOutputSchema;
|
|
|
29078
29508
|
var buildChartOutputSchemaToolMode = baseOutputSchema.extend({
|
|
29079
29509
|
imageUrl: exports_external.string().optional()
|
|
29080
29510
|
});
|
|
29081
|
-
function getBuildChartOutputSchema() {
|
|
29082
|
-
return
|
|
29511
|
+
function getBuildChartOutputSchema(flags) {
|
|
29512
|
+
return flags.mcpAppEnabled ? buildChartOutputSchemaAppMode : buildChartOutputSchemaToolMode;
|
|
29083
29513
|
}
|
|
29084
29514
|
function getChartSummaries(sessionState) {
|
|
29085
29515
|
return sessionState?.get("chart:summaries") ?? [];
|
|
@@ -29089,46 +29519,43 @@ function addChartSummary(sessionState, summary) {
|
|
|
29089
29519
|
summaries.push(summary);
|
|
29090
29520
|
sessionState?.set("chart:summaries", summaries);
|
|
29091
29521
|
}
|
|
29092
|
-
async function buildChart(args, sessionState
|
|
29522
|
+
async function buildChart(args, sessionState) {
|
|
29523
|
+
const { mcpAppEnabled, toolBuildChartNarrativeEnabled } = getFeatureFlags(sessionState);
|
|
29093
29524
|
try {
|
|
29094
|
-
const { dataSourceTitle, userPrompt } = args;
|
|
29095
|
-
const
|
|
29525
|
+
const { dataSourceTitle, userPrompt, queryId } = args;
|
|
29526
|
+
const httpClient = getSessionHttpClient(sessionState);
|
|
29527
|
+
const openAIClient = getSessionOpenAIClient(sessionState);
|
|
29528
|
+
const toolCallId = generateArtifactId("chart");
|
|
29096
29529
|
const result = await csdkBrowserMock.withBrowserEnvironment(async () => {
|
|
29097
|
-
const { buildChartEngine, runWithUserAction } = await import("./index-
|
|
29098
|
-
const { renderChartWidget } = await import("./widget-renderer-
|
|
29530
|
+
const { buildChartEngine, runWithUserAction } = await import("./index-xxces5vh.js");
|
|
29531
|
+
const { renderChartWidget } = await import("./widget-renderer-hynpvfm9.js");
|
|
29099
29532
|
const buildChartContext = {
|
|
29100
29533
|
toolCallId,
|
|
29101
29534
|
dataSourceTitle,
|
|
29102
29535
|
chartSummaries: getChartSummaries(sessionState),
|
|
29103
29536
|
retrieveChart: (id) => sessionState?.get(id) ?? null,
|
|
29104
29537
|
saveChart: (id, props) => sessionState?.set(id, props),
|
|
29538
|
+
retrieveQuery: (id) => sessionState?.get(`query-${id}`) ?? null,
|
|
29539
|
+
onInternalQueryResult: (result2) => sessionState?.set(`query-${result2.queryId}`, result2),
|
|
29105
29540
|
isNlqV3Enabled: true,
|
|
29106
|
-
httpClient
|
|
29107
|
-
openAIClient
|
|
29541
|
+
httpClient,
|
|
29542
|
+
openAIClient,
|
|
29543
|
+
...queryId != null && { queryId }
|
|
29108
29544
|
};
|
|
29109
|
-
const chartSummary2 = await runWithUserAction("MCP", "ASSISTANT", () => buildChartEngine({ dataSourceTitle, userPrompt }, buildChartContext));
|
|
29545
|
+
const chartSummary2 = await runWithUserAction("MCP", "ASSISTANT", () => buildChartEngine({ dataSourceTitle, userPrompt, queryId: queryId ?? undefined }, buildChartContext));
|
|
29110
29546
|
console.info(">>> CHART SUMMARY", chartSummary2);
|
|
29111
29547
|
addChartSummary(sessionState, chartSummary2);
|
|
29112
29548
|
const savedProps = sessionState?.get(chartSummary2.chartId);
|
|
29113
29549
|
if (savedProps) {
|
|
29114
|
-
const
|
|
29115
|
-
const
|
|
29116
|
-
const
|
|
29117
|
-
const
|
|
29118
|
-
|
|
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
|
-
}
|
|
29124
|
-
const narrativeEnabled = isNarrativeEnabled();
|
|
29125
|
-
const { getNlgInsightsFromWidget } = await import("./ai-3wz11tv8.js");
|
|
29126
|
-
const insightsPromise = narrativeEnabled && httpClient ? getNlgInsightsFromWidget(savedProps, httpClient, { verbosity: "High" }) : Promise.resolve(undefined);
|
|
29127
|
-
const renderPromise = isMcpAppEnabled() ? Promise.resolve(null) : renderChartWidget({
|
|
29550
|
+
const sisenseUrl = getSessionSisenseUrl(sessionState);
|
|
29551
|
+
const sisenseToken = getSessionSisenseToken(sessionState);
|
|
29552
|
+
const { getNlgInsightsFromWidget } = await import("./ai-w2gkxdn7.js");
|
|
29553
|
+
const insightsPromise = toolBuildChartNarrativeEnabled && httpClient ? getNlgInsightsFromWidget(savedProps, httpClient, { verbosity: "High" }) : Promise.resolve(undefined);
|
|
29554
|
+
const renderPromise = mcpAppEnabled ? Promise.resolve(null) : renderChartWidget({
|
|
29128
29555
|
widgetProps: savedProps,
|
|
29129
|
-
sisenseUrl
|
|
29130
|
-
sisenseToken
|
|
29131
|
-
baseUrl
|
|
29556
|
+
sisenseUrl,
|
|
29557
|
+
sisenseToken,
|
|
29558
|
+
baseUrl: getSessionBaseUrl(sessionState)
|
|
29132
29559
|
});
|
|
29133
29560
|
const [insightsResult, renderResult] = await Promise.allSettled([
|
|
29134
29561
|
insightsPromise,
|
|
@@ -29142,19 +29569,27 @@ async function buildChart(args, sessionState, requestId) {
|
|
|
29142
29569
|
console.warn("Failed to generate NLG insights:", sanitized.message);
|
|
29143
29570
|
}
|
|
29144
29571
|
let imageUrl2;
|
|
29145
|
-
if (!
|
|
29572
|
+
if (!mcpAppEnabled && renderResult.status === "fulfilled" && renderResult.value) {
|
|
29146
29573
|
imageUrl2 = renderResult.value.content[0]?.text;
|
|
29147
|
-
} else if (!
|
|
29574
|
+
} else if (!mcpAppEnabled && renderResult.status === "rejected") {
|
|
29148
29575
|
const sanitized = sanitizeError(renderResult.reason);
|
|
29149
29576
|
console.warn("Failed to render chart widget:", sanitized.message);
|
|
29150
29577
|
}
|
|
29578
|
+
const serializedWidgetProps = ni.serialize(savedProps);
|
|
29579
|
+
if (mcpAppEnabled && sisenseUrl && sisenseToken) {
|
|
29580
|
+
sessionState?.set(`chart:payload:${chartSummary2.chartId}`, {
|
|
29581
|
+
sisenseUrl,
|
|
29582
|
+
sisenseToken,
|
|
29583
|
+
serializedWidgetProps
|
|
29584
|
+
});
|
|
29585
|
+
}
|
|
29151
29586
|
return {
|
|
29152
29587
|
chartSummary: chartSummary2,
|
|
29153
29588
|
imageUrl: imageUrl2,
|
|
29154
29589
|
insights: insights2,
|
|
29155
|
-
sisenseUrl
|
|
29156
|
-
sisenseToken
|
|
29157
|
-
serializedWidgetProps
|
|
29590
|
+
sisenseUrl,
|
|
29591
|
+
sisenseToken,
|
|
29592
|
+
serializedWidgetProps
|
|
29158
29593
|
};
|
|
29159
29594
|
}
|
|
29160
29595
|
console.warn("No saved props found for chartId:", chartSummary2.chartId);
|
|
@@ -29166,13 +29601,13 @@ async function buildChart(args, sessionState, requestId) {
|
|
|
29166
29601
|
sisenseToken: undefined
|
|
29167
29602
|
};
|
|
29168
29603
|
});
|
|
29169
|
-
const { chartSummary, imageUrl, insights
|
|
29604
|
+
const { chartSummary, imageUrl, insights } = result;
|
|
29170
29605
|
const output = {
|
|
29171
29606
|
success: true,
|
|
29172
29607
|
chartId: chartSummary.chartId,
|
|
29173
29608
|
message: chartSummary.message || `Chart created successfully for query: "${userPrompt}"`,
|
|
29174
|
-
...
|
|
29175
|
-
...
|
|
29609
|
+
...toolBuildChartNarrativeEnabled && insights != null ? { insights } : {},
|
|
29610
|
+
...mcpAppEnabled ? {} : { imageUrl }
|
|
29176
29611
|
};
|
|
29177
29612
|
const finalOutput = {
|
|
29178
29613
|
content: [
|
|
@@ -29181,14 +29616,7 @@ async function buildChart(args, sessionState, requestId) {
|
|
|
29181
29616
|
text: JSON.stringify(output, null, 2)
|
|
29182
29617
|
}
|
|
29183
29618
|
],
|
|
29184
|
-
structuredContent: output
|
|
29185
|
-
...isMcpAppEnabled() ? {
|
|
29186
|
-
_meta: {
|
|
29187
|
-
sisenseUrl,
|
|
29188
|
-
sisenseToken,
|
|
29189
|
-
serializedWidgetProps
|
|
29190
|
-
}
|
|
29191
|
-
} : {}
|
|
29619
|
+
structuredContent: output
|
|
29192
29620
|
};
|
|
29193
29621
|
return finalOutput;
|
|
29194
29622
|
} catch (error40) {
|
|
@@ -29197,8 +29625,8 @@ async function buildChart(args, sessionState, requestId) {
|
|
|
29197
29625
|
success: false,
|
|
29198
29626
|
chartId: undefined,
|
|
29199
29627
|
message: `Failed to create chart: ${errorMessage}`,
|
|
29200
|
-
...
|
|
29201
|
-
...
|
|
29628
|
+
...toolBuildChartNarrativeEnabled ? { insights: undefined } : {},
|
|
29629
|
+
...mcpAppEnabled ? {} : { imageUrl: undefined }
|
|
29202
29630
|
};
|
|
29203
29631
|
return {
|
|
29204
29632
|
content: [
|
|
@@ -29213,16 +29641,66 @@ async function buildChart(args, sessionState, requestId) {
|
|
|
29213
29641
|
}
|
|
29214
29642
|
}
|
|
29215
29643
|
|
|
29644
|
+
// src/tools/build-query.ts
|
|
29645
|
+
var buildQueryOutputSchema = exports_external.object({
|
|
29646
|
+
success: exports_external.boolean(),
|
|
29647
|
+
queryId: exports_external.string().optional(),
|
|
29648
|
+
title: exports_external.string().optional(),
|
|
29649
|
+
message: exports_external.string(),
|
|
29650
|
+
dataset: exports_external.unknown().optional()
|
|
29651
|
+
});
|
|
29652
|
+
async function buildQuery(args, sessionState) {
|
|
29653
|
+
try {
|
|
29654
|
+
const { dataSourceTitle, queryPrompt } = args;
|
|
29655
|
+
const httpClient = getSessionHttpClient(sessionState);
|
|
29656
|
+
const toolCallId = generateArtifactId("query");
|
|
29657
|
+
const { queryId, title, dataset } = await csdkBrowserMock.withBrowserEnvironment(async () => {
|
|
29658
|
+
const { buildQueryEngine, toQuerySummary, runWithUserAction } = await import("./index-xxces5vh.js");
|
|
29659
|
+
const queryResult = await runWithUserAction("MCP", "ASSISTANT", () => buildQueryEngine({ dataSourceTitle, queryPrompt }, { toolCallId, httpClient }));
|
|
29660
|
+
sessionState?.set(`query-${queryResult.queryId}`, queryResult);
|
|
29661
|
+
const summary = toQuerySummary(queryResult, true);
|
|
29662
|
+
return { queryId: summary.queryId, title: summary.title, dataset: summary.dataset };
|
|
29663
|
+
});
|
|
29664
|
+
const output = {
|
|
29665
|
+
success: true,
|
|
29666
|
+
queryId,
|
|
29667
|
+
title,
|
|
29668
|
+
message: `Query executed successfully for: "${queryPrompt}"`,
|
|
29669
|
+
dataset
|
|
29670
|
+
};
|
|
29671
|
+
return {
|
|
29672
|
+
content: [{ type: "text", text: JSON.stringify(output, null, 2) }],
|
|
29673
|
+
structuredContent: output
|
|
29674
|
+
};
|
|
29675
|
+
} catch (error40) {
|
|
29676
|
+
const sanitized = sanitizeError(error40, true);
|
|
29677
|
+
console.error("buildQuery failed:", sanitized.message);
|
|
29678
|
+
if (sanitized.stack) {
|
|
29679
|
+
console.error(sanitized.stack);
|
|
29680
|
+
}
|
|
29681
|
+
const output = {
|
|
29682
|
+
success: false,
|
|
29683
|
+
message: `Failed to execute query: ${sanitized.message}`
|
|
29684
|
+
};
|
|
29685
|
+
return {
|
|
29686
|
+
content: [{ type: "text", text: JSON.stringify(output, null, 2) }],
|
|
29687
|
+
structuredContent: output,
|
|
29688
|
+
isError: true
|
|
29689
|
+
};
|
|
29690
|
+
}
|
|
29691
|
+
}
|
|
29692
|
+
|
|
29216
29693
|
// src/tools/get-data-sources.ts
|
|
29217
29694
|
var getDataSourcesOutputSchema = {
|
|
29218
29695
|
dataSources: exports_external.array(exports_external.any())
|
|
29219
29696
|
};
|
|
29220
29697
|
async function getDataSources(_args, sessionState) {
|
|
29221
29698
|
try {
|
|
29222
|
-
const
|
|
29699
|
+
const httpClient = getSessionHttpClient(sessionState);
|
|
29700
|
+
const { getDataSourcesEngine } = await import("./index-xxces5vh.js");
|
|
29223
29701
|
const getDataSourcesContext = {
|
|
29224
29702
|
toolCallId: "get-data-sources",
|
|
29225
|
-
httpClient
|
|
29703
|
+
httpClient
|
|
29226
29704
|
};
|
|
29227
29705
|
const result = await getDataSourcesEngine({}, getDataSourcesContext);
|
|
29228
29706
|
return {
|
|
@@ -29262,10 +29740,11 @@ var getDataSourceFieldsOutputSchema = {
|
|
|
29262
29740
|
async function getDataSourceFields(args, sessionState) {
|
|
29263
29741
|
const { dataSourceTitle } = args;
|
|
29264
29742
|
try {
|
|
29265
|
-
const
|
|
29743
|
+
const httpClient = getSessionHttpClient(sessionState);
|
|
29744
|
+
const { getDataSourceFieldsEngine } = await import("./index-xxces5vh.js");
|
|
29266
29745
|
const getDataSourceFieldsContext = {
|
|
29267
29746
|
toolCallId: "get-data-source-fields",
|
|
29268
|
-
httpClient
|
|
29747
|
+
httpClient
|
|
29269
29748
|
};
|
|
29270
29749
|
const result = await getDataSourceFieldsEngine({ dataSourceTitle }, getDataSourceFieldsContext);
|
|
29271
29750
|
return {
|
|
@@ -29531,9 +30010,6 @@ var __dirname2 = path.dirname(fileURLToPath(import.meta.url));
|
|
|
29531
30010
|
var isSource = import.meta.url.endsWith(".ts");
|
|
29532
30011
|
var DIST_DIR = isSource ? path.join(__dirname2, "..", "dist") : __dirname2;
|
|
29533
30012
|
var ANALYTICS_RESOURCE_URI = "ui://sisense-analytics/view.html";
|
|
29534
|
-
function isMcpAppEnabled2() {
|
|
29535
|
-
return process.env.TOOL_CHART_BUILDER_MCP_APP_ENABLED !== "false" && process.env.TOOL_CHART_BUILDER_MCP_APP_ENABLED !== "0";
|
|
29536
|
-
}
|
|
29537
30013
|
function getCspMeta(sessionState) {
|
|
29538
30014
|
const sisenseUrl = sessionState?.get("sisenseUrl")?.trim() ?? process.env.SISENSE_URL?.trim();
|
|
29539
30015
|
const connectDomains = sisenseUrl ? [sisenseUrl] : [];
|
|
@@ -29552,14 +30028,18 @@ var noOpValidator = {
|
|
|
29552
30028
|
};
|
|
29553
30029
|
async function setupMcpServer(sessionState) {
|
|
29554
30030
|
try {
|
|
30031
|
+
const { mcpAppEnabled, toolBuildQueryEnabled } = getFeatureFlags(sessionState);
|
|
29555
30032
|
const {
|
|
29556
30033
|
TOOL_NAME_CHART_BUILDER,
|
|
30034
|
+
TOOL_NAME_BUILD_QUERY,
|
|
29557
30035
|
TOOL_NAME_GET_DATA_SOURCE_FIELDS,
|
|
29558
30036
|
TOOL_NAME_GET_DATA_SOURCES,
|
|
29559
30037
|
getDataSourcesSchema,
|
|
29560
30038
|
getDataSourceFieldsSchema,
|
|
29561
|
-
buildChartSchema
|
|
29562
|
-
|
|
30039
|
+
buildChartSchema,
|
|
30040
|
+
buildChartSchemaNaturalConversation,
|
|
30041
|
+
buildQuerySchema
|
|
30042
|
+
} = await import("./index-xxces5vh.js");
|
|
29563
30043
|
const server = new McpServer({
|
|
29564
30044
|
name: "sisense-mcp-server",
|
|
29565
30045
|
version: "1.0.0"
|
|
@@ -29582,35 +30062,46 @@ async function setupMcpServer(sessionState) {
|
|
|
29582
30062
|
}, async (args) => {
|
|
29583
30063
|
return await getDataSourceFields(args, sessionState);
|
|
29584
30064
|
});
|
|
29585
|
-
|
|
29586
|
-
|
|
29587
|
-
|
|
30065
|
+
if (toolBuildQueryEnabled) {
|
|
30066
|
+
server.registerTool(TOOL_NAME_BUILD_QUERY, {
|
|
30067
|
+
title: "Execute Sisense Analytics Query",
|
|
30068
|
+
description: "Converts a natural language question into an analytics query for a Sisense data source, executes it, and returns the resulting dataset and a queryId. Use the queryId when calling buildChart to visualize the results without re-running the query.",
|
|
30069
|
+
inputSchema: buildQuerySchema.shape,
|
|
30070
|
+
outputSchema: buildQueryOutputSchema.shape
|
|
30071
|
+
}, async (args) => {
|
|
30072
|
+
return await buildQuery(args, sessionState);
|
|
30073
|
+
});
|
|
30074
|
+
}
|
|
30075
|
+
const buildChartOutputSchema = getBuildChartOutputSchema(getFeatureFlags(sessionState));
|
|
30076
|
+
const chartInputSchema = toolBuildQueryEnabled ? buildChartSchemaNaturalConversation : buildChartSchema;
|
|
30077
|
+
if (mcpAppEnabled) {
|
|
30078
|
+
hZ(server, TOOL_NAME_CHART_BUILDER, {
|
|
29588
30079
|
title: "Build Sisense Chart from User Prompt",
|
|
29589
30080
|
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
|
-
inputSchema:
|
|
30081
|
+
inputSchema: chartInputSchema.shape,
|
|
29591
30082
|
outputSchema: buildChartOutputSchema.shape,
|
|
29592
30083
|
_meta: { ui: { resourceUri: ANALYTICS_RESOURCE_URI } }
|
|
29593
|
-
}, async (args
|
|
29594
|
-
return await buildChart(args, sessionState
|
|
30084
|
+
}, async (args) => {
|
|
30085
|
+
return await buildChart(args, sessionState);
|
|
29595
30086
|
});
|
|
29596
30087
|
} else {
|
|
29597
30088
|
server.registerTool(TOOL_NAME_CHART_BUILDER, {
|
|
29598
30089
|
title: "Build Sisense Chart from User Prompt",
|
|
29599
30090
|
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.",
|
|
29600
|
-
inputSchema:
|
|
30091
|
+
inputSchema: chartInputSchema.shape,
|
|
29601
30092
|
outputSchema: buildChartOutputSchema.shape
|
|
29602
30093
|
}, async (args) => {
|
|
29603
30094
|
return await buildChart(args, sessionState);
|
|
29604
30095
|
});
|
|
29605
30096
|
}
|
|
29606
|
-
|
|
30097
|
+
mZ(server, ANALYTICS_RESOURCE_URI, ANALYTICS_RESOURCE_URI, { mimeType: u }, async () => {
|
|
29607
30098
|
const html = await readFile(path.join(DIST_DIR, "view.html"), "utf-8");
|
|
29608
30099
|
const meta = getCspMeta(sessionState);
|
|
29609
30100
|
return {
|
|
29610
30101
|
contents: [
|
|
29611
30102
|
{
|
|
29612
30103
|
uri: ANALYTICS_RESOURCE_URI,
|
|
29613
|
-
mimeType:
|
|
30104
|
+
mimeType: u,
|
|
29614
30105
|
text: html,
|
|
29615
30106
|
_meta: meta
|
|
29616
30107
|
}
|
|
@@ -29618,6 +30109,22 @@ async function setupMcpServer(sessionState) {
|
|
|
29618
30109
|
};
|
|
29619
30110
|
});
|
|
29620
30111
|
registerPrompts(server);
|
|
30112
|
+
server.registerResource("chart-data", new ResourceTemplate("ui://sisense-analytics/chart/{chartId}", { list: undefined }), { mimeType: "application/json" }, async (uri, vars) => {
|
|
30113
|
+
const chartId = String(vars.chartId);
|
|
30114
|
+
const payload = sessionState?.get(`chart:payload:${chartId}`);
|
|
30115
|
+
if (!payload) {
|
|
30116
|
+
throw new Error(`Chart data not found for chartId: ${chartId}`);
|
|
30117
|
+
}
|
|
30118
|
+
return {
|
|
30119
|
+
contents: [
|
|
30120
|
+
{
|
|
30121
|
+
uri: uri.href,
|
|
30122
|
+
mimeType: "application/json",
|
|
30123
|
+
text: JSON.stringify(payload)
|
|
30124
|
+
}
|
|
30125
|
+
]
|
|
30126
|
+
};
|
|
30127
|
+
});
|
|
29621
30128
|
return server;
|
|
29622
30129
|
} catch (error40) {
|
|
29623
30130
|
console.error("Error setting up MCP server:", error40);
|
|
@@ -29644,6 +30151,18 @@ var persistentStates = new Map;
|
|
|
29644
30151
|
function getCredentialKey(sisenseUrl, sisenseToken) {
|
|
29645
30152
|
return createHash("sha256").update(`${sisenseUrl}:${sisenseToken}`).digest("hex").slice(0, 16);
|
|
29646
30153
|
}
|
|
30154
|
+
function resetConversationState(existingState, req) {
|
|
30155
|
+
const freshState = new Map(existingState);
|
|
30156
|
+
for (const key of freshState.keys()) {
|
|
30157
|
+
if (key === "chart:summaries" || typeof key === "string" && (key.startsWith("chart-") || key.startsWith("query-"))) {
|
|
30158
|
+
freshState.delete(key);
|
|
30159
|
+
}
|
|
30160
|
+
}
|
|
30161
|
+
const protocol = req.headers["x-forwarded-proto"] || "http";
|
|
30162
|
+
const host = req.headers["x-forwarded-host"] || req.headers.host;
|
|
30163
|
+
freshState.set("baseUrl", `${protocol}://${host}`);
|
|
30164
|
+
return freshState;
|
|
30165
|
+
}
|
|
29647
30166
|
var server = createServer(async (req, res) => {
|
|
29648
30167
|
const url2 = new URL(req.url || "/", `http://${req.headers.host}`);
|
|
29649
30168
|
if (url2.pathname === "/health" && req.method === "GET") {
|
|
@@ -29736,7 +30255,8 @@ var server = createServer(async (req, res) => {
|
|
|
29736
30255
|
const credKey = getCredentialKey(sisenseUrl, sisenseToken);
|
|
29737
30256
|
const existingState = persistentStates.get(credKey);
|
|
29738
30257
|
if (existingState) {
|
|
29739
|
-
state = existingState;
|
|
30258
|
+
state = resetConversationState(existingState, req);
|
|
30259
|
+
persistentStates.set(credKey, state);
|
|
29740
30260
|
} else {
|
|
29741
30261
|
try {
|
|
29742
30262
|
const validatedUrl = validateUrl(sisenseUrl, {
|
|
@@ -29759,7 +30279,7 @@ var server = createServer(async (req, res) => {
|
|
|
29759
30279
|
createOpenAIClient,
|
|
29760
30280
|
initializeHttpClient,
|
|
29761
30281
|
initializeOpenAIClient
|
|
29762
|
-
} = await import("./index-
|
|
30282
|
+
} = await import("./index-xxces5vh.js");
|
|
29763
30283
|
const httpClient = createHttpClientFromConfig({
|
|
29764
30284
|
url: validatedUrl,
|
|
29765
30285
|
token: validatedToken
|
|
@@ -29804,6 +30324,7 @@ var server = createServer(async (req, res) => {
|
|
|
29804
30324
|
sessions.delete(transport.sessionId);
|
|
29805
30325
|
}
|
|
29806
30326
|
};
|
|
30327
|
+
applyFeatureFlagsToSession(url2, state);
|
|
29807
30328
|
const mcpServer = await setupMcpServer(state);
|
|
29808
30329
|
await mcpServer.connect(transport);
|
|
29809
30330
|
} else {
|
|
@@ -29854,6 +30375,9 @@ initializeSisenseClients().then(() => {
|
|
|
29854
30375
|
console.log(` http://localhost:${PORT}/mcp?sisenseUrl=<SISENSE_URL>&sisenseToken=<SISENSE_TOKEN>`);
|
|
29855
30376
|
console.log(" Or set SISENSE_URL and SISENSE_TOKEN in the environment and use http://localhost:" + `${PORT}/mcp`);
|
|
29856
30377
|
console.log("");
|
|
30378
|
+
console.log("Optional feature-flag query params (override env vars per connection):");
|
|
30379
|
+
console.log(" mcpAppEnabled=true|false, toolBuildQueryEnabled=true|false, toolBuildChartNarrativeEnabled=true|false");
|
|
30380
|
+
console.log("");
|
|
29857
30381
|
console.log("Endpoints:");
|
|
29858
30382
|
console.log(` Health: http://localhost:${PORT}/health`);
|
|
29859
30383
|
console.log(` Screenshots: http://localhost:${PORT}/screenshots/`);
|