AI agents, CLI & API

Ask your AI agent which post made you money, or read your stats from the terminal and scripts.

Every DataBull install has a built-in MCP server at https://YOUR-DATABULL-URL/mcp. AI agents connect to it with a read-only API key and get the same numbers as your dashboard: traffic, revenue by source, sales, visitor journeys, goals and funnels. Nothing extra to host, and it works on Cloudflare's free plan.

Set it up in one command

npx databull@latest mcp

It updates your install if it's older than 1.1.0, creates a read-only key, checks that it works, adds DataBull to Claude Code if it's installed, and prints the exact config for every other client. Prefer clicking? Create a key under Settings → API keys & AI agents in your dashboard; it shows the same snippets, filled in.

Connect a client by hand

Claude Code

claude mcp add --transport http --scope user databull https://YOUR-DATABULL-URL/mcp \
  --header "Authorization: Bearer dbk_YOUR_KEY"

Cursor

~/.cursor/mcp.json (or .cursor/mcp.json in a project):

{
  "mcpServers": {
    "databull": {
      "url": "https://YOUR-DATABULL-URL/mcp",
      "headers": { "Authorization": "Bearer dbk_YOUR_KEY" }
    }
  }
}

VS Code

.vscode/mcp.json, or MCP: Open User Configuration:

{
  "servers": {
    "databull": {
      "type": "http",
      "url": "https://YOUR-DATABULL-URL/mcp",
      "headers": { "Authorization": "Bearer dbk_YOUR_KEY" }
    }
  }
}

Codex

~/.codex/config.toml:

[mcp_servers.databull]
url = "https://YOUR-DATABULL-URL/mcp"
http_headers = { "Authorization" = "Bearer dbk_YOUR_KEY" }

Windsurf

~/.codeium/windsurf/mcp_config.json: the Cursor block, with serverUrl instead of url.

Any other client

Streamable HTTP at /mcp, with the header Authorization: Bearer dbk_….

What you can ask

The tools

All read-only. Every tool takes a site (its domain is fine), a period (today, 7d, 30d, mtd, last_month, 12m, all…) or from/to dates, and filters such as {"referrer": "news.ycombinator.com"}.

From the terminal

npx databull@latest sites
npx databull@latest stats example.com --period 7d
npx databull@latest sources --by revenue
npx databull@latest breakdown country --filter referrer=google.com
npx databull@latest compare
npx databull@latest sales -n 10
npx databull@latest visitor 3f2a91c0
npx databull@latest live

On the computer you installed from, the first command creates its own key (it asks first). Add --json for scripts and agents; databull query <tool> '{"…"}' calls any tool directly.

On another machine, CI or a script

export DATABULL_URL=https://YOUR-DATABULL-URL
export DATABULL_API_KEY=dbk_YOUR_KEY
npx databull@latest stats --json

Under the hood it's JSON-RPC: POST /mcp with {"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_overview","arguments":{"period":"7d"}}}.

Keys and privacy