@databrainhq/mcp-server 0.2.10 → 0.2.12
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 +76 -17
- package/dist/index.js +1439 -412
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,12 +15,14 @@ Works with Claude, Cursor, Windsurf, and any MCP-compatible client.
|
|
|
15
15
|
|
|
16
16
|
### 1. Get your Service Token
|
|
17
17
|
|
|
18
|
-
1. Log in to
|
|
18
|
+
1. Log in to your Databrain instance (cloud or self-hosted)
|
|
19
19
|
2. Go to **Settings → Service Tokens**
|
|
20
20
|
3. Create a new token and copy it
|
|
21
21
|
|
|
22
22
|
### 2. Add to your AI client
|
|
23
23
|
|
|
24
|
+
> **Self-hosted?** Also set `DATABRAIN_API_URL` in the `env` block — see [Self-hosted Databrain](#self-hosted-databrain) below.
|
|
25
|
+
|
|
24
26
|
<details>
|
|
25
27
|
<summary><b>Cursor</b></summary>
|
|
26
28
|
|
|
@@ -105,13 +107,39 @@ npx @databrainhq/mcp-server
|
|
|
105
107
|
```
|
|
106
108
|
</details>
|
|
107
109
|
|
|
110
|
+
### Self-hosted Databrain
|
|
111
|
+
|
|
112
|
+
Running Databrain on your own infrastructure? Point the MCP server at your instance by setting `DATABRAIN_API_URL` alongside your token:
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"mcpServers": {
|
|
117
|
+
"databrain": {
|
|
118
|
+
"command": "npx",
|
|
119
|
+
"args": ["@databrainhq/mcp-server"],
|
|
120
|
+
"env": {
|
|
121
|
+
"DATABRAIN_SERVICE_TOKEN": "<your-service-token>",
|
|
122
|
+
"DATABRAIN_API_URL": "https://api.your-databrain.example.com"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Checklist:
|
|
130
|
+
- `DATABRAIN_API_URL` must be the **API origin** for your self-hosted instance (not the dashboard URL). Typically `https://api.<your-domain>`.
|
|
131
|
+
- The token must be minted from that same self-hosted instance — tokens are not portable across instances.
|
|
132
|
+
- Use `DATABRAIN_SERVICE_TOKEN` (Settings → Service Tokens) for org-level access. Per-user identity binding will arrive with the OAuth-based login flow now in development.
|
|
133
|
+
- The MCP client process must be able to reach the URL (VPN, firewall, self-signed certs all apply here).
|
|
134
|
+
- Scaffolded frontend code (React, Next.js, Vue, etc.) reads the same `DATABRAIN_API_URL` for server-side guest-token generation, so the variable flows through to your app.
|
|
135
|
+
|
|
108
136
|
### 3. Start talking
|
|
109
137
|
|
|
110
138
|
Open your AI assistant and try any of these:
|
|
111
139
|
|
|
112
140
|
> **"Set up a Databrain embed for my dashboard"**
|
|
113
141
|
|
|
114
|
-
> **"Brand my embed to match our
|
|
142
|
+
> **"Brand my embed to match our colors"**
|
|
115
143
|
|
|
116
144
|
> **"What was total revenue last month?"**
|
|
117
145
|
|
|
@@ -165,13 +193,23 @@ Each of your customers gets their own dashboard with row-level security.
|
|
|
165
193
|
|
|
166
194
|
### Tweak widgets on a customer dashboard
|
|
167
195
|
|
|
168
|
-
Add, remove, or modify widgets (metrics) on a specific customer's embed without opening the Databrain UI. Clone from a template widget, write a fresh SQL spec, or generate one from a prompt.
|
|
196
|
+
Add, remove, or modify widgets (metrics) on a specific customer's embed without opening the Databrain UI. Clone from a template widget, write a fresh SQL spec, or generate one from a prompt. End with a demo link to verify exactly what that customer will see — same URL the UI's "Share Demo Link" generates.
|
|
197
|
+
|
|
198
|
+
> "Add the 'Calls per day' widget from the standard template to a client's dashboard"
|
|
199
|
+
|
|
200
|
+
> "Generate a widget showing disqualification reasons and add it to a client's embed"
|
|
169
201
|
|
|
170
|
-
> "
|
|
202
|
+
> "Remove the billing widget from one client's dashboard but keep it for other clients"
|
|
171
203
|
|
|
172
|
-
> "
|
|
204
|
+
> "Give me a demo link for a client's dashboard so I can see what they'll see"
|
|
173
205
|
|
|
174
|
-
|
|
206
|
+
### Migrate validated SQL into metrics
|
|
207
|
+
|
|
208
|
+
Turn warehouse-validated SQL into Databrain metrics with a production-safe flow: validate the target dashboard/datasource, produce a dry-run plan, then apply only after explicit confirmation.
|
|
209
|
+
|
|
210
|
+
> "Validate this SQL as a new metric on my operations dashboard"
|
|
211
|
+
|
|
212
|
+
> "Dry-run creating this converted query as a metric, then show me the exact apply plan"
|
|
175
213
|
|
|
176
214
|
### Enable self-serve analytics
|
|
177
215
|
|
|
@@ -191,11 +229,16 @@ Let end-users build their own metrics with drag-and-drop or AI-powered chat.
|
|
|
191
229
|
|
|
192
230
|
## Environment Variables
|
|
193
231
|
|
|
232
|
+
At least one of `DATABRAIN_SERVICE_TOKEN` or `DATABRAIN_API_TOKEN` must be set. Per-user identity binding (OAuth-based login) is in active development — until it ships, sessions authenticate at the org / data-app level.
|
|
233
|
+
|
|
194
234
|
| Variable | Required | Default | Description |
|
|
195
235
|
|----------|----------|---------|-------------|
|
|
196
|
-
| `DATABRAIN_SERVICE_TOKEN` |
|
|
197
|
-
| `DATABRAIN_API_TOKEN` |
|
|
198
|
-
| `DATABRAIN_API_URL` |
|
|
236
|
+
| `DATABRAIN_SERVICE_TOKEN` | One of two† | — | Org-level token from Settings → Service Tokens. Powers all discovery and setup operations. Audit logs record actions as `actor=system` until per-user OAuth login ships. |
|
|
237
|
+
| `DATABRAIN_API_TOKEN` | One of two† | — | Per-data-app token. Created automatically during setup via `create_api_token`, or set manually if you already have one. Sufficient for embedding operations on a single data app. |
|
|
238
|
+
| `DATABRAIN_API_URL` | **Required for self-hosted** | `https://api.usedatabrain.com` | API base URL. Set to your instance's API origin (e.g. `https://api.your-databrain.example.com`). |
|
|
239
|
+
| `DATABRAIN_DEMO_DOMAIN` | Optional | `https://demo.usedatabrain.com` | Base host for `get_demo_link` URLs. Override for self-hosted instances or custom preview domains (e.g. `https://demo.your-databrain.example.com`). |
|
|
240
|
+
|
|
241
|
+
† At least one of these two credentials must be set. Token resolution priority: `DATABRAIN_SERVICE_TOKEN` > `DATABRAIN_API_TOKEN`.
|
|
199
242
|
|
|
200
243
|
---
|
|
201
244
|
|
|
@@ -211,17 +254,18 @@ Prompts are guided workflows your AI assistant can follow. Ask for them by name
|
|
|
211
254
|
| `brand-my-embed` | Customize colors, fonts, charts, card styling, responsive layout |
|
|
212
255
|
| `query-data` | Query your data with natural language, manage the semantic layer |
|
|
213
256
|
| `populate-semantic-layer` | Auto-generate table/column descriptions to enable natural language querying |
|
|
257
|
+
| `sql-to-metric-migration` | Production-safe SQL-to-metric workflow: validate, dry-run, then apply with explicit confirmation |
|
|
214
258
|
|
|
215
259
|
---
|
|
216
260
|
|
|
217
261
|
## Tools Reference
|
|
218
262
|
|
|
219
|
-
|
|
263
|
+
34 tools organized by category. Your AI assistant picks the right tools automatically — you don't need to call them directly.
|
|
220
264
|
|
|
221
|
-
> **Note:**
|
|
265
|
+
> **Note:** Datasource and workspace creation happen outside MCP. Datamarts can be planned with `create_datamart` in `dry_run` mode and created only with `confirm: "APPLY_TO_PRODUCTION"`. The semantic layer is managed via MCP tools (`get_semantic_layer`, `update_semantic_layer`, `start_semantic_layer_generation`, `get_semantic_layer_generation_status`).
|
|
222
266
|
|
|
223
267
|
<details>
|
|
224
|
-
<summary><b>Infrastructure — Exploration
|
|
268
|
+
<summary><b>Infrastructure — Exploration and setup</b> (6)</summary>
|
|
225
269
|
|
|
226
270
|
| Tool | Description |
|
|
227
271
|
|------|-------------|
|
|
@@ -229,7 +273,8 @@ Prompts are guided workflows your AI assistant can follow. Ask for them by name
|
|
|
229
273
|
| `discover_datasource_schema` | Inspect a datasource to see available tables and columns |
|
|
230
274
|
| `list_datamarts` | List datamarts |
|
|
231
275
|
| `list_workspaces` | List all workspaces (shows datamart/datasource connections) |
|
|
232
|
-
| `
|
|
276
|
+
| `sync_datasource` | Trigger datasource schema sync |
|
|
277
|
+
| `create_datamart` | Dry-run or create a datamart from selected tables and relationships |
|
|
233
278
|
</details>
|
|
234
279
|
|
|
235
280
|
<details>
|
|
@@ -245,15 +290,16 @@ Prompts are guided workflows your AI assistant can follow. Ask for them by name
|
|
|
245
290
|
</details>
|
|
246
291
|
|
|
247
292
|
<details>
|
|
248
|
-
<summary><b>Embeds</b> (
|
|
293
|
+
<summary><b>Embeds</b> (6) — Create, configure, and customize embedded dashboards</summary>
|
|
249
294
|
|
|
250
295
|
| Tool | Description |
|
|
251
296
|
|------|-------------|
|
|
252
297
|
| `create_embed` | Create an embed (standard or multi-tenant with `clientId`) |
|
|
253
|
-
| `list_embeds` | List embed configurations |
|
|
298
|
+
| `list_embeds` | List embed configurations (includes `distinctClientIds` for multi-tenant client discovery) |
|
|
254
299
|
| `get_embed_details` | Get full embed details by ID |
|
|
255
300
|
| `update_embed` | Update embed config — access settings, options, filters, i18n (via `body` passthrough) |
|
|
256
301
|
| `customize_embed_theme` | Presets, colors, fonts, cards, chart appearance, responsive layout |
|
|
302
|
+
| `get_demo_link` | Get a shareable demo URL for a `clientId` — same link the UI's "Share Demo Link" generates. Use to preview ops-built widgets without a test app |
|
|
257
303
|
</details>
|
|
258
304
|
|
|
259
305
|
<details>
|
|
@@ -266,28 +312,41 @@ Prompts are guided workflows your AI assistant can follow. Ask for them by name
|
|
|
266
312
|
</details>
|
|
267
313
|
|
|
268
314
|
<details>
|
|
269
|
-
<summary><b>Query & Semantic Layer</b> (
|
|
315
|
+
<summary><b>Query & Semantic Layer</b> (5) — Ask questions and manage data documentation</summary>
|
|
270
316
|
|
|
271
317
|
| Tool | Description |
|
|
272
318
|
|------|-------------|
|
|
273
319
|
| `ask_question` | Ask a natural language question — gets converted to SQL, returns data + chart suggestion |
|
|
274
320
|
| `get_semantic_layer` | Inspect semantic layer metadata (table/column descriptions, synonyms, completion score) |
|
|
275
321
|
| `update_semantic_layer` | Improve semantic layer quality (add descriptions, synonyms, example questions) |
|
|
322
|
+
| `start_semantic_layer_generation` | Start backend semantic-layer generation for a datamart |
|
|
323
|
+
| `get_semantic_layer_generation_status` | Check semantic-layer generation progress |
|
|
276
324
|
</details>
|
|
277
325
|
|
|
278
326
|
<details>
|
|
279
|
-
<summary><b>Dashboards & Widgets</b> (
|
|
327
|
+
<summary><b>Dashboards & Widgets</b> (8) — Discover dashboards and CRUD widgets on customer embeds</summary>
|
|
280
328
|
|
|
281
329
|
| Tool | Description |
|
|
282
330
|
|------|-------------|
|
|
283
331
|
| `list_dashboards` | List dashboards (by data app, workspace, or globally) |
|
|
284
332
|
| `list_widgets` | List widgets on an embed for a specific client |
|
|
333
|
+
| `validate_metric_spec` | Validate a SQL-backed metric target without saving |
|
|
334
|
+
| `create_or_update_metric_from_query` | Dry-run or apply a SQL-backed metric create/update |
|
|
285
335
|
| `add_widget` | Add a widget — clone from a template (`templateMetricId`), supply a full spec, or pass a raw body from `generate_widget` |
|
|
286
336
|
| `update_widget` | Patch a widget's fields (name, query, chartOptions, isPublished, etc.) |
|
|
287
337
|
| `remove_widget` | Per-client soft delete — hides the widget for one client only |
|
|
288
338
|
| `generate_widget` | AI-generate a widget draft from a natural-language prompt. Returns a draft; pass to `add_widget` to persist |
|
|
289
339
|
|
|
290
340
|
Widget mutation tools mint a guest token internally for `(clientId, dataAppName)`. Provide `embedId` + `clientId` — the tools resolve the rest.
|
|
341
|
+
Production writes through `create_or_update_metric_from_query` default to `dry_run`; `apply` requires `confirm: "APPLY_TO_PRODUCTION"`.
|
|
342
|
+
</details>
|
|
343
|
+
|
|
344
|
+
<details>
|
|
345
|
+
<summary><b>Scheduled Reports</b> (1)</summary>
|
|
346
|
+
|
|
347
|
+
| Tool | Description |
|
|
348
|
+
|------|-------------|
|
|
349
|
+
| `list_scheduled_reports` | List configured scheduled reports for a dashboard/client scope. Delivery history is not part of this MCP/API surface yet |
|
|
291
350
|
</details>
|
|
292
351
|
|
|
293
352
|
---
|