@sisense/mcp-server 0.2.3 → 0.2.5

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.
Files changed (2) hide show
  1. package/dist/sse-server.js +27 -17
  2. package/package.json +5 -3
@@ -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
- var MCP_APP_BUILD_CHART_ENABLED = process.env.MCP_APP_BUILD_CHART_ENABLED !== "false" && process.env.MCP_APP_BUILD_CHART_ENABLED !== "0";
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 MCP_APP_BUILD_CHART_ENABLED ? buildChartOutputSchemaAppMode : buildChartOutputSchemaToolMode;
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.reject(new Error("HttpClient not available for insights generation"));
29739
- const renderPromise = MCP_APP_BUILD_CHART_ENABLED ? Promise.resolve(null) : renderChartWidget({
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 (!MCP_APP_BUILD_CHART_ENABLED && renderResult.status === "fulfilled" && renderResult.value) {
29763
+ if (!isMcpAppEnabled() && renderResult.status === "fulfilled" && renderResult.value) {
29758
29764
  imageUrl2 = renderResult.value.content[0]?.text;
29759
- } else if (!MCP_APP_BUILD_CHART_ENABLED && renderResult.status === "rejected") {
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
- ...MCP_APP_BUILD_CHART_ENABLED ? {} : { imageUrl }
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
- _meta: {
29798
- sisenseUrl,
29799
- sisenseToken,
29800
- serializedWidgetProps
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
- ...MCP_APP_BUILD_CHART_ENABLED ? {} : { imageUrl: undefined }
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
- var MCP_APP_BUILD_CHART_ENABLED2 = process.env.MCP_APP_BUILD_CHART_ENABLED !== "false" && process.env.MCP_APP_BUILD_CHART_ENABLED !== "0";
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 (MCP_APP_BUILD_CHART_ENABLED2) {
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",
3
+ "version": "0.2.5",
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.",
@@ -34,8 +34,10 @@
34
34
  "build:view": "cross-env INPUT=view.html vite build",
35
35
  "dev": "bun run --watch src/sse-server.ts",
36
36
  "start": "bun run dist/sse-server.js",
37
- "test": "bun test",
38
- "test:e2e": "bun test e2e",
37
+ "test": "bun test --preload ./src/__test-helpers__/setup.ts ./src/**/*.test.ts",
38
+ "test:e2e": "cross-env NODE_ENV=production bun test ./e2e/tests/*.test.ts",
39
+ "test:visual": "cross-env NODE_ENV=production bun test e2e/visual-tests/analytics-app-render.test.ts",
40
+ "test:all": "bun run test && bun run test:e2e && bun run test:visual",
39
41
  "lint": "eslint src/**/*.ts",
40
42
  "type-check": "tsc --noEmit",
41
43
  "format": "prettier --write \"src/**/*.{ts,tsx}\" \"e2e/**/*.{ts,tsx}\"",