325 lines
13 KiB
Markdown

> **🚀 Don't want to self-host?** [Join the waitlist for our fully managed solution →](https://mcpengage.com/product-analytics)
>
> Zero setup. Zero maintenance. Just connect and automate.
---
# 🚀 Product Analytics MCP Server — 2026 Complete Version
## 💡 What This Unlocks
**This MCP server gives AI direct access to your entire product analytics stack.** Query Mixpanel, Amplitude, and PostHog from a single unified interface—no more switching between dashboards.
Instead of clicking through analytics platforms and copying CSV exports, just *tell* your AI what insights you need. It queries all three platforms, correlates data, and gives you actionable answers.
### 🎯 Analytics Power Moves
Stop context-switching between analytics tools. The AI can directly query your entire stack:
1. **Cross-platform funnel analysis** — "Compare signup→activation funnels between Mixpanel and Amplitude for the past 30 days"
2. **Unified cohort intelligence** — "Show me retention curves for users who tried feature X in PostHog vs Amplitude cohorts"
3. **Real-time feature flag monitoring** — "List all PostHog feature flags and show user count in each variant"
4. **Power-user segmentation** — "Find Mixpanel users with 10+ sessions this week, check their Amplitude engagement scores, and export as cohort"
5. **Custom query synthesis** — "Run this HogQL query in PostHog and this JQL script in Mixpanel, compare results side-by-side"
### 🔗 The Real Power: Combining Tools
AI can orchestrate complex multi-platform analytics workflows:
- Query Mixpanel events → Segment by property → Export to Amplitude cohort → Track PostHog feature flag performance
- HogQL power query → JQL custom script → Amplitude chart lookup → Synthesize insights across platforms
- Compare retention curves → Identify top-performing cohorts → Deep-dive into user profiles → Generate strategic recommendations
- Monitor feature flags → Query adoption metrics → Funnel breakdown → Automated performance reports
## 📦 What's Inside
**20 powerful API tools** covering Mixpanel, Amplitude, and PostHog:
### Mixpanel (7 tools)
1. **query_mixpanel_segmentation** — Event analysis over time with property breakdowns
2. **query_mixpanel_funnels** — Multi-step conversion funnel analysis
3. **query_mixpanel_retention** — Cohort retention and birth/compounded analysis
4. **get_mixpanel_user_profile** — Individual user profile lookup
5. **query_mixpanel_jql** — Custom JQL (JavaScript Query Language) queries
6. **export_mixpanel_events** — Raw event export with filters
7. **list_mixpanel_events** — Event catalog and taxonomy
### Amplitude (6 tools)
8. **query_amplitude_segmentation** — Event segmentation with custom metrics
9. **get_amplitude_user_activity** — User event stream and activity history
10. **list_amplitude_cohorts** — All saved cohorts in project
11. **get_amplitude_cohort** — Cohort details and member list
12. **query_amplitude_charts** — Saved chart data retrieval
13. **get_amplitude_taxonomy** — Event and property taxonomy
### PostHog (7 tools)
14. **query_posthog_events** — Event queries with advanced filters
15. **get_posthog_person** — Person profile by ID or distinct_id
16. **list_posthog_feature_flags** — All feature flags and variants
17. **query_posthog_insights** — Trends, funnels, retention, paths analysis
18. **query_posthog_hogql** — Custom HogQL (SQL-like) queries
19. **list_posthog_annotations** — Project annotations and markers
All with proper error handling, automatic authentication, and TypeScript types.
**API Foundations:**
- [Mixpanel Query API](https://developer.mixpanel.com/reference/query-api) (REST)
- [Amplitude Analytics API](https://www.docs.developers.amplitude.com/analytics/) (REST)
- [PostHog API](https://posthog.com/docs/api) (REST + HogQL)
## 🚀 Quick Start
### Option 1: Claude Desktop (Local)
1. **Clone and build:**
```bash
git clone https://github.com/BusyBee3333/Product-Analytics-MCP-2026-Complete.git
cd product-analytics-mcp-2026-complete
npm install
npm run build
```
2. **Get your API credentials:**
**Mixpanel:**
- Log into [Mixpanel](https://mixpanel.com/)
- Go to **Settings → Project Settings → Service Accounts**
- Create service account with query permissions
- Copy Project ID and Secret
**Amplitude:**
- Log into [Amplitude](https://amplitude.com/)
- Go to **Settings → Projects → [Your Project]**
- Copy API Key and Secret Key from **General** tab
**PostHog:**
- Log into [PostHog](https://app.posthog.com/)
- Go to **Project Settings → API Keys**
- Create Personal API Key
- Copy API Key and Project ID
3. **Configure Claude Desktop:**
On macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
On Windows: `%APPDATA%\Claude\claude_desktop_config.json`
```json
{
"mcpServers": {
"product-analytics": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/product-analytics-mcp-2026-complete/dist/index.js"],
"env": {
"MIXPANEL_PROJECT_ID": "your_project_id",
"MIXPANEL_SERVICE_ACCOUNT_SECRET": "your_secret",
"AMPLITUDE_API_KEY": "your_api_key",
"AMPLITUDE_SECRET_KEY": "your_secret_key",
"POSTHOG_API_KEY": "phx_...",
"POSTHOG_PROJECT_ID": "12345"
}
}
}
}
```
**Note:** You can configure just one platform or all three. The server auto-detects available credentials and enables tools accordingly.
4. **Restart Claude Desktop**
### Option 2: Deploy to Railway
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/product-analytics-mcp)
1. Click the button above
2. Set environment variables for platforms you want to use
3. Use the Railway URL as your MCP server endpoint
### Option 3: Docker
```bash
docker build -t product-analytics-mcp .
docker run -p 3000:3000 \
-e MIXPANEL_PROJECT_ID=your_project_id \
-e MIXPANEL_SERVICE_ACCOUNT_SECRET=your_secret \
-e AMPLITUDE_API_KEY=your_api_key \
-e AMPLITUDE_SECRET_KEY=your_secret_key \
-e POSTHOG_API_KEY=phx_... \
-e POSTHOG_PROJECT_ID=12345 \
product-analytics-mcp
```
## 🔐 Authentication
### Mixpanel
- **Auth method:** Basic auth (service account)
- **Format:** `project_id:secret` (base64)
- **Required env vars:** `MIXPANEL_PROJECT_ID`, `MIXPANEL_SERVICE_ACCOUNT_SECRET`
- **Endpoints:** Query API (https://mixpanel.com/api/2.0) and Ingestion API (https://api.mixpanel.com)
- **Rate limits:** Varies by plan (typically 60 req/hour for free, higher for paid)
### Amplitude
- **Auth method:** Basic auth (API key + secret)
- **Format:** `api_key:secret_key` (base64)
- **Required env vars:** `AMPLITUDE_API_KEY`, `AMPLITUDE_SECRET_KEY`
- **Endpoints:** Dashboard API (https://amplitude.com/api/2)
- **Rate limits:** 360 requests per hour (free/growth), higher for enterprise
### PostHog
- **Auth method:** Bearer token (Personal API Key)
- **Format:** `Bearer phx_...`
- **Required env vars:** `POSTHOG_API_KEY`, `POSTHOG_PROJECT_ID`
- **Endpoints:** Cloud API (https://app.posthog.com/api/) or self-hosted
- **Rate limits:** 480 requests per minute (cloud), unlimited (self-hosted)
The MCP server handles all authentication automatically—just set the environment variables.
## 🎯 Example Prompts for Product Teams
Once connected to Claude, use natural language. Here are real product analytics workflows:
### Cross-Platform Analysis
- *"Compare signup funnel conversion rates between Mixpanel and Amplitude for the last 30 days"*
- *"Show me PostHog feature flag 'new-onboarding' adoption vs Mixpanel activation event counts"*
- *"Query retention in all three platforms for users who signed up in January 2026"*
### Power User Workflows
- *"Run this JQL script in Mixpanel: [paste script]. Then find those users in Amplitude and show their activity"*
- *"Export all Mixpanel events for 'purchase_completed' last week, cross-reference with PostHog person properties"*
- *"List all PostHog insights of type FUNNELS, then recreate the top one in Mixpanel for comparison"*
### Cohort & Segmentation
- *"Show me all Amplitude cohorts with 'power_user' in the name, get their IDs, query Mixpanel for their event volumes"*
- *"Find Mixpanel users with 10+ sessions this month, check if they exist in PostHog, list their feature flag exposure"*
- *"Get PostHog persons who triggered event X, look up their profiles in Mixpanel, summarize common properties"*
### Custom Queries
- *"Run this HogQL query in PostHog: SELECT * FROM events WHERE event = 'signup' AND timestamp > now() - INTERVAL 7 DAY"*
- *"Execute Mixpanel segmentation for 'page_view' event, group by $browser, last 14 days"*
- *"Query Amplitude event taxonomy, filter for events containing 'checkout', show me property schemas"*
### Feature Flag Intelligence
- *"List all PostHog feature flags, show rollout percentage and user counts for each variant"*
- *"Check PostHog feature flag 'beta_feature' exposure, query Mixpanel for event counts from exposed users"*
- *"Find users in PostHog flag 'experiment_v2' variant B, get their Amplitude retention data"*
### Real-Time Monitoring
- *"Export Mixpanel events from the last hour, filter for errors, check if affected users are in Amplitude"*
- *"Query PostHog events for 'payment_failed' in the last 24h, get user profiles from all platforms"*
- *"Check Amplitude user activity for user_id X, then query their full event stream in Mixpanel"*
## 🛠️ Development
### Prerequisites
- Node.js 18+
- npm or yarn
- Accounts on Mixpanel, Amplitude, and/or PostHog
### Setup
```bash
git clone https://github.com/BusyBee3333/Product-Analytics-MCP-2026-Complete.git
cd product-analytics-mcp-2026-complete
npm install
cp .env.example .env
# Edit .env with your API credentials
npm run build
npm start
```
### Testing
```bash
npm test # Run all tests
npm run test:watch # Watch mode
npm run test:coverage # Coverage report
```
### Project Structure
```
product-analytics-mcp-2026-complete/
├── src/
│ └── index.ts # Main server implementation
│ # - MixpanelClient
│ # - AmplitudeClient
│ # - PostHogClient
│ # - 20 tool definitions
│ # - Handler routing
├── dist/ # Compiled JavaScript
├── package.json
├── tsconfig.json
└── .env.example
```
## 🐛 Troubleshooting
### "Mixpanel API error: 401"
- Verify service account credentials are correct
- Check that service account has query permissions
- Ensure Project ID matches the secret's project
### "Amplitude API error: 403"
- Confirm API Key and Secret Key are from the same project
- Check that keys haven't been revoked or expired
- Verify project access permissions
### "PostHog API error: 401"
- Ensure Personal API Key is active (check Settings → API Keys)
- Verify Project ID is correct (visible in project settings URL)
- Check that API key has project-level permissions
### "Rate limit exceeded"
- Mixpanel: 60 req/hour (free), wait or upgrade plan
- Amplitude: 360 req/hour (growth), wait or upgrade to enterprise
- PostHog: 480 req/min (cloud), upgrade or use self-hosted
### "At least one analytics platform must be configured"
- Set credentials for Mixpanel, Amplitude, OR PostHog
- You don't need all three—server works with any combination
- Verify environment variables are spelled correctly
### "Tools not appearing in Claude"
- Restart Claude Desktop after updating config
- Check that the path in `claude_desktop_config.json` is absolute (not relative)
- Verify the build completed: `ls dist/index.js`
- Check Claude Desktop logs: `tail -f ~/Library/Logs/Claude/mcp*.log`
### "Unknown tool error"
- Ensure the tool name matches the platform you configured
- Example: `query_mixpanel_segmentation` requires Mixpanel credentials
- Check server startup logs for "Total tools available" count
## 📖 Resources
- **[Mixpanel Query API Docs](https://developer.mixpanel.com/reference/query-api)** — Official API reference
- **[Amplitude Analytics API Docs](https://www.docs.developers.amplitude.com/analytics/)** — Dashboard API guide
- **[PostHog API Docs](https://posthog.com/docs/api)** — REST API and HogQL reference
- **[MCP Protocol Spec](https://modelcontextprotocol.io/)** — How MCP servers work
- **[Claude Desktop Docs](https://claude.ai/desktop)** — Installing and configuring Claude
- **[MCPEngage Platform](https://mcpengine.pages.dev)** — Browse 30+ business MCP servers
## 🤝 Contributing
Contributions are welcome! Please:
1. Fork the repo
2. Create a feature branch (`git checkout -b feature/retention-analysis`)
3. Commit your changes (`git commit -m 'Add cross-platform retention comparison'`)
4. Push to the branch (`git push origin feature/retention-analysis`)
5. Open a Pull Request
## 📄 License
MIT License - see [LICENSE](LICENSE) for details
## 🙏 Credits
Built by [MCPEngage](https://mcpengage.com) — AI infrastructure for business software.
Want more MCP servers? Check out our [full catalog](https://mcpengage.com) covering 30+ business platforms including Segment, Google Analytics, Heap, and more.
---
**Questions?** Open an issue or join our [Discord community](https://discord.gg/mcpengage).