@lightdash-tools/mcp 0.13.1 → 0.14.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.
Files changed (48) hide show
  1. package/README.md +56 -11
  2. package/dist/auth/request-state-key.d.ts +1 -1
  3. package/dist/auth/request-state-key.js +1 -1
  4. package/dist/auth/resource-server/oauth-protected-resource.d.ts +2 -2
  5. package/dist/auth/resource-server/oauth-protected-resource.js +8 -7
  6. package/dist/bin.js +1 -1
  7. package/dist/config/enabled-profiles.d.ts +23 -0
  8. package/dist/config/enabled-profiles.js +57 -0
  9. package/dist/config/enabled-profiles.test.d.ts +1 -0
  10. package/dist/config/enabled-profiles.test.js +62 -0
  11. package/dist/config/env.d.ts +2 -0
  12. package/dist/config/env.js +3 -1
  13. package/dist/config/load-mcp-config.d.ts +3 -0
  14. package/dist/config/load-mcp-config.js +20 -23
  15. package/dist/config/load-mcp-config.test.js +41 -0
  16. package/dist/config/obsolete-env.js +2 -8
  17. package/dist/config/read-env.d.ts +4 -0
  18. package/dist/config/read-env.js +13 -0
  19. package/dist/config/test-mcp-http-config.js +4 -1
  20. package/dist/http.integration.test.js +47 -24
  21. package/dist/index.integration.test.js +3 -12
  22. package/dist/profiles/content-developer/v1/prompts.js +3 -2
  23. package/dist/profiles/content-developer/v1/prompts.test.js +8 -0
  24. package/dist/profiles/content-developer/v1/resources/playbooks/chart-types.md +3 -0
  25. package/dist/profiles/content-developer/v1/resources/playbooks/core.md +18 -16
  26. package/dist/profiles/content-developer/v1/resources/playbooks/dashboard-design.md +11 -1
  27. package/dist/profiles/content-developer/v1/resources/playbooks/dashboards.md +2 -2
  28. package/dist/profiles/content-developer/v1/resources/playbooks/index.md +8 -7
  29. package/dist/profiles/content-developer/v1/resources/playbooks/table-calculations.md +131 -0
  30. package/dist/profiles/content-developer/v1/resources/playbooks.d.ts +1 -1
  31. package/dist/profiles/content-developer/v1/resources/playbooks.js +8 -1
  32. package/dist/profiles/content-reader/v1/index.js +1 -0
  33. package/dist/profiles/content-reader/v1/prompts.js +10 -9
  34. package/dist/profiles/content-reader/v1/resources/playbooks/compare.md +1 -1
  35. package/dist/profiles/content-reader/v1/resources/playbooks/core.md +12 -11
  36. package/dist/profiles/content-reader/v1/resources/playbooks/discover.md +12 -3
  37. package/dist/profiles/content-reader/v1/resources/playbooks/explain-run.md +3 -2
  38. package/dist/profiles/index.d.ts +2 -1
  39. package/dist/profiles/index.js +2 -1
  40. package/dist/profiles/index.test.js +2 -1
  41. package/dist/stdio.process.test.js +2 -1
  42. package/dist/tools/project/reader-content.d.ts +4 -0
  43. package/dist/tools/project/reader-content.js +61 -6
  44. package/dist/tools/project/reader-content.test.d.ts +4 -0
  45. package/dist/tools/project/reader-content.test.js +64 -0
  46. package/dist/transports/streamable-http.js +6 -3
  47. package/dist/transports/streamable-http.test.js +16 -0
  48. package/package.json +3 -3
@@ -41,17 +41,18 @@ Record budget / pagination / truncation stops in the answer.
41
41
 
42
42
  ## Allowed tools (`lightdash_*`)
43
43
 
