Install
Reference v0.5.1

MCP Server (13 Tools)

Full read-write Day-2 operations over JSON-RPC 2.0 at POST /mcp—add sites, goals, and webhooks with zero SSH and zero restarts.

Endpoint & Authentication

Read & Diagnostic Tools (6)

Tool Key Parameters Returns
list_sites hours? (default 24) All configured sites (TOML + DB), source, domains, and traffic totals
get_report site_id, hours?, page?, referrer?, country?, city?, browser?, os?, device? Verified pageviews, visitors, sessions, goals, top pages/referrers, AI crawlers & referrals, geo, clients, campaigns
get_recent_hits site_id, limit?, offset? Paginated recent events with capture mode (hybrid, js, server, pixel)
get_agents none Connected agents, versions, spool depth, last heartbeat, and site bindings
probe_sites none Live DNS-pinned HTML check verifying /_q.js or /q.js on every site
test_webhooks none Synchronous delivery test across all configured webhooks (secret tokens masked)

Write & Management Tools (7)

Tool Required Parameters Behavior
upsert_site id, domains (string[]), ignore_paths? Creates or updates a SQLite-owned site live (no restart)
delete_site id Removes a SQLite-owned site and its DB-owned goals
upsert_goal site_id, name, plus event or path Attaches a conversion goal to any site (including TOML-owned sites)
delete_goal site_id, name Deletes a DB-owned goal
add_webhook url, events?, sites?, secret? Registers a Discord or HMAC-SHA256 webhook and hot-reloads the dispatcher
delete_webhook id Removes a DB-owned webhook by numeric ID
create_password_link ttl_secs? (30–600, default 120) Mints a single-use, expiring /setup-password URL so the operator can set or reset their dashboard password in the browser without sharing plaintext with the agent (rejected if admin_password_hash is set in server.toml)

Example request & expected response

POST /mcp — upsert_site
curl -fsSL -X POST https://analytics.example.com/mcp   -H "Authorization: Bearer $ADMIN_TOKEN"   -H "Content-Type: application/json"   -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "upsert_site",
      "arguments": {
        "id": "northstar",
        "domains": ["northstar.dev", "www.northstar.dev"]
      }
    }
  }'
Expected responseOutput
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      { "type": "text", "text": "{"id":"northstar","source":"db","domains":["northstar.dev","www.northstar.dev"]}" }
    ]
  }
}

Error codes & edge cases

Condition Code / Response Fix
Missing or wrong admin_token HTTP 401 Unauthorized Pass Authorization: Bearer <admin_token> matching server.toml.
Mutating a server.toml site/goal/webhook 409 Conflict server.toml is read-only at runtime. Run quarkd config-import and remove the entry from TOML to hand ownership to SQLite.
Webhook URL resolves to private/loopback IP Rejected (SSRF guard) Webhooks and probe_sites enforce DNS-pinned public IP checks on every hop. Use a public HTTPS endpoint.
Duplicate goal name (case-insensitive) 409 Conflict Goal names are unique per site regardless of casing.