/mixpanel-headless:auth [session|login|account|project|workspace|target] [...]from mixpanel-headless
Manages Mixpanel credentials for mixpanel_headless and mp CLI: checks sessions, logs in via OAuth, switches accounts/projects/workspaces, and manages saved targets. Use on auth errors or when credentials are missing.
Ships in mixpanel-headless. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Manage Mixpanel credentials through auth_manager.py. Each subcommand prints
exactly one JSON object to stdout. Parse it and present the result in plain
words.
Run each command below exactly as written, with the full interpreter path. The
pre-approved pattern in allowed-tools matches only that text.
The commands use the plugin environment that the setup skill creates. If the
interpreter path does not exist ("No such file or directory"), tell the user
to run /mixpanel-headless:setup first.
In this skill, mp means ${CLAUDE_PLUGIN_DATA}/venv/bin/mp. When you tell
the user to run an mp command, write that full path, because mp is often
not on the user's PATH. This also applies to the commands in next hints.
Schema: every response has schema_version: 1 and a state of ok,
needs_account, needs_project, or error. Errors are also JSON on stdout
with exit code 0, so you can parse the output without a try/except.
! ${CLAUDE_PLUGIN_DATA}/venv/bin/mp account add <name> --type service_account --username <username> --project <project_id> --region <region> themselves. The command prompts for the secret with hidden input when it has a terminal.! session has no terminal for the prompt. Tell the user to run the same command in their own terminal, outside Claude Code. Another option: export MP_SECRET in their shell first. Still do not ask for the secret in the chat.Parse $ARGUMENTS and route to the matching subcommand. With no arguments,
run session.
For first-time setup, the one-shot path is mp login. It picks the auth flow
from the environment, derives the account name from /me, and pins a default
project. Tell the user to run:
! ${CLAUDE_PLUGIN_DATA}/venv/bin/mp login
The region behavior depends on the auth type:
service_account and oauth_token paths probe us → eu → in and use the first region that answers.oauth_browser path (the default for a bare mp login) uses us. EU and India users must pass --region eu or --region in.Optional flags:
--name NAME — override the derived account name--region us|eu|in — set the region explicitly (required for EU and India browser users)--project ID — skip the project picker--service-account — force the service-account path (needs MP_USERNAME and MP_SECRET in the environment)--token-env VAR — force the static-bearer path (reads the token from $VAR)--no-browser — print the authorization URL instead of opening a browserIf mp login fails with "Multiple projects accessible to this account", the
command had no terminal for its project picker. Show the listed projects, ask
which one to use, and tell the user to run it again with --project <id>.
After the user confirms, run ${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py session to get account.name. Then run
${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py account test <account.name>.
Run ${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py session. Switch on state:
ok — show one line: "Active: account.name → project project.id". Add workspace workspace.id if it is not null. Mention /mixpanel-headless:auth account list and /mixpanel-headless:auth project list for a switch.needs_account — no account is configured. Show next[0].command (the one-shot mp login) as the recommended step. List the alternatives: next[1] (explicit account add) and next[2] (the MP_OAUTH_TOKEN environment variables, best for CI and agents).needs_project — an account exists but no project is pinned. Run ${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py project list, show the table, and ask which project to use. Then run ${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py project use <id>.error — show error.message. If error.actionable is true, the message names the next command.Run ${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py account list. Show items as a table: name, type, region,
is_active. Mark the active account with a star. If referenced_by_targets
is not empty for an account, say so ("team is referenced by targets: ecom").
If items is empty, show the next onboarding hints (as for needs_account).
This is a guided wizard. Do not run any script that handles secrets.
oauth_browser (recommended for laptops), service_account (long-lived), or oauth_token (CI and agents).service_account, ask for the username and the numeric project ID. For oauth_token, ask for the project ID and the name of the environment variable that holds the bearer token. For oauth_browser, the project ID is optional, because mp account login fills it in after the browser flow.Now run this command. It prompts for your service account secret with hidden input:
! ${CLAUDE_PLUGIN_DATA}/venv/bin/mp account add <NAME> --type service_account --username <USERNAME> --project <PROJECT_ID> --region <REGION>
For an OAuth token, the named environment variable must hold the token in the shell where the command runs:
! ${CLAUDE_PLUGIN_DATA}/venv/bin/mp account add <NAME> --type oauth_token --token-env <VAR> --project <PROJECT_ID> --region <REGION>
For OAuth browser, prefer the one-shot mp login (see "login" above):
! ${CLAUDE_PLUGIN_DATA}/venv/bin/mp login --name <NAME> --region <REGION>
For full control over registration before the browser flow, the two-step path still works:
! ${CLAUDE_PLUGIN_DATA}/venv/bin/mp account add <NAME> --type oauth_browser --region <REGION>
! ${CLAUDE_PLUGIN_DATA}/venv/bin/mp account login <NAME> # opens a browser for the PKCE flow
Replace the placeholders with the values you collected. The ! prefix runs the
command in the user's terminal session.
${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py account test <NAME>.result.ok field.If a name is given, run ${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py account use <name>.
If no name is given:
${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py account list to show the accounts.${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py account use <name> with the chosen name.On state: ok, show one line: "Switched to active.account (project active.project)".
On state: error, show error.message.
The name is required. If it is missing, run ${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py account list and ask.
Then run ${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py account login <name>.
Tell the user that a browser window opens for Mixpanel authentication. Wait for the JSON response.
On state: ok: "OAuth login successful. logged_in_as.user.email, token
valid until logged_in_as.expires_at."
On state: error: show error.message and suggest a retry.
The script needs a name. If none is given, run ${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py session and use
account.name. Then run ${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py account test <name>.
The subcommand does not raise, so state is always ok. Read result.ok:
result.ok: true → "Connected as result.user.email · result.accessible_project_count accessible projects."result.ok: false → "Test failed: result.error."Run ${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py project list. Show items as a table: organization, project name,
project ID. Mark the active project (is_active: true) with a star. Suggest
/mixpanel-headless:auth project use <id> for a switch.
If no ID is given, run ${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py project list first and ask which one to use.
Run ${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py project use <PROJECT_ID>.
On state: ok: "Switched to project active.project."
On state: error: show error.message.
Run ${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py workspace list. Show items as a table: workspace ID, name,
is_default. Mark the active workspace with a star. Name the parent project
from project.name (project.id).
Run ${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py workspace use <WORKSPACE_ID>.
On state: ok: "Pinned workspace active.workspace."
On state: error: show error.message.
Run ${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py target list. A target is a saved combination of an account, a project,
and an optional workspace. Show a table: name, account, project,
workspace.
This is a guided wizard. Collect the target name, the account name, the project ID, and an optional workspace ID. Then run:
${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py target add <NAME> --account <ACCT> --project <PROJ> [--workspace <WS>]
Run ${CLAUDE_PLUGIN_DATA}/venv/bin/python ${CLAUDE_PLUGIN_ROOT}/skills/auth/scripts/auth_manager.py target use <name>. It applies all three axes (account,
project, workspace) to [active] in one atomic config write.
MP_OAUTH_TOKEN)For non-interactive contexts (CI, agents, short-lived environments), the browser flow does not work. Set these instead:
export MP_OAUTH_TOKEN=<bearer-token>
export MP_PROJECT_ID=<project-id>
export MP_REGION=<us|eu|in>
The library sends an Authorization: Bearer <token> header to every Mixpanel
endpoint. When the full service-account set (MP_USERNAME + MP_SECRET +
MP_PROJECT_ID + MP_REGION) is also present, the library ignores
MP_OAUTH_TOKEN. To use the token, unset MP_USERNAME and MP_SECRET.
error.message verbatim, because it names the fix.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub mixpanel/mixpanel-headless --plugin mixpanel-headless5 skills in this plugin
/dashboard-expertAnalyzes, builds, modifies, and adds explainer text cards to Mixpanel dashboards with the mixpanel_headless Python library. It reads a dashboard's layout and runs every report on it, creates dashboards with text cards and a grid layout, edits cells and rows in place, and writes data-driven explainer cards. Use when the user asks to analyze, summarize, explain, build, create, redesign, update, reorganize, or clean up a Mixpanel dashboard; asks about dashboard layout, rows, cell widths, text cards, or which chart type suits a board; or wants to turn queries into reports placed on a dashboard. Do not use for general analytics questions or one-off queries (use mixpanelyst), or for what a specific user did in a session recording (use session-replay)./mixpanelystAnalyzes Mixpanel data with Python, mixpanel_headless, and pandas. Use when the user asks about their Mixpanel data, such as event trends, DAU/WAU/MAU, funnels, retention and churn, user paths, user profiles, cohorts, a user's event history (activity feed), segment comparisons, revenue, feature adoption, or experiment results. Also use to explore a project's events and properties, use or manage saved metrics and behaviors, build a custom property or cohort, share a query as a report link, read or write business context, or manage entities such as feature flags, experiments, alerts, annotations, webhooks, Lexicon, and other governance objects, or when code runs mixpanel_headless or `mp query` / `mp inspect`. Do not use for adding tracking to an app's source code, for what a specific user did on screen (use session-replay), for building or editing dashboards (use dashboard-expert), for logging in, credentials, or switching accounts (use auth), or for installing the library (run /mixpanel-headless:setup)./session-replayReads Mixpanel session replay recordings with the mixpanel_headless library. It fetches a user's sessions, turns them into action timelines and pandas DataFrames, and explains what happened on screen. Use when the user asks what a specific user did on screen, in a recording, or click by click; asks about rage clicks, dead clicks, rage taps, dead taps, error sessions, long pauses, or action timelines; wants to correlate a tracked event with on-screen behavior; gives a distinct_id or a replay ID and asks what happened in the session; or asks about iOS, Android, React Native, or Flutter recordings, screens, or taps. Do not use for aggregate analytics questions such as trends, funnels, retention, or segment counts (use mixpanelyst), or for building or editing dashboards (use dashboard-expert)./setupCreates the plugin's own Python environment and installs or upgrades mixpanel_headless (0.4.0 or newer) with pandas, numpy, matplotlib, seaborn, networkx, anytree, scipy, and pyarrow (Python 3.11+ only) on Python 3.10+, then checks the imports, mp help, and the credentials. Use when setting up Mixpanel analysis, or when the plugin environment is missing or older than 0.4.0. Do not use for login or account changes (use auth).Other plugins' skills for the same job