Mixpanel Analytics MCP server

Track analytics events in Mixpanel, supporting custom events, page views, user profiles, and signups.
Back to servers
Provider
Ciara Adkins
Release date
Apr 18, 2025
Language
TypeScript
Stats
4 stars

The Mixpanel MCP server allows AI assistants like Claude to interact with Mixpanel analytics, enabling event tracking, page view logging, user signup tracking, and user profile management directly from your AI interactions.

Installation

Prerequisites

  • Node.js 16 or higher
  • A Mixpanel project token (from Mixpanel)

NPM Installation

# Install globally
npm install -g mixpanel-mcp-server

# Or use directly with npx
npx mixpanel-mcp-server --token YOUR_MIXPANEL_TOKEN

Manual Installation

# Clone the repository
git clone https://github.com/yourusername/mixpanel-mcp-server.git
cd mixpanel-mcp-server

# Install dependencies
npm install

# Run the server
node index.js --token YOUR_MIXPANEL_TOKEN

Quick Start with Claude Desktop

  1. Make sure Claude Desktop is installed on your machine

  2. Create or edit the Claude Desktop configuration file:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %AppData%\Claude\claude_desktop_config.json
  3. Add the Mixpanel MCP server configuration:

{
  "mcpServers": {
    "mixpanel-analytics": {
      "command": "npx",
      "args": [
        "-y",
        "mixpanel-mcp-server",
        "--token",
        "YOUR_MIXPANEL_TOKEN"
      ]
    }
  }
}
  1. Restart Claude Desktop to activate the analytics capabilities

Using the Mixpanel MCP Server

With Claude Desktop

After setup, you can use Mixpanel analytics directly in your conversations with Claude using natural language:

  • "Track a custom event in Mixpanel named 'document_generated' for user 'user123'"
  • "Track a page view for the homepage in Mixpanel"
  • "Create a new user profile in Mixpanel for John Doe with email [email protected]"
  • "Update user profile information in Mixpanel for user 'user123'"

With Other MCP Clients

  1. Start the server:

    npx mixpanel-mcp-server --token YOUR_MIXPANEL_TOKEN
    
  2. Connect your MCP client to the server using stdio transport

  3. The client can discover and use the available Mixpanel tools

Available Tools

mixpanel_track_event

Tracks custom events in Mixpanel.

Parameters:

  • event_name (string, required): The name of the event to track
  • distinct_id (string, optional): User identifier. Defaults to 'anonymous'
  • properties (object, optional): Additional properties to track with the event

Example:

{
  "event_name": "button_clicked",
  "distinct_id": "user123",
  "properties": {
    "button_id": "submit_form",
    "page": "checkout"
  }
}

mixpanel_track_pageview

Tracks page view events in Mixpanel.

Parameters:

  • page_name (string, required): The name of the page viewed
  • distinct_id (string, optional): User identifier. Defaults to 'anonymous'
  • referrer (string, optional): The referring page

Example:

{
  "page_name": "homepage",
  "distinct_id": "user123",
  "referrer": "google.com"
}

mixpanel_track_signup

Tracks signup events and creates user profiles in Mixpanel.

Parameters:

  • user_name (string, required): User's full name
  • email (string, required): User's email address
  • plan (string, optional): Signup plan. Defaults to 'free'

Example:

{
  "user_name": "John Doe",
  "email": "[email protected]",
  "plan": "premium"
}

mixpanel_set_user_profile

Updates user profile properties in Mixpanel.

Parameters:

  • distinct_id (string, required): User identifier
  • properties (object, required): Profile properties to set

Example:

{
  "distinct_id": "user123",
  "properties": {
    "$name": "John Doe",
    "$email": "[email protected]",
    "plan": "premium",
    "company": "Acme Inc"
  }
}

Practical Examples

Tracking a Button Click

You: Can you track an event in Mixpanel when a user clicks the submit button?

Claude: I'll track that event for you. Let me use the Mixpanel analytics tool.

[Claude uses the mixpanel_track_event tool with appropriate parameters]

Claude: I've successfully tracked the 'button_clicked' event in Mixpanel with the properties you specified.

Creating a User Profile

You: Create a new user profile in Mixpanel for Sarah Johnson who signed up with [email protected] on the premium plan.

Claude: I'll create that user profile in Mixpanel.

[Claude uses the mixpanel_track_signup tool with appropriate parameters]

Claude: I've successfully tracked the signup for Sarah Johnson and created a profile in Mixpanel with the premium plan.

Troubleshooting

Common Issues

  1. Server not starting:

    • Ensure you've provided a valid Mixpanel token
    • Check that Node.js is installed and is version 16 or higher
  2. Claude Desktop not showing Mixpanel tools:

    • Verify your claude_desktop_config.json file syntax
    • Make sure you've restarted Claude Desktop after editing the config
    • Check that the path to the server is correct
  3. Events not appearing in Mixpanel:

    • Verify your Mixpanel token is correct
    • Check your Mixpanel project settings to ensure data is being received
    • Events may take a few minutes to appear in the Mixpanel interface

Debug Mode

For more verbose logging:

npx mixpanel-mcp-server --token YOUR_MIXPANEL_TOKEN --debug

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later