@lightdash-tools/mcp 0.8.0 → 0.11.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 +112 -236
- package/dist/audit/server-profile.d.ts +13 -0
- package/dist/audit/server-profile.js +28 -0
- package/dist/audit/server-profile.test.js +21 -0
- package/dist/auth/oauth-broker/pending-store.d.ts +6 -7
- package/dist/auth/oauth-broker/pending-store.js +3 -4
- package/dist/auth/oauth-broker/pending-store.test.d.ts +2 -3
- package/dist/auth/oauth-broker/pending-store.test.js +2 -39
- package/dist/auth/oauth-broker/routes.d.ts +1 -1
- package/dist/auth/oauth-broker/routes.js +3 -3
- package/dist/auth/oauth-broker/routes.test.js +1 -1
- package/dist/auth/request-state-key.d.ts +19 -0
- package/dist/auth/request-state-key.js +49 -0
- package/dist/auth/resource-server/lightdash-oauth-middleware.d.ts +1 -3
- package/dist/auth/resource-server/lightdash-oauth-middleware.js +1 -20
- package/dist/auth/resource-server/lightdash-oauth-middleware.test.js +14 -14
- package/dist/auth/resource-server/oauth-protected-resource.d.ts +6 -6
- package/dist/auth/resource-server/oauth-protected-resource.js +8 -8
- package/dist/auth/resource-server/token-scopes.d.ts +1 -1
- package/dist/auth/resource-server/token-scopes.js +1 -1
- package/dist/auth/resource-server/www-authenticate.test.js +11 -13
- package/dist/bin.js +54 -51
- package/dist/config/env.d.ts +8 -16
- package/dist/config/env.js +9 -17
- package/dist/config/load-mcp-config.d.ts +0 -4
- package/dist/config/load-mcp-config.js +9 -38
- package/dist/config/load-mcp-config.test.js +8 -2
- package/dist/config/normalize-url.d.ts +1 -1
- package/dist/config/normalize-url.js +1 -1
- package/dist/config/normalize-url.test.js +16 -13
- package/dist/config/obsolete-env.d.ts +5 -0
- package/dist/config/obsolete-env.js +48 -0
- package/dist/config/obsolete-env.test.js +22 -0
- package/dist/config/runtime.d.ts +3 -3
- package/dist/config/runtime.js +19 -23
- package/dist/config/runtime.test.js +23 -9
- package/dist/config/test-mcp-http-config.js +1 -1
- package/dist/destructive/content-promote.js +7 -1
- package/dist/destructive/promote-contract.test.js +106 -47
- package/dist/destructive/register-destructive-tool.js +6 -24
- package/dist/destructive/request-state.d.ts +2 -6
- package/dist/destructive/request-state.js +3 -38
- package/dist/destructive/types.d.ts +2 -1
- package/dist/governance/available-projects.d.ts +37 -0
- package/dist/governance/available-projects.js +132 -0
- package/dist/governance/available-projects.test.d.ts +4 -0
- package/dist/governance/available-projects.test.js +107 -0
- package/dist/governance/mcp-client-session.d.ts +3 -2
- package/dist/governance/mcp-client-session.js +3 -2
- package/dist/governance/mcp-post-factory-context.d.ts +15 -0
- package/dist/governance/mcp-post-factory-context.js +22 -0
- package/dist/governance/mcp-post-factory-context.test.js +34 -0
- package/dist/governance/project-scope.d.ts +8 -22
- package/dist/governance/project-scope.js +36 -44
- package/dist/governance/project-scope.test.d.ts +1 -1
- package/dist/governance/project-scope.test.js +21 -44
- package/dist/governance/promote-allowlist.d.ts +18 -0
- package/dist/governance/promote-allowlist.js +66 -0
- package/dist/governance/promote-allowlist.test.d.ts +4 -0
- package/dist/governance/promote-allowlist.test.js +87 -0
- package/dist/http.integration.test.js +116 -265
- package/dist/http.test.js +0 -12
- package/dist/index.d.ts +5 -1
- package/dist/index.integration.test.js +0 -4
- package/dist/index.js +31 -16
- package/dist/policy/content-developer.d.ts +3 -3
- package/dist/policy/content-developer.js +3 -3
- package/dist/policy/content-developer.test.js +10 -4
- package/dist/policy/content-reader.d.ts +15 -6
- package/dist/policy/content-reader.js +39 -10
- package/dist/policy/content-reader.test.js +5 -3
- package/dist/policy/envelope.d.ts +4 -2
- package/dist/policy/envelope.js +2 -2
- package/dist/policy/envelope.test.js +28 -0
- package/dist/policy/preview-ledger-fault.test.js +101 -426
- package/dist/policy/preview-ledger.d.ts +38 -74
- package/dist/policy/preview-ledger.js +108 -186
- package/dist/policy/preview-ledger.test.js +237 -111
- package/dist/policy/result-limits.d.ts +6 -1
- package/dist/policy/result-limits.js +28 -29
- package/dist/policy/result-limits.test.js +10 -1
- package/dist/profiles/ai-agent-ops/v1/index.d.ts +6 -0
- package/dist/profiles/ai-agent-ops/v1/index.js +20 -0
- package/dist/profiles/ai-agent-ops/v1/prompts.d.ts +5 -0
- package/dist/profiles/ai-agent-ops/v1/prompts.js +141 -0
- package/dist/profiles/ai-agent-ops/v1/prompts.test.d.ts +4 -0
- package/dist/profiles/ai-agent-ops/v1/prompts.test.js +26 -0
- package/dist/profiles/ai-agent-ops/v1/resources/playbooks/core.md +39 -0
- package/dist/profiles/ai-agent-ops/v1/resources/playbooks/evaluation.md +25 -0
- package/dist/profiles/ai-agent-ops/v1/resources/playbooks/index.md +14 -0
- package/dist/profiles/ai-agent-ops/v1/resources/playbooks/loop-engineering.md +28 -0
- package/dist/profiles/ai-agent-ops/v1/resources/playbooks/release-gate.md +22 -0
- package/dist/profiles/ai-agent-ops/v1/resources/playbooks.d.ts +10 -0
- package/dist/profiles/ai-agent-ops/v1/resources/playbooks.js +41 -0
- package/dist/profiles/content-developer/v1/index.d.ts +8 -0
- package/dist/profiles/content-developer/v1/index.js +22 -0
- package/dist/{personas → profiles}/content-developer/v1/prompts.d.ts +3 -0
- package/dist/profiles/content-developer/v1/prompts.js +157 -0
- package/dist/profiles/content-developer/v1/prompts.test.js +286 -0
- package/dist/profiles/content-developer/v1/resources/playbooks/chart-types.md +138 -0
- package/dist/profiles/content-developer/v1/resources/playbooks/content-move.md +22 -0
- package/dist/profiles/content-developer/v1/resources/playbooks/core.md +109 -0
- package/dist/profiles/content-developer/v1/resources/playbooks/dashboard-design.md +153 -0
- package/dist/profiles/content-developer/v1/resources/playbooks/dashboards.md +108 -0
- package/dist/profiles/content-developer/v1/resources/playbooks/index.md +15 -0
- package/dist/{personas → profiles}/content-developer/v1/resources/playbooks.d.ts +1 -1
- package/dist/profiles/content-developer/v1/resources/playbooks.js +65 -0
- package/dist/profiles/content-governance/v1/index.d.ts +7 -0
- package/dist/profiles/content-governance/v1/index.js +21 -0
- package/dist/{personas → profiles}/content-governance/v1/prompts.test.js +2 -2
- package/dist/{personas → profiles}/content-governance/v1/resources/playbooks/core.md +3 -3
- package/dist/{personas → profiles}/content-governance/v1/resources/playbooks/dashboards.md +1 -1
- package/dist/{personas → profiles}/content-governance/v1/resources/playbooks.js +4 -4
- package/dist/profiles/content-reader/v1/index.d.ts +6 -0
- package/dist/profiles/content-reader/v1/index.js +20 -0
- package/dist/profiles/content-reader/v1/prompts.js +162 -0
- package/dist/{personas → profiles}/content-reader/v1/prompts.test.js +2 -2
- package/dist/profiles/content-reader/v1/resources/playbooks/compare.md +36 -0
- package/dist/profiles/content-reader/v1/resources/playbooks/core.md +67 -0
- package/dist/profiles/content-reader/v1/resources/playbooks/discover.md +35 -0
- package/dist/profiles/content-reader/v1/resources/playbooks/explain-run.md +49 -0
- package/dist/profiles/content-reader/v1/resources/playbooks/index.md +14 -0
- package/dist/{personas → profiles}/content-reader/v1/resources/playbooks.js +4 -4
- package/dist/profiles/data-analyst/v1/index.d.ts +6 -0
- package/dist/profiles/data-analyst/v1/index.js +20 -0
- package/dist/profiles/data-analyst/v1/prompts.d.ts +5 -0
- package/dist/profiles/data-analyst/v1/prompts.js +41 -0
- package/dist/profiles/data-analyst/v1/prompts.test.d.ts +4 -0
- package/dist/profiles/data-analyst/v1/prompts.test.js +26 -0
- package/dist/profiles/data-analyst/v1/resources/playbooks/core.md +41 -0
- package/dist/profiles/data-analyst/v1/resources/playbooks/explore.md +26 -0
- package/dist/profiles/data-analyst/v1/resources/playbooks/index.md +8 -0
- package/dist/profiles/data-analyst/v1/resources/playbooks.d.ts +10 -0
- package/dist/profiles/data-analyst/v1/resources/playbooks.js +33 -0
- package/dist/profiles/index.d.ts +24 -0
- package/dist/profiles/index.js +73 -0
- package/dist/profiles/index.test.js +121 -0
- package/dist/{personas → profiles}/lib/playbook-resources.d.ts +12 -10
- package/dist/{personas → profiles}/lib/playbook-resources.js +28 -24
- package/dist/profiles/organization-audit/v1/index.d.ts +6 -0
- package/dist/profiles/organization-audit/v1/index.js +20 -0
- package/dist/profiles/organization-audit/v1/prompts.js +124 -0
- package/dist/{personas → profiles}/organization-audit/v1/prompts.test.js +2 -2
- package/dist/profiles/organization-audit/v1/resources/playbooks/access.md +21 -0
- package/dist/profiles/organization-audit/v1/resources/playbooks/content.md +19 -0
- package/dist/profiles/organization-audit/v1/resources/playbooks/core.md +69 -0
- package/dist/profiles/organization-audit/v1/resources/playbooks/deliveries.md +14 -0
- package/dist/profiles/organization-audit/v1/resources/playbooks/index.md +14 -0
- package/dist/{personas → profiles}/organization-audit/v1/resources/playbooks.js +3 -3
- package/dist/profiles/profile.membership.test.js +36 -0
- package/dist/profiles/semantic-layer/v1/index.d.ts +6 -0
- package/dist/profiles/semantic-layer/v1/index.js +19 -0
- package/dist/profiles/semantic-layer/v1/prompts.js +96 -0
- package/dist/{personas → profiles}/semantic-layer/v1/prompts.test.js +2 -2
- package/dist/profiles/semantic-layer/v1/resources/playbooks/compose-compile.md +60 -0
- package/dist/profiles/semantic-layer/v1/resources/playbooks/core.md +71 -0
- package/dist/profiles/semantic-layer/v1/resources/playbooks/explore.md +79 -0
- package/dist/profiles/semantic-layer/v1/resources/playbooks/index.md +13 -0
- package/dist/{personas → profiles}/semantic-layer/v1/resources/playbooks.js +4 -4
- package/dist/{personas → profiles}/types.d.ts +6 -7
- package/dist/{personas → profiles}/types.js +1 -1
- package/dist/protocol-contract.test.js +48 -3
- package/dist/server/capabilities.d.ts +6 -6
- package/dist/server/capabilities.js +11 -8
- package/dist/server/capabilities.test.js +8 -7
- package/dist/server/server.js +17 -13
- package/dist/server/upstream-errors.d.ts +17 -0
- package/dist/server/upstream-errors.js +60 -0
- package/dist/server/upstream-errors.test.js +50 -0
- package/dist/stdio.process.test.js +65 -9
- package/dist/tools/ai-agents/agents.d.ts +7 -0
- package/dist/tools/ai-agents/agents.js +32 -0
- package/dist/tools/ai-agents/agents.test.d.ts +1 -0
- package/dist/tools/ai-agents/agents.test.js +176 -0
- package/dist/tools/ai-agents/discovery.d.ts +9 -0
- package/dist/tools/ai-agents/discovery.js +73 -0
- package/dist/tools/ai-agents/evaluations.d.ts +14 -0
- package/dist/tools/ai-agents/evaluations.js +177 -0
- package/dist/tools/ai-agents/helpers.d.ts +63 -0
- package/dist/tools/ai-agents/helpers.js +321 -0
- package/dist/tools/ai-agents/threads.d.ts +7 -0
- package/dist/tools/ai-agents/threads.js +40 -0
- package/dist/tools/composition/explain-content.js +3 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/index.test.js +16 -10
- package/dist/tools/lib/schema-fields.d.ts +2 -0
- package/dist/tools/lib/schema-fields.js +4 -1
- package/dist/tools/lib/stable-stringify.d.ts +1 -1
- package/dist/tools/lib/stable-stringify.js +1 -1
- package/dist/tools/organization/invariants.test.d.ts +1 -1
- package/dist/tools/organization/invariants.test.js +5 -5
- package/dist/tools/organization/inventory.js +2 -1
- package/dist/tools/project/content.js +5 -1
- package/dist/tools/project/developer-content-preview.d.ts +3 -2
- package/dist/tools/project/developer-content-preview.js +41 -36
- package/dist/tools/project/developer-content-shared.d.ts +9 -3
- package/dist/tools/project/developer-content-shared.js +8 -4
- package/dist/tools/project/developer-content.d.ts +7 -8
- package/dist/tools/project/developer-content.js +72 -67
- package/dist/tools/project/developer-get-chart-as-code.d.ts +9 -0
- package/dist/tools/project/developer-get-chart-as-code.js +39 -0
- package/dist/tools/project/developer-get-chart-as-code.test.d.ts +4 -0
- package/dist/tools/project/developer-get-chart-as-code.test.js +70 -0
- package/dist/tools/project/developer-helpers.d.ts +1 -1
- package/dist/tools/project/developer-helpers.js +1 -1
- package/dist/tools/project/get-dashboard-promote-diff.js +12 -2
- package/dist/tools/project/invariants.test.d.ts +1 -1
- package/dist/tools/project/invariants.test.js +12 -10
- package/dist/tools/project/parameters.js +8 -3
- package/dist/tools/project/projects.d.ts +1 -4
- package/dist/tools/project/projects.js +37 -15
- package/dist/tools/project/projects.test.js +70 -8
- package/dist/tools/project/reader-content.js +6 -3
- package/dist/tools/project/reader-execution.js +4 -2
- package/dist/tools/project/reader-export-chart-image.d.ts +6 -0
- package/dist/tools/project/reader-export-chart-image.js +78 -0
- package/dist/tools/project/reader-export-chart-image.test.d.ts +4 -0
- package/dist/tools/project/reader-export-chart-image.test.js +149 -0
- package/dist/tools/project/spaces.js +12 -4
- package/dist/tools/project/spaces.test.d.ts +1 -0
- package/dist/tools/project/spaces.test.js +47 -0
- package/dist/tools/query/bounded-saved-query.d.ts +4 -3
- package/dist/tools/query/bounded-saved-query.js +4 -6
- package/dist/tools/query/lifecycle.d.ts +1 -1
- package/dist/tools/query/lifecycle.js +25 -31
- package/dist/tools/query/query-ledger.d.ts +17 -9
- package/dist/tools/query/query-ledger.js +21 -15
- package/dist/tools/query/query-ledger.test.js +13 -11
- package/dist/tools/query/reader-tool-helpers.d.ts +4 -2
- package/dist/tools/query/reader-tool-helpers.js +11 -8
- package/dist/tools/query/reader-tool-helpers.test.js +8 -4
- package/dist/tools/query/run-metric-query.d.ts +6 -0
- package/dist/tools/query/run-metric-query.js +94 -0
- package/dist/tools/query/run-metric-query.test.d.ts +4 -0
- package/dist/tools/query/run-metric-query.test.js +116 -0
- package/dist/tools/registry.d.ts +71 -8
- package/dist/tools/registry.js +36 -6
- package/dist/tools/semantic/explores.js +43 -17
- package/dist/tools/semantic/metrics.js +22 -8
- package/dist/tools/semantic/query.js +25 -17
- package/dist/tools/shared.d.ts +28 -9
- package/dist/tools/shared.js +62 -29
- package/dist/tools/shared.test.js +100 -4
- package/dist/transports/streamable-http.js +75 -223
- package/dist/transports/streamable-http.test.js +19 -12
- package/package.json +5 -6
- package/dist/destructive/confirmation-claim.d.ts +0 -21
- package/dist/destructive/confirmation-claim.js +0 -87
- package/dist/destructive/confirmation-claim.test.js +0 -50
- package/dist/personas/content-developer/v1/index.d.ts +0 -10
- package/dist/personas/content-developer/v1/index.js +0 -51
- package/dist/personas/content-developer/v1/prompts.js +0 -138
- package/dist/personas/content-developer/v1/prompts.test.js +0 -75
- package/dist/personas/content-developer/v1/resources/playbooks/content-move.md +0 -15
- package/dist/personas/content-developer/v1/resources/playbooks/core.md +0 -63
- package/dist/personas/content-developer/v1/resources/playbooks/dashboards.md +0 -55
- package/dist/personas/content-developer/v1/resources/playbooks/index.md +0 -13
- package/dist/personas/content-developer/v1/resources/playbooks.js +0 -44
- package/dist/personas/content-governance/v1/index.d.ts +0 -9
- package/dist/personas/content-governance/v1/index.js +0 -29
- package/dist/personas/content-reader/v1/index.d.ts +0 -8
- package/dist/personas/content-reader/v1/index.js +0 -37
- package/dist/personas/content-reader/v1/prompts.js +0 -128
- package/dist/personas/content-reader/v1/resources/playbooks/compare.md +0 -21
- package/dist/personas/content-reader/v1/resources/playbooks/core.md +0 -40
- package/dist/personas/content-reader/v1/resources/playbooks/discover.md +0 -13
- package/dist/personas/content-reader/v1/resources/playbooks/explain-run.md +0 -19
- package/dist/personas/content-reader/v1/resources/playbooks/index.md +0 -14
- package/dist/personas/index.d.ts +0 -22
- package/dist/personas/index.js +0 -73
- package/dist/personas/index.test.js +0 -109
- package/dist/personas/organization-audit/v1/index.d.ts +0 -8
- package/dist/personas/organization-audit/v1/index.js +0 -42
- package/dist/personas/organization-audit/v1/prompts.js +0 -92
- package/dist/personas/organization-audit/v1/resources/playbooks/access.md +0 -13
- package/dist/personas/organization-audit/v1/resources/playbooks/content.md +0 -9
- package/dist/personas/organization-audit/v1/resources/playbooks/core.md +0 -36
- package/dist/personas/organization-audit/v1/resources/playbooks/deliveries.md +0 -9
- package/dist/personas/organization-audit/v1/resources/playbooks/index.md +0 -14
- package/dist/personas/persona.parity.test.js +0 -26
- package/dist/personas/semantic-layer/v1/index.d.ts +0 -8
- package/dist/personas/semantic-layer/v1/index.js +0 -32
- package/dist/personas/semantic-layer/v1/prompts.js +0 -85
- package/dist/personas/semantic-layer/v1/resources/playbooks/compose-compile.md +0 -55
- package/dist/personas/semantic-layer/v1/resources/playbooks/core.md +0 -39
- package/dist/personas/semantic-layer/v1/resources/playbooks/explore.md +0 -76
- package/dist/personas/semantic-layer/v1/resources/playbooks/index.md +0 -13
- package/dist/store/config.d.ts +0 -11
- package/dist/store/config.js +0 -50
- package/dist/store/config.test.js +0 -56
- package/dist/store/create-oauth-broker-store.d.ts +0 -6
- package/dist/store/create-oauth-broker-store.js +0 -16
- package/dist/store/create-preview-store.d.ts +0 -10
- package/dist/store/create-preview-store.js +0 -30
- package/dist/store/create-session-store.d.ts +0 -19
- package/dist/store/create-session-store.js +0 -24
- package/dist/store/in-memory-preview-store.d.ts +0 -17
- package/dist/store/in-memory-preview-store.js +0 -72
- package/dist/store/redis-client.d.ts +0 -11
- package/dist/store/redis-client.js +0 -48
- package/dist/store/redis-oauth-broker-store.d.ts +0 -42
- package/dist/store/redis-oauth-broker-store.js +0 -167
- package/dist/store/redis-oauth-broker-store.test.js +0 -80
- package/dist/store/redis-preview-store.d.ts +0 -23
- package/dist/store/redis-preview-store.js +0 -94
- package/dist/store/redis-preview-store.test.js +0 -39
- package/dist/store/redis-session-index.d.ts +0 -33
- package/dist/store/redis-session-index.js +0 -49
- package/dist/store/types.d.ts +0 -13
- package/dist/store/types.js +0 -8
- package/dist/transports/http-request-utils.d.ts +0 -2
- package/dist/transports/http-request-utils.js +0 -13
- package/dist/transports/session-store.d.ts +0 -72
- package/dist/transports/session-store.js +0 -143
- package/dist/transports/session-store.test.js +0 -111
- /package/dist/{destructive/confirmation-claim.test.d.ts → audit/server-profile.test.d.ts} +0 -0
- /package/dist/{personas/index.test.d.ts → config/obsolete-env.test.d.ts} +0 -0
- /package/dist/{personas/persona.parity.test.d.ts → governance/mcp-post-factory-context.test.d.ts} +0 -0
- /package/dist/{store/config.test.d.ts → policy/envelope.test.d.ts} +0 -0
- /package/dist/{personas → profiles}/content-developer/v1/prompts.test.d.ts +0 -0
- /package/dist/{personas → profiles}/content-governance/v1/prompts.d.ts +0 -0
- /package/dist/{personas → profiles}/content-governance/v1/prompts.js +0 -0
- /package/dist/{personas → profiles}/content-governance/v1/prompts.test.d.ts +0 -0
- /package/dist/{personas → profiles}/content-governance/v1/resources/playbooks/charts.md +0 -0
- /package/dist/{personas → profiles}/content-governance/v1/resources/playbooks/index.md +0 -0
- /package/dist/{personas → profiles}/content-governance/v1/resources/playbooks.d.ts +0 -0
- /package/dist/{personas → profiles}/content-reader/v1/prompts.d.ts +0 -0
- /package/dist/{personas → profiles}/content-reader/v1/prompts.test.d.ts +0 -0
- /package/dist/{personas → profiles}/content-reader/v1/resources/playbooks.d.ts +0 -0
- /package/dist/{store/redis-oauth-broker-store.test.d.ts → profiles/index.test.d.ts} +0 -0
- /package/dist/{personas → profiles}/organization-audit/v1/prompts.d.ts +0 -0
- /package/dist/{personas → profiles}/organization-audit/v1/prompts.test.d.ts +0 -0
- /package/dist/{personas → profiles}/organization-audit/v1/resources/playbooks.d.ts +0 -0
- /package/dist/{store/redis-preview-store.test.d.ts → profiles/profile.membership.test.d.ts} +0 -0
- /package/dist/{personas → profiles}/semantic-layer/v1/prompts.d.ts +0 -0
- /package/dist/{personas → profiles}/semantic-layer/v1/prompts.test.d.ts +0 -0
- /package/dist/{personas → profiles}/semantic-layer/v1/resources/playbooks.d.ts +0 -0
- /package/dist/{transports/session-store.test.d.ts → server/upstream-errors.test.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,307 +1,183 @@
|
|
|
1
1
|
# [@lightdash-tools/mcp](https://www.npmjs.com/package/@lightdash-tools/mcp) <!-- markdown-link-check-disable-line -->
|
|
2
2
|
|
|
3
|
-
MCP server for Lightdash with **
|
|
3
|
+
MCP server for Lightdash with **profile-scoped** surfaces. One package, seven profiles: explore/compile, org audit, saved-content reads, chart/dashboard authoring, soft-delete governance, AI-agent ops, and ad-hoc Explore queries. Uses [`@lightdash-tools/client`](https://www.npmjs.com/package/@lightdash-tools/client) for API access. <!-- markdown-link-check-disable-line -->
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Developing this package? See [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Choose a profile
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
| Profile | Use when | HTTP path | Stdio | Catalog |
|
|
10
|
+
| :------------------- | :--------------------------------------- | :--------------------------- | :------------------- | :--------------------------------------------------------------- |
|
|
11
|
+
| `semantic-layer` | Explore metrics, compile queries | `/semantic-layer/v1/mcp` | **default** | — |
|
|
12
|
+
| `organization-audit` | Read-only org governance | `/organization-audit/v1/mcp` | `organization-audit` | [inventory](../../docs/profiles/organization-audit/inventory.md) |
|
|
13
|
+
| `content-reader` | Discover and run saved content | `/content-reader/v1/mcp` | `content-reader` | [inventory](../../docs/profiles/content-reader/inventory.md) |
|
|
14
|
+
| `content-developer` | Author charts/dashboards (preview gate) | `/content-developer/v1/mcp` | `content-developer` | [inventory](../../docs/profiles/content-developer/inventory.md) |
|
|
15
|
+
| `content-governance` | Soft-delete / promote (form elicitation) | `/content-governance/v1/mcp` | `content-governance` | [inventory](../../docs/profiles/content-governance/inventory.md) |
|
|
16
|
+
| `ai-agent-ops` | Thin AI-agent APIs + product eval runs | `/ai-agent-ops/v1/mcp` | `ai-agent-ops` | [inventory](../../docs/profiles/ai-agent-ops/inventory.md) |
|
|
17
|
+
| `data-analyst` | Unsaved Explore metric queries | `/data-analyst/v1/mcp` | `data-analyst` | [inventory](../../docs/profiles/data-analyst/inventory.md) |
|
|
10
18
|
|
|
11
|
-
|
|
12
|
-
| :------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------ |
|
|
13
|
-
| Shared tools / registry | `src/tools/` (`registry.ts`, domain modules) |
|
|
14
|
-
| Persona (tools allowlist, prompts, playbook, HTTP path) | `src/personas/<id>/` |
|
|
15
|
-
| Destructive confirmation (form elicitation / MRTR) | `src/destructive/` |
|
|
16
|
-
| HTTP transport / sessions | `src/transports/` |
|
|
17
|
-
| HTTP auth | `src/auth/` |
|
|
18
|
-
| Runtime client + guardrail env | `src/config/runtime.ts` |
|
|
19
|
-
| HTTP env / loader | `src/config/env.ts`, `src/config/load-mcp-config.ts` |
|
|
20
|
-
| Ephemeral store (memory/redis) | `src/store/` ([ADR-0016](../../docs/adr/0016-mcp-pluggable-ephemeral-store-for-http-preview-sessions-and-oauth.md)) |
|
|
21
|
-
| Audit logging helpers | `src/audit/` |
|
|
22
|
-
| Entrypoints | `src/bin.ts`, `src/index.ts` (stdio), `src/http.ts` |
|
|
19
|
+
Tool names are prefixed with `lightdash_`. MCP display names are shortened where needed for client length limits (e.g. `lightdash-mcp-content`).
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
## Replaces `@lightdash-tools/semantic-layer-mcp`
|
|
27
|
-
|
|
28
|
-
That package was removed (ADR-0006). Migrate as follows:
|
|
29
|
-
|
|
30
|
-
| Removed | Use instead |
|
|
31
|
-
| ------------------------------------- | ------------------------ |
|
|
32
|
-
| `@lightdash-tools/semantic-layer-mcp` | `@lightdash-tools/mcp` |
|
|
33
|
-
| Binary `lightdash-semantic-layer-mcp` | `lightdash-mcp` |
|
|
34
|
-
| HTTP `/mcp` (old) | `/semantic-layer/v1/mcp` |
|
|
35
|
-
| Unprefixed tool names | `lightdash_*` |
|
|
36
|
-
|
|
37
|
-
## Installation
|
|
38
|
-
|
|
39
|
-
You can run the MCP server using `npx`:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
npx @lightdash-tools/mcp
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Or install it globally:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
npm install -g @lightdash-tools/mcp
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Transports
|
|
52
|
-
|
|
53
|
-
- **Stdio** — for local use (e.g. Claude Desktop, IDE). One process per client.
|
|
54
|
-
- **Streamable HTTP** — for remote use. Session-based; supports optional endpoint auth.
|
|
55
|
-
|
|
56
|
-
### SDK / protocol compatibility
|
|
57
|
-
|
|
58
|
-
- Uses MCP TypeScript SDK v2 (`@modelcontextprotocol/server`, `@modelcontextprotocol/node`).
|
|
59
|
-
- Speaks the established 2025-era protocol by default (not `2026-07-28` unless a future flag).
|
|
60
|
-
- Hosted OAuth client setup: [docs/cursor-lightdash-oauth-mcp.md](../../docs/cursor-lightdash-oauth-mcp.md). Protocol/auth details: [docs/mcp-oauth-http.md](../../docs/mcp-oauth-http.md).
|
|
61
|
-
|
|
62
|
-
### Hosted OAuth (primary HTTP)
|
|
63
|
-
|
|
64
|
-
Auth is **inferred** from credentials ([ADR-0007](../../docs/adr/0007-mcp-http-transport-auth-modes-sdk-v2.md)). The MCP host holds the Lightdash OAuth app client id/secret and brokers login; Claude Code / Cursor use URL-only config. Protocol reference: [MCP Authorization 2026-07-28](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization).
|
|
65
|
-
|
|
66
|
-
| What works | Gap |
|
|
67
|
-
| :-------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
68
|
-
| Server-held confidential client + `{PUBLIC_URL}/oauth/callback` | Full RFC 8707 audience binding on opaque Lightdash tokens |
|
|
69
|
-
| PRM + broker AS metadata; per-user Bearer to Lightdash | MCP-local scope enforcement for opaque tokens |
|
|
70
|
-
| Session binding to `userUuid` / `organizationUuid` | Multi-instance scale: default in-memory needs sticky routing; opt into Redis via `LIGHTDASH_TOOLS_MCP_STORE=redis` ([ADR-0016](../../docs/adr/0016-mcp-pluggable-ephemeral-store-for-http-preview-sessions-and-oauth.md)) |
|
|
71
|
-
|
|
72
|
-
Authorization: Lightdash RBAC + persona tool surface ([ADR-0006](../../docs/adr/0006-mcp-personas-shared-registry-fixed-paths.md)) + optional `X-Lightdash-Project` pin. See [mcp-oauth-http.md](../../docs/mcp-oauth-http.md).
|
|
73
|
-
|
|
74
|
-
## Environment variables
|
|
75
|
-
|
|
76
|
-
Preferred names use the `LIGHTDASH_TOOLS_*` prefixes (see [ADR-0009](../../docs/adr/0009-cross-cutting-conventions.md)). Prefer env vars from the parent process. Avoid plaintext `.env` when AI agents have file access. If using `.env`, use [dotenvx](https://dotenvx.com/). See [docs/secrets-and-credentials.md](../../docs/secrets-and-credentials.md).
|
|
77
|
-
|
|
78
|
-
### Stdio (secondary)
|
|
79
|
-
|
|
80
|
-
| Required | Optional |
|
|
81
|
-
| :----------------------------------- | :-------------------------- |
|
|
82
|
-
| `LIGHTDASH_URL`, `LIGHTDASH_API_KEY` | `LIGHTDASH_TOOLS_AUDIT_LOG` |
|
|
83
|
-
|
|
84
|
-
Do **not** set OAuth client secrets for stdio. MCP does not use CLI `SAFETY_MODE` / `ALLOWED_PROJECTS` / `DRY_RUN`.
|
|
85
|
-
|
|
86
|
-
### HTTP OAuth (primary)
|
|
87
|
-
|
|
88
|
-
| Required | Common optional |
|
|
89
|
-
| :-------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------- |
|
|
90
|
-
| `LIGHTDASH_URL`, `LIGHTDASH_TOOLS_MCP_PUBLIC_URL`, `LIGHTDASH_TOOLS_OAUTH_CLIENT_ID`, `LIGHTDASH_TOOLS_OAUTH_CLIENT_SECRET` | port, `ALLOWED_ORIGINS`, audit log, token cache TTL |
|
|
91
|
-
|
|
92
|
-
Register Lightdash redirect URI: `{PUBLIC_URL}/oauth/callback`. Clients: URL only to `/semantic-layer/v1/mcp`, `/organization-audit/v1/mcp`, `/content-reader/v1/mcp`, `/content-developer/v1/mcp`, or `/content-governance/v1/mcp`.
|
|
93
|
-
|
|
94
|
-
### Content-governance (destructive soft-delete)
|
|
95
|
-
|
|
96
|
-
| Required (non-test) | Notes |
|
|
97
|
-
| :-------------------------------------- | :------------------------------------------------------------------------------------------ |
|
|
98
|
-
| `LIGHTDASH_TOOLS_MCP_REQUEST_STATE_KEY` | ≥32-byte secret for HMAC-signed opaque `requestState` (not encrypted; fail closed if unset) |
|
|
99
|
-
| Client form elicitation | Missing capability → `ELICITATION_REQUIRED`; no DELETE / promote |
|
|
100
|
-
|
|
101
|
-
### HTTP shared-key / local (secondary)
|
|
102
|
-
|
|
103
|
-
| Mode | Env |
|
|
104
|
-
| :--------- | :----------------------------------------------------- |
|
|
105
|
-
| Shared-key | `LIGHTDASH_API_KEY` + `LIGHTDASH_TOOLS_MCP_SHARED_KEY` |
|
|
106
|
-
| Local none | `NODE_ENV=development` (not `production`) |
|
|
107
|
-
|
|
108
|
-
Obsolete `LIGHTDASH_TOOLS_MCP_AUTH_MODE`, `EXPERIMENTAL_*`, `DANGEROUSLY_*`, and `INSECURE_DEV` vars are **rejected**. Endpoint path is persona-owned (`LIGHTDASH_TOOLS_MCP_PATH` rejected).
|
|
109
|
-
|
|
110
|
-
### Ephemeral store (HTTP sessions / preview / OAuth)
|
|
111
|
-
|
|
112
|
-
Start with **memory** (default). Add **Redis** when scaling beyond a single HTTP instance ([ADR-0016](../../docs/adr/0016-mcp-pluggable-ephemeral-store-for-http-preview-sessions-and-oauth.md)).
|
|
113
|
-
|
|
114
|
-
| Env | Default | Notes |
|
|
115
|
-
| :------------------------------ | :------- | :---------------------------------------- |
|
|
116
|
-
| `LIGHTDASH_TOOLS_MCP_STORE` | `memory` | `memory` \| `redis` |
|
|
117
|
-
| `LIGHTDASH_TOOLS_MCP_REDIS_URL` | — | Required when `STORE=redis` (fail closed) |
|
|
118
|
-
|
|
119
|
-
What Redis shares vs what stays local:
|
|
120
|
-
|
|
121
|
-
| Concern | memory | redis |
|
|
122
|
-
| :---------------------------------- | :------------ | :-------------------------------------------------------------------------------------------------- |
|
|
123
|
-
| Content-developer preview ledger | process-local | shared |
|
|
124
|
-
| OAuth pending / codes / DCR clients | process-local | shared (full multi-instance OAuth) |
|
|
125
|
-
| Streamable HTTP session transports | process-local | process-local + Redis session _index_; sticky or single instance still required for live transports |
|
|
126
|
-
|
|
127
|
-
Stdio and tests use memory. Production may use memory on a single instance (HTTP logs a multi-instance/restart warning).
|
|
128
|
-
|
|
129
|
-
See also: [mcp-oauth-http.md](../../docs/mcp-oauth-http.md), [cursor-lightdash-oauth-mcp.md](../../docs/cursor-lightdash-oauth-mcp.md), [cloud-run-mcp-oauth.md](../../docs/cloud-run-mcp-oauth.md), [threat model](../../docs/security/mcp-oauth-threat-model.md).
|
|
130
|
-
|
|
131
|
-
## Running
|
|
21
|
+
## Quick start
|
|
132
22
|
|
|
133
23
|
### Stdio (local)
|
|
134
24
|
|
|
135
|
-
For use with Claude Desktop or IDEs, use `npx`:
|
|
136
|
-
|
|
137
25
|
```bash
|
|
138
|
-
npx @lightdash-tools/mcp
|
|
139
|
-
#
|
|
140
|
-
npx @lightdash-tools/mcp semantic-layer
|
|
141
|
-
npx @lightdash-tools/mcp organization-audit
|
|
142
|
-
npx @lightdash-tools/mcp content-reader
|
|
143
|
-
npx @lightdash-tools/mcp content-developer
|
|
144
|
-
npx @lightdash-tools/mcp content-governance
|
|
26
|
+
npx @lightdash-tools/mcp # semantic-layer (default)
|
|
27
|
+
npx @lightdash-tools/mcp content-reader # other profiles by name
|
|
145
28
|
```
|
|
146
29
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
lightdash
|
|
30
|
+
Required env: `LIGHTDASH_URL`, `LIGHTDASH_API_KEY`. Logs go to **stderr**; stdout is JSON-RPC only ([stdio transport](https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/stdio)).
|
|
31
|
+
|
|
32
|
+
Example Cursor / Claude Desktop config:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"mcpServers": {
|
|
37
|
+
"lightdash": {
|
|
38
|
+
"command": "npx",
|
|
39
|
+
"args": ["@lightdash-tools/mcp", "content-reader"],
|
|
40
|
+
"env": {
|
|
41
|
+
"LIGHTDASH_URL": "https://app.lightdash.cloud",
|
|
42
|
+
"LIGHTDASH_API_KEY": "your_pat"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
155
47
|
```
|
|
156
48
|
|
|
157
|
-
|
|
49
|
+
Or install globally: `npm install -g @lightdash-tools/mcp`, then `lightdash-mcp [profile]`.
|
|
158
50
|
|
|
159
51
|
### Streamable HTTP (remote)
|
|
160
52
|
|
|
161
53
|
```bash
|
|
162
|
-
# Backward-compatible
|
|
163
|
-
npx @lightdash-tools/mcp --http
|
|
164
|
-
|
|
165
|
-
# Explicit subcommand
|
|
166
|
-
npx @lightdash-tools/mcp serve-http
|
|
167
|
-
|
|
168
|
-
# Hosted OAuth (server-held Lightdash confidential client)
|
|
169
54
|
export LIGHTDASH_URL="https://app.lightdash.cloud"
|
|
170
55
|
export LIGHTDASH_TOOLS_MCP_PUBLIC_URL="https://lightdash-mcp.example.com"
|
|
171
56
|
export LIGHTDASH_TOOLS_OAUTH_CLIENT_ID="..."
|
|
172
57
|
export LIGHTDASH_TOOLS_OAUTH_CLIENT_SECRET="..."
|
|
173
|
-
npx @lightdash-tools/mcp
|
|
58
|
+
npx @lightdash-tools/mcp http
|
|
174
59
|
```
|
|
175
60
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
- `POST/GET/DELETE /semantic-layer/v1/mcp`
|
|
179
|
-
- `POST/GET/DELETE /organization-audit/v1/mcp`
|
|
180
|
-
- `POST/GET/DELETE /content-reader/v1/mcp`
|
|
181
|
-
- `POST/GET/DELETE /content-developer/v1/mcp`
|
|
182
|
-
- `POST/GET/DELETE /content-governance/v1/mcp`
|
|
183
|
-
|
|
184
|
-
Register `{PUBLIC_URL}/oauth/callback` in Lightdash. See [mcp-oauth-http.md](../../docs/mcp-oauth-http.md).
|
|
61
|
+
Profile MCP endpoints accept **POST** only ([Streamable HTTP 2026-07-28](https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/streamable-http); no protocol sessions). Default listen port: `3100` (`LIGHTDASH_TOOLS_MCP_HTTP_PORT`).
|
|
185
62
|
|
|
186
|
-
|
|
63
|
+
- Hosted OAuth (Cursor URL-only): [docs/operators/cursor-claude.md](../../docs/operators/cursor-claude.md)
|
|
64
|
+
- Operator guide: [docs/operators/mcp-oauth.md](../../docs/operators/mcp-oauth.md)
|
|
187
65
|
|
|
188
|
-
|
|
189
|
-
- Hosted OAuth smoke: expose `:3100` with Cloudflare Tunnel (`cloudflared tunnel --url http://127.0.0.1:3100`), set `LIGHTDASH_TOOLS_MCP_PUBLIC_URL` in `.env` to the `*.trycloudflare.com` URL, recreate the container, register `{PUBLIC_URL}/oauth/callback` in Lightdash, and point Cursor at `{PUBLIC_URL}/semantic-layer/v1/mcp`. Do not use free ngrok. Details: [cursor-lightdash-oauth-mcp.md](../../docs/cursor-lightdash-oauth-mcp.md).
|
|
66
|
+
Local Compose smoke: `docker compose -f docker-compose.dev.yml --profile semantic-layer up --build` → `http://localhost:8080/semantic-layer/v1/mcp`.
|
|
190
67
|
|
|
191
|
-
##
|
|
68
|
+
## Configuration
|
|
192
69
|
|
|
193
|
-
|
|
70
|
+
Prefer `LIGHTDASH_TOOLS_*` env from the parent process. Avoid plaintext `.env` when agents can read files; if needed, use [dotenvx](https://dotenvx.com/). See [docs/operators/secrets.md](../../docs/operators/secrets.md).
|
|
194
71
|
|
|
195
|
-
|
|
72
|
+
### Stdio
|
|
196
73
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
- **Query**: `compile_query` (empty SELECT → `isError`; no run-query)
|
|
74
|
+
| Required | Optional |
|
|
75
|
+
| :----------------------------------- | :-------------------------------------------------------------------------------------------- |
|
|
76
|
+
| `LIGHTDASH_URL`, `LIGHTDASH_API_KEY` | `LIGHTDASH_TOOLS_AUDIT_LOG` (file; else stderr JSON), `LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS` |
|
|
201
77
|
|
|
202
|
-
|
|
78
|
+
Do **not** set OAuth client secrets for stdio. MCP ignores CLI `SAFETY_MODE` / `DRY_RUN`.
|
|
203
79
|
|
|
204
|
-
###
|
|
80
|
+
### HTTP OAuth (primary)
|
|
205
81
|
|
|
206
|
-
|
|
82
|
+
| Required | Common optional |
|
|
83
|
+
| :-------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------- |
|
|
84
|
+
| `LIGHTDASH_URL`, `LIGHTDASH_TOOLS_MCP_PUBLIC_URL`, `LIGHTDASH_TOOLS_OAUTH_CLIENT_ID`, `LIGHTDASH_TOOLS_OAUTH_CLIENT_SECRET` | port, `ALLOWED_ORIGINS`, `ALLOWED_PROJECT_UUIDS`, token cache TTL |
|
|
207
85
|
|
|
208
|
-
|
|
209
|
-
- **Access**: `list_org_role_assignments`, `list_custom_roles`, `get_custom_role`, `list_project_roles`, `list_project_direct_access`, `list_space_access`, `resolve_effective_access`
|
|
210
|
-
- **Content / health**: `list_content`, `get_dashboard_meta`, `list_validation_results`, `get_project_user_activity`
|
|
211
|
-
- **Delivery**: `list_project_schedulers`, `get_scheduler`
|
|
86
|
+
On Cloud Run / hosted HTTP, leave `LIGHTDASH_TOOLS_AUDIT_LOG` unset — tool audits are stderr JSON (`channel: "audit"`) → Cloud Logging. See [cloud-run.md](../../docs/operators/cloud-run.md).
|
|
212
87
|
|
|
213
|
-
|
|
88
|
+
Register Lightdash redirect URI: `{PUBLIC_URL}/oauth/callback`. Clients connect with URL only to a profile path above. Protocol: [MCP Authorization 2026-07-28](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization).
|
|
214
89
|
|
|
215
|
-
###
|
|
90
|
+
### Content-developer / content-governance signing
|
|
216
91
|
|
|
217
|
-
|
|
92
|
+
| Required (non-test) | Notes |
|
|
93
|
+
| :-------------------------------------- | :---------------------------------------------------------------------------------------------- |
|
|
94
|
+
| `LIGHTDASH_TOOLS_MCP_REQUEST_STATE_KEY` | ≥32-byte secret for HMAC `previewToken` / `requestState` (fail closed if unset; not encryption) |
|
|
218
95
|
|
|
219
|
-
-
|
|
220
|
-
- **Metadata**: `get_dashboard`, `get_chart`, `list_project_parameters`, `get_project_parameters`, `explain_content`
|
|
221
|
-
- **Execution**: `run_chart`, `run_dashboard_tile` (semantic saved content only; SQL charts disabled by default)
|
|
222
|
-
- **Lifecycle**: `get_query_result`, `cancel_query` (session-owned ledger)
|
|
96
|
+
Governance soft-delete needs client form elicitation; missing capability → `ELICITATION_REQUIRED`.
|
|
223
97
|
|
|
224
|
-
|
|
98
|
+
### HTTP shared-key / local (secondary)
|
|
225
99
|
|
|
226
|
-
|
|
100
|
+
| Mode | Env |
|
|
101
|
+
| :--------- | :----------------------------------------------------- |
|
|
102
|
+
| Shared-key | `LIGHTDASH_API_KEY` + `LIGHTDASH_TOOLS_MCP_SHARED_KEY` |
|
|
103
|
+
| Local none | `NODE_ENV=development` (not `production`) |
|
|
227
104
|
|
|
228
|
-
|
|
105
|
+
Obsolete vars (`AUTH_MODE`, `EXPERIMENTAL_*`, `DANGEROUSLY_*`, `INSECURE_DEV`, `MCP_STORE`, `MCP_REDIS_URL`, free-form `MCP_PATH`) are **rejected**. See [ADR-0019](../../docs/adr/0019-mcp-stateless-protocol-core-without-redis-ephemeral-store.md).
|
|
229
106
|
|
|
230
|
-
|
|
231
|
-
- **Preview / confirm / validate / diff**: `preview_chart_changes`, `preview_dashboard_changes`, `preview_content_move`, `confirm_preview`, `validate_chart`, `validate_dashboard`, `compare_chart_versions`, `compare_dashboard_versions`
|
|
232
|
-
- **Charts (as-code)**: `create_chart`, `update_chart`, `duplicate_chart`
|
|
233
|
-
- **Dashboards (REST)**: `create_dashboard`, `update_dashboard`, `duplicate_dashboard`
|
|
234
|
-
- **Layout**: `add_dashboard_tile`, `move_dashboard_tile`, `remove_dashboard_tile`, `resize_dashboard_tile`
|
|
235
|
-
- **Spaces**: `list_spaces`, `get_space`, `move_content` (no create/update space; use `preview_content_move` before apply)
|
|
107
|
+
## Profiles at a glance
|
|
236
108
|
|
|
237
|
-
|
|
109
|
+
### `semantic-layer`
|
|
238
110
|
|
|
239
|
-
|
|
111
|
+
Projects, explores, metrics, and `compile_query` (no warehouse run). Playbook: `lightdash://playbooks/semantic-layer`.
|
|
240
112
|
|
|
241
|
-
|
|
113
|
+
### `organization-audit`
|
|
242
114
|
|
|
243
|
-
-
|
|
244
|
-
- **Promote**: `get_dashboard_promote_diff`, elicitation-gated `promote_dashboard` (upstream via Data Ops config)
|
|
245
|
-
- **Confirmation**: MCP form elicitation (`decision` + typed `confirmationText`) + HMAC-signed opaque `requestState` (do not put secrets in the token payload); fail closed without form capability
|
|
246
|
-
- **Not included**: bulk delete, space delete, permanent purge, chart/SQL promote, authoring, warehouse queries
|
|
115
|
+
Read-only inventory, access, content health, usage, and schedulers. No mutations or warehouse queries. Server name: `lightdash-mcp-org-audit`.
|
|
247
116
|
|
|
248
|
-
|
|
117
|
+
### `content-reader`
|
|
249
118
|
|
|
250
|
-
|
|
119
|
+
Project-scoped discovery, metadata, bounded `run_chart` / `run_dashboard_tile`, and `export_chart_image` (PNG). SQL charts off by default. Project: `X-Lightdash-Project` or tool `projectUuid`. Server name: `lightdash-mcp-content`.
|
|
251
120
|
|
|
252
|
-
|
|
121
|
+
### `content-developer`
|
|
253
122
|
|
|
254
|
-
|
|
255
|
-
lightdash-mcp --help
|
|
256
|
-
```
|
|
123
|
+
Author charts (as-code) and dashboards behind preview → `confirm_preview` → apply with HMAC `previewToken`. No warehouse execution or hard delete. Server name: `lightdash-mcp-cdev`.
|
|
257
124
|
|
|
258
|
-
###
|
|
125
|
+
### `content-governance`
|
|
259
126
|
|
|
260
|
-
-
|
|
261
|
-
- `stdio` / `semantic-layer` / `organization-audit` / `content-reader` / `content-developer` / `content-governance` / `serve-http` — Explicit transport/persona subcommands.
|
|
127
|
+
Soft-delete charts/dashboards and elicitation-gated dashboard promote. Permanent purge stays off MCP. Server name: `lightdash-mcp-gov`.
|
|
262
128
|
|
|
263
|
-
|
|
129
|
+
### `ai-agent-ops`
|
|
264
130
|
|
|
265
|
-
MCP
|
|
131
|
+
Thin AI-agent inventory, readiness, thread reads, and product evaluation suite/run APIs. No agent CRUD or thread generate on MCP. Server name: `lightdash-mcp-aops`. Loop engineering: [docs/profiles/ai-agent-ops/loop.md](../../docs/profiles/ai-agent-ops/loop.md).
|
|
266
132
|
|
|
267
|
-
|
|
268
|
-
| :----------- | :----------------------------------------------------------------------------------------------------------------- |
|
|
269
|
-
| Which tools | Persona `toolIds` in code (including `content-governance` soft-delete) |
|
|
270
|
-
| Who | Auth mode + Lightdash API RBAC |
|
|
271
|
-
| Where (HTTP) | Optional `X-Lightdash-Project` pin; content-reader/content-developer also use `LIGHTDASH_TOOLS_PROJECT_UUID` |
|
|
272
|
-
| Hardening | Input validation + audit log + org-audit GET asserts + preview ledger + elicitation/`requestState` for soft-delete |
|
|
133
|
+
### `data-analyst`
|
|
273
134
|
|
|
274
|
-
|
|
135
|
+
Unsaved Explore-style metric queries (`run_metric_query`) with explore discovery and optional `compile_query`. Bounded rows; no chart save. Server name: `lightdash-mcp-analyst`.
|
|
275
136
|
|
|
276
|
-
|
|
137
|
+
## Safety
|
|
277
138
|
|
|
278
|
-
|
|
139
|
+
- **Off MCP:** irrecoverable admin deletes, permanent content purge, broad org mutations — use `@lightdash-tools/client` or the CLI ([ADR-0004](../../docs/adr/0004-agent-safe-exposure-mcp-cli-vs-client-only.md)).
|
|
140
|
+
- **Writes:** only on `content-developer` (preview gate). Soft-delete / promote: only on `content-governance` (form elicitation).
|
|
141
|
+
- **Redaction:** emails masked unless `includeEmail=true`; scheduler destinations redacted unless `revealDestinations=true`; warehouse/dbt connection secrets never on MCP ([ADR-0011](../../docs/adr/0011-mcp-tool-response-sensitivity-classes.md)).
|
|
142
|
+
- **Project scope:** optional HTTP pin `X-Lightdash-Project`, else tool `projectUuid`; optional ceiling `LIGHTDASH_TOOLS_ALLOWED_PROJECT_UUIDS`.
|
|
279
143
|
|
|
280
|
-
|
|
144
|
+
Profile tool allowlists are the capability surface — not CLI safety-mode.
|
|
281
145
|
|
|
282
|
-
|
|
146
|
+
## Upstream API failures
|
|
283
147
|
|
|
284
|
-
|
|
148
|
+
When a tool handler throws (for example a Lightdash HTTP/API failure), MCP returns a **tool execution error** (`isError: true`) with structured `{ error: { code, message } }` — not a JSON-RPC protocol error — so clients/models can self-correct ([MCP tools error handling](https://modelcontextprotocol.io/specification/2025-11-25/server/tools#error-handling)).
|
|
285
149
|
|
|
286
|
-
|
|
150
|
+
| Code | Typical cause |
|
|
151
|
+
| :---------------------- | :--------------------------------------------- |
|
|
152
|
+
| `RATE_LIMITED` | HTTP 429 |
|
|
153
|
+
| `UPSTREAM_TRANSIENT` | Network errors, 408, 5xx |
|
|
154
|
+
| `UPSTREAM_NOT_FOUND` | HTTP 404 |
|
|
155
|
+
| `UPSTREAM_FORBIDDEN` | HTTP 403 |
|
|
156
|
+
| `UPSTREAM_UNSUPPORTED` | HTTP 501 |
|
|
157
|
+
| `UPSTREAM_VALIDATION` | HTTP 400 / 422 (including new required fields) |
|
|
158
|
+
| `UPSTREAM_CLIENT_ERROR` | Other 4xx |
|
|
159
|
+
| `UPSTREAM_CONTRACT` | Success HTTP but unexpected response shape |
|
|
160
|
+
| `IMAGE_TOO_LARGE` | Chart PNG over size limit |
|
|
161
|
+
| `UPSTREAM_UNKNOWN` | Non-API throws |
|
|
287
162
|
|
|
288
|
-
|
|
163
|
+
Intentional API upgrades still go through the pinned OpenAPI sync (`config/lightdash-openapi-ref.txt`). This layer only makes runtime drift fail safely and legibly.
|
|
289
164
|
|
|
290
|
-
|
|
291
|
-
pnpm test
|
|
292
|
-
```
|
|
165
|
+
## Migration from `@lightdash-tools/semantic-layer-mcp`
|
|
293
166
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
```
|
|
167
|
+
| Removed | Use instead |
|
|
168
|
+
| :------------------------------------ | :----------------------- |
|
|
169
|
+
| `@lightdash-tools/semantic-layer-mcp` | `@lightdash-tools/mcp` |
|
|
170
|
+
| Binary `lightdash-semantic-layer-mcp` | `lightdash-mcp` |
|
|
171
|
+
| HTTP `/mcp` (old) | `/semantic-layer/v1/mcp` |
|
|
172
|
+
| Unprefixed tool names | `lightdash_*` |
|
|
301
173
|
|
|
302
|
-
|
|
174
|
+
## Further reading
|
|
303
175
|
|
|
304
|
-
|
|
176
|
+
- Architecture / contributing — [CONTRIBUTING.md](./CONTRIBUTING.md)
|
|
177
|
+
- OAuth operator guide — [docs/operators/mcp-oauth.md](../../docs/operators/mcp-oauth.md)
|
|
178
|
+
- Cursor hosted OAuth — [docs/operators/cursor-claude.md](../../docs/operators/cursor-claude.md)
|
|
179
|
+
- Architecture decisions — [docs/adr/](../../docs/adr/)
|
|
180
|
+
- MCP transports — [2026-07-28](https://modelcontextprotocol.io/specification/2026-07-28/basic/transports)
|
|
305
181
|
|
|
306
182
|
## License
|
|
307
183
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bind an MCP server instance to a profile id for audit attribution and
|
|
3
|
+
* profile-aware tool registration (envelopes, get_project capabilities).
|
|
4
|
+
* Call once in registerCapabilities before registering tools; registerToolSafe
|
|
5
|
+
* and tool registrars read it via getServerProfile / requireServerProfile.
|
|
6
|
+
*/
|
|
7
|
+
import type { ProfileId } from '@lightdash-tools/common';
|
|
8
|
+
/** Associate a profile id with an MCP server (call before registering tools). */
|
|
9
|
+
export declare function bindServerProfile(server: object, profileId: ProfileId): void;
|
|
10
|
+
/** Profile id bound to this server, if any. */
|
|
11
|
+
export declare function getServerProfile(server: object): ProfileId | undefined;
|
|
12
|
+
/** Fail closed when a registrar runs without bindServerProfile. */
|
|
13
|
+
export declare function requireServerProfile(server: object, toolId: string): ProfileId;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Bind an MCP server instance to a profile id for audit attribution and
|
|
4
|
+
* profile-aware tool registration (envelopes, get_project capabilities).
|
|
5
|
+
* Call once in registerCapabilities before registering tools; registerToolSafe
|
|
6
|
+
* and tool registrars read it via getServerProfile / requireServerProfile.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.bindServerProfile = bindServerProfile;
|
|
10
|
+
exports.getServerProfile = getServerProfile;
|
|
11
|
+
exports.requireServerProfile = requireServerProfile;
|
|
12
|
+
const serverProfile = new WeakMap();
|
|
13
|
+
/** Associate a profile id with an MCP server (call before registering tools). */
|
|
14
|
+
function bindServerProfile(server, profileId) {
|
|
15
|
+
serverProfile.set(server, profileId);
|
|
16
|
+
}
|
|
17
|
+
/** Profile id bound to this server, if any. */
|
|
18
|
+
function getServerProfile(server) {
|
|
19
|
+
return serverProfile.get(server);
|
|
20
|
+
}
|
|
21
|
+
/** Fail closed when a registrar runs without bindServerProfile. */
|
|
22
|
+
function requireServerProfile(server, toolId) {
|
|
23
|
+
const profile = getServerProfile(server);
|
|
24
|
+
if (!profile) {
|
|
25
|
+
throw new Error(`profileId is required to register ${toolId}`);
|
|
26
|
+
}
|
|
27
|
+
return profile;
|
|
28
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const server_profile_js_1 = require("./server-profile.js");
|
|
5
|
+
(0, vitest_1.describe)('server-profile', () => {
|
|
6
|
+
(0, vitest_1.it)('bindServerProfile / getServerProfile round-trip', () => {
|
|
7
|
+
const server = {};
|
|
8
|
+
(0, vitest_1.expect)((0, server_profile_js_1.getServerProfile)(server)).toBeUndefined();
|
|
9
|
+
(0, server_profile_js_1.bindServerProfile)(server, 'content-developer');
|
|
10
|
+
(0, vitest_1.expect)((0, server_profile_js_1.getServerProfile)(server)).toBe('content-developer');
|
|
11
|
+
});
|
|
12
|
+
(0, vitest_1.it)('requireServerProfile returns the bound id', () => {
|
|
13
|
+
const server = {};
|
|
14
|
+
(0, server_profile_js_1.bindServerProfile)(server, 'content-reader');
|
|
15
|
+
(0, vitest_1.expect)((0, server_profile_js_1.requireServerProfile)(server, 'list_spaces')).toBe('content-reader');
|
|
16
|
+
});
|
|
17
|
+
(0, vitest_1.it)('requireServerProfile throws when unbound', () => {
|
|
18
|
+
const server = {};
|
|
19
|
+
(0, vitest_1.expect)(() => (0, server_profile_js_1.requireServerProfile)(server, 'list_spaces')).toThrow(/profileId is required/);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OAuth broker pending / codes / DCR clients (ADR-0007 / ADR-
|
|
2
|
+
* OAuth broker pending / codes / DCR clients (ADR-0007 / ADR-0019).
|
|
3
3
|
*
|
|
4
|
-
* All values are JSON-serializable
|
|
5
|
-
*
|
|
6
|
-
* handoff for authorize → callback → token when STORE=redis.
|
|
4
|
+
* All values are JSON-serializable. Backend: in-memory only — process-local.
|
|
5
|
+
* Multi-instance OAuth needs sticky `/oauth/*` or a single replica until signed-state/CIMD.
|
|
7
6
|
*/
|
|
8
7
|
export interface PendingAuthorization {
|
|
9
8
|
/** Broker state sent to Lightdash (opaque). */
|
|
@@ -54,8 +53,8 @@ export type OAuthBrokerStoreOptions = {
|
|
|
54
53
|
maxClients?: number;
|
|
55
54
|
};
|
|
56
55
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
56
|
+
* OAuth broker ephemeral store (ADR-0019). In-memory only (process-local).
|
|
57
|
+
* Async methods keep call sites await-uniform for future backends if needed.
|
|
59
58
|
*/
|
|
60
59
|
export interface OAuthBrokerStore {
|
|
61
60
|
registerClient(redirectUris: readonly string[]): Promise<RegisteredClient | undefined>;
|
|
@@ -69,7 +68,7 @@ export interface OAuthBrokerStore {
|
|
|
69
68
|
tokenType?: string;
|
|
70
69
|
scope?: string;
|
|
71
70
|
}): Promise<IssuedAuthorizationCode | undefined>;
|
|
72
|
-
/** Atomic get+delete
|
|
71
|
+
/** Atomic get+delete for one-time code consume. */
|
|
73
72
|
takeCode(code: string): Promise<IssuedAuthorizationCode | undefined>;
|
|
74
73
|
/**
|
|
75
74
|
* Re-insert a previously taken code with remaining TTL based on `createdAt`
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* OAuth broker pending / codes / DCR clients (ADR-0007 / ADR-
|
|
3
|
+
* OAuth broker pending / codes / DCR clients (ADR-0007 / ADR-0019).
|
|
4
4
|
*
|
|
5
|
-
* All values are JSON-serializable
|
|
6
|
-
*
|
|
7
|
-
* handoff for authorize → callback → token when STORE=redis.
|
|
5
|
+
* All values are JSON-serializable. Backend: in-memory only — process-local.
|
|
6
|
+
* Multi-instance OAuth needs sticky `/oauth/*` or a single replica until signed-state/CIMD.
|
|
8
7
|
*/
|
|
9
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
9
|
exports.InMemoryOAuthBrokerStore = exports.DEFAULT_MAX_CLIENTS = exports.DEFAULT_MAX_CODES = exports.DEFAULT_MAX_PENDING = exports.DEFAULT_CLIENT_TTL_MS = exports.DEFAULT_CODE_TTL_MS = exports.DEFAULT_PENDING_TTL_MS = void 0;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* In-memory OAuthBrokerStore unit tests (ADR-
|
|
3
|
-
* Redis
|
|
4
|
-
* (skipped otherwise — no Redis required for default CI).
|
|
2
|
+
* In-memory OAuthBrokerStore unit tests (ADR-0019).
|
|
3
|
+
* Redis backend removed per ADR-0019; always memory.
|
|
5
4
|
*/
|
|
6
5
|
export {};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* In-memory OAuthBrokerStore unit tests (ADR-
|
|
4
|
-
* Redis
|
|
5
|
-
* (skipped otherwise — no Redis required for default CI).
|
|
3
|
+
* In-memory OAuthBrokerStore unit tests (ADR-0019).
|
|
4
|
+
* Redis backend removed per ADR-0019; always memory.
|
|
6
5
|
*/
|
|
7
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
7
|
const vitest_1 = require("vitest");
|
|
9
|
-
const create_oauth_broker_store_js_1 = require("../../store/create-oauth-broker-store.js");
|
|
10
|
-
const redis_client_js_1 = require("../../store/redis-client.js");
|
|
11
8
|
const pending_store_js_1 = require("./pending-store.js");
|
|
12
9
|
(0, vitest_1.describe)('InMemoryOAuthBrokerStore', () => {
|
|
13
10
|
(0, vitest_1.it)('createPending / takePending is single-use', async () => {
|
|
@@ -110,37 +107,3 @@ const pending_store_js_1 = require("./pending-store.js");
|
|
|
110
107
|
(0, vitest_1.expect)(await store.registerClient(['http://127.0.0.1:1/cb2'])).toBeUndefined();
|
|
111
108
|
});
|
|
112
109
|
});
|
|
113
|
-
(0, vitest_1.describe)('createOAuthBrokerStore', () => {
|
|
114
|
-
var _a;
|
|
115
|
-
(0, vitest_1.it)('returns memory store by default', async () => {
|
|
116
|
-
const store = (0, create_oauth_broker_store_js_1.createOAuthBrokerStore)({ backend: 'memory' });
|
|
117
|
-
const pending = await store.createPending({
|
|
118
|
-
clientId: 'c1',
|
|
119
|
-
redirectUri: 'http://127.0.0.1:1/cb',
|
|
120
|
-
codeChallenge: 'ch',
|
|
121
|
-
codeChallengeMethod: 'S256',
|
|
122
|
-
});
|
|
123
|
-
(0, vitest_1.expect)(pending === null || pending === void 0 ? void 0 : pending.brokerState).toBeTruthy();
|
|
124
|
-
});
|
|
125
|
-
const redisUrl = (_a = process.env.LIGHTDASH_TOOLS_MCP_REDIS_URL) === null || _a === void 0 ? void 0 : _a.trim();
|
|
126
|
-
const describeRedis = redisUrl ? vitest_1.describe : vitest_1.describe.skip;
|
|
127
|
-
describeRedis('redis backend', () => {
|
|
128
|
-
(0, vitest_1.afterEach)(async () => {
|
|
129
|
-
await (0, redis_client_js_1.resetSharedRedisClientForTests)();
|
|
130
|
-
});
|
|
131
|
-
(0, vitest_1.it)('persists pending across store instances', async () => {
|
|
132
|
-
const config = { backend: 'redis', redisUrl: redisUrl };
|
|
133
|
-
const a = (0, create_oauth_broker_store_js_1.createOAuthBrokerStore)(config);
|
|
134
|
-
const pending = await a.createPending({
|
|
135
|
-
clientId: 'c1',
|
|
136
|
-
redirectUri: 'http://127.0.0.1:1/cb',
|
|
137
|
-
codeChallenge: 'ch',
|
|
138
|
-
codeChallengeMethod: 'S256',
|
|
139
|
-
});
|
|
140
|
-
(0, vitest_1.expect)(pending).toBeDefined();
|
|
141
|
-
const b = (0, create_oauth_broker_store_js_1.createOAuthBrokerStore)(config);
|
|
142
|
-
const taken = await b.takePending(pending.brokerState);
|
|
143
|
-
(0, vitest_1.expect)(taken === null || taken === void 0 ? void 0 : taken.clientId).toBe('c1');
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
});
|