Connect Mixpanel to Claude Code

Run Mixpanel segmentation, funnel and retention queries, and browse events, properties and cohorts. Add Toolspoke to Claude Code once and it can use 9 Mixpanel actions. Your Mixpanel credential stays in Toolspoke, and you choose which actions Claude Code may call.

Set it up in Claude Code

Three steps, the first one once for every toolkit you will ever add.

  1. Add Toolspoke to Claude Code

    Run it in your project, then /mcp to sign in

    claude mcp add --transport http toolspoke https://toolspoke.com/mcp

    The sign-in opens in your browser, and Toolspoke asks you to approve it.

  2. Install Mixpanel and connect it

    Add Mixpanel to a project in your Toolspoke workspace.

    Service account. You provide it once, when you install the connector. Toolspoke encrypts it at rest and decrypts it only for the length of a single call, and the gateway attaches it to the outbound request itself, so it is never part of the arguments an agent sends.

    Service account username and secret
    Your service account's username, a colon, then its secret. Mixpanel → Organization settings → Service accounts → Add service account. Sent as HTTP Basic. Give it the Analyst role on only the project this connection should reach; the secret is shown once, at creation.
    Project ID
    The numeric project ID from Mixpanel → Settings → Project settings. A service account belongs to an organization rather than to a project, so every Query API request has to name the project, without it Mixpanel refuses the call in a way that reads like the credential is wrong.
  3. Choose what Claude Code may do

    All 9 actions only read, and any of them can be switched off for a project.

What you can ask Claude Code for

A few of the Mixpanel actions that only read, so they are safe to try first.

  • Run one of the project's saved funnels over a date range
  • List the funnels saved in the project, as funnel_id and name pairs
  • Measure how many users who did a first action came back later
  • List the project's most common event names over the last 31 days

What Claude Code can do in Mixpanel

9 actions read.

Reads

  • Run segmentation

    The general-purpose reporting action: count one event over a date range, bucketed by time and optionally split by a property. `type` picks what is counted, general counts every occurrence, unique counts distinct users, average counts occurrences per user. Use `on` to break the totals down by a property expression such as properties["$browser"], and `where` to filter with the same expression syntax. Dates are yyyy-mm-dd and both ends are inclusive. Note the buckets here are minute, hour, day or month. Mixpanel offers no weekly unit on this endpoint.

  • Run funnel

    Run one of the project's saved funnels over a date range. Mixpanel has no ad-hoc funnel on this endpoint, the steps live in a funnel saved in the UI, so call list_saved_funnels first and pass its funnel_id. `length` and `length_unit` set the conversion window; leave them out to use whatever the saved funnel was built with. Dates are yyyy-mm-dd.

  • List saved funnels

    List the funnels saved in the project, as funnel_id and name pairs. run_funnel can only query a saved funnel, so this is where its funnel_id comes from.

  • Run retention

    Measure how many users who did a first action came back later. Mixpanel defaults retention_type to birth, and birth retention needs born_event, pass it unless you set retention_type to compounded. Leave `event` out to count a return on any event. `interval_count` is how many buckets of `unit` to report. Dates are yyyy-mm-dd and both ends are inclusive.

  • List cohorts

    List the cohorts saved in the project: each one's ID, name, description, creation date and how many users currently match it. This returns the cohort definitions and their sizes, never the people inside them. Mixpanel does not expose cohort membership through this endpoint. Note it is a POST despite being a read; that is Mixpanel's own shape for it.

  • Get event names

    List the project's most common event names over the last 31 days. Call this before any query action: Mixpanel matches event names literally, and a near-miss returns an empty series rather than an error.

  • Get event properties

    List the property names most often sent with one event, each with how often it appears. Use it to discover what you can pass to `on` or `where` in run_segmentation before spelling a property wrong.

  • Get property values

    List the values one property actually takes on one event, as a flat list of strings. Use it to find the exact spelling of a value before filtering on it, the difference between "IN" and "India" in a where expression is an empty result.

  • Get top events

    The events with the most activity today, each with its count and how far that has moved from the usual. Use it as the quick "what is happening right now" read; get_event_names is the one for discovering the taxonomy over a longer window.

Mixpanel in Claude Code: questions

Does Claude Code see my Mixpanel credential?

No. The credential is stored encrypted in Toolspoke, and the gateway adds it to each call. Claude Code only ever talks to Toolspoke, and the dashboard shows the last four characters of the credential and nothing more.

Will 9 actions crowd Claude Code's context?

No. Toolspoke shows Claude Code five bridge tools, plus a guide where a toolkit has one, and Claude Code searches for the Mixpanel action it needs when it needs it. Adding more toolkits does not add more tools to its list.

Can I add it once for every project?

Yes. Add --scope user to the command and Claude Code keeps Toolspoke in every project on this machine. Without it, the server is added to the project you ran the command in.

What does it cost?

Tool calls are free on every plan, and a Mixpanel call does not run in a sandbox, so it bills nothing.

Try Mixpanel in Claude Code

Free to start, and tool calls cost nothing on any plan.