44
- | Tool | Use for |
45
- | ---------------------------------------------------- | -------------------------------------------------------- |
46
- | `get_project` | Resolve project; read `readerCapabilities` + pin context |
47
- | `search_content` | Find charts/dashboards/spaces/data apps |
48
- | `list_spaces` / `get_space` | Space hierarchy + immediate content |
49
- | `get_dashboard` / `get_chart` | Structure / definition (SQL text hidden) |
50
- | `list_project_parameters` / `get_project_parameters` | Parameter defs / values |
51
- | `explain_content` | Compact metadata explanation |
52
- | `run_chart` / `run_dashboard_tile` | Bounded saved execution (numbers) |
53
- | `export_chart_image` | PNG snapshot of a saved chart (vision); needs headless |
54
- | `get_query_result` / `cancel_query` | Poll / cancel by `queryUuid` |
44
+ | Tool | Use for |
45
+ | ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
46
+ | `get_project` | Resolve project; read `readerCapabilities` + pin context |
47
+ | `search_content` | Find charts/dashboards/spaces/data apps |
48
+ | `list_verified_content` | List admin-verified charts/dashboards (prefer as trusted seeds) |
49
+ | `list_spaces` / `get_space` | Space hierarchy + immediate content |
50
+ | `get_dashboard` / `get_chart` | Structure / definition (saved SQL **chart** bodies hidden; semantic `tableCalculations` may appear when query is included) |
51
+ | `list_project_parameters` / `get_project_parameters` | Parameter defs / values |
52
+ | `explain_content` | Compact metadata explanation |
53
+ | `run_chart` / `run_dashboard_tile` | Bounded saved execution (numbers) |
54
+ | `export_chart_image` | PNG snapshot of a saved chart (vision); needs headless |
55
+ | `get_query_result` / `cancel_query` | Poll / cancel by `queryUuid` |
55
56
 
56
57
  ## Phase 0 — Resolve project
57
58
 
@@ -6,17 +6,26 @@ URI: `lightdash://playbooks/content-reader/discover`
6
6
 
7
7
  Map the user request to: find / explain / retrieve values / summarize dashboard / compare / investigate. Discovery-only intents **must not** execute.
8
8
 
