# MCP server

> Connect Claude Desktop, Claude Code, Cursor or your own AI agent to a workspace's approved metrics over the Model Context Protocol — tokens, scopes, client config and tools.

DataxLand runs a [Model Context Protocol](https://modelcontextprotocol.io) server. External agents use **the same tools as Si**: metrics, dimensions, filters, periods and comparisons through the semantic layer. There is no free-form SQL tool by default; a token granted the extra `explore:run` scope gets the exploration sandbox (results are always Unconfirmed, see [Si writes and runs SQL/Python](/en/docs/ask/sandbox)).

## 1. Create a token

MCP needs the **Small Business** plan or above and the Admin role or above.

1. Go to **Settings → Integrations**, section **MCP tokens**.
2. Under **Create token**, enter a **Label**.
3. **Permissions**: **metrics:read** to read metrics; add **ops:read** if the agent should see build status (it never returns data values).
4. **Workspace**: the workspace the token can read. The Enterprise plan can give one token several workspaces.
5. **Expires after (days)**: default 90, up to 365.
6. Click **Create token**. The token (prefix `dxp_`) is shown **once**, so click **Copy**. DataxLand stores only its hash.

**Created tokens** lists tokens as **Active**, **Expired** or **Revoked**. **Revoke** revokes immediately.

## 2. Configure your client

The server speaks Streamable HTTP at the path `/mcp` and authenticates with `Authorization: Bearer <token>`. The URL below is the hosted service; a self-hosted deployment uses its own MCP server address.

### Cursor

`~/.cursor/mcp.json` (or `.cursor/mcp.json` in a project — never commit the token):

```json
{
  "mcpServers": {
    "dataxland": {
      "url": "https://app.dataxland.com/mcp",
      "headers": { "Authorization": "Bearer " }
    }
  }
}
```

### Claude Code

```bash
claude mcp add --transport http dataxland https://app.dataxland.com/mcp \
  --header "Authorization: Bearer "
```

### Claude Desktop

Claude Desktop reaches a remote server with a header through the `mcp-remote` bridge (requires Node.js). Open **Settings → Developer → Edit Config** and add:

```json
{
  "mcpServers": {
    "dataxland": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://app.dataxland.com/mcp", "--header", "Authorization:${DX_MCP_TOKEN}"],
      "env": { "DX_MCP_TOKEN": "Bearer " }
    }
  }
}
```

Restart Claude Desktop.

## 3. Try it

Ask your agent: "Using DataxLand, list the workspace metrics", then "Profit after fees last month by channel".

## Tools

| Scope | Tools |
| --- | --- |
| metrics:read | `list_metrics`, `describe_metric`, `query_metric`, `query_semantic`, `get_semantic_model`, `explain_change`, `get_business_model`, `search_knowledge` |
| ops:read | `get_health`, `list_runs`, `get_run`, `list_metric_requests` |

A multi-workspace token (Enterprise plan) also gets `list_tenants`, and every tool takes a `tenant` parameter.

## Safety and limits

- Every call is logged with its token and tool.
- A multi-workspace token names the workspace in each call; the server checks the token is allowed for it.
- Operations tools never return data cell values; no tool returns buyers' personal data.
- At most 60 calls per minute per token and 120 per minute per user.
- Treat the token as a secret: do not paste it into public chats or commit it.

## Related

- [Ask Si in the app](/en/docs/ask/app)
- [API overview](/en/docs/api/overview)
- [Security and privacy](/en/docs/security-privacy)
