@sisense/mcp-server 0.2.9 → 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/{index-8027b2t7.js → index-xxces5vh.js} +1150 -1138
- package/dist/{sse-server-qhqncg7f.js → sse-server-yrjhgg0x.js} +4 -1
- package/dist/sse-server.js +153 -40
- package/dist/{widget-renderer-9rr9sfh8.js → widget-renderer-hynpvfm9.js} +1 -1
- package/package.json +2 -2
|
@@ -12007,6 +12007,9 @@ function validateUrl(url, options = {}) {
|
|
|
12007
12007
|
}
|
|
12008
12008
|
return trimmed;
|
|
12009
12009
|
}
|
|
12010
|
+
function generateArtifactId(type) {
|
|
12011
|
+
return `${type}-${crypto.randomUUID().split("-")[0]}`;
|
|
12012
|
+
}
|
|
12010
12013
|
function validateToken(token, options = {}) {
|
|
12011
12014
|
const { maxLength = 2048, minLength = 1 } = options;
|
|
12012
12015
|
if (typeof token !== "string") {
|
|
@@ -12022,4 +12025,4 @@ function validateToken(token, options = {}) {
|
|
|
12022
12025
|
return trimmed;
|
|
12023
12026
|
}
|
|
12024
12027
|
|
|
12025
|
-
export { require_dist_cjs54 as require_dist_cjs, toKebabCase, sanitizeForText, sanitizeForDescription, sanitizeError, validateUrl, validateToken };
|
|
12028
|
+
export { require_dist_cjs54 as require_dist_cjs, toKebabCase, sanitizeForText, sanitizeForDescription, sanitizeError, validateUrl, generateArtifactId, validateToken };
|
package/dist/sse-server.js
CHANGED
|
@@ -5,13 +5,14 @@ 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";
|
|
@@ -29459,13 +29460,44 @@ function getSessionBaseUrl(sessionState) {
|
|
|
29459
29460
|
return baseUrl;
|
|
29460
29461
|
}
|
|
29461
29462
|
|
|
29462
|
-
// src/
|
|
29463
|
-
function
|
|
29464
|
-
|
|
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
|
+
};
|
|
29480
|
+
}
|
|
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
|
+
};
|
|
29488
|
+
}
|
|
29489
|
+
function applyFeatureFlagsToSession(url2, state) {
|
|
29490
|
+
state.set("featureFlags", resolveFeatureFlagsFromUrl(url2));
|
|
29465
29491
|
}
|
|
29466
|
-
function
|
|
29467
|
-
|
|
29492
|
+
function getFeatureFlags(sessionState) {
|
|
29493
|
+
const stored = sessionState?.get("featureFlags");
|
|
29494
|
+
if (stored != null) {
|
|
29495
|
+
return stored;
|
|
29496
|
+
}
|
|
29497
|
+
return resolveFeatureFlagsFromEnv();
|
|
29468
29498
|
}
|
|
29499
|
+
|
|
29500
|
+
// src/tools/build-chart.ts
|
|
29469
29501
|
var baseOutputSchema = exports_external.object({
|
|
29470
29502
|
success: exports_external.boolean(),
|
|
29471
29503
|
chartId: exports_external.string().optional(),
|
|
@@ -29476,8 +29508,8 @@ var buildChartOutputSchemaAppMode = baseOutputSchema;
|
|
|
29476
29508
|
var buildChartOutputSchemaToolMode = baseOutputSchema.extend({
|
|
29477
29509
|
imageUrl: exports_external.string().optional()
|
|
29478
29510
|
});
|
|
29479
|
-
function getBuildChartOutputSchema() {
|
|
29480
|
-
return
|
|
29511
|
+
function getBuildChartOutputSchema(flags) {
|
|
29512
|
+
return flags.mcpAppEnabled ? buildChartOutputSchemaAppMode : buildChartOutputSchemaToolMode;
|
|
29481
29513
|
}
|
|
29482
29514
|
function getChartSummaries(sessionState) {
|
|
29483
29515
|
return sessionState?.get("chart:summaries") ?? [];
|
|
@@ -29487,36 +29519,39 @@ function addChartSummary(sessionState, summary) {
|
|
|
29487
29519
|
summaries.push(summary);
|
|
29488
29520
|
sessionState?.set("chart:summaries", summaries);
|
|
29489
29521
|
}
|
|
29490
|
-
async function buildChart(args, sessionState
|
|
29522
|
+
async function buildChart(args, sessionState) {
|
|
29523
|
+
const { mcpAppEnabled, toolBuildChartNarrativeEnabled } = getFeatureFlags(sessionState);
|
|
29491
29524
|
try {
|
|
29492
|
-
const { dataSourceTitle, userPrompt } = args;
|
|
29525
|
+
const { dataSourceTitle, userPrompt, queryId } = args;
|
|
29493
29526
|
const httpClient = getSessionHttpClient(sessionState);
|
|
29494
29527
|
const openAIClient = getSessionOpenAIClient(sessionState);
|
|
29495
|
-
const toolCallId =
|
|
29528
|
+
const toolCallId = generateArtifactId("chart");
|
|
29496
29529
|
const result = await csdkBrowserMock.withBrowserEnvironment(async () => {
|
|
29497
|
-
const { buildChartEngine, runWithUserAction } = await import("./index-
|
|
29498
|
-
const { renderChartWidget } = await import("./widget-renderer-
|
|
29530
|
+
const { buildChartEngine, runWithUserAction } = await import("./index-xxces5vh.js");
|
|
29531
|
+
const { renderChartWidget } = await import("./widget-renderer-hynpvfm9.js");
|
|
29499
29532
|
const buildChartContext = {
|
|
29500
29533
|
toolCallId,
|
|
29501
29534
|
dataSourceTitle,
|
|
29502
29535
|
chartSummaries: getChartSummaries(sessionState),
|
|
29503
29536
|
retrieveChart: (id) => sessionState?.get(id) ?? null,
|
|
29504
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),
|
|
29505
29540
|
isNlqV3Enabled: true,
|
|
29506
29541
|
httpClient,
|
|
29507
|
-
openAIClient
|
|
29542
|
+
openAIClient,
|
|
29543
|
+
...queryId != null && { queryId }
|
|
29508
29544
|
};
|
|
29509
|
-
const chartSummary2 = await runWithUserAction("MCP", "ASSISTANT", () => buildChartEngine({ dataSourceTitle, userPrompt }, buildChartContext));
|
|
29545
|
+
const chartSummary2 = await runWithUserAction("MCP", "ASSISTANT", () => buildChartEngine({ dataSourceTitle, userPrompt, queryId: queryId ?? undefined }, buildChartContext));
|
|
29510
29546
|
console.info(">>> CHART SUMMARY", chartSummary2);
|
|
29511
29547
|
addChartSummary(sessionState, chartSummary2);
|
|
29512
29548
|
const savedProps = sessionState?.get(chartSummary2.chartId);
|
|
29513
29549
|
if (savedProps) {
|
|
29514
29550
|
const sisenseUrl = getSessionSisenseUrl(sessionState);
|
|
29515
29551
|
const sisenseToken = getSessionSisenseToken(sessionState);
|
|
29516
|
-
const narrativeEnabled = isNarrativeEnabled();
|
|
29517
29552
|
const { getNlgInsightsFromWidget } = await import("./ai-w2gkxdn7.js");
|
|
29518
|
-
const insightsPromise =
|
|
29519
|
-
const renderPromise =
|
|
29553
|
+
const insightsPromise = toolBuildChartNarrativeEnabled && httpClient ? getNlgInsightsFromWidget(savedProps, httpClient, { verbosity: "High" }) : Promise.resolve(undefined);
|
|
29554
|
+
const renderPromise = mcpAppEnabled ? Promise.resolve(null) : renderChartWidget({
|
|
29520
29555
|
widgetProps: savedProps,
|
|
29521
29556
|
sisenseUrl,
|
|
29522
29557
|
sisenseToken,
|
|
@@ -29534,14 +29569,14 @@ async function buildChart(args, sessionState, requestId) {
|
|
|
29534
29569
|
console.warn("Failed to generate NLG insights:", sanitized.message);
|
|
29535
29570
|
}
|
|
29536
29571
|
let imageUrl2;
|
|
29537
|
-
if (!
|
|
29572
|
+
if (!mcpAppEnabled && renderResult.status === "fulfilled" && renderResult.value) {
|
|
29538
29573
|
imageUrl2 = renderResult.value.content[0]?.text;
|
|
29539
|
-
} else if (!
|
|
29574
|
+
} else if (!mcpAppEnabled && renderResult.status === "rejected") {
|
|
29540
29575
|
const sanitized = sanitizeError(renderResult.reason);
|
|
29541
29576
|
console.warn("Failed to render chart widget:", sanitized.message);
|
|
29542
29577
|
}
|
|
29543
29578
|
const serializedWidgetProps = ni.serialize(savedProps);
|
|
29544
|
-
if (
|
|
29579
|
+
if (mcpAppEnabled && sisenseUrl && sisenseToken) {
|
|
29545
29580
|
sessionState?.set(`chart:payload:${chartSummary2.chartId}`, {
|
|
29546
29581
|
sisenseUrl,
|
|
29547
29582
|
sisenseToken,
|
|
@@ -29571,8 +29606,8 @@ async function buildChart(args, sessionState, requestId) {
|
|
|
29571
29606
|
success: true,
|
|
29572
29607
|
chartId: chartSummary.chartId,
|
|
29573
29608
|
message: chartSummary.message || `Chart created successfully for query: "${userPrompt}"`,
|
|
29574
|
-
...
|
|
29575
|
-
...
|
|
29609
|
+
...toolBuildChartNarrativeEnabled && insights != null ? { insights } : {},
|
|
29610
|
+
...mcpAppEnabled ? {} : { imageUrl }
|
|
29576
29611
|
};
|
|
29577
29612
|
const finalOutput = {
|
|
29578
29613
|
content: [
|
|
@@ -29590,8 +29625,8 @@ async function buildChart(args, sessionState, requestId) {
|
|
|
29590
29625
|
success: false,
|
|
29591
29626
|
chartId: undefined,
|
|
29592
29627
|
message: `Failed to create chart: ${errorMessage}`,
|
|
29593
|
-
...
|
|
29594
|
-
...
|
|
29628
|
+
...toolBuildChartNarrativeEnabled ? { insights: undefined } : {},
|
|
29629
|
+
...mcpAppEnabled ? {} : { imageUrl: undefined }
|
|
29595
29630
|
};
|
|
29596
29631
|
return {
|
|
29597
29632
|
content: [
|
|
@@ -29606,6 +29641,55 @@ async function buildChart(args, sessionState, requestId) {
|
|
|
29606
29641
|
}
|
|
29607
29642
|
}
|
|
29608
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
|
+
|
|
29609
29693
|
// src/tools/get-data-sources.ts
|
|
29610
29694
|
var getDataSourcesOutputSchema = {
|
|
29611
29695
|
dataSources: exports_external.array(exports_external.any())
|
|
@@ -29613,7 +29697,7 @@ var getDataSourcesOutputSchema = {
|
|
|
29613
29697
|
async function getDataSources(_args, sessionState) {
|
|
29614
29698
|
try {
|
|
29615
29699
|
const httpClient = getSessionHttpClient(sessionState);
|
|
29616
|
-
const { getDataSourcesEngine } = await import("./index-
|
|
29700
|
+
const { getDataSourcesEngine } = await import("./index-xxces5vh.js");
|
|
29617
29701
|
const getDataSourcesContext = {
|
|
29618
29702
|
toolCallId: "get-data-sources",
|
|
29619
29703
|
httpClient
|
|
@@ -29657,7 +29741,7 @@ async function getDataSourceFields(args, sessionState) {
|
|
|
29657
29741
|
const { dataSourceTitle } = args;
|
|
29658
29742
|
try {
|
|
29659
29743
|
const httpClient = getSessionHttpClient(sessionState);
|
|
29660
|
-
const { getDataSourceFieldsEngine } = await import("./index-
|
|
29744
|
+
const { getDataSourceFieldsEngine } = await import("./index-xxces5vh.js");
|
|
29661
29745
|
const getDataSourceFieldsContext = {
|
|
29662
29746
|
toolCallId: "get-data-source-fields",
|
|
29663
29747
|
httpClient
|
|
@@ -29926,9 +30010,6 @@ var __dirname2 = path.dirname(fileURLToPath(import.meta.url));
|
|
|
29926
30010
|
var isSource = import.meta.url.endsWith(".ts");
|
|
29927
30011
|
var DIST_DIR = isSource ? path.join(__dirname2, "..", "dist") : __dirname2;
|
|
29928
30012
|
var ANALYTICS_RESOURCE_URI = "ui://sisense-analytics/view.html";
|
|
29929
|
-
function isMcpAppEnabled2() {
|
|
29930
|
-
return process.env.TOOL_CHART_BUILDER_MCP_APP_ENABLED !== "false" && process.env.TOOL_CHART_BUILDER_MCP_APP_ENABLED !== "0";
|
|
29931
|
-
}
|
|
29932
30013
|
function getCspMeta(sessionState) {
|
|
29933
30014
|
const sisenseUrl = sessionState?.get("sisenseUrl")?.trim() ?? process.env.SISENSE_URL?.trim();
|
|
29934
30015
|
const connectDomains = sisenseUrl ? [sisenseUrl] : [];
|
|
@@ -29947,14 +30028,18 @@ var noOpValidator = {
|
|
|
29947
30028
|
};
|
|
29948
30029
|
async function setupMcpServer(sessionState) {
|
|
29949
30030
|
try {
|
|
30031
|
+
const { mcpAppEnabled, toolBuildQueryEnabled } = getFeatureFlags(sessionState);
|
|
29950
30032
|
const {
|
|
29951
30033
|
TOOL_NAME_CHART_BUILDER,
|
|
30034
|
+
TOOL_NAME_BUILD_QUERY,
|
|
29952
30035
|
TOOL_NAME_GET_DATA_SOURCE_FIELDS,
|
|
29953
30036
|
TOOL_NAME_GET_DATA_SOURCES,
|
|
29954
30037
|
getDataSourcesSchema,
|
|
29955
30038
|
getDataSourceFieldsSchema,
|
|
29956
|
-
buildChartSchema
|
|
29957
|
-
|
|
30039
|
+
buildChartSchema,
|
|
30040
|
+
buildChartSchemaNaturalConversation,
|
|
30041
|
+
buildQuerySchema
|
|
30042
|
+
} = await import("./index-xxces5vh.js");
|
|
29958
30043
|
const server = new McpServer({
|
|
29959
30044
|
name: "sisense-mcp-server",
|
|
29960
30045
|
version: "1.0.0"
|
|
@@ -29977,22 +30062,33 @@ async function setupMcpServer(sessionState) {
|
|
|
29977
30062
|
}, async (args) => {
|
|
29978
30063
|
return await getDataSourceFields(args, sessionState);
|
|
29979
30064
|
});
|
|
29980
|
-
|
|
29981
|
-
|
|
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) {
|
|
29982
30078
|
hZ(server, TOOL_NAME_CHART_BUILDER, {
|
|
29983
30079
|
title: "Build Sisense Chart from User Prompt",
|
|
29984
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.",
|
|
29985
|
-
inputSchema:
|
|
30081
|
+
inputSchema: chartInputSchema.shape,
|
|
29986
30082
|
outputSchema: buildChartOutputSchema.shape,
|
|
29987
30083
|
_meta: { ui: { resourceUri: ANALYTICS_RESOURCE_URI } }
|
|
29988
|
-
}, async (args
|
|
29989
|
-
return await buildChart(args, sessionState
|
|
30084
|
+
}, async (args) => {
|
|
30085
|
+
return await buildChart(args, sessionState);
|
|
29990
30086
|
});
|
|
29991
30087
|
} else {
|
|
29992
30088
|
server.registerTool(TOOL_NAME_CHART_BUILDER, {
|
|
29993
30089
|
title: "Build Sisense Chart from User Prompt",
|
|
29994
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.",
|
|
29995
|
-
inputSchema:
|
|
30091
|
+
inputSchema: chartInputSchema.shape,
|
|
29996
30092
|
outputSchema: buildChartOutputSchema.shape
|
|
29997
30093
|
}, async (args) => {
|
|
29998
30094
|
return await buildChart(args, sessionState);
|
|
@@ -30055,6 +30151,18 @@ var persistentStates = new Map;
|
|
|
30055
30151
|
function getCredentialKey(sisenseUrl, sisenseToken) {
|
|
30056
30152
|
return createHash("sha256").update(`${sisenseUrl}:${sisenseToken}`).digest("hex").slice(0, 16);
|
|
30057
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
|
+
}
|
|
30058
30166
|
var server = createServer(async (req, res) => {
|
|
30059
30167
|
const url2 = new URL(req.url || "/", `http://${req.headers.host}`);
|
|
30060
30168
|
if (url2.pathname === "/health" && req.method === "GET") {
|
|
@@ -30147,7 +30255,8 @@ var server = createServer(async (req, res) => {
|
|
|
30147
30255
|
const credKey = getCredentialKey(sisenseUrl, sisenseToken);
|
|
30148
30256
|
const existingState = persistentStates.get(credKey);
|
|
30149
30257
|
if (existingState) {
|
|
30150
|
-
state = existingState;
|
|
30258
|
+
state = resetConversationState(existingState, req);
|
|
30259
|
+
persistentStates.set(credKey, state);
|
|
30151
30260
|
} else {
|
|
30152
30261
|
try {
|
|
30153
30262
|
const validatedUrl = validateUrl(sisenseUrl, {
|
|
@@ -30170,7 +30279,7 @@ var server = createServer(async (req, res) => {
|
|
|
30170
30279
|
createOpenAIClient,
|
|
30171
30280
|
initializeHttpClient,
|
|
30172
30281
|
initializeOpenAIClient
|
|
30173
|
-
} = await import("./index-
|
|
30282
|
+
} = await import("./index-xxces5vh.js");
|
|
30174
30283
|
const httpClient = createHttpClientFromConfig({
|
|
30175
30284
|
url: validatedUrl,
|
|
30176
30285
|
token: validatedToken
|
|
@@ -30215,6 +30324,7 @@ var server = createServer(async (req, res) => {
|
|
|
30215
30324
|
sessions.delete(transport.sessionId);
|
|
30216
30325
|
}
|
|
30217
30326
|
};
|
|
30327
|
+
applyFeatureFlagsToSession(url2, state);
|
|
30218
30328
|
const mcpServer = await setupMcpServer(state);
|
|
30219
30329
|
await mcpServer.connect(transport);
|
|
30220
30330
|
} else {
|
|
@@ -30265,6 +30375,9 @@ initializeSisenseClients().then(() => {
|
|
|
30265
30375
|
console.log(` http://localhost:${PORT}/mcp?sisenseUrl=<SISENSE_URL>&sisenseToken=<SISENSE_TOKEN>`);
|
|
30266
30376
|
console.log(" Or set SISENSE_URL and SISENSE_TOKEN in the environment and use http://localhost:" + `${PORT}/mcp`);
|
|
30267
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("");
|
|
30268
30381
|
console.log("Endpoints:");
|
|
30269
30382
|
console.log(` Health: http://localhost:${PORT}/health`);
|
|
30270
30383
|
console.log(` Screenshots: http://localhost:${PORT}/screenshots/`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sisense/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
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.",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
52
52
|
"@playwright/experimental-ct-react": "^1.56.1",
|
|
53
53
|
"@playwright/test": "^1.56.1",
|
|
54
|
-
"@sisense/sdk-ai-core": "0.6.
|
|
54
|
+
"@sisense/sdk-ai-core": "0.6.3",
|
|
55
55
|
"@sisense/sdk-data": "2.24.0",
|
|
56
56
|
"@sisense/sdk-ui": "2.24.0",
|
|
57
57
|
"playwright": "^1.56.1",
|