@databrainhq/mcp-server 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -14
- package/dist/index.js +21 -453
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -197,12 +197,7 @@ Prompts are guided workflows your AI assistant can follow. Ask for them by name
|
|
|
197
197
|
|--------|-------------|
|
|
198
198
|
| `embed-existing-dashboard` | Embed a dashboard you've already built in the Databrain UI |
|
|
199
199
|
| `embed-blank-dashboard` | Multi-tenant setup — each client gets their own dashboard |
|
|
200
|
-
| `enable-metric-creation` | Let end-users build metrics (drag-and-drop or AI chat) |
|
|
201
200
|
| `brand-my-embed` | Customize colors, fonts, charts, card styling, responsive layout |
|
|
202
|
-
| `localize-embed` | Multi-language support, translations, calendar format |
|
|
203
|
-
| `secure-my-embed` | Permissions, access controls, role-based guest tokens |
|
|
204
|
-
| `setup-filters` | Dashboard filters — dropdowns, date ranges, server-side filters |
|
|
205
|
-
| `manage-embeds` | List, compare, and review existing embed configurations |
|
|
206
201
|
| `query-data` | Query your data with natural language, manage the semantic layer |
|
|
207
202
|
| `populate-semantic-layer` | Auto-generate table/column descriptions to enable natural language querying |
|
|
208
203
|
|
|
@@ -210,7 +205,7 @@ Prompts are guided workflows your AI assistant can follow. Ask for them by name
|
|
|
210
205
|
|
|
211
206
|
## Tools Reference
|
|
212
207
|
|
|
213
|
-
|
|
208
|
+
21 tools organized by category. Your AI assistant picks the right tools automatically — you don't need to call them directly.
|
|
214
209
|
|
|
215
210
|
> **Note:** Infrastructure creation (datasources, datamarts, workspaces) is done in the **Databrain UI**. However, the **semantic layer** is populated via MCP tools (`get_semantic_layer`, `update_semantic_layer`) — the AI auto-generates descriptions from column names.
|
|
216
211
|
|
|
@@ -239,17 +234,15 @@ Prompts are guided workflows your AI assistant can follow. Ask for them by name
|
|
|
239
234
|
</details>
|
|
240
235
|
|
|
241
236
|
<details>
|
|
242
|
-
<summary><b>Embeds</b> (
|
|
237
|
+
<summary><b>Embeds</b> (5) — Create, configure, and customize embedded dashboards</summary>
|
|
243
238
|
|
|
244
239
|
| Tool | Description |
|
|
245
240
|
|------|-------------|
|
|
246
241
|
| `create_embed` | Create an embed (standard or multi-tenant with `clientId`) |
|
|
247
242
|
| `list_embeds` | List embed configurations |
|
|
248
243
|
| `get_embed_details` | Get full embed details by ID |
|
|
249
|
-
| `update_embed` | Update embed config (
|
|
244
|
+
| `update_embed` | Update embed config — access settings, options, filters, i18n (via `body` passthrough) |
|
|
250
245
|
| `customize_embed_theme` | Presets, colors, fonts, cards, chart appearance, responsive layout |
|
|
251
|
-
| `configure_embed` | UI options, filters (string/date/number/SQL), i18n, translations |
|
|
252
|
-
| `diagnose_embed_health` | Diagnose malformed embeds + validate runtime readiness |
|
|
253
246
|
</details>
|
|
254
247
|
|
|
255
248
|
<details>
|
|
@@ -258,7 +251,7 @@ Prompts are guided workflows your AI assistant can follow. Ask for them by name
|
|
|
258
251
|
| Tool | Description |
|
|
259
252
|
|------|-------------|
|
|
260
253
|
| `generate_guest_token` | Generate a frontend guest token (server-side) |
|
|
261
|
-
| `generate_embed_code` | Generate integration code (React, Next.js, Vue, Angular, Svelte, vanilla JS) |
|
|
254
|
+
| `generate_embed_code` | Generate integration code (React, Next.js, Vue, Angular, Svelte, SolidJS, vanilla JS) |
|
|
262
255
|
</details>
|
|
263
256
|
|
|
264
257
|
<details>
|
|
@@ -272,12 +265,11 @@ Prompts are guided workflows your AI assistant can follow. Ask for them by name
|
|
|
272
265
|
</details>
|
|
273
266
|
|
|
274
267
|
<details>
|
|
275
|
-
<summary><b>Discovery
|
|
268
|
+
<summary><b>Dashboard Discovery</b> (1)</summary>
|
|
276
269
|
|
|
277
270
|
| Tool | Description |
|
|
278
271
|
|------|-------------|
|
|
279
272
|
| `list_dashboards` | List dashboards (by data app, workspace, or globally) |
|
|
280
|
-
| `setup_embed_interactive` | Guided step-by-step flow for the full embed setup |
|
|
281
273
|
</details>
|
|
282
274
|
|
|
283
275
|
---
|
|
@@ -320,7 +312,7 @@ This usually means no workspace was selected. Ask the assistant: *"List my works
|
|
|
320
312
|
|
|
321
313
|
1. Check that the guest token is generated **server-side** (never expose API tokens in frontend code)
|
|
322
314
|
2. Verify the embed ID and dashboard ID match
|
|
323
|
-
3. Ask: *"
|
|
315
|
+
3. Ask: *"Check my embed configuration for issues"* — the assistant inspects via `get_embed_details`
|
|
324
316
|
|
|
325
317
|
### Theme changes not showing
|
|
326
318
|
|
package/dist/index.js
CHANGED
|
@@ -6484,7 +6484,7 @@ tenant. For example, filter by department or user role within an organization.
|
|
|
6484
6484
|
// src/resources/content/use-case-guides.ts
|
|
6485
6485
|
var useCaseGuidesContent = `# Databrain Use Case Guides
|
|
6486
6486
|
|
|
6487
|
-
Databrain supports
|
|
6487
|
+
Databrain supports 3 core use cases for embedding analytics. Each maps to a specific MCP prompt and tool sequence.
|
|
6488
6488
|
|
|
6489
6489
|
---
|
|
6490
6490
|
|
|
@@ -6501,15 +6501,7 @@ Databrain supports 4 core use cases for embedding analytics. Each maps to a spec
|
|
|
6501
6501
|
**Tool sequence:** \`list_data_apps\` \u2192 \`list_datamarts\` \u2192 \`create_embed\` with \`clientId\` (per client) \u2192 \`generate_guest_token\` \u2192 \`generate_embed_code\`
|
|
6502
6502
|
**Key concepts:** \`clientId\` for tenant isolation, \`templateDashboardId\` for cloning, \`tableTenancySettings\` for row-level security.
|
|
6503
6503
|
|
|
6504
|
-
## Use Case 3:
|
|
6505
|
-
**When to use:** You want end-users to build their own metrics/charts on embedded dashboards.
|
|
6506
|
-
**Prompt:** \`enable-metric-creation\`
|
|
6507
|
-
**Two modes:**
|
|
6508
|
-
- **DRAG_DROP:** Visual metric builder \u2014 users drag columns, pick chart types. No AI needed.
|
|
6509
|
-
- **CHAT:** AI-powered natural language \u2014 users type questions. Requires LLM connector in Databrain admin.
|
|
6510
|
-
**Tool sequence:** \`list_embeds\` \u2192 \`update_embed\` (set accessSettings and options) \u2192 \`generate_guest_token\` (with permissions)
|
|
6511
|
-
|
|
6512
|
-
## Use Case 4: Explore and Query Data
|
|
6504
|
+
## Use Case 3: Explore and Query Data
|
|
6513
6505
|
**When to use:** You want to explore available data and ask questions using natural language.
|
|
6514
6506
|
**Prompt:** \`query-data\` (or \`populate-semantic-layer\` if starting from an empty semantic layer)
|
|
6515
6507
|
**Path:** Exploration + querying (datasources, datamarts, and workspaces are created in the Databrain UI). The semantic layer is populated via MCP tools.
|
|
@@ -6520,17 +6512,17 @@ Databrain supports 4 core use cases for embedding analytics. Each maps to a spec
|
|
|
6520
6512
|
|
|
6521
6513
|
## Customization (After Any Setup)
|
|
6522
6514
|
|
|
6523
|
-
Once an embed exists, use
|
|
6515
|
+
Once an embed exists, use the \`brand-my-embed\` prompt for theming. For everything else, describe what you need and the assistant uses tools directly:
|
|
6524
6516
|
|
|
6525
|
-
|
|
|
6526
|
-
|
|
6527
|
-
|
|
|
6528
|
-
|
|
|
6529
|
-
| \`
|
|
6530
|
-
|
|
|
6531
|
-
|
|
|
6532
|
-
|
|
|
6533
|
-
| \`populate-semantic-layer\`
|
|
6517
|
+
| Task | How |
|
|
6518
|
+
|------|-----|
|
|
6519
|
+
| Colors, fonts, chart styles | Prompt: \`brand-my-embed\` |
|
|
6520
|
+
| Filters (string, date, SQL) | \`update_embed\` with \`options.globalFilterOptions\` via body passthrough |
|
|
6521
|
+
| Localization / translations | \`update_embed\` with \`componentAttributes\` via body passthrough |
|
|
6522
|
+
| Permissions / access controls | \`update_embed\` + \`generate_guest_token\` with permissions |
|
|
6523
|
+
| Metric creation modes | \`update_embed\` accessSettings + \`generate_guest_token\` |
|
|
6524
|
+
| Manage / audit embeds | \`list_embeds\` \u2192 \`get_embed_details\` |
|
|
6525
|
+
| Semantic layer | Prompt: \`populate-semantic-layer\` or \`get_semantic_layer\` / \`update_semantic_layer\` |
|
|
6534
6526
|
|
|
6535
6527
|
---
|
|
6536
6528
|
|
|
@@ -6540,9 +6532,8 @@ Once an embed exists, use these prompts to customize:
|
|
|
6540
6532
|
|----------|-------------------|
|
|
6541
6533
|
| Do you have dashboards in Databrain UI? | Yes \u2192 Use Case 1 |
|
|
6542
6534
|
| Does each client need their own dashboard? | Yes \u2192 Use Case 2 |
|
|
6543
|
-
|
|
|
6544
|
-
|
|
|
6545
|
-
| Just need to brand/filter/secure? | Use customization prompts |
|
|
6535
|
+
| Want to explore or query your data? | Yes \u2192 Use Case 3 |
|
|
6536
|
+
| Just need to brand/customize? | Use \`brand-my-embed\` prompt or describe what you need |
|
|
6546
6537
|
`;
|
|
6547
6538
|
|
|
6548
6539
|
// src/resources/content/permission-schema.ts
|
|
@@ -6665,7 +6656,7 @@ var resources = [
|
|
|
6665
6656
|
{
|
|
6666
6657
|
uri: "databrain://use-case-guides",
|
|
6667
6658
|
name: "Use Case Guides",
|
|
6668
|
-
description: "Summary of
|
|
6659
|
+
description: "Summary of 3 core use cases with tool sequences, prompt names, and decision guide",
|
|
6669
6660
|
content: useCaseGuidesContent
|
|
6670
6661
|
},
|
|
6671
6662
|
{
|
|
@@ -6747,7 +6738,7 @@ Only after they answer, call \`generate_embed_code\` with the \`embedId\`.
|
|
|
6747
6738
|
- Prefer existing embeds when the user already has one for their target dashboard.
|
|
6748
6739
|
- NEVER ask for service or API tokens \u2014 both are handled automatically.
|
|
6749
6740
|
- \`workspaceName\` comes from dashboard data, not from the data app name.
|
|
6750
|
-
- After setup, suggest: \`brand-my-embed
|
|
6741
|
+
- After setup, suggest: \`brand-my-embed\` for theming. For filters, localization, or permissions, just describe what you need and use \`update_embed\` / \`generate_guest_token\` directly.`;
|
|
6751
6742
|
|
|
6752
6743
|
// src/prompts/embed-blank-dashboard.ts
|
|
6753
6744
|
var embedBlankDashboardPrompt = `You are guiding a multi-tenant setup where each client gets their own blank (or template-based) dashboard. This is ideal for SaaS platforms where each customer sees their own analytics.
|
|
@@ -6811,83 +6802,7 @@ The frontend code is the same for all clients \u2014 the \`clientId\` in the gue
|
|
|
6811
6802
|
- STOP after each step. Present results and wait for user input before proceeding.
|
|
6812
6803
|
- When calling \`create_embed\` with \`clientId\`, only pass \`accessSettings: { datamartName }\` \u2014 the tool fills in all required defaults automatically. Do NOT enumerate isAllow* fields.
|
|
6813
6804
|
- \`clientId\` must be consistent between embed creation and guest token generation.
|
|
6814
|
-
- After setup, suggest: \`brand-my-embed
|
|
6815
|
-
|
|
6816
|
-
// src/prompts/enable-metric-creation.ts
|
|
6817
|
-
var enableMetricCreationPrompt = `You are helping the user enable end-user metric creation on their embedded dashboards. Databrain supports two modes: DRAG_DROP (visual builder) and CHAT (AI-powered natural language).
|
|
6818
|
-
|
|
6819
|
-
**CRITICAL: This is an interactive guide. You MUST stop and ask the user at each decision point before proceeding. Never assume answers.**
|
|
6820
|
-
|
|
6821
|
-
**Two Metric Creation Modes:**
|
|
6822
|
-
- **DRAG_DROP**: Visual metric builder where users drag columns, choose chart types, and configure metrics. No AI needed.
|
|
6823
|
-
- **CHAT**: AI-powered natural language metric creation. Users type questions like "Show me revenue by month" and Databrain generates the metric. Requires an LLM connector configured in the Databrain admin panel.
|
|
6824
|
-
|
|
6825
|
-
**Step 1 \u2014 Identify the Embed**
|
|
6826
|
-
Call \`list_embeds\` to show available embeds.
|
|
6827
|
-
STOP and ASK the user: "Which embed do you want to enable metric creation on?"
|
|
6828
|
-
Only after they answer, call \`get_embed_details\` to see current access settings.
|
|
6829
|
-
|
|
6830
|
-
**Step 2 \u2014 Choose the Mode**
|
|
6831
|
-
STOP and ASK the user:
|
|
6832
|
-
- "Which metric creation mode do you want?"
|
|
6833
|
-
- **DRAG_DROP**: Visual builder, no AI dependency
|
|
6834
|
-
- **CHAT**: AI-powered, requires LLM connector setup in Databrain admin
|
|
6835
|
-
Do NOT proceed until the user picks a mode.
|
|
6836
|
-
|
|
6837
|
-
If they choose CHAT, tell them: "CHAT mode requires an LLM connector configured in the Databrain admin panel (Settings > AI Configuration). Have you set this up?"
|
|
6838
|
-
|
|
6839
|
-
**Step 3 \u2014 Update Embed Access Settings**
|
|
6840
|
-
Call \`update_embed\` with the embed ID and updated \`accessSettings\`:
|
|
6841
|
-
|
|
6842
|
-
For DRAG_DROP mode:
|
|
6843
|
-
\`\`\`json
|
|
6844
|
-
{
|
|
6845
|
-
"accessSettings": {
|
|
6846
|
-
"isAllowMetricCreation": true,
|
|
6847
|
-
"metricCreationMode": "DRAG_DROP"
|
|
6848
|
-
}
|
|
6849
|
-
}
|
|
6850
|
-
\`\`\`
|
|
6851
|
-
|
|
6852
|
-
For CHAT mode:
|
|
6853
|
-
\`\`\`json
|
|
6854
|
-
{
|
|
6855
|
-
"accessSettings": {
|
|
6856
|
-
"isAllowMetricCreation": true,
|
|
6857
|
-
"metricCreationMode": "CHAT"
|
|
6858
|
-
}
|
|
6859
|
-
}
|
|
6860
|
-
\`\`\`
|
|
6861
|
-
|
|
6862
|
-
**Step 4 \u2014 Configure Embed Options**
|
|
6863
|
-
Call \`update_embed\` (body passthrough with options) to ensure the UI supports metric creation:
|
|
6864
|
-
- \`disableMetricCreation\`: false
|
|
6865
|
-
- \`hideCreateMetricButton\`: false
|
|
6866
|
-
- \`hideChartSettings\`: false (so users can customize their created metrics)
|
|
6867
|
-
|
|
6868
|
-
**Step 5 \u2014 Set Guest Token Permissions**
|
|
6869
|
-
Remind the user: guest token \`permissions\` override embed \`accessSettings\` at runtime. When generating guest tokens via \`generate_guest_token\`, include:
|
|
6870
|
-
\`\`\`json
|
|
6871
|
-
{
|
|
6872
|
-
"permissions": {
|
|
6873
|
-
"isDisableMetricCreation": false
|
|
6874
|
-
}
|
|
6875
|
-
}
|
|
6876
|
-
\`\`\`
|
|
6877
|
-
|
|
6878
|
-
**Step 6 \u2014 Verify and Test**
|
|
6879
|
-
Call \`get_embed_details\` to verify the settings were applied correctly.
|
|
6880
|
-
Tell the user to refresh their embed and look for the "+ Create Metric" button.
|
|
6881
|
-
|
|
6882
|
-
If using CHAT mode, remind the user:
|
|
6883
|
-
- An LLM connector must be configured in Databrain admin (Settings > AI Configuration)
|
|
6884
|
-
- The datamart should have a populated semantic layer for best AI results (use \`get_semantic_layer\` to check, and \`update_semantic_layer\` or the \`populate-semantic-layer\` prompt to populate it)
|
|
6885
|
-
|
|
6886
|
-
**Important rules:**
|
|
6887
|
-
- STOP and ASK at each decision point. Never skip ahead.
|
|
6888
|
-
- Guest token \`permissions\` take precedence over embed \`accessSettings\` \u2014 both must allow metric creation.
|
|
6889
|
-
- CHAT mode requires external LLM connector setup (not available via MCP).
|
|
6890
|
-
- After enabling, suggest: \`secure-my-embed\` to fine-tune which users get metric creation access.`;
|
|
6805
|
+
- After setup, suggest: \`brand-my-embed\` for theming. For filters, metric creation, or permissions, just describe what you need and use \`update_embed\` / \`generate_guest_token\` directly.`;
|
|
6891
6806
|
|
|
6892
6807
|
// src/prompts/brand-my-embed.ts
|
|
6893
6808
|
var brandMyEmbedPrompt = `You are helping the user brand and visually customize their embedded Databrain dashboard. Follow these steps.
|
|
@@ -6964,327 +6879,6 @@ Iterate by calling the relevant tools again with adjusted values. Remember: all
|
|
|
6964
6879
|
|
|
6965
6880
|
**Reference**: Use \`databrain://theme-reference\` for the full theme schema and \`databrain://web-component-reference\` for all component attributes.`;
|
|
6966
6881
|
|
|
6967
|
-
// src/prompts/localize-embed.ts
|
|
6968
|
-
var localizeEmbedPrompt = `You are helping the user set up multi-language support for their embedded Databrain dashboard. Follow these steps.
|
|
6969
|
-
|
|
6970
|
-
**Step 1 \u2014 Identify the Embed and Target Languages**
|
|
6971
|
-
Call \`list_embeds\` and ask the user which embed to localize. Then ask:
|
|
6972
|
-
- Which languages do they need? (Supported: English, French, Spanish, German, Italian, Portuguese, Chinese, Japanese, Korean, Hindi, Arabic, Russian)
|
|
6973
|
-
- What is the default/primary language?
|
|
6974
|
-
|
|
6975
|
-
**Step 2 \u2014 Set the Primary Language**
|
|
6976
|
-
Use \`update_embed\` (body passthrough with componentAttributes) with the \`language\` parameter set to their primary language code (e.g. "fr" for French).
|
|
6977
|
-
|
|
6978
|
-
**Step 3 \u2014 Gather Translations**
|
|
6979
|
-
Call \`get_embed_details\` to understand what text is in the dashboard. Then help the user build translations:
|
|
6980
|
-
|
|
6981
|
-
Ask the user to list the key text elements in their dashboard:
|
|
6982
|
-
- Dashboard title
|
|
6983
|
-
- Metric titles and descriptions
|
|
6984
|
-
- Filter labels
|
|
6985
|
-
- Any footnotes or annotations
|
|
6986
|
-
|
|
6987
|
-
For each text element, ask for translations in their target languages. Build translation entries like:
|
|
6988
|
-
\`\`\`
|
|
6989
|
-
{ key: "Revenue", translations: { fr: "Revenus", es: "Ingresos", de: "Einnahmen" } }
|
|
6990
|
-
\`\`\`
|
|
6991
|
-
|
|
6992
|
-
**Important rules for translation keys:**
|
|
6993
|
-
- Keys must match the dashboard text EXACTLY (case-sensitive)
|
|
6994
|
-
- Define longer keys before shorter ones to avoid partial matches
|
|
6995
|
-
- If a translation is missing for a language, the original key text is shown as fallback
|
|
6996
|
-
|
|
6997
|
-
**Step 4 \u2014 Apply Translations**
|
|
6998
|
-
Use \`update_embed\` (body passthrough with componentAttributes.translationDictionary) with the translations.
|
|
6999
|
-
|
|
7000
|
-
**Step 5 \u2014 Configure Calendar (if needed)**
|
|
7001
|
-
Ask if they need a different calendar system:
|
|
7002
|
-
- \`"default"\` \u2014 standard Gregorian calendar
|
|
7003
|
-
- \`"ind"\` \u2014 Indian calendar format
|
|
7004
|
-
|
|
7005
|
-
Set via \`calendarType\` in \`update_embed\` (body passthrough with componentAttributes).
|
|
7006
|
-
|
|
7007
|
-
**Step 6 \u2014 Set Custom Messages**
|
|
7008
|
-
Ask if they want to translate system messages:
|
|
7009
|
-
- Token expiry message (shown when session expires)
|
|
7010
|
-
- Token absent message (shown when no auth token)
|
|
7011
|
-
|
|
7012
|
-
Use \`update_embed\` (body passthrough with options.customMessages) with \`tokenExpiry\` and \`tokenAbsent\` in their primary language.
|
|
7013
|
-
|
|
7014
|
-
**Step 7 \u2014 Test**
|
|
7015
|
-
Tell the user to refresh the embed and verify translations appear correctly. If any text isn't translating, double-check that the key matches exactly.
|
|
7016
|
-
|
|
7017
|
-
Remind the user: translations can also be applied per-user at the web component level using the \`translation-dictionary\` attribute, which is useful for dynamically switching languages based on user preferences.
|
|
7018
|
-
|
|
7019
|
-
**Tip:** The \`language\`, \`calendarType\`, \`hideDashboardFilters\`, and filter settings are all configurable via \`update_embed\` body passthrough.
|
|
7020
|
-
|
|
7021
|
-
**Important:** After changing language or translation settings, existing guest tokens still carry the old configuration. Remind the user to **regenerate guest tokens** (or reload their app) for changes to take effect.`;
|
|
7022
|
-
|
|
7023
|
-
// src/prompts/secure-my-embed.ts
|
|
7024
|
-
var secureMyEmbedPrompt = `You are helping the user secure and configure permissions for their embedded Databrain dashboard. Follow these steps.
|
|
7025
|
-
|
|
7026
|
-
**Step 1 \u2014 Understand User Roles**
|
|
7027
|
-
Ask the user about their end-user roles. Common patterns:
|
|
7028
|
-
- **Viewer** \u2014 can see data, maybe filter, but can't modify anything
|
|
7029
|
-
- **Analyst** \u2014 can export data, drill down, use filters
|
|
7030
|
-
- **Builder/Power User** \u2014 can create/edit metrics, change layouts
|
|
7031
|
-
- **Admin** \u2014 full access including AI features
|
|
7032
|
-
|
|
7033
|
-
Ask: "What roles do your end-users have? What should each role be allowed to do?"
|
|
7034
|
-
|
|
7035
|
-
**Step 2 \u2014 Lock Down the Embed Defaults**
|
|
7036
|
-
Use \`update_embed\` (body passthrough with options) to set restrictive defaults (principle of least privilege):
|
|
7037
|
-
|
|
7038
|
-
\`\`\`
|
|
7039
|
-
update_embed(embedId, body: { options: {
|
|
7040
|
-
disableMetricCreation: true,
|
|
7041
|
-
disableMetricUpdation: true,
|
|
7042
|
-
disableMetricDeletion: true,
|
|
7043
|
-
disableManageMetrics: true,
|
|
7044
|
-
disableLayoutCustomization: true,
|
|
7045
|
-
disableSaveLayout: true,
|
|
7046
|
-
disableUnderlyingData: true,
|
|
7047
|
-
disableScheduleEmailReports: true,
|
|
7048
|
-
enableDownloadCsv: false,
|
|
7049
|
-
enableDownloadAllPdf: false)
|
|
7050
|
-
\`\`\`
|
|
7051
|
-
|
|
7052
|
-
Explain: "We start with everything locked down, then use guest token permissions to grant access per role."
|
|
7053
|
-
|
|
7054
|
-
**Step 3 \u2014 Create Role-Based Guest Token Examples**
|
|
7055
|
-
Show the user how to generate tokens for each role:
|
|
7056
|
-
|
|
7057
|
-
**Viewer (default \u2014 no overrides needed):**
|
|
7058
|
-
\`\`\`
|
|
7059
|
-
generate_guest_token(clientId, dataAppName)
|
|
7060
|
-
\`\`\`
|
|
7061
|
-
|
|
7062
|
-
**Analyst (can export and drill down):**
|
|
7063
|
-
\`\`\`
|
|
7064
|
-
generate_guest_token(clientId, dataAppName, {
|
|
7065
|
-
permissions: {
|
|
7066
|
-
isEnableDownloadMetrics: true,
|
|
7067
|
-
isEnableUnderlyingData: true
|
|
7068
|
-
}
|
|
7069
|
-
})
|
|
7070
|
-
\`\`\`
|
|
7071
|
-
|
|
7072
|
-
**Builder (can create and edit):**
|
|
7073
|
-
\`\`\`
|
|
7074
|
-
generate_guest_token(clientId, dataAppName, {
|
|
7075
|
-
permissions: {
|
|
7076
|
-
isEnableManageMetrics: true,
|
|
7077
|
-
isEnableMetricUpdation: true,
|
|
7078
|
-
isEnableCustomizeLayout: true
|
|
7079
|
-
}
|
|
7080
|
-
})
|
|
7081
|
-
\`\`\`
|
|
7082
|
-
|
|
7083
|
-
**Admin (full access with AI):**
|
|
7084
|
-
\`\`\`
|
|
7085
|
-
generate_guest_token(clientId, dataAppName, {
|
|
7086
|
-
permissions: {
|
|
7087
|
-
isEnableManageMetrics: true,
|
|
7088
|
-
isEnableMetricUpdation: true,
|
|
7089
|
-
isEnableCustomizeLayout: true,
|
|
7090
|
-
isEnableDownloadMetrics: true,
|
|
7091
|
-
isEnableUnderlyingData: true
|
|
7092
|
-
}
|
|
7093
|
-
})
|
|
7094
|
-
\`\`\`
|
|
7095
|
-
|
|
7096
|
-
**Step 4 \u2014 Multi-Tenancy Check**
|
|
7097
|
-
Ask: "Do different customers/organizations see different data?"
|
|
7098
|
-
|
|
7099
|
-
If yes:
|
|
7100
|
-
- Explain that \`clientId\` in the guest token controls row-level security
|
|
7101
|
-
- The \`clientId\` must match values in the datamart's client column
|
|
7102
|
-
- Suggest using \`params.appFilters\` / \`params.dashboardAppFilters\` in \`generate_guest_token\` for server-side row-level filtering
|
|
7103
|
-
|
|
7104
|
-
**Step 5 \u2014 Security Checklist**
|
|
7105
|
-
Walk through this checklist with the user:
|
|
7106
|
-
|
|
7107
|
-
1. \u2705 API token is stored server-side only (never in frontend code)
|
|
7108
|
-
2. \u2705 Guest tokens are generated server-side per request
|
|
7109
|
-
3. \u2705 Guest tokens have appropriate expiry time
|
|
7110
|
-
4. \u2705 Embed defaults are restrictive (locked down in Step 2)
|
|
7111
|
-
5. \u2705 Role-based permissions are granted via guest token overrides
|
|
7112
|
-
6. \u2705 Multi-tenancy is configured if serving multiple customers
|
|
7113
|
-
7. \u2705 Download restrictions are set (\`disableDownloadDataNoFilters\` if needed)
|
|
7114
|
-
|
|
7115
|
-
**Step 6 \u2014 Generate Secure Frontend Code**
|
|
7116
|
-
Call \`generate_embed_code\` for their framework. Emphasize that the generated code includes a backend route for token generation \u2014 this is the secure pattern.
|
|
7117
|
-
|
|
7118
|
-
When reviewing runtime behavior (for example missing \`+ Create Metric\`), verify contract shape explicitly:
|
|
7119
|
-
- Guest token request body must send \`permissions\` at top level (not nested inside \`params\`)
|
|
7120
|
-
- Include \`dataAppName\` at top level
|
|
7121
|
-
- For metric creation flows, ensure \`permissions.isDisableMetricCreation=false\` and \`permissions.isEnableManageMetrics=true\`
|
|
7122
|
-
- Confirm embed options do not set \`disableMetricCreation=true\`
|
|
7123
|
-
- In browser network response for \`/api/v2/dashboard\`, confirm \`isAllowedToCreateMetrics=true\` and \`metricCreationMode=DRAG_DROP\`
|
|
7124
|
-
|
|
7125
|
-
**Important:** After changing embed permissions or access settings, existing guest tokens still carry the old configuration. Remind the user to **regenerate guest tokens** (or reload their app) for changes to take effect.
|
|
7126
|
-
|
|
7127
|
-
**Reference**: Use \`databrain://self-serve-reference\` for all permission flags and \`databrain://multi-tenancy-guide\` for row-level security details.`;
|
|
7128
|
-
|
|
7129
|
-
// src/prompts/setup-filters.ts
|
|
7130
|
-
var setupFiltersPrompt = `You are helping the user configure dashboard filters for their embedded Databrain dashboard. Follow these steps.
|
|
7131
|
-
|
|
7132
|
-
**Step 1 \u2014 Understand the Data**
|
|
7133
|
-
Call \`list_embeds\` and ask which embed to configure. Then call \`get_embed_details\` to see the current filter configuration.
|
|
7134
|
-
|
|
7135
|
-
**Step 2 \u2014 Identify Filter Needs**
|
|
7136
|
-
Ask the user:
|
|
7137
|
-
- "What filters do your end-users need?" (e.g. date range, region, product category, status)
|
|
7138
|
-
- "Should any filters have default values?"
|
|
7139
|
-
- "Are there filters you want to hide from end-users?" (e.g. internal IDs)
|
|
7140
|
-
- "Do any filters have very large option lists?" (100+ options \u2014 these benefit from SQL-based filters)
|
|
7141
|
-
|
|
7142
|
-
**Step 3 \u2014 Configure String Filters**
|
|
7143
|
-
For text/category filters, use \`update_embed\` (body passthrough with options.globalFilterOptions) for \`stringFilters\`:
|
|
7144
|
-
|
|
7145
|
-
\`\`\`
|
|
7146
|
-
stringFilters: [{
|
|
7147
|
-
filterName: "Region",
|
|
7148
|
-
options: [
|
|
7149
|
-
{ value: "US", label: "United States" },
|
|
7150
|
-
{ value: "EU", label: "Europe" },
|
|
7151
|
-
{ value: "APAC", label: "Asia Pacific" }
|
|
7152
|
-
],
|
|
7153
|
-
defaultOption: "US"
|
|
7154
|
-
}]
|
|
7155
|
-
\`\`\`
|
|
7156
|
-
|
|
7157
|
-
For multi-select defaults, use an array: \`defaultOption: ["US", "EU"]\`
|
|
7158
|
-
|
|
7159
|
-
**Step 4 \u2014 Configure Date Filters**
|
|
7160
|
-
For date range filters, use \`dateFilters\`:
|
|
7161
|
-
|
|
7162
|
-
\`\`\`
|
|
7163
|
-
dateFilters: [{
|
|
7164
|
-
filterName: "Date Range",
|
|
7165
|
-
startDate: "2024-01-01",
|
|
7166
|
-
endDate: "2024-12-31",
|
|
7167
|
-
datePresetOptions: [
|
|
7168
|
-
{ label: "Last 30 Days", type: "Last", interval: "Days" },
|
|
7169
|
-
{ label: "This Quarter", type: "This", interval: "Quarter" },
|
|
7170
|
-
{ label: "This Year", type: "This", interval: "Year" }
|
|
7171
|
-
]
|
|
7172
|
-
}]
|
|
7173
|
-
\`\`\`
|
|
7174
|
-
|
|
7175
|
-
**Step 5 \u2014 Configure Number Filters**
|
|
7176
|
-
For numeric range filters, use \`numberFilters\`:
|
|
7177
|
-
|
|
7178
|
-
\`\`\`
|
|
7179
|
-
numberFilters: [{
|
|
7180
|
-
filterName: "Revenue",
|
|
7181
|
-
min: 0,
|
|
7182
|
-
max: 1000000
|
|
7183
|
-
}]
|
|
7184
|
-
\`\`\`
|
|
7185
|
-
|
|
7186
|
-
**Step 6 \u2014 SQL-Based Filters (for large datasets)**
|
|
7187
|
-
If a filter has 100+ options (e.g. company names, product SKUs), use \`sqlFilters\`:
|
|
7188
|
-
|
|
7189
|
-
\`\`\`
|
|
7190
|
-
sqlFilters: [{
|
|
7191
|
-
filterName: "Company",
|
|
7192
|
-
sql: "SELECT DISTINCT \\"company_name\\" FROM \\"companies\\" ORDER BY \\"company_name\\"",
|
|
7193
|
-
columnName: "company_name"
|
|
7194
|
-
}]
|
|
7195
|
-
\`\`\`
|
|
7196
|
-
|
|
7197
|
-
Explain: "SQL filters dynamically fetch options from the database, so they're always up-to-date and don't bloat the embed configuration."
|
|
7198
|
-
|
|
7199
|
-
**Step 7 \u2014 Hide Unnecessary Filters**
|
|
7200
|
-
If the user has filters that should be hidden (e.g. internal IDs, tenant columns already handled by clientId):
|
|
7201
|
-
|
|
7202
|
-
\`\`\`
|
|
7203
|
-
hideDashboardFilters: ["internal_id", "tenant_id"]
|
|
7204
|
-
\`\`\`
|
|
7205
|
-
|
|
7206
|
-
**Step 8 \u2014 Configure Date Picker Options**
|
|
7207
|
-
Ask if they want to hide certain date picker presets:
|
|
7208
|
-
|
|
7209
|
-
\`\`\`
|
|
7210
|
-
hideDatePickerOptions: ["yesterday", "last week"]
|
|
7211
|
-
\`\`\`
|
|
7212
|
-
|
|
7213
|
-
**Step 9 \u2014 Metric Filter Position**
|
|
7214
|
-
Ask: "Do you want metric-level filters inside the card or outside?"
|
|
7215
|
-
- \`"inside"\` \u2014 compact, within each metric card (default)
|
|
7216
|
-
- \`"outside"\` \u2014 above the card, more prominent
|
|
7217
|
-
|
|
7218
|
-
Also ask if they want cross-metric filtering (\`enableMultiMetricFilters\`).
|
|
7219
|
-
|
|
7220
|
-
**Step 10 \u2014 Server-Side Filters (via Guest Token)**
|
|
7221
|
-
If the user needs filters that end-users cannot remove (e.g. for security):
|
|
7222
|
-
- Explain that \`appFilters\` in \`generate_guest_token\` are server-side enforced
|
|
7223
|
-
- These are invisible to the end-user and cannot be overridden
|
|
7224
|
-
- Perfect for tenant filtering, role-based data access, or compliance requirements
|
|
7225
|
-
|
|
7226
|
-
Show an example:
|
|
7227
|
-
\`\`\`
|
|
7228
|
-
generate_guest_token(clientId, dataAppName, {
|
|
7229
|
-
params: {
|
|
7230
|
-
appFilters: [{
|
|
7231
|
-
metricId: "metric_123",
|
|
7232
|
-
values: {
|
|
7233
|
-
region: ["US", "CA"]
|
|
7234
|
-
}
|
|
7235
|
-
}]
|
|
7236
|
-
}
|
|
7237
|
-
})
|
|
7238
|
-
\`\`\`
|
|
7239
|
-
|
|
7240
|
-
**Important:** After changing filter settings, existing guest tokens still carry the old configuration. Remind the user to **regenerate guest tokens** (or reload their app) for changes to take effect.
|
|
7241
|
-
|
|
7242
|
-
**Reference**: Use \`databrain://filter-reference\` for all filter types, operators, and combination rules.`;
|
|
7243
|
-
|
|
7244
|
-
// src/prompts/manage-embeds.ts
|
|
7245
|
-
var manageEmbedsPrompt = `You are helping the user manage Databrain embed configurations \u2014 list, compare, and review settings. Follow these steps based on what the user needs.
|
|
7246
|
-
|
|
7247
|
-
**Step 1 \u2014 Understand the Task**
|
|
7248
|
-
Ask the user what they want to do:
|
|
7249
|
-
1. **List and compare embeds** \u2014 see all embeds and their configurations
|
|
7250
|
-
2. **Review embed settings** \u2014 audit theme, permissions, and options
|
|
7251
|
-
|
|
7252
|
-
**For Listing and Comparing Embeds:**
|
|
7253
|
-
1. Call \`list_embeds\` to show all embed configurations
|
|
7254
|
-
2. For detailed comparison, call \`get_embed_details\` on each embed the user wants to compare
|
|
7255
|
-
3. Present a comparison table showing:
|
|
7256
|
-
- Embed name and ID
|
|
7257
|
-
- Linked dashboard
|
|
7258
|
-
- Theme (preset or custom)
|
|
7259
|
-
- Key permissions (metric creation, downloads, AI pilot)
|
|
7260
|
-
- Multi-tenancy settings
|
|
7261
|
-
|
|
7262
|
-
**For Reviewing Embed Settings:**
|
|
7263
|
-
1. Call \`get_embed_details\` for the embed
|
|
7264
|
-
2. Present a clear summary organized by category:
|
|
7265
|
-
|
|
7266
|
-
**Theme:**
|
|
7267
|
-
- Current preset or custom theme values
|
|
7268
|
-
- Suggest \`customize_embed_theme\` if they want changes
|
|
7269
|
-
|
|
7270
|
-
**Permissions / Access Settings:**
|
|
7271
|
-
- What's enabled vs disabled
|
|
7272
|
-
- Suggest \`update_embed\` for changes
|
|
7273
|
-
|
|
7274
|
-
**Filters:**
|
|
7275
|
-
- Current filter configuration
|
|
7276
|
-
- Suggest \`update_embed\` (body passthrough with options.globalFilterOptions) for changes
|
|
7277
|
-
|
|
7278
|
-
**Internationalization:**
|
|
7279
|
-
- Current language and translations
|
|
7280
|
-
- Suggest \`update_embed\` (body passthrough with componentAttributes) for changes
|
|
7281
|
-
|
|
7282
|
-
3. Ask: "Would you like to modify any of these settings?"
|
|
7283
|
-
|
|
7284
|
-
**Tips:**
|
|
7285
|
-
- Embed IDs are permanent \u2014 even if you rename an embed, the ID stays the same
|
|
7286
|
-
- After any embed setting changes, existing guest tokens still carry the old configuration \u2014 **regenerate guest tokens** for changes to take effect`;
|
|
7287
|
-
|
|
7288
6882
|
// src/prompts/query-data.ts
|
|
7289
6883
|
var queryDataPrompt = `You are helping the user query their data using natural language. Databrain's AI converts questions into SQL, runs them against the database, and returns results with chart type suggestions.
|
|
7290
6884
|
|
|
@@ -7453,36 +7047,11 @@ var prompts = [
|
|
|
7453
7047
|
description: "Multi-tenant blank dashboard setup: each client gets their own dashboard copy via create_embed with clientId",
|
|
7454
7048
|
content: embedBlankDashboardPrompt
|
|
7455
7049
|
},
|
|
7456
|
-
{
|
|
7457
|
-
name: "enable-metric-creation",
|
|
7458
|
-
description: "Enable end-user metric creation on embeds: DRAG_DROP (visual) or CHAT (AI-powered) modes",
|
|
7459
|
-
content: enableMetricCreationPrompt
|
|
7460
|
-
},
|
|
7461
7050
|
{
|
|
7462
7051
|
name: "brand-my-embed",
|
|
7463
7052
|
description: "Customize colors, fonts, chart styles, and component theme to match your brand",
|
|
7464
7053
|
content: brandMyEmbedPrompt
|
|
7465
7054
|
},
|
|
7466
|
-
{
|
|
7467
|
-
name: "localize-embed",
|
|
7468
|
-
description: "Set up multi-language support with translations and locale settings",
|
|
7469
|
-
content: localizeEmbedPrompt
|
|
7470
|
-
},
|
|
7471
|
-
{
|
|
7472
|
-
name: "secure-my-embed",
|
|
7473
|
-
description: "Configure permissions, access controls, and role-based guest tokens",
|
|
7474
|
-
content: secureMyEmbedPrompt
|
|
7475
|
-
},
|
|
7476
|
-
{
|
|
7477
|
-
name: "setup-filters",
|
|
7478
|
-
description: "Configure dashboard filters: string, date, number, SQL-based, and server-side filters",
|
|
7479
|
-
content: setupFiltersPrompt
|
|
7480
|
-
},
|
|
7481
|
-
{
|
|
7482
|
-
name: "manage-embeds",
|
|
7483
|
-
description: "List, compare, rename, delete embeds and rotate API tokens",
|
|
7484
|
-
content: manageEmbedsPrompt
|
|
7485
|
-
},
|
|
7486
7055
|
{
|
|
7487
7056
|
name: "query-data",
|
|
7488
7057
|
description: "Query your data with natural language: ask questions, get results with chart suggestions, manage the semantic layer",
|
|
@@ -7523,16 +7092,15 @@ function createServer(config) {
|
|
|
7523
7092
|
\u2022 SERVICE TOKEN (DATABRAIN_SERVICE_TOKEN): org-level, pre-configured in MCP server config. Used for: list_datasources, discover_datasource_schema, list_datamarts, list_workspaces, link_datamart_to_workspace, list_data_apps, create_data_app, list_api_tokens, create_api_token, rotate_api_token, list_dashboards (workspace scope), ask_question, get_semantic_layer, update_semantic_layer. You already have this \u2014 never ask the user for it.
|
|
7524
7093
|
\u2022 API TOKEN (per data app): scoped to one data app, used for embedding operations (list_embeds, get_embed_details, create_embed, update_embed, generate_guest_token) and data-app scoped dashboard listing. Created/rotated via create_api_token or rotate_api_token during setup.
|
|
7525
7094
|
|
|
7526
|
-
|
|
7095
|
+
3 core use cases \u2014 match the user's scenario to the right prompt:
|
|
7527
7096
|
1. Embed existing dashboard \u2192 prompt: embed-existing-dashboard (list_data_apps \u2192 create_api_token \u2192 list_dashboards \u2192 create_embed \u2192 generate_guest_token \u2192 generate_embed_code)
|
|
7528
7097
|
2. Blank dashboard per client \u2192 prompt: embed-blank-dashboard (list_data_apps \u2192 list_datamarts \u2192 create_embed with clientId per client \u2192 generate_guest_token \u2192 generate_embed_code)
|
|
7529
|
-
3.
|
|
7530
|
-
4. Explore & query data \u2192 prompt: query-data (list_datamarts \u2192 get_semantic_layer \u2192 if empty, auto-generate descriptions with update_semantic_layer or use populate-semantic-layer prompt \u2192 ask_question)
|
|
7098
|
+
3. Explore & query data \u2192 prompt: query-data (list_datamarts \u2192 get_semantic_layer \u2192 if empty, auto-generate descriptions with update_semantic_layer or use populate-semantic-layer prompt \u2192 ask_question)
|
|
7531
7099
|
|
|
7532
7100
|
Infrastructure CREATION (datasources, datamarts, workspaces) is done in the Databrain UI.
|
|
7533
7101
|
However, the **semantic layer** is populated and maintained entirely via MCP tools (get_semantic_layer, update_semantic_layer). When the semantic layer is empty, YOU (the assistant) should auto-generate descriptions from table/column names and push them with update_semantic_layer \u2014 do NOT send the user to the UI for this.
|
|
7534
7102
|
|
|
7535
|
-
After embed setup, customize with: brand-my-embed
|
|
7103
|
+
After embed setup, customize with: brand-my-embed prompt for theming. Use update_embed (body passthrough) for filters, localization, and permissions.
|
|
7536
7104
|
Use generate_guest_token for frontend auth and generate_embed_code for framework snippets.
|
|
7537
7105
|
For advanced embed configuration (UI toggles, filters, i18n), use update_embed with a body passthrough.
|
|
7538
7106
|
To diagnose embed issues, use get_embed_details and reason about the response.
|
|
@@ -7566,7 +7134,7 @@ async function main() {
|
|
|
7566
7134
|
const server = createServer(config);
|
|
7567
7135
|
const transport = new StdioServerTransport();
|
|
7568
7136
|
await server.connect(transport);
|
|
7569
|
-
banner(`v${VERSION} ready (
|
|
7137
|
+
banner(`v${VERSION} ready (21 tools, 11 resources, 5 prompts)`);
|
|
7570
7138
|
} catch (error) {
|
|
7571
7139
|
logger.error("Failed to start server", error);
|
|
7572
7140
|
process.exit(1);
|