9
+ ## Verified content first
10
+
11
+ When the user asks for trusted / canonical / verified content, or the prompt sets `verifiedOnly=true`:
12
+
13
+ 1. Call `list_verified_content` **before** keyword `search_content`.
14
+ 2. Prefer verified matches as an absolute trump ([verified content](https://docs.lightdash.com/guides/verified-content)).
15
+ 3. If the list is empty, fall back to search — verification is often absent in real orgs; do not stall.
16
+
9
17
  ## Search strategy
10
18
 
11
19
  1. Prefer **short, high-signal tokens** that appear in titles (product names, Japanese KPI words). Multi-word English phrases often return **zero** hits even when related content exists.
12
20
  2. If the first query is empty, try: alternate language tokens, a single keyword, `spaceUuids` / `parentSpaceUuid`, or browse with `sortBy=views` + `sortDirection=desc` (optional empty/`query` omitted) and then refine.
13
21
  3. Always set `pageSize` (≤25). Prefer `contentTypes` when the user asked for charts vs dashboards.
14
22
  4. Read `source` on chart hits: `dbt_explore` (or similar semantic) vs `sql`. Treat `sql` as **not executable** on this profile.
15
- 5. Ranking heuristics when relevance ties:
23
+ 5. Ranking heuristics when relevance ties (after verified preference above):
16
24
  - Higher `views` / pinned (`pinnedList` non-null)
17
25
  - Richer description / clearer name match
18
26
  - Prefer non-deleted / non-sandbox space names when obvious
19
- - Verification is often **null** in real orgs — do not stall waiting for verified content; prefer pinned + views + description instead
27
+
28
+ `search_content` does **not** filter by verification — use `list_verified_content` for that.
20
29
 
21
30
  ## Spaces
22
31
 
@@ -29,7 +38,7 @@ Map the user request to: find / explain / retrieve values / summarize dashboard
29
38
  Return **≤5** candidates:
30
39
 
31
40
  ```text
32
- - name (type) — uuid/slug — space — views/pinned — source(if chart) — why relevant — warnings
41
+ - name (type) — uuid/slug — space — views/pinned — verified? — source(if chart) — why relevant — warnings
33
42
  ```
34
43
 
35
44
  Do not execute unless the user asked for values or analysis.
@@ -14,7 +14,7 @@ URI: `lightdash://playbooks/content-reader/explain-run`
14
14
  | Signal | Action |
15
15
  | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
16
16
  | Search `source=sql` | Do **not** call `run_chart`; explain metadata only; cite `CONTENT_NOT_EXECUTABLE` / capability |
17
- | `get_chart` → `chartType=sql` + warnings | Same — SQL text is hidden; execution disabled |
17
+ | `get_chart` → `chartType=sql` + warnings | Same — saved SQL **chart** body hidden; execution disabled |
18
18
  | Opaque API errors (e.g. “Saved query not found”) on SQL ids | Treat as non-executable; do not retry endlessly |
19
19
  | `readerCapabilities.canExecuteSqlCharts=false` | Hard stop for SQL execution |
20
20
 
@@ -36,7 +36,8 @@ Defaults: `useCache=true`, modest `limit` (≤100; summarize ≤20 rows in the a
36
36
  1. Pick tiles with `executable=true` and a `chartUuid` (skip markdown / non-chart tiles).
37
37
  2. Call `run_dashboard_tile` with dashboard UUID/slug + **`tileUuid`** from `get_dashboard`.
38
38
  3. Preserve dashboard context; only pass `filterOverrides` / `parameterOverrides` for **existing** filter ids / known parameter names with **values** (never retarget filters).
39
- 4. Cap tiles per summary (`maximumTiles` / budget ≤5). Unexecuted tiles must not support conclusions.
39
+ 4. Optional **date zoom**: pass `dateZoom: { granularity?, xAxisFieldId? }` when the user asks to simulate a zoom ([date zoom](https://docs.lightdash.com/guides/date-zoom)). Otherwise execution uses the dashboard’s saved default granularity. Cite `appliedDateZoom` in the report when present.
40
+ 5. Cap tiles per summary (`maximumTiles` / budget ≤5). Unexecuted tiles must not support conclusions.
40
41
 
41
42
  ## Async handles
42
43
 
@@ -1,5 +1,6 @@
1
1
  /**
2
- * Shipped MCP profiles (path → definition). No PROFILE/PATH env knobs (ADR-0006).
2
+ * Shipped MCP profiles (path → definition). No free-form PATH env (ADR-0006).
3
+ * HTTP may filter mounts via LIGHTDASH_TOOLS_MCP_PROFILES (ADR-0024); catalog stays complete.
3
4
  */
4
5
  import type { ProfileDefinition, ProfileId } from './types.js';
5
6
  export type { ProfileDefinition, ProfileId } from './types.js';
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
- * Shipped MCP profiles (path → definition). No PROFILE/PATH env knobs (ADR-0006).
3
+ * Shipped MCP profiles (path → definition). No free-form PATH env (ADR-0006).
4
+ * HTTP may filter mounts via LIGHTDASH_TOOLS_MCP_PROFILES (ADR-0024); catalog stays complete.
4
5
  */
5
6
  Object.defineProperty(exports, "__esModule", { value: true });
6
7
  exports.PROFILES = exports.DEFAULT_PROFILE_ID = exports.DATA_ANALYST_PROFILE_PATH = exports.CONTENT_GOVERNANCE_PROFILE_PATH = exports.CONTENT_DEVELOPER_PROFILE_PATH = exports.CONTENT_READER_PROFILE_PATH = exports.ORGANIZATION_AUDIT_PROFILE_PATH = exports.SEMANTIC_LAYER_PROFILE_PATH = exports.AI_AGENT_OPS_PROFILE_PATH = void 0;
@@ -55,8 +55,9 @@ const index_js_1 = require("./index.js");
55
55
  });
56
56
  (0, vitest_1.it)('content-reader membership and server name', () => {
57
57
  const profile = (0, index_js_1.getProfile)('content-reader');
58
- (0, vitest_1.expect)((0, index_js_1.listToolIds)(profile)).toHaveLength(14);
58
+ (0, vitest_1.expect)((0, index_js_1.listToolIds)(profile)).toHaveLength(15);
59
59
  (0, vitest_1.expect)((0, index_js_1.listToolIds)(profile)).toContain('export_chart_image');
60
+ (0, vitest_1.expect)((0, index_js_1.listToolIds)(profile)).toContain('list_verified_content');
60
61
  (0, vitest_1.expect)((0, index_js_1.getProfileServerName)(profile)).toBe('lightdash-mcp-content');
61
62
  });
62
63
  (0, vitest_1.it)('content-developer membership and short server name', () => {
@@ -197,8 +197,9 @@ async function initializeThenListTools(child, getStderr, clientName) {
197
197
  child = spawned.child;
198
198
  const { serverName, tools } = await initializeThenListTools(child, spawned.getStderr, 'stdio-process-smoke');
199
199
  (0, vitest_1.expect)(serverName).toBe('lightdash-mcp-content');
200
- (0, vitest_1.expect)(tools).toHaveLength(14);
200
+ (0, vitest_1.expect)(tools).toHaveLength(15);
201
201
  (0, vitest_1.expect)(tools.some((t) => t.name === 'lightdash_search_content')).toBe(true);
202
+ (0, vitest_1.expect)(tools.some((t) => t.name === 'lightdash_list_verified_content')).toBe(true);
202
203
  (0, vitest_1.expect)(tools.some((t) => t.name === 'lightdash_run_chart')).toBe(true);
203
204
  (0, vitest_1.expect)(tools.some((t) => t.name === 'lightdash_export_chart_image')).toBe(true);
204
205
  killChild(child);
@@ -4,9 +4,13 @@
4
4
  import type { McpContextProvider } from '../../server/request-context.js';
5
5
  import type { McpServer } from '@modelcontextprotocol/server';
6
6
  export declare function detectChartType(chart: Record<string, unknown>): 'semantic' | 'sql' | 'unknown';
7
+ /** Pass through OpenAPI TableCalculation fields agents need to clone. */
8
+ export declare function toReaderTableCalculation(tc: unknown): Record<string, unknown>;
7
9
  export declare function registerSearchContent(server: McpServer, contextProvider: McpContextProvider): void;
10
+ export declare function registerListVerifiedContent(server: McpServer, contextProvider: McpContextProvider): void;
8
11
  export declare function registerGetDashboard(server: McpServer, contextProvider: McpContextProvider): void;
9
12
  export declare function registerGetChart(server: McpServer, contextProvider: McpContextProvider): void;
10
13
  export declare const searchContentTool: import("../types.js").ToolModule;
14
+ export declare const listVerifiedContentTool: import("../types.js").ToolModule;
11
15
  export declare const getDashboardTool: import("../types.js").ToolModule;
12
16
  export declare const getChartTool: import("../types.js").ToolModule;
@@ -3,9 +3,11 @@
3
3
  * Content-reader discovery/metadata tools: search, dashboard, chart.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getChartTool = exports.getDashboardTool = exports.searchContentTool = void 0;
6
+ exports.getChartTool = exports.getDashboardTool = exports.listVerifiedContentTool = exports.searchContentTool = void 0;
7
7
  exports.detectChartType = detectChartType;
8
+ exports.toReaderTableCalculation = toReaderTableCalculation;
8
9
  exports.registerSearchContent = registerSearchContent;
10
+ exports.registerListVerifiedContent = registerListVerifiedContent;
9
11
  exports.registerGetDashboard = registerGetDashboard;
10
12
  exports.registerGetChart = registerGetChart;
11
13
  const common_1 = require("@lightdash-tools/common");
@@ -30,6 +32,36 @@ function detectChartType(chart) {
30
32
  }
31
33
  return 'unknown';
32
34
  }
35
+ /** Pass through OpenAPI TableCalculation fields agents need to clone. */
36
+ function toReaderTableCalculation(tc) {
37
+ const row = (tc !== null && tc !== void 0 ? tc : {});
38
+ const out = {
39
+ name: row.name,
40
+ displayName: row.displayName,
41
+ };
42
+ if (row.type !== undefined) {
43
+ out.type = row.type;
44
+ }
45
+ if (row.format !== undefined) {
46
+ out.format = row.format;
47
+ }
48
+ if (row.totalMode !== undefined) {
49
+ out.totalMode = row.totalMode;
50
+ }
51
+ if (row.index !== undefined) {
52
+ out.index = row.index;
53
+ }
54
+ if (row.formula !== undefined) {
55
+ out.formula = row.formula;
56
+ }
57
+ if (row.sql !== undefined) {
58
+ out.sql = row.sql;
59
+ }
60
+ if (row.template !== undefined) {
61
+ out.template = row.template;
62
+ }
63
+ return out;
64
+ }
33
65
  /* eslint-disable-next-line sonarjs/cyclomatic-complexity -- chart shape mapping */
34
66
  function toReaderChart(chart, includeQuery) {
35
67
  var _a, _b, _c, _d;
@@ -42,10 +74,7 @@ function toReaderChart(chart, includeQuery) {
42
74
  ? metricQuery.metrics.map((fieldId) => ({ fieldId }))
43
75
  : [];
44
76
  const tableCalculations = includeQuery
45
- ? ((_b = metricQuery.tableCalculations) !== null && _b !== void 0 ? _b : []).map((tc) => {
46
- const row = tc;
47
- return { name: row.name, displayName: row.displayName };
48
- })
77
+ ? ((_b = metricQuery.tableCalculations) !== null && _b !== void 0 ? _b : []).map(toReaderTableCalculation)
49
78
  : undefined;
50
79
  return {
51
80
  uuid: chart.uuid,
@@ -152,6 +181,31 @@ function registerSearchContent(server, contextProvider) {
152
181
  }
153
182
  }));
154
183
  }
184
+ function registerListVerifiedContent(server, contextProvider) {
185
+ (0, content_reader_js_1.registerContentReaderTool)(server, 'list_verified_content', {
186
+ title: 'List verified content',
187
+ description: 'List admin-verified charts and dashboards in the resolved project (prefer these as trusted seeds)',
188
+ safety: content_reader_js_1.METADATA_SAFETY,
189
+ inputSchema: {
190
+ projectUuid: (0, schema_fields_js_1.projectUuidField)().optional(),
191
+ },
192
+ }, (profile) => (0, shared_js_1.wrapTool)(contextProvider, (c) => async (args) => {
193
+ try {
194
+ const scope = (0, project_scope_js_1.resolveProjectScope)({ projectUuid: args.projectUuid });
195
+ const items = await c.v1.projects.listVerifiedContent(scope.projectUuid);
196
+ return (0, shared_js_1.jsonToolResult)((0, envelope_js_1.contentReaderEnvelope)({ items }, {
197
+ profile,
198
+ projectUuid: scope.projectUuid,
199
+ projectPinned: scope.projectPinned,
200
+ complete: true,
201
+ truncated: false,
202
+ }));
203
+ }
204
+ catch (err) {
205
+ return (0, reader_tool_helpers_js_1.projectScopeErrorResult)(err);
206
+ }
207
+ }));
208
+ }
155
209
  function registerGetDashboard(server, contextProvider) {
156
210
  (0, content_reader_js_1.registerContentReaderTool)(server, 'get_dashboard', {
157
211
  title: 'Get dashboard',
@@ -185,7 +239,7 @@ function registerGetDashboard(server, contextProvider) {
185
239
  function registerGetChart(server, contextProvider) {
186
240
  (0, content_reader_js_1.registerContentReaderTool)(server, 'get_chart', {
187
241
  title: 'Get chart',
188
- description: 'Explain a saved chart definition (SQL text hidden)',
242
+ description: 'Explain a saved semantic chart definition (saved SQL chart bodies stay hidden; tableCalculations expressions included when includeQueryDefinition)',
189
243
  safety: content_reader_js_1.METADATA_SAFETY,
190
244
  inputSchema: {
191
245
  projectUuid: (0, schema_fields_js_1.projectUuidField)().optional(),
@@ -213,5 +267,6 @@ function registerGetChart(server, contextProvider) {
213
267
  }
214
268
  // ToolModule exports (profile mounts)
215
269
  exports.searchContentTool = (0, types_js_1.defineTool)('search_content', registerSearchContent);
270
+ exports.listVerifiedContentTool = (0, types_js_1.defineTool)('list_verified_content', registerListVerifiedContent);
216
271
  exports.getDashboardTool = (0, types_js_1.defineTool)('get_dashboard', registerGetDashboard);
217
272
  exports.getChartTool = (0, types_js_1.defineTool)('get_chart', registerGetChart);
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Unit tests for get_chart table-calculation pass-through.
3
+ */
4
+ export {};
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ /**
3
+ * Unit tests for get_chart table-calculation pass-through.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const vitest_1 = require("vitest");
7
+ const reader_content_js_1 = require("./reader-content.js");
8
+ (0, vitest_1.describe)('toReaderTableCalculation', () => {
9
+ (0, vitest_1.it)('preserves formula table calculations', () => {
10
+ (0, vitest_1.expect)((0, reader_content_js_1.toReaderTableCalculation)({
11
+ name: 'revenue_running_total',
12
+ displayName: 'Running total',
13
+ type: 'number',
14
+ totalMode: 'sum_of_rows',
15
+ formula: '=RUNNING_TOTAL(orders_total_order_amount)',
16
+ index: 0,
17
+ })).toEqual({
18
+ name: 'revenue_running_total',
19
+ displayName: 'Running total',
20
+ type: 'number',
21
+ totalMode: 'sum_of_rows',
22
+ formula: '=RUNNING_TOTAL(orders_total_order_amount)',
23
+ index: 0,
24
+ });
25
+ });
26
+ (0, vitest_1.it)('preserves template table calculations', () => {
27
+ (0, vitest_1.expect)((0, reader_content_js_1.toReaderTableCalculation)({
28
+ name: 'revenue_pct_change',
29
+ displayName: '% change vs previous',
30
+ type: 'number',
31
+ format: { type: 'percent' },
32
+ totalMode: 'sum_of_rows',
33
+ template: {
34
+ type: 'percent_change_from_previous',
35
+ fieldId: 'orders_total_order_amount',
36
+ orderBy: [{ fieldId: 'orders_order_date_week', order: 'asc' }],
37
+ },
38
+ })).toEqual({
39
+ name: 'revenue_pct_change',
40
+ displayName: '% change vs previous',
41
+ type: 'number',
42
+ format: { type: 'percent' },
43
+ totalMode: 'sum_of_rows',
44
+ template: {
45
+ type: 'percent_change_from_previous',
46
+ fieldId: 'orders_total_order_amount',
47
+ orderBy: [{ fieldId: 'orders_order_date_week', order: 'asc' }],
48
+ },
49
+ });
50
+ });
51
+ (0, vitest_1.it)('preserves sql table calculations', () => {
52
+ (0, vitest_1.expect)((0, reader_content_js_1.toReaderTableCalculation)({
53
+ name: 'pct_of_total',
54
+ displayName: '% of total',
55
+ sql: '${orders.total_order_amount} / total(${orders.total_order_amount})',
56
+ format: { type: 'percent' },
57
+ })).toEqual({
58
+ name: 'pct_of_total',
59
+ displayName: '% of total',
60
+ format: { type: 'percent' },
61
+ sql: '${orders.total_order_amount} / total(${orders.total_order_amount})',
62
+ });
63
+ });
64
+ });
@@ -16,6 +16,7 @@ const lightdash_oauth_middleware_js_1 = require("../auth/resource-server/lightda
16
16
  const oauth_protected_resource_js_1 = require("../auth/resource-server/oauth-protected-resource.js");
17
17
  const shared_key_middleware_js_1 = require("../auth/resource-server/shared-key-middleware.js");
18
18
  const token_hash_js_1 = require("../auth/token-hash.js");
19
+ const enabled_profiles_js_1 = require("../config/enabled-profiles.js");
19
20
  const load_mcp_config_js_1 = require("../config/load-mcp-config.js");
20
21
  const runtime_js_1 = require("../config/runtime.js");
21
22
  const available_projects_js_1 = require("../governance/available-projects.js");
@@ -175,7 +176,9 @@ async function createStreamableHttpServer(config) {
175
176
  (0, load_mcp_config_js_1.emitMcpHttpSecurityWarnings)(inputConfig);
176
177
  (0, runtime_js_1.warnIgnoredCliGuardrailEnvVars)();
177
178
  (0, available_projects_js_1.validateAvailableProjectsConfig)();
178
- (0, request_state_key_js_1.assertHttpSignedStateKeyConfigured)();
179
+ if ((0, enabled_profiles_js_1.requiresSignedStateKey)(inputConfig.enabledProfiles)) {
180
+ (0, request_state_key_js_1.assertHttpSignedStateKeyConfigured)();
181
+ }
179
182
  (0, audit_js_1.initAuditLog)((0, runtime_js_1.getAuditLogPath)());
180
183
  let httpConfig = inputConfig;
181
184
  let oauthBroker;
@@ -219,7 +222,7 @@ async function createStreamableHttpServer(config) {
219
222
  function startStreamableHttpServer(config) {
220
223
  void createStreamableHttpServer(config)
221
224
  .then(({ baseUrl, config: httpConfig }) => {
222
- const paths = (0, index_js_1.listProfilePaths)()
225
+ const paths = (0, enabled_profiles_js_1.listEnabledProfilePaths)(httpConfig.enabledProfiles)
223
226
  .map((p) => `${baseUrl}${p}`)
224
227
  .join(', ');
225
228
  console.error(`Lightdash MCP server listening on ${paths} (auth: ${httpConfig.authMode})`);
@@ -299,7 +302,7 @@ async function handleHttpRequest(req, res, config, oauthBroker, nodeHandler) {
299
302
  return;
300
303
  }
301
304
  const profile = (0, index_js_1.getProfileByPath)(path);
302
- if (!profile) {
305
+ if (!profile || !(0, enabled_profiles_js_1.isProfileEnabled)(config.enabledProfiles, profile.id)) {
303
306
  (0, http_response_js_1.sendJson)(res, 404, { error: 'Not Found' });
304
307
  return;
305
308
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const vitest_1 = require("vitest");
4
4
  const oauth_protected_resource_js_1 = require("../auth/resource-server/oauth-protected-resource.js");
5
5
  const www_authenticate_js_1 = require("../auth/resource-server/www-authenticate.js");
6
+ const enabled_profiles_js_1 = require("../config/enabled-profiles.js");
6
7
  const env_js_1 = require("../config/env.js");
7
8
  const load_mcp_config_js_1 = require("../config/load-mcp-config.js");
8
9
  const test_mcp_http_config_js_1 = require("../config/test-mcp-http-config.js");
@@ -104,4 +105,19 @@ function clearMcpEnv() {
104
105
  process.env.VITEST = savedVitest;
105
106
  }
106
107
  });
108
+ (0, vitest_1.it)('allows HTTP startup without request-state key when write profiles are disabled', async () => {
109
+ const savedVitest = process.env.VITEST;
110
+ delete process.env.VITEST;
111
+ process.env.NODE_ENV = 'production';
112
+ delete process.env[env_js_1.ENV_LIGHTDASH_TOOLS_MCP_REQUEST_STATE_KEY];
113
+ const handle = await (0, streamable_http_js_1.createStreamableHttpServer)((0, test_mcp_http_config_js_1.makeTestMcpHttpConfig)({
114
+ port: 0,
115
+ enabledProfiles: (0, enabled_profiles_js_1.parseEnabledProfiles)('content-reader'),
116
+ }));
117
+ (0, vitest_1.expect)(handle.port).toBeGreaterThan(0);
118
+ await handle.close();
119
+ if (savedVitest !== undefined) {
120
+ process.env.VITEST = savedVitest;
121
+ }
122
+ });
107
123
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash-tools/mcp",
3
- "version": "0.13.1",
3
+ "version": "0.14.0",
4
4
  "description": "MCP server for Lightdash semantic-layer, organization-audit, content-reader, content-developer, content-governance, and ai-agent-ops profiles.",
5
5
  "keywords": [],
6
6
  "repository": {
@@ -24,8 +24,8 @@
24
24
  "commander": "^15.0.0",
25
25
  "hono": "^4.13.0",
26
26
  "zod": "^4.4.3",
27
- "@lightdash-tools/client": "0.13.1",
28
- "@lightdash-tools/common": "0.13.1"
27
+ "@lightdash-tools/client": "0.14.0",
28
+ "@lightdash-tools/common": "0.14.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@modelcontextprotocol/client": "2.0.0",