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
- "Which referrer made me the most money this month?"
- "Compare this week with last week. What changed, and why?"
- "Show my last 10 sales and where each buyer came from."
- "Walk me through the journey of my latest customer."
- "Which landing page converts best for visitors from Google?"
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"}.
list_sites: every site with today, online now, 7 and 30 days.get_overview: visitors, revenue, sales, conversion, revenue per visitor… with the previous period, a time series and traffic spikes.get_breakdown: rank referrers, channels, campaigns, pages, countries, devices or goals by visitors or revenue.compare_periods: what changed, with the biggest gainers and losers.list_sales: sales with the source each one is credited to.list_visitorsandget_visitor: who visited, and one person's whole journey.get_realtime,get_goals,get_funnels,get_customer_value(lifetime value by first source).
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
- Keys are read-only and only ever stored as a hash. Revoke one under Settings → API keys, or with
npx databull@latest api-key revoke dbk_…. - Customer names and emails stay hidden unless a key is created with Include customer names and emails.
- Your data still never leaves your Cloudflare account: the agent talks to your own install.