@databrainhq/mcp-server 0.2.11 → 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 CHANGED
@@ -118,7 +118,7 @@ Running Databrain on your own infrastructure? Point the MCP server at your insta
118
118
  "command": "npx",
119
119
  "args": ["@databrainhq/mcp-server"],
120
120
  "env": {
121
- "DATABRAIN_PAT": "<your-personal-access-token>",
121
+ "DATABRAIN_SERVICE_TOKEN": "<your-service-token>",
122
122
  "DATABRAIN_API_URL": "https://api.your-databrain.example.com"
123
123
  }
124
124
  }
@@ -129,7 +129,7 @@ Running Databrain on your own infrastructure? Point the MCP server at your insta
129
129
  Checklist:
130
130
  - `DATABRAIN_API_URL` must be the **API origin** for your self-hosted instance (not the dashboard URL). Typically `https://api.<your-domain>`.
131
131
  - The token must be minted from that same self-hosted instance — tokens are not portable across instances.
132
- - Use `DATABRAIN_PAT` (Settings → Personal Access Tokens) for per-user role checks and audit. Use `DATABRAIN_SERVICE_TOKEN` if you want the MCP server to act with full org-level privileges (no per-user audit).
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
133
  - The MCP client process must be able to reach the URL (VPN, firewall, self-signed certs all apply here).
134
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
135
 
@@ -139,7 +139,7 @@ Open your AI assistant and try any of these:
139
139
 
140
140
  > **"Set up a Databrain embed for my dashboard"**
141
141
 
142
- > **"Brand my embed to match our company colors"**
142
+ > **"Brand my embed to match our colors"**
143
143
 
144
144
  > **"What was total revenue last month?"**
145
145
 
@@ -195,13 +195,21 @@ Each of your customers gets their own dashboard with row-level security.
195
195
 
196
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
197
 
198
- > "Add the 'Calls per day' widget from the standard template to Acme's dashboard"
198
+ > "Add the 'Calls per day' widget from the standard template to a client's dashboard"
199
199
 
200
- > "Generate a widget showing disqualification reasons for Acme and add it to their embed"
200
+ > "Generate a widget showing disqualification reasons and add it to a client's embed"
201
201
 
202
- > "Remove the billing widget from Acme's dashboard but keep it for other customers"
202
+ > "Remove the billing widget from one client's dashboard but keep it for other clients"
203
203
 
204
- > "Give me a demo link for Acme's dashboard so I can see what they'll see"
204
+ > "Give me a demo link for a client's dashboard so I can see what they'll see"
205
+
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"
205
213
 
206
214
  ### Enable self-serve analytics
207
215
 
@@ -221,17 +229,16 @@ Let end-users build their own metrics with drag-and-drop or AI-powered chat.
221
229
 
222
230
  ## Environment Variables
223
231
 
224
- At least one of `DATABRAIN_PAT`, `DATABRAIN_SERVICE_TOKEN`, or `DATABRAIN_API_TOKEN` must be set. PAT is preferred — it binds the MCP session to a specific user so role checks and audit logs work correctly.
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.
225
233
 
226
234
  | Variable | Required | Default | Description |
227
235
  |----------|----------|---------|-------------|
228
- | `DATABRAIN_PAT` | One of three† | — | Personal Access Token from Settings → Personal Access Tokens. Binds the MCP session to your Databrain user — actions are role-checked and audited under your account. **Preferred for sandboxed hosts** (Claude Desktop, ChatGPT Desktop) and headless/CI environments where local credential caching isn't reliable. |
229
- | `DATABRAIN_SERVICE_TOKEN` | One of three† | — | Org-level token from Settings → Service Tokens. Powers all discovery and setup operations. The `connect` tool can mint a PAT on top of this for per-user audit. |
230
- | `DATABRAIN_API_TOKEN` | One of three† | — | Per-data-app token. Created automatically during setup via `create_api_token`, or set manually if you already have one. |
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. |
231
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`). |
232
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`). |
233
240
 
