@sisense/mcp-server 0.2.3 → 0.2.4
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/sse-server.js +27 -17
- package/package.json +2 -2
package/dist/sse-server.js
CHANGED
|
@@ -29680,7 +29680,12 @@ import path from "node:path";
|
|
|
29680
29680
|
import { fileURLToPath } from "node:url";
|
|
29681
29681
|
|
|
29682
29682
|
// src/tools/build-chart.ts
|
|
29683
|
-
|
|
29683
|
+
function isMcpAppEnabled() {
|
|
29684
|
+
return process.env.TOOL_CHART_BUILDER_MCP_APP_ENABLED !== "false" && process.env.TOOL_CHART_BUILDER_MCP_APP_ENABLED !== "0";
|
|
29685
|
+
}
|
|
29686
|
+
function isNarrativeEnabled() {
|
|
29687
|
+
return process.env.TOOL_CHART_BUILDER_NARRATIVE_ENABLED !== "false" && process.env.TOOL_CHART_BUILDER_NARRATIVE_ENABLED !== "0";
|
|
29688
|
+
}
|
|
29684
29689
|
var baseOutputSchema = exports_external.object({
|
|
29685
29690
|
success: exports_external.boolean(),
|
|
29686
29691
|
chartId: exports_external.string().optional(),
|
|
@@ -29692,7 +29697,7 @@ var buildChartOutputSchemaToolMode = baseOutputSchema.extend({
|
|
|
29692
29697
|
imageUrl: exports_external.string().optional()
|
|
29693
29698
|
});
|
|
29694
29699
|
function getBuildChartOutputSchema() {
|
|
29695
|
-
return
|
|
29700
|
+
return isMcpAppEnabled() ? buildChartOutputSchemaAppMode : buildChartOutputSchemaToolMode;
|
|
29696
29701
|
}
|
|
29697
29702
|
function getChartSummaries(sessionState) {
|
|
29698
29703
|
return sessionState?.get("chart:summaries") ?? [];
|
|
@@ -29734,9 +29739,10 @@ async function buildChart(args, sessionState, requestId) {
|
|
|
29734
29739
|
if (!baseUrl) {
|
|
29735
29740
|
throw new Error("Base URL not found in session.");
|
|
29736
29741
|
}
|
|
29742
|
+
const narrativeEnabled = isNarrativeEnabled();
|
|
29737
29743
|
const { getNlgInsightsFromWidget } = await import("./ai-qt2rw4p0.js");
|
|
29738
|
-
const insightsPromise = httpClient ? getNlgInsightsFromWidget(savedProps, httpClient, { verbosity: "High" }) : Promise.
|
|
29739
|
-
const renderPromise =
|
|
29744
|
+
const insightsPromise = narrativeEnabled && httpClient ? getNlgInsightsFromWidget(savedProps, httpClient, { verbosity: "High" }) : Promise.resolve(undefined);
|
|
29745
|
+
const renderPromise = isMcpAppEnabled() ? Promise.resolve(null) : renderChartWidget({
|
|
29740
29746
|
widgetProps: savedProps,
|
|
29741
29747
|
sisenseUrl: sisenseUrl2,
|
|
29742
29748
|
sisenseToken: sisenseToken2,
|
|
@@ -29754,9 +29760,9 @@ async function buildChart(args, sessionState, requestId) {
|
|
|
29754
29760
|
console.warn("Failed to generate NLG insights:", sanitized.message);
|
|
29755
29761
|
}
|
|
29756
29762
|
let imageUrl2;
|
|
29757
|
-
if (!
|
|
29763
|
+
if (!isMcpAppEnabled() && renderResult.status === "fulfilled" && renderResult.value) {
|
|
29758
29764
|
imageUrl2 = renderResult.value.content[0]?.text;
|
|
29759
|
-
} else if (!
|
|
29765
|
+
} else if (!isMcpAppEnabled() && renderResult.status === "rejected") {
|
|
29760
29766
|
const sanitized = sanitizeError(renderResult.reason);
|
|
29761
29767
|
console.warn("Failed to render chart widget:", sanitized.message);
|
|
29762
29768
|
}
|
|
@@ -29783,8 +29789,8 @@ async function buildChart(args, sessionState, requestId) {
|
|
|
29783
29789
|
success: true,
|
|
29784
29790
|
chartId: chartSummary.chartId,
|
|
29785
29791
|
message: chartSummary.message || `Chart created successfully for query: "${userPrompt}"`,
|
|
29786
|
-
insights,
|
|
29787
|
-
...
|
|
29792
|
+
...isNarrativeEnabled() && insights != null ? { insights } : {},
|
|
29793
|
+
...isMcpAppEnabled() ? {} : { imageUrl }
|
|
29788
29794
|
};
|
|
29789
29795
|
const finalOutput = {
|
|
29790
29796
|
content: [
|
|
@@ -29794,11 +29800,13 @@ async function buildChart(args, sessionState, requestId) {
|
|
|
29794
29800
|
}
|
|
29795
29801
|
],
|
|
29796
29802
|
structuredContent: output,
|
|
29797
|
-
|
|
29798
|
-
|
|
29799
|
-
|
|
29800
|
-
|
|
29801
|
-
|
|
29803
|
+
...isMcpAppEnabled() ? {
|
|
29804
|
+
_meta: {
|
|
29805
|
+
sisenseUrl,
|
|
29806
|
+
sisenseToken,
|
|
29807
|
+
serializedWidgetProps
|
|
29808
|
+
}
|
|
29809
|
+
} : {}
|
|
29802
29810
|
};
|
|
29803
29811
|
return finalOutput;
|
|
29804
29812
|
} catch (error2) {
|
|
@@ -29807,8 +29815,8 @@ async function buildChart(args, sessionState, requestId) {
|
|
|
29807
29815
|
success: false,
|
|
29808
29816
|
chartId: undefined,
|
|
29809
29817
|
message: `Failed to create chart: ${errorMessage}`,
|
|
29810
|
-
insights: undefined,
|
|
29811
|
-
...
|
|
29818
|
+
...isNarrativeEnabled() ? { insights: undefined } : {},
|
|
29819
|
+
...isMcpAppEnabled() ? {} : { imageUrl: undefined }
|
|
29812
29820
|
};
|
|
29813
29821
|
return {
|
|
29814
29822
|
content: [
|
|
@@ -30141,7 +30149,9 @@ var __dirname2 = path.dirname(fileURLToPath(import.meta.url));
|
|
|
30141
30149
|
var isSource = import.meta.url.endsWith(".ts");
|
|
30142
30150
|
var DIST_DIR = isSource ? path.join(__dirname2, "..", "dist") : __dirname2;
|
|
30143
30151
|
var ANALYTICS_RESOURCE_URI = "ui://sisense-analytics/view.html";
|
|
30144
|
-
|
|
30152
|
+
function isMcpAppEnabled2() {
|
|
30153
|
+
return process.env.TOOL_CHART_BUILDER_MCP_APP_ENABLED !== "false" && process.env.TOOL_CHART_BUILDER_MCP_APP_ENABLED !== "0";
|
|
30154
|
+
}
|
|
30145
30155
|
function getCspMeta(sessionState) {
|
|
30146
30156
|
const sisenseUrl = sessionState?.get("sisenseUrl")?.trim() ?? process.env.SISENSE_URL?.trim();
|
|
30147
30157
|
const connectDomains = sisenseUrl ? [sisenseUrl] : [];
|
|
@@ -30191,7 +30201,7 @@ async function setupMcpServer(sessionState) {
|
|
|
30191
30201
|
return await getDataSourceFields(args, sessionState);
|
|
30192
30202
|
});
|
|
30193
30203
|
const buildChartOutputSchema = getBuildChartOutputSchema();
|
|
30194
|
-
if (
|
|
30204
|
+
if (isMcpAppEnabled2()) {
|
|
30195
30205
|
hk(server, TOOL_NAME_CHART_BUILDER, {
|
|
30196
30206
|
title: "Build Sisense Chart from User Prompt",
|
|
30197
30207
|
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.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sisense/mcp-server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"mcpName": "io.github.sisense/sisense-mcp-server",
|
|
5
5
|
"homepage": "https://github.com/sisense/sisense-mcp-server#readme",
|
|
6
6
|
"description": "MCP server leveraging Sisense Intelligence for actionable insights and analytics.",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dev": "bun run --watch src/sse-server.ts",
|
|
36
36
|
"start": "bun run dist/sse-server.js",
|
|
37
37
|
"test": "bun test",
|
|
38
|
-
"test:e2e": "bun test e2e",
|
|
38
|
+
"test:e2e": "cross-env NODE_ENV=production bun test e2e",
|
|
39
39
|
"lint": "eslint src/**/*.ts",
|
|
40
40
|
"type-check": "tsc --noEmit",
|
|
41
41
|
"format": "prettier --write \"src/**/*.{ts,tsx}\" \"e2e/**/*.{ts,tsx}\"",
|