Mixpanel MCP Server

Mixpanel MCP Server

A Model Context Protocol server that enables AI assistants like Claude to interact with Mixpanel analytics, allowing them to track events, page views, user signups, and update user profiles directly through natural language requests.

Category
访问服务器

README

Mixpanel MCP Server

A Model Context Protocol (MCP) server for integrating Mixpanel analytics into AI workflows. This server allows AI assistants like Claude to track events, page views, user signups, and update user profiles in Mixpanel.

Version 2.0.1 Note: Tool names now include the mixpanel_ prefix to prevent namespace collisions with other analytics MCP servers.

Table of Contents

Features

  • Track custom events in Mixpanel
  • Track page views with referrer information
  • Track user signups and create user profiles
  • Update existing user profiles
  • Simple integration with Claude Desktop and other MCP clients

Installation

Prerequisites

  • Node.js 16 or higher
  • A Mixpanel project token (get one by signing up at Mixpanel)

NPM Installation (Recommended)

# 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

To start using the Mixpanel MCP server with Claude Desktop:

  1. Make sure Claude Desktop is installed on your machine (download from claude.ai/download)

  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 and start tracking analytics!

Detailed Usage

With Claude Desktop

After setting up the configuration file as shown in the Quick Start section, you can use the Mixpanel analytics capabilities directly in your conversations with Claude.

Examples of prompts you can use:

  • "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 john@example.com"
  • "Update user profile information in Mixpanel for user 'user123'"

Claude will use the appropriate Mixpanel MCP tool based on your request.

With Other MCP Clients

This server uses the standard Model Context Protocol and can be integrated with any MCP client:

  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 tools (mixpanel_track_event, mixpanel_track_pageview, mixpanel_track_signup, mixpanel_set_user_profile)

Tool Reference

The Mixpanel MCP server provides the following tools:

mixpanel_track_event

Tracks a custom event 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 a page view event 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 a signup event and creates a user profile 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": "john@example.com",
  "plan": "premium"
}

mixpanel_set_user_profile

Updates a user's 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": "john@example.com",
    "plan": "premium",
    "company": "Acme Inc"
  }
}

Examples

Here are some practical examples of using the Mixpanel MCP server with Claude:

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 sarah@example.com 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

To run the server in debug mode for more verbose logging:

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

Security Notes

  • Your Mixpanel token is stored in the Claude Desktop configuration file. Ensure this file has appropriate permissions
  • Consider using environment variables for sensitive tokens in production environments
  • This server does not implement rate limiting - consider adding additional security measures for production use
  • Events are sent directly to Mixpanel's API - review Mixpanel's privacy policy for data handling practices

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选