@andrew_eragon/mcp-mixpanel
v0.0.10
Published
SaaS-ready Mixpanel MCP server with connection pooling, multi-tenant support, and automatic retry logic
Maintainers
Readme
Mixpanel MCP Server
🚀 SaaS-ready Mixpanel MCP server with enterprise-grade features: connection pooling, multi-tenant support, automatic retry logic, and graceful shutdown.
Query your Mixpanel events data directly from any MCP client like Claude Desktop, Cursor, or AI frameworks like Agno. Perfect for on-demand analytics like: "What's the weekly retention for users in the Feb 1 cohort?"
Features
🏢 Enterprise SaaS Architecture
- ✅ Connection Pooling - Reuses connections, reduces auth overhead by ~70%
- ✅ Multi-Tenant Support - Per-request credential isolation, concurrent users
- ✅ Automatic Retry Logic - 3 retries with exponential backoff + jitter
- ✅ Timeout Protection - 30-second timeout on all requests
- ✅ Idle Connection Cleanup - 30min timeout, 5min cleanup interval
- ✅ Graceful Shutdown - Proper cleanup on SIGINT/SIGTERM
- ✅ Comprehensive Logging - Pool statistics and performance metrics
See SAAS_ARCHITECTURE.md for detailed documentation.
Prerequisites
- A Mixpanel account with a Service Account
- Your service account username and password
- Your Mixpanel project ID (found in Project Settings)
- Node.js >= 18.0.0
Installation
Method 1: Direct npx (Recommended)
The simplest way to use this server:
npx -y @andrew_eragon/mcp-mixpanel <USERNAME> <PASSWORD> <PROJECT_ID>Method 2: Global Installation
npm install -g @andrew_eragon/mcp-mixpanel
mcp-mixpanel <USERNAME> <PASSWORD> <PROJECT_ID>Method 3: From Source
git clone https://github.com/andrew_eragon/mcp-mixpanel.git
cd mcp-mixpanel
npm install
npm run build
node build/index.js <USERNAME> <PASSWORD> <PROJECT_ID>Usage
With Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"mixpanel": {
"command": "npx",
"args": [
"-y",
"@andrew_eragon/mcp-mixpanel",
"YOUR_SERVICE_ACCOUNT_USERNAME",
"YOUR_SERVICE_ACCOUNT_PASSWORD",
"YOUR_PROJECT_ID"
]
}
}
}Or with environment variables:
{
"mcpServers": {
"mixpanel": {
"command": "npx",
"args": ["-y", "@andrew_eragon/mcp-mixpanel"],
"env": {
"MIXPANEL_USERNAME": "YOUR_SERVICE_ACCOUNT_USERNAME",
"MIXPANEL_PASSWORD": "YOUR_SERVICE_ACCOUNT_PASSWORD",
"MIXPANEL_PROJECT_ID": "YOUR_PROJECT_ID"
}
}
}
}With Cursor
Go to Settings → Cursor Settings → Features → MCP Servers → + Add
Select Type: command and paste:
npx -y @andrew_eragon/mcp-mixpanel YOUR_USERNAME YOUR_PASSWORD YOUR_PROJECT_IDWith Agno Framework (Python)
from agno.tools.mcp import MCPTools
mixpanel = MCPTools(
stdio={
"command": "npx",
"args": [
"-y",
"@andrew_eragon/mcp-mixpanel",
"YOUR_SERVICE_ACCT_USERNAME",
"YOUR_SERVICE_ACCT_PASSWORD",
"YOUR_MIXPANEL_PROJECT_ID"
]
}
)
# Or using environment variables (recommended):
import os
mixpanel = MCPTools(
stdio={
"command": "npx",
"args": ["-y", "@andrew_eragon/mcp-mixpanel"],
"env": {
"MIXPANEL_USERNAME": os.getenv("MIXPANEL_USERNAME"),
"MIXPANEL_PASSWORD": os.getenv("MIXPANEL_PASSWORD"),
"MIXPANEL_PROJECT_ID": os.getenv("MIXPANEL_PROJECT_ID")
}
}
)With Cline or Other MCP Clients
Use the stdio transport with the npx command:
{
"command": "npx",
"args": ["-y", "@andrew_eragon/mcp-mixpanel", "USERNAME", "PASSWORD", "PROJECT_ID"]
}Available Tools
The server provides 30+ Mixpanel API tools:
Event Management & Discovery
mixpanel_get_projects- Get all accessible projectsmixpanel_send_events- Send events with automatic deduplication (up to 2000 events)mixpanel_get_events- Get all event names for a projectmixpanel_get_event_properties- Get properties for a specific eventmixpanel_get_event_property_values- Get values for an event property
Query & Analysis Tools
mixpanel_run_segmentation_query- Flexible event stream analysismixpanel_run_funnels_query- Conversion funnel analysismixpanel_run_retention_query- User retention and cohort analysismixpanel_run_frequency_query- User engagement pattern analysis
Legacy Query Tools (also available)
get_today_top_events- Today's most active eventsget_top_events- Most common events (last 31 days)aggregate_event_counts- Event data over time periodsprofile_event_activity- Individual user journeysquery_retention_report- User retention analysis (D7, W12, M6, etc.)query_funnel_report- Conversion funnel dataquery_segmentation_report- Event segmentation by propertiescustom_jql- Run custom JQL queriesquery_profiles- User profile queries- And 10+ more...
Example Queries
Ask your AI assistant:
- "What are the top 10 events today?"
- "Show me D7 retention for users from February"
- "What's the conversion rate for my signup funnel?"
- "How many users completed the checkout event this week?"
- "Show me the profile for user ID abc123"
Configuration
Environment Variables
The server supports these environment variable patterns:
# Primary (recommended)
export MIXPANEL_USERNAME="your_service_account_username"
export MIXPANEL_PASSWORD="your_service_account_password"
export MIXPANEL_PROJECT_ID="your_project_id"
# Alternative (legacy)
export SERVICE_ACCOUNT_USER_NAME="your_service_account_username"
export SERVICE_ACCOUNT_PASSWORD="your_service_account_password"
export DEFAULT_PROJECT_ID="your_project_id"SaaS Features
The server automatically handles:
- Connection pooling (30min idle timeout)
- Automatic retries (3 attempts with exponential backoff)
- Request timeouts (30 seconds)
- Multi-tenant isolation
- Graceful shutdown with statistics
Monitor via logs:
╔════════════════════════════════════════════════════════════╗
║ MIXPANEL MCP SERVER v2.0.0 - SaaS Ready ║
╠════════════════════════════════════════════════════════════╣
║ Features: ║
║ ✓ Connection Pooling ║
║ ✓ Multi-Tenant Support ║
║ ✓ Automatic Retry Logic (3 retries, exponential backoff) ║
║ ✓ Timeout Protection (30s) ║
║ ✓ Idle Connection Cleanup (30min timeout, 5min interval) ║
║ ✓ Graceful Shutdown ║
╚════════════════════════════════════════════════════════════╝Architecture
See SAAS_ARCHITECTURE.md for detailed documentation on:
- Connection pooling strategy
- Multi-tenant isolation
- Retry logic and timeouts
- Performance benchmarks
- Monitoring and observability
Performance
v2.0.0 (SaaS-ready):
- ⚡ 75% latency reduction for cached requests (150-300ms vs 700-1000ms)
- 🚀 4x throughput increase (~400 req/min per user)
- 🛡️ 8x reduction in failure rate (<1% vs ~8%)
- 💾 Zero memory leaks with automatic cleanup
Development
# Install dependencies
npm install
# Build
npm run build
# Run locally
node build/index.js USERNAME PASSWORD PROJECT_ID
# Watch mode (for development)
npm run build -- --watchTroubleshooting
Server won't start
- Check Node.js version:
node --version(must be >= 18.0.0) - Verify credentials are correct
- Check Mixpanel service account has proper permissions
Slow requests
- Normal for first request (connection establishment)
- Subsequent requests should be fast (cached connection)
- Check network latency to Mixpanel API
Connection errors
- Verify service account credentials
- Check Mixpanel API status
- Review error logs for details
Contributing
Contributions welcome! Please open an issue or PR.
License
MIT
Links
Credits
Built with ❤️ for the MCP community. Enhanced with enterprise SaaS architecture for production use.
