I’ve been running Umami Analytics for a while now, and while I love the privacy-first approach and clean data it provides, I found myself spending too much time manually digging through the dashboard to understand trends and create reports.
So I built something to let AI do the heavy lifting: an automated analytics reporting tool that connects Google Gemini to my Umami data using the Model Context Protocol (MCP).
🤖 What It Does
The setup combines a few powerful tools:
- MCP Python SDK: Official Python SDK for building MCP clients and servers
- Google Gemini: Advanced AI model for intelligent analysis and reporting
- Umami MCP Server: Connects directly to your Umami instance to fetch analytics data
Instead of clicking through dashboards, I can now ask questions like:
- “Show me a summary of last month’s traffic”
- “What are my top-performing pages this week?”
- “Generate a comprehensive quarterly report”
- “How does this month compare to last month?”
The AI reads the raw data from Umami and generates intelligent insights in natural language.
🚀 How I Set It Up
Getting started is straightforward:
pip install uv
uv run --with-requirements requirements.txt run.py --chat
The configuration connects to your Umami instance and Google Gemini:
UMAMI_API_URL=https://your-umami-instance.com/api
UMAMI_USERNAME=your-username
UMAMI_PASSWORD=your-password
UMAMI_TEAM_ID=your-team-id
GEMINI_API_KEY=your-gemini-api-key
By default, the tool uses Google Gemini for AI analysis, but you can also choose Ollama (for local inference) or Cloudflare Workers by specifying the --ai-provider
flag.
💡 Why This Approach Works
Privacy-First: Your analytics data never leaves your control. Umami keeps visitor data anonymous, and the AI processing happens through Google’s secure API endpoints.
Natural Language Interface: Instead of learning dashboard UIs, you ask questions in plain English and get comprehensive answers.
Automated Insights: The AI spots patterns and trends that might not be obvious from raw numbers, like seasonal traffic patterns or content performance correlations.
Flexible Reporting: Generate everything from quick summaries to detailed monthly reports, all customized to your specific needs.
Demo
Here’s a real chat session showing the tool in action with Gemini CLI:
% uv run --with-requirements requirements.txt run.py --start-date 2025-06-01 --end-date 2025-06-30 --website rhelmer.org --mcp-server-dir ~/src/umami_mcp_server --chat
🚀 Starting Analytics Dashboard
Website: rhelmer.org
Date Range: 2025-06-01 to 2025-06-30
Timezone: UTC
AI Provider: GEMINI-CLI
Chat Mode: Enabled
✅ Connected to MCP server
✅ Session initialized
📊 Getting real data for rhelmer.org...
Available MCP tools: ['get_websites', 'get_tracking_data', 'get_website_stats', 'get_session_ids', 'get_website_metrics', 'get_docs', 'get_screenshot', 'get_html', 'get_pageview_series', 'get_active_visitors']
🤖 Generating dashboard with GEMINI-CLI...
📈 DASHBOARD ANALYSIS (GEMINI-CLI):
================================================================================
# Analytics Dashboard: rhelmer.org
**Date Range:** 2025-06-01 to 2025-06-30
## 1. Overview Metrics
| Metric | Value |
| :--- | :--- |
| **Total Pageviews** | 1,003 |
| **Unique Visitors** | 199 |
| **Total Visits** | 329 |
| **Bounce Rate** | 77.2% (254 bounces / 329 visits) |
## 2. Top Content Performance
**Most Visited Pages:**
| Page Path | Pageviews |
| :--- | :--- |
| / | 213 |
| /blog/ | 184 |
| /blog/automatic-event-tracking-with-umami-kit/ | 115 |
| /blog/privacy-analytics-without-cookie-banners/ | 93 |
| /projects/ | 92 |
| /blog/ai-powered-analytics-reports-using-mcp/ | 91 |
## 3. Traffic Sources
**Top Referral Sources:**
| Referrer | Visits |
| :--- | :--- |
| linkedin.com | 28 |
| google.com | 22 |
| duckduckgo.com | 3 |
## 4. Key Recommendations
- **High Bounce Rate:** The 77.2% bounce rate suggests optimization opportunities
- **Low Newsletter Conversions:** Only 2 signups from 1,003 pageviews indicates CTA improvements needed
- **Traffic Peaks:** Investigate content published on June 9th, 24th, and 26th for replication strategies
🤖 Entering chat mode using GEMINI-CLI! Ask questions about your analytics data.
📊 Your question: I've just improved the placement and relevance of the main call-to-action (newsletter signups) on most blog posts. Any other ideas to improve conversion?
💬 GEMINI-CLI Response:
--------------------------------------------------
Great question! Based on your June analytics, here are some targeted recommendations:
### Data-Driven Insights
- You had only **2 newsletter signups** from **1,003 pageviews** and **199 unique visitors**
- Your top traffic sources are **LinkedIn** (28 visitors) and **Google** (22 visitors)
- Most popular content is your Umami and privacy-focused blog posts
### Conversion Optimization Ideas
1. **Optimize for Top Pages:** Your `/blog/automatic-event-tracking-with-umami-kit/` post gets 115 pageviews - consider a custom CTA specifically tailored to this technical audience.
2. **Tailor CTAs to Traffic Sources:** LinkedIn visitors might respond to professional networking benefits, while Google visitors might prefer technical content promises.
3. **Review External Links:** You have 51 external link clicks - consider moving these to after your CTA to reduce distraction.
4. **A/B Test Your CTA:** Now that placement is improved, test different value propositions like "Join our community" vs "Get exclusive tutorials."
Would you like me to analyze any specific pages or time periods in more detail?
--------------------------------------------------
🔄 What’s Next
I’m planning to add:
- Scheduled report generation (weekly/monthly automated emails)
- Custom report templates for different stakeholders
- Integration with more analytics sources beyond Umami
- Historical trend analysis and forecasting
The beauty of using the MCP Python SDK is that it’s extensible and follows the official protocol standards — I can easily add new data sources or AI capabilities as needed.
🔗 Try It Yourself
The project is open source and designed to work with any Umami instance. Whether you’re self-hosting or using Umami Cloud, you can connect your data and start getting AI-powered insights in minutes:
https://github.com/rhelmer/umami-mcp-llm-report
Quick Start Options:
- Default (Gemini): Get a free API key from Google AI Studio
- Local (Ollama): Run models locally with
--ai-provider ollama
- Cloud (Cloudflare): Use Cloudflare Workers with
--ai-provider cloudflare
MCP Python SDK: The project uses the official MCP Python SDK for seamless integration with the Model Context Protocol ecosystem.
It’s particularly useful if you manage multiple sites or need to generate regular reports for clients or stakeholders — the AI handles the analysis while you focus on acting on the insights.