API Reference

MCP Server

The Databuddy MCP server lets AI agents (Claude, Cursor, Windsurf, or any MCP-compatible client) query your analytics, manage feature flags, triage errors, and more through a standard protocol.

Endpoint

EnvironmentURL
Productionhttps://api.databuddy.cc/v1/mcp/
Localhttp://localhost:3001/v1/mcp/

The server uses the Streamable HTTP transport (JSON-RPC over HTTP). No SSE or WebSocket connection required.

Authentication

Pass an API key with the read:data scope:

json
{
"mcpServers": {
  "databuddy": {
    "type": "http",
    "url": "https://api.databuddy.cc/v1/mcp/",
    "headers": {
      "x-api-key": "dbdy_your_api_key_here"
    }
  }
}
}

Get your API key from Dashboard → Organization Settings → API Keys. The key needs at least the read:data scope. Add manage:config for mutation tools (flags, links).

Client Setup

Claude Code / Claude Desktop

Add to your .mcp.json or Claude Desktop config:

json
{
"mcpServers": {
  "databuddy": {
    "type": "http",
    "url": "https://api.databuddy.cc/v1/mcp/",
    "headers": {
      "x-api-key": "dbdy_your_api_key_here"
    }
  }
}
}

Cursor / Windsurf

Add to your MCP settings (typically .cursor/mcp.json or workspace settings):

json
{
"mcpServers": {
  "databuddy": {
    "type": "http",
    "url": "https://api.databuddy.cc/v1/mcp/",
    "headers": {
      "x-api-key": "dbdy_your_api_key_here"
    }
  }
}
}

Available Tools

Analytics

ToolDescription
get_dataTyped analytics queries (top_pages, recent_errors, errors_by_type, etc.). Batch 2-10 queries in one call.
capabilitiesTool catalog and available query types. Filter by category.
get_schemaClickHouse column definitions. Use when a field name is uncertain.
list_websitesList websites accessible to the authenticated key.

Insights

ToolDescription
summarize_insightsPre-built insight summaries for a website.
compare_metricCompare metrics across two time periods.
top_moversFind dimensions with the largest changes.
detect_anomaliesDetect anomalies in your metrics.

Funnels & Goals

ToolDescription
list_funnelsList configured funnels.
get_funnel_analyticsPer-step conversion analytics for a funnel.
list_goalsList configured goals.
get_goal_analyticsGoal completion analytics.

Feature Flags

ToolDescription
list_flagsList active feature flags.
create_flagCreate a new feature flag (requires confirmation).
update_flagUpdate flag configuration (requires confirmation).
ToolDescription
list_linksList short links.
search_linksSearch links by keyword.
list_link_foldersList link folders with usage counts.

Memory

ToolDescription
search_memorySearch saved memories for the workspace.
save_memorySave a memory (requires confirmation).
forget_memoryDelete a memory (requires confirmation).

Agent

ToolDescription
askOpen-ended natural language question. Slower; only available when the AI gateway is configured. Reuse conversationId for follow-ups.

Prompts (Workflows)

The server exposes pre-built prompts that orchestrate multi-step workflows:

PromptDescription
weekly_reportTraffic trends, top pages, referrers, error health, and one item to investigate.
triage_errorserror_summary → errors_by_type → errors_by_page → recent_errors, prioritized by user impact.
funnel_healthList funnels + per-step analytics, surfaces biggest drop-offs.
flag_rollout_checkAudit active flags for stale or risky rollouts.

Conventions

Website selection: Any tool that needs a website accepts websiteId, websiteName, or websiteDomain. Pass one.

Dates: Use a preset (e.g. last_7d, last_30d) OR both from and to (YYYY-MM-DD). Defaults to last_7d. Passing only one of from/to is rejected.

Filters: The field value is the ClickHouse column name. Use get_schema when uncertain. Error messages suggest close matches on typos.

Mutations: Tools that create, update, or delete (flags, links, memory) require a two-step flow: preview with confirmed: false, then execute with confirmed: true.

Example Usage

Batch multiple queries in a single get_data call:

json
{
"tool": "get_data",
"arguments": {
  "websiteDomain": "example.com",
  "queries": [
    { "type": "summary_metrics", "preset": "last_7d" },
    { "type": "top_pages", "preset": "last_7d", "limit": 5 },
    { "type": "top_referrers", "preset": "last_7d", "limit": 5 },
    { "type": "error_summary", "preset": "last_7d" }
  ]
}
}

Filter errors by type:

json
{
"tool": "get_data",
"arguments": {
  "websiteDomain": "example.com",
  "type": "recent_errors",
  "preset": "last_7d",
  "limit": 20,
  "filters": [
    { "field": "error_type", "op": "eq", "value": "TypeError" }
  ]
}
}

Resources

The server exposes a databuddy://guide resource with extended workflow tips and known footguns. MCP clients that support resources can read it for additional context.

Scopes & Access Control

Tools are filtered based on your API key's scopes:

ScopeTools
read:dataAll analytics, insights, schema, and read-only tools
manage:configFeature flag mutations, link mutations, memory writes

Session-authenticated users (via the dashboard) get access based on their organization role instead.

How is this guide?