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.
# Install globally
npm install -g mixpanel-mcp-server
# Or use directly with npx
npx mixpanel-mcp-server --token YOUR_MIXPANEL_TOKEN
# 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
Make sure Claude Desktop is installed on your machine
Create or edit the Claude Desktop configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%AppData%\Claude\claude_desktop_config.json
Add the Mixpanel MCP server configuration:
{
"mcpServers": {
"mixpanel-analytics": {
"command": "npx",
"args": [
"-y",
"mixpanel-mcp-server",
"--token",
"YOUR_MIXPANEL_TOKEN"
]
}
}
}
After setup, you can use Mixpanel analytics directly in your conversations with Claude using natural language:
Start the server:
npx mixpanel-mcp-server --token YOUR_MIXPANEL_TOKEN
Connect your MCP client to the server using stdio transport
The client can discover and use the available Mixpanel tools
Tracks custom events in Mixpanel.
Parameters:
event_name
(string, required): The name of the event to trackdistinct_id
(string, optional): User identifier. Defaults to 'anonymous'properties
(object, optional): Additional properties to track with the eventExample:
{
"event_name": "button_clicked",
"distinct_id": "user123",
"properties": {
"button_id": "submit_form",
"page": "checkout"
}
}
Tracks page view events in Mixpanel.
Parameters:
page_name
(string, required): The name of the page vieweddistinct_id
(string, optional): User identifier. Defaults to 'anonymous'referrer
(string, optional): The referring pageExample:
{
"page_name": "homepage",
"distinct_id": "user123",
"referrer": "google.com"
}
Tracks signup events and creates user profiles in Mixpanel.
Parameters:
user_name
(string, required): User's full nameemail
(string, required): User's email addressplan
(string, optional): Signup plan. Defaults to 'free'Example:
{
"user_name": "John Doe",
"email": "[email protected]",
"plan": "premium"
}
Updates user profile properties in Mixpanel.
Parameters:
distinct_id
(string, required): User identifierproperties
(object, required): Profile properties to setExample:
{
"distinct_id": "user123",
"properties": {
"$name": "John Doe",
"$email": "[email protected]",
"plan": "premium",
"company": "Acme Inc"
}
}
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.
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.
Server not starting:
Claude Desktop not showing Mixpanel tools:
Events not appearing in Mixpanel:
For more verbose logging:
npx mixpanel-mcp-server --token YOUR_MIXPANEL_TOKEN --debug
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.
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"
]
}
}
}
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.
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.