HomeBack to recipes
RecipesMonitoringAnalytics Dashboard

TL;DR

Analytics Dashboard is a monitoring workflow that chains ClickHouse + Grafana to automate a common task. Connect ClickHouse to Grafana to build real-time analytics dashboards over billions of events with sub-second query times. Once configured, it saves ~15 hours/week per analyst, plus replacement of $24-120k/year analytics SaaS contracts and runs through Claude Code, Cursor, Windsurf or any MCP-compatible AI agent.

🟡📊
MonitoringAdvanced

Analytics Dashboard

Connect ClickHouse to Grafana to build real-time analytics dashboards over billions of events with sub-second query times.

30 min setup, sub-second analytics at any scale2 MCPs requiredSaves ~15 hours/week per analyst, plus replacement of $24-120k/year analytics SaaS contracts

How it works

🟡ClickHouse
📊Grafana
Automated
1Configure ClickHouse Grafana data source2Design materialized view for rollup metrics3Build time-series panels for event volume+2 more steps

Local CLI only

None of these MCPs are hosted yet. Install and run the recipe locally:

mcpizy recipe install clickhouse-grafana-analytics

Why this combo?

ClickHouse processes billions of events with sub-second aggregation performance; Grafana renders that data as interactive dashboards. Together they create a product analytics platform that scales to any event volume — without the licensing cost of Mixpanel or Amplitude.

Without this workflow

Query a Postgres events table for daily active users. Times out after 45 seconds. Roll up data with a cron job into an aggregation table. Forget to update the cron job when you add a new metric.

With MCPizy

ClickHouse materializes rollups in real time. Grafana dashboard loads in under a second regardless of event volume.

Business value

Concrete ROI — not marketing fluff.

Time saved

~15 hours/week per analyst, plus replacement of $24-120k/year analytics SaaS contracts

  • Replaces Mixpanel/Amplitude — saves $2-10k/month in event-based pricing at growing scale
  • Product teams iterate on funnels live: sub-second queries enable 'what-if' exploration during standups
  • Anomaly alerts catch broken tracking pixels within minutes — protects attribution data worth millions in ad spend decisions
  • Full ownership of raw event data — no vendor lock-in, no quota surprises, no data silos

Workflow steps

  1. 1
    Configure ClickHouse Grafana data source
  2. 2
    Design materialized view for rollup metrics
  3. 3
    Build time-series panels for event volume
  4. 4
    Add funnel and retention panels
  5. 5
    Set alert on anomalous drop in events

Use cases

  • Real-time DAU/WAU/MAU dashboards over raw event streams
  • Funnel analysis that refreshes as conversions happen
  • Anomaly detection alerting on event volume drops (e.g. tracking pixel down)
  • Retention cohort analysis over months of behavioral data

MCPs required

🟡

ClickHouse

ClickHouse MCP Server

View
📊

Grafana

Grafana MCP Server

View

Agent prompt (copy into Claude Code)

This prompt is the workflow. Paste into Claude Code, Cursor, or Windsurf.

You are an analytics-dashboard agent. Runs ad-hoc to set up or refresh Grafana analytics.

Given an events table in ClickHouse:
1. Call clickhouse.describe_table(db, table) to get schema (event_name, user_id, timestamp, properties)
2. Generate materialized views for common rollups:
   - dau_mv: SELECT toDate(ts), uniqExact(user_id) GROUP BY day
   - funnel_mv: windowFunnel for a configurable set of events
   - retention_mv: retention function per cohort
3. Call clickhouse.execute(sql) to create/replace each MV with appropriate engine (AggregatingMergeTree)
4. Call grafana.create_dashboard via API with panels:
   - DAU/WAU/MAU time-series
   - Funnel conversion bars
   - Retention cohort heatmap
   - Event volume with anomaly band
5. Set alert on event_volume 1h drop > 40% vs 7d avg

Use Grafana's clickhouse plugin for live queries (no pre-aggregation in Grafana).

Trigger & credentials

How this workflow fires and what env vars you need.

.env.example
ManualTrigger
Run in Claude Code to bootstrap dashboards, then rely on Grafana for continuous queries
🟡ClickHouse· 4 vars
CLICKHOUSE_URL

ClickHouse HTTP endpoint

e.g. https://clickhouse.company.com:8443

CLICKHOUSE_USER

ClickHouse user with SELECT + CREATE MATERIALIZED VIEW

e.g. analytics

CLICKHOUSE_PASSWORD

ClickHouse password

e.g. change-me

CLICKHOUSE_DATABASE

Target database name

e.g. events

📊Grafana· 2 vars
GRAFANA_URL

Grafana server URL

e.g. https://grafana.company.com

GRAFANA_API_KEYGet key

API key with Editor or Admin role

e.g. eyJrIjoi...

One-command deploy

Install everything — MCPs, prompt, env template — in a single call.

$ mcpizy recipe install clickhouse-grafana-analytics

✓ Installs all 2 MCP servers
✓ Writes prompt to ~/.mcpizy/prompts/clickhouse-grafana-analytics.md
✓ Generates .env.example in current directory
✓ Ready to paste into Claude Code

Requires mcpizy CLI v1.1+ — install via npm i -g mcpizy.

Quick install (MCPs only)

30 min setup, sub-second analytics at any scale
$ mcpizy install clickhouse && mcpizy install grafana

More Monitoring recipes

💬🟢

Database Change Alerts

Get a Slack alert whenever a critical Supabase table row is created, updated, or deleted — ideal for audit trails.

🐛💬

Error Alerting Pipeline

Sentry new issues are de-duplicated, enriched with commit info, and routed to the right Slack channel based on project.

🐘📊

Database Monitoring Dashboard

Stream Postgres metrics — query latency, lock waits, vacuum stats — into Grafana for a live operations dashboard.

📊💬

Alert Routing from Grafana

Grafana alerts are enriched with runbook links and routed to the correct Slack channel based on severity and team labels.

Frequently asked questions

What is this workflow?

Analytics Dashboard is a monitoring automation that uses ClickHouse + Grafana together via the Model Context Protocol. Connect ClickHouse to Grafana to build real-time analytics dashboards over billions of events with sub-second query times.

How long does setup take?

Setup takes around 30 min setup, sub-second analytics at any scale. You install the required MCP servers with `mcpizy install clickhouse && mcpizy install grafana`, connect your accounts, and the workflow is ready to run.

How much time does this workflow save?

Once running, this workflow saves ~15 hours/week per analyst, plus replacement of $24-120k/year analytics SaaS contracts. The concrete business value: Replaces Mixpanel/Amplitude — saves $2-10k/month in event-based pricing at growing scale; Product teams iterate on funnels live: sub-second queries enable 'what-if' exploration during standups.

Which MCP servers do I need for this?

You need 2 MCP servers: ClickHouse (mcpizy install clickhouse), Grafana (mcpizy install grafana). All are installable in one command via the MCPizy CLI and configured in your `.claude.json` or `.cursor/mcp.json`.

Does this work with Claude Code, Cursor, and Windsurf?

Yes. The workflow runs with any MCP-compatible AI agent — Claude Code, Claude Desktop, Cursor, Windsurf, VS Code with Copilot, and custom agents built on the MCP SDK. The MCP servers are identical across clients; only the config file path (`.claude.json` vs `.cursor/mcp.json`) changes.

Start building this workflow

Install the required MCPs from the marketplace and automate this in 30 min setup.

$ mcpizy install clickhouse && mcpizy install grafana

🟡Install ClickHouse📊Install Grafana

Free to install. Connect your accounts and this workflow runs itself.