MCP Server¶
Expose mixpanel_data analytics capabilities to AI assistants through the Model Context Protocol (MCP).
Explore on DeepWiki
π€ MCP Server Guide β
Ask questions about tools, explore configuration options, or get help with AI assistant integration.
Overview¶
The mp_mcp package provides an MCP server that connects AI assistants like Claude Desktop to your Mixpanel analytics. Built on FastMCP 3.x, it transforms natural language requests into structured analytics queries.
Key capabilities:
- Account Management β List, switch, and test Mixpanel account credentials
- Schema Discovery β Explore events, properties, funnels, cohorts, Lexicon schemas, and bookmarks
- Live Analytics β Run segmentation, funnel, retention, JQL, and numeric aggregation queries
- Saved Reports β Execute saved Insights, Retention, Funnel, and Flows reports
- Data Fetching β Download events and profiles to local DuckDB storage
- Local Analysis β Execute SQL queries against fetched data
- Intelligent Tools β AI-powered metric diagnosis and natural language queries
- Interactive Workflows β Guided analysis with user confirmation for large operations
What's New in v2¶
The MCP Server v2 transforms from a thin API wrapper into an intelligent analytics platform:
| Feature | Description |
|---|---|
| Intelligent Tools | AI-powered analysis using ctx.sample() for synthesis |
| Composed Tools | Multi-query orchestration (AARRR dashboards, GQM investigations) |
| Interactive Workflows | User confirmation via ctx.elicit() for large operations |
| Progress Reporting | Real-time updates for long-running fetches |
| Middleware Layer | Caching, rate limiting, and audit logging |
| Graceful Degradation | All tools work when sampling/elicitation unavailable |
Quick Start¶
1. Install the Server¶
Or from the repository:
2. Configure Credentials¶
Set environment variables:
export MP_USERNAME="your-service-account-username"
export MP_SECRET="your-service-account-secret"
export MP_PROJECT_ID="123456"
export MP_REGION="us" # or "eu", "in"
Or create ~/.mp/config.toml:
[default]
username = "your-service-account-username"
secret = "your-service-account-secret"
project_id = 123456
region = "us"
3. Add to Claude Desktop¶
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
4. Restart Claude Desktop¶
The Mixpanel tools are now available! Try asking:
- "What events are tracked in my Mixpanel project?"
- "How many logins happened each day last week?"
- "Why did signups drop on January 7th?"
Tool Tiers¶
The server organizes tools into tiers based on complexity:
| Tier | Description | MCP Feature |
|---|---|---|
| Tier 1 | Primitive tools (direct API calls) | Standard tools |
| Tier 2 | Composed tools (multi-query orchestration) | Standard tools |
| Tier 3 | Intelligent tools (AI synthesis) | ctx.sample() |
| Interactive | Elicitation workflows | ctx.elicit() |
See Tools for the complete reference.
Architecture¶
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MCP Client β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ
β Middleware Layer β
β βββββββββββ ββββββββββββββββ βββββββββββββββββββ β
β β Logging ββ β Rate Limitingββ β Caching β β
β βββββββββββ ββββββββββββββββ βββββββββββββββββββ β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ
β Tool Tiers β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Tier 3: Intelligent (sampling-powered) β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Tier 2: Composed (multi-query orchestration) β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Tier 1: Primitive (direct API calls) β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ
β mixpanel_data.Workspace β
β βββββββββββββββ ββββββββββββββββββ βββββββββββββββ β
β β Discovery β β Live Queries β β Storage β β
β βββββββββββββββ ββββββββββββββββββ βββββββββββββββ β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ
β Mixpanel API β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Next Steps¶
- Installation β Detailed setup instructions
- Tools β Complete tool reference
- Resources & Prompts β MCP resources and workflow prompts
- Examples β Example conversations and workflows