Examples
Analytics API to MCP
Analytics APIs are strong MCP candidates because agents can answer business questions from structured metrics. The danger is unbounded queries, expensive scans, and ambiguous metric names.
Implementation
Path to ship.
Guide
Recommended tool surface
The best analytics MCP tools are metric-specific and bounded: get_active_users, query_funnel, compare_conversion, and list_dashboard_cards. They give the agent reliable names and limits.
Avoid exposing a raw SQL-style analytics endpoint unless you also enforce allowed datasets, max rows, max time range, and query cost limits.
analytics_query_metric
Queries an approved product metric over a bounded date range with explicit granularity.
Generated input schema
{
"type": "object",
"properties": {
"workspace_id": { "type": "string" },
"metric": { "type": "string", "enum": ["active_users", "new_signups", "activation_rate", "paid_conversion"] },
"start_date": { "type": "string", "format": "date" },
"end_date": { "type": "string", "format": "date" },
"granularity": { "type": "string", "enum": ["day", "week", "month"] }
},
"required": ["workspace_id", "metric", "start_date", "end_date", "granularity"]
}Example tools/call
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "analytics_query_metric",
"arguments": {
"workspace_id": "ws_prod",
"metric": "activation_rate",
"start_date": "2026-06-01",
"end_date": "2026-06-24",
"granularity": "day"
}
}
}analytics_get_funnel_summary
Returns step counts and conversion rates for an approved funnel.
Generated input schema
{
"type": "object",
"properties": {
"workspace_id": { "type": "string" },
"funnel_id": { "type": "string" },
"start_date": { "type": "string", "format": "date" },
"end_date": { "type": "string", "format": "date" },
"segment": { "type": "string", "maxLength": 80 }
},
"required": ["workspace_id", "funnel_id", "start_date", "end_date"]
}Example tools/call
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "analytics_get_funnel_summary",
"arguments": {
"workspace_id": "ws_prod",
"funnel_id": "signup_to_first_server",
"start_date": "2026-06-01",
"end_date": "2026-06-24",
"segment": "source:docs"
}
}
}Guide
Production guardrails
Analytics tools should enforce maximum date windows, row limits, and cost controls. A helpful agent should not accidentally run a warehouse-sized query for a casual question.
Metric definitions should be returned with the data. If an agent explains activation_rate, it needs the numerator, denominator, timezone, and freshness timestamp.
FAQ
Common questions.
Should an analytics MCP server expose raw events?
Usually no. Start with metric and funnel tools, then add event samples only with strict row limits and redaction.
What should every analytics result include?
Metric definition, date range, timezone, freshness, row count, and any filters applied.