@databrainhq/mcp-server 0.2.9 → 0.2.11

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
@@ -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 [Databrain](https://usedatabrain.com)
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,6 +107,32 @@ 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_PAT": "<your-personal-access-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_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).
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:
@@ -165,7 +193,7 @@ 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.
169
197
 
170
198
  > "Add the 'Calls per day' widget from the standard template to Acme's dashboard"
171
199
 
@@ -173,6 +201,8 @@ Add, remove, or modify widgets (metrics) on a specific customer's embed without
173
201
 
174
202
  > "Remove the billing widget from Acme's dashboard but keep it for other customers"
175
203
 
204
+ > "Give me a demo link for Acme's dashboard so I can see what they'll see"
205
+
176
206
  ### Enable self-serve analytics
177
207
 
178
208
  Let end-users build their own metrics with drag-and-drop or AI-powered chat.
@@ -191,11 +221,17 @@ Let end-users build their own metrics with drag-and-drop or AI-powered chat.
191
221
 
192
222
  ## Environment Variables
193
223
 
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.
225
+
194
226
  | Variable | Required | Default | Description |
195
227
  |----------|----------|---------|-------------|
196
- | `DATABRAIN_SERVICE_TOKEN` | **Yes** | — | Org-level token from Settings → Service Tokens. Powers all discovery and setup operations. |
197
- | `DATABRAIN_API_TOKEN` | No | — | Per-data-app token. Created automatically during setup via `create_api_token`, or set manually if you already have one. |
198
- | `DATABRAIN_API_URL` | No | `https://api.usedatabrain.com` | API base URL. Only change this for self-hosted Databrain. |
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. |
231
+ | `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
+ | `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
+
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`.
199
235
 
200
236
  ---
201
237
 
@@ -216,12 +252,12 @@ Prompts are guided workflows your AI assistant can follow. Ask for them by name
216
252
 
217
253
  ## Tools Reference
218
254
 
219
- 26 tools organized by category. Your AI assistant picks the right tools automatically — you don't need to call them directly.
255
+ 29 tools organized by category. Your AI assistant picks the right tools automatically — you don't need to call them directly.
220
256
 
221
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.
222
258
 
223
259
  <details>
224
- <summary><b>Infrastructure — Exploration & Linking</b> (5)</summary>
260
+ <summary><b>Infrastructure — Exploration</b> (4)</summary>
225
261
 
226
262
  | Tool | Description |
227
263
  |------|-------------|
@@ -229,7 +265,6 @@ Prompts are guided workflows your AI assistant can follow. Ask for them by name
229
265
  | `discover_datasource_schema` | Inspect a datasource to see available tables and columns |
230
266
  | `list_datamarts` | List datamarts |
231
267
  | `list_workspaces` | List all workspaces (shows datamart/datasource connections) |
232
- | `link_datamart_to_workspace` | Link a datamart to an existing workspace |
233
268
  </details>
234
269
 
235
270
  <details>
@@ -245,15 +280,16 @@ Prompts are guided workflows your AI assistant can follow. Ask for them by name
245
280
  </details>
246
281
 
247
282
  <details>
248
- <summary><b>Embeds</b> (5) — Create, configure, and customize embedded dashboards</summary>
283
+ <summary><b>Embeds</b> (6) — Create, configure, and customize embedded dashboards</summary>
249
284
 
250
285
  | Tool | Description |
251
286
  |------|-------------|
252
287
  | `create_embed` | Create an embed (standard or multi-tenant with `clientId`) |
253
- | `list_embeds` | List embed configurations |
288
+ | `list_embeds` | List embed configurations (includes `distinctClientIds` for multi-tenant client discovery) |
254
289
  | `get_embed_details` | Get full embed details by ID |
255
290
  | `update_embed` | Update embed config — access settings, options, filters, i18n (via `body` passthrough) |
256
291
  | `customize_embed_theme` | Presets, colors, fonts, cards, chart appearance, responsive layout |
292
+ | `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
293
  </details>
258
294
 
259
295
  <details>