Mixpanel CLI - query analytics from your terminal.
mp wraps the entire Mixpanel read API into a single command-line tool. Export raw events, run segmentation queries, inspect user profiles, and browse project metadata - all from your terminal with JSON, table, or CSV output.
brew install aviadshiber/tap/mpgo install github.com/aviadshiber/mp/cmd/mp@latestDownload the latest release from GitHub Releases.
macOS (Apple Silicon):
curl -sL https://github.com/aviadshiber/mp/releases/latest/download/mp_darwin_arm64.tar.gz | tar xz
sudo mv mp /usr/local/bin/macOS (Intel):
curl -sL https://github.com/aviadshiber/mp/releases/latest/download/mp_darwin_amd64.tar.gz | tar xz
sudo mv mp /usr/local/bin/Linux (amd64):
curl -sL https://github.com/aviadshiber/mp/releases/latest/download/mp_linux_amd64.tar.gz | tar xz
sudo mv mp /usr/local/bin/git clone https://github.com/aviadshiber/mp
cd mp
make installCreate a Service Account in Mixpanel, then:
mp config set project_id YOUR_PROJECT_ID
mp config set service_account YOUR_SA_USERNAME
mp config set service_secret YOUR_SA_SECRETOr use environment variables:
export MP_TOKEN="username:secret"
export MP_PROJECT_ID="12345"# Export raw events
mp export events --from 2024-01-01 --to 2024-01-31 --limit 100
# Segmentation query
mp query segmentation --event "Signup" --from 2024-01-01 --to 2024-01-31
# Aggregate event counts
mp query events --event "Signup,Login" --type general --unit day --from 2024-01-01 --to 2024-01-31
# User profiles
mp profiles query --where 'user["$city"]=="San Francisco"' --limit 10
# List cohorts
mp cohorts list| Command | Description |
|---|---|
mp export events |
Export raw event data as JSONL |
| Command | Description |
|---|---|
mp query segmentation |
Event segmentation (Insights report equivalent) |
mp query events |
Aggregate event counts over time |
mp query properties |
Event property breakdown |
mp query funnels |
Funnel conversion analysis |
mp query funnels list |
List saved funnels |
mp query retention |
User retention analysis |
mp query frequency |
Event frequency analysis |
mp query insights |
Query a saved Insights report |
| Command | Description |
|---|---|
mp profiles query |
Query user profiles |
mp profiles groups |
Query group profiles |
| Command | Description |
|---|---|
mp activity |
User activity stream |
mp cohorts list |
List cohorts |
mp annotations list |
List annotations |
mp annotations get |
Get annotation by ID |
mp schemas list |
List event/profile schemas |
mp schemas get |
Get schema details |
mp lookup-tables list |
List lookup tables |
mp pipelines list |
List data pipeline jobs |
mp pipelines status |
Get pipeline status |
Every command supports the --json, --jq, and --template flags:
# JSON output
mp cohorts list --json
# Select specific fields
mp cohorts list --json id,name,count
# Filter with jq
mp cohorts list --json --jq '.[].name'
# Format with Go templates
mp cohorts list --json --template '{{range .}}{{.name}}: {{.count}}{{"\n"}}{{end}}'Default output is a human-readable table in terminals, or JSON when piped.
Config file: ~/.config/mp/config.yaml
mp config set <key> <value>
mp config get <key>
mp config list| Key | Description | Env Variable |
|---|---|---|
project_id |
Mixpanel project ID | MP_PROJECT_ID |
region |
API region (us, eu, in) | MP_REGION |
service_account |
Service account username | MP_TOKEN (user:secret) |
service_secret |
Service account secret | MP_TOKEN (user:secret) |
Precedence: flags > environment variables > config file > defaults
mp config set region eu # EU data residency
mp config set region in # India data residencyOr per-command: mp query segmentation --region eu --event "Signup" ...
MIT