> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usedatabrain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Troubleshooting

> Common issues and solutions for the Databrain MCP server

## Common Issues

> [accordion] Missing token configuration
>
> **Cause:** Neither `DATABRAIN_SERVICE_TOKEN` nor `DATABRAIN_API_TOKEN` is set, or your MCP client is not reading the configured `env` block.
>
> **Fix:**
>
> 1. Check that your token is in the `env` block of your MCP config.
> 2. Verify the token value has no extra spaces or quotes.
> 3. Restart your AI client after changing the config.
>
> ```json theme={"dark"}
> {
>   "mcpServers": {
>     "databrain": {
>       "command": "npx",
>       "args": ["@databrainhq/mcp-server"],
>       "env": {
>         "DATABRAIN_SERVICE_TOKEN": "your-actual-token-here"
>       }
>     }
>   }
> }
> ```
>
> If the token is set correctly and the error persists, regenerate it in **Settings -> Service Tokens** in the Databrain UI.

> [accordion] API-token-only mode cannot run setup tools
>
> **Cause:** You configured only `DATABRAIN_API_TOKEN`. API tokens are scoped to one data app and cannot run org-level setup tools.
>
> **Fix:** Add `DATABRAIN_SERVICE_TOKEN` when you need discovery, data app management, API token creation, semantic layer operations, or datamart setup.
>
> API-token-only mode is still valid for embed operations, widget operations, guest tokens, demo links, and scheduled report metadata inside the configured data app.

> [accordion] No dashboards found
>
> **Cause:** No workspace was selected, the selected workspace has no dashboards, or the configured token is scoped too narrowly.
>
> **Fix:** Ask the assistant:
>
> > "List my workspaces and then show dashboards"
>
> Dashboards are usually scoped to workspaces. If you see workspaces but no dashboards, verify that dashboards exist in the Databrain UI for that workspace.

> [accordion] Embed not rendering in frontend
>
> **Cause:** Usually a token, ID, domain, or guest token payload mismatch.
>
> **Fix:**
>
> 1. **Guest token generated server-side?** Never expose API tokens in frontend code.
>
> 2. **IDs match?** Verify the embed ID and dashboard ID.
>
> 3. **Domain whitelisted?** Check that your frontend's domain is allowed in the data app settings.
>
> 4. **Inspect the embed:** Ask the assistant:
>
> > "Check my embed configuration for issues"
>
> The assistant uses `get_embed_details` to inspect access settings, dashboard references, and token inputs.

> [accordion] Theme or option changes not showing
>
> **Cause:** Existing guest tokens may still carry old configuration.
>
> **Fix:** After updating theme or options through `customize_embed_theme` or `update_embed`:
>
> 1. Regenerate the guest token with `generate_guest_token`.
> 2. Reload your application to use the new token.
>
> Guest tokens are generated server-side and should be refreshed after configuration changes that affect runtime behavior.

> [accordion] Widget changes do not appear in preview
>
> **Cause:** The widget may be unpublished, the preview is using a stale guest token, or the wrong `clientId` was used.
>
> **Fix:**
>
> 1. Ask the assistant to call `list_widgets` for the target `clientId` and dashboard.
> 2. Confirm the widget has `isPublished: true` if it should appear to end users.
> 3. Generate a fresh `get_demo_link` URL.
> 4. If testing inside your own app, regenerate the app's guest token.

> [accordion] SQL-to-metric apply is rejected
>
> **Cause:** Production writes require an explicit confirmation value.
>
> **Fix:** Run the dry-run first, review the returned plan, then apply only after approval:
>
> ```json theme={"dark"}
> {
>   "mode": "apply",
>   "confirm": "APPLY_TO_PRODUCTION"
> }
> ```
>
> This applies to `create_or_update_metric_from_query` and production datamart creation through `create_datamart`.

> [accordion] ask\_question returns poor results
>
> **Cause:** The semantic layer is empty, incomplete, or missing business context.
>
> **Fix:** Check its status:
>
> > "Check the semantic layer quality for my datamart"
>
> If descriptions or synonyms are missing, ask:
>
> > "Add descriptions and synonyms to improve query accuracy"
>
> The assistant can update metadata with `update_semantic_layer` or start semantic-layer generation with `start_semantic_layer_generation`.

> [accordion] Server won't start
>
> **Cause:** Usually a Node.js version issue or invalid environment variable.
>
> **Fix:** The MCP server requires Node.js 18 or higher:
>
> ```bash theme={"dark"}
> node --version
> ```
>
> If you see a version below 18, update Node.js. Also verify `DATABRAIN_API_URL` and `DATABRAIN_DEMO_DOMAIN` are valid URLs when set.

> [accordion] npx command not found or hangs
>
> **Cause:** npm/npx is not installed or the client cannot fetch the package.
>
> **Fix:**
>
> 1. Ensure npm is installed: `npm --version`
> 2. Try running the package directly:
>
> ```bash theme={"dark"}
> npx @databrainhq/mcp-server
> ```
>
> 3. If fetching the package hangs, install globally:
>
> ```bash theme={"dark"}
> npm install -g @databrainhq/mcp-server
> ```
>
> Then update your config to use the global binary:
>
> ```json theme={"dark"}
> {
>   "mcpServers": {
>     "databrain": {
>       "command": "databrain-mcp-server",
>       "env": {
>         "DATABRAIN_SERVICE_TOKEN": "<your-service-token>"
>       }
>     }
>   }
> }
> ```

***

## Diagnostics

Ask your assistant:

> "Who am I authenticated as in Databrain?"

This calls `whoami` and confirms whether the session is using a service token or API token.

For embed issues, ask:

> "Check my embed configuration for issues"

The assistant uses `get_embed_details` to inspect access settings and dashboard references, then regenerates a guest token if runtime state changed.

For customer dashboard issues, ask:

> "List widgets for this client and give me a demo link"

The assistant uses `list_widgets` and `get_demo_link`.

***

## Known Limitations

| Area | Limitation | Workaround |
| - | - | - |
| **Datasource setup** | Datasources are connected in the Databrain UI | Create datasources in the Databrain UI, then use `list_datasources`, `discover_datasource_schema`, and `sync_datasource` |
| **Workspace setup** | Workspaces are created in the Databrain UI | Create workspaces in the Databrain UI, then use `list_workspaces` and dashboard workflows |
| **Transport** | stdio only; no HTTP/SSE transport yet | Use `npx` with your MCP client's config file |
| **Production writes** | Datamart and SQL-to-metric apply operations require explicit confirmation | Run dry-run first, review the plan, then apply with `confirm: "APPLY_TO_PRODUCTION"` |
| **Scheduled reports** | `list_scheduled_reports` returns configured schedule metadata | Use Databrain reporting views for delivery status |

***

## Getting Help

> [card] [Quickstart](https://docs.usedatabrain.com/developer-docs/mcp-server/quickstart.md)
>
> Start over with setup

> [card] [Client Setup](https://docs.usedatabrain.com/developer-docs/mcp-server/client-setup.md)
>
> Verify your client config

> [card] [Tools Reference](https://docs.usedatabrain.com/developer-docs/mcp-server/tools-reference.md)
>
> Review available tools


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.