234
- † At least one of these three credentials must be set. Token resolution priority: `DATABRAIN_PAT` > cached PAT (from `connect`) > `DATABRAIN_SERVICE_TOKEN` > `DATABRAIN_API_TOKEN`.
241
+ † At least one of these two credentials must be set. Token resolution priority: `DATABRAIN_SERVICE_TOKEN` > `DATABRAIN_API_TOKEN`.
235
242
 
236
243
  ---
237
244
 
@@ -247,17 +254,18 @@ Prompts are guided workflows your AI assistant can follow. Ask for them by name
247
254
  | `brand-my-embed` | Customize colors, fonts, charts, card styling, responsive layout |
248
255
  | `query-data` | Query your data with natural language, manage the semantic layer |
249
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 |
250
258
 
251
259
  ---
252
260
 
253
261
  ## Tools Reference
254
262
 
255
- 29 tools organized by category. Your AI assistant picks the right tools automatically — you don't need to call them directly.
263
+ 34 tools organized by category. Your AI assistant picks the right tools automatically — you don't need to call them directly.
256
264
 
257
- > **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.
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`).
258
266
 
259
267
  <details>
260
- <summary><b>Infrastructure — Exploration</b> (4)</summary>
268
+ <summary><b>Infrastructure — Exploration and setup</b> (6)</summary>
261
269
 
262
270
  | Tool | Description |
263
271
  |------|-------------|
@@ -265,6 +273,8 @@ Prompts are guided workflows your AI assistant can follow. Ask for them by name
265
273
  | `discover_datasource_schema` | Inspect a datasource to see available tables and columns |
266
274
  | `list_datamarts` | List datamarts |
267
275
  | `list_workspaces` | List all workspaces (shows datamart/datasource connections) |
276
+ | `sync_datasource` | Trigger datasource schema sync |
277
+ | `create_datamart` | Dry-run or create a datamart from selected tables and relationships |
268
278
  </details>
269
279
 
270
280
  <details>
@@ -302,28 +312,41 @@ Prompts are guided workflows your AI assistant can follow. Ask for them by name
302
312
  </details>
303
313
 
304
314
  <details>
305
- <summary><b>Query & Semantic Layer</b> (3) — Ask questions and manage data documentation</summary>
315
+ <summary><b>Query & Semantic Layer</b> (5) — Ask questions and manage data documentation</summary>
306
316
 
307
317
  | Tool | Description |
308
318
  |------|-------------|
309
319
  | `ask_question` | Ask a natural language question — gets converted to SQL, returns data + chart suggestion |
310
320
  | `get_semantic_layer` | Inspect semantic layer metadata (table/column descriptions, synonyms, completion score) |
311
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 |
312
324
  </details>
313
325
 
314
326
  <details>
315
- <summary><b>Dashboards & Widgets</b> (6) — Discover dashboards and CRUD widgets on customer embeds</summary>
327
+ <summary><b>Dashboards & Widgets</b> (8) — Discover dashboards and CRUD widgets on customer embeds</summary>
316
328
 
317
329
  | Tool | Description |
318
330
  |------|-------------|
319
331
  | `list_dashboards` | List dashboards (by data app, workspace, or globally) |
320
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 |
321
335
  | `add_widget` | Add a widget — clone from a template (`templateMetricId`), supply a full spec, or pass a raw body from `generate_widget` |
322
336
  | `update_widget` | Patch a widget's fields (name, query, chartOptions, isPublished, etc.) |
323
337
  | `remove_widget` | Per-client soft delete — hides the widget for one client only |
324
338
  | `generate_widget` | AI-generate a widget draft from a natural-language prompt. Returns a draft; pass to `add_widget` to persist |
325
339
 
326
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 |
327
350
  </details>
328
351
 
329
352
  ---