Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

posthog-mcp

MCP.Pizza Chef: PostHog

PostHog MCP Server is a lightweight MCP server enabling direct interaction with PostHog analytics. It allows users to list projects and create annotations with timestamps, integrating PostHog data into AI workflows. Designed for easy setup with Python 3.10+, it supports managing PostHog projects and insights programmatically via the Model Context Protocol.

Use This MCP server To

List all PostHog projects in an organization Create timestamped annotations on PostHog projects Integrate PostHog analytics data into AI-driven workflows Manage PostHog project metadata through MCP clients Automate annotation creation based on model insights Enable real-time PostHog data access for AI copilots

README

PostHog MCP Server πŸ“Š

A Model Context Protocol (MCP) server for interacting with PostHog. Create annotations and manage projects directly through Claude Desktop!

Features πŸš€

  • List Projects: View all available PostHog projects in your organization
  • Create Annotations: Add annotations to your PostHog projects with optional timestamps [this list can be much longer, anything our api has basically...]

Setup πŸ› οΈ

  1. Prerequisites

    • Python 3.10 or higher
    • uv package manager
    • PostHog API Key with annotation:write and project:read scopes obtained from your project settings
  2. Installation

    # clone the repo
    git clone git@github.com:PostHog/posthog-mcp.git
    
    # or if https, use: git clone https://github.com/PostHog/posthog-mcp.git
    
    cd posthog-mcp
    
    uv venv
    source .venv/bin/activate
    
    # Install dependencies
    uv pip install .
  3. Configuration

    • Create a .env file in the project root:
      PERSONAL_API_KEY=phx_your_posthog_api_key_here
      
  4. Claude Desktop Setup

    • Install Claude Desktop
    • Open Claude Desktop settings and click "Edit Config". Alternatively, you can open the file from:
      • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
      • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • Add this to your claude_desktop_config.json (adjust paths according to your system):
      {
        "mcpServers": {
          "posthog": {
            "command": "/path/to/uv",  # Get this by running: which uv
            "args": [
              "--directory",
              "/path/to/your/posthog-mcp",  # Full path to this project
              "run",
              "posthog_mcp"
            ]
          }
        }
      }
      Check the latest documentation on setting up Claude Desktop as MCP client if you ran into any issues.

Usage πŸ’‘

After setup, you'll see a hammer πŸ”¨ icon in Claude Desktop. The following commands are available:

List Projects

Ask Claude:

"List my PostHog projects"

Get and Search for Insights

Ask Claude:

"List my PostHog insights" or "Search for revenue insights in my PostHog"

Search for documentations online

You can ask:

  • "how can i do reverse proxy in nextjs in posthog?"

Create Annotation

Using the Project ID you get from the list of projects, ask Claude:

"Create a PostHog annotation in project 53497 saying 'Deployed v1.2.3'"

or with a specific date:

"Create a PostHog annotation in project 53497 for March 20th saying 'Started new marketing campaign'"

Troubleshooting πŸ”

  • If the hammer icon doesn't appear, restart Claude Desktop
  • Check logs at ~/Library/Logs/Claude/mcp*.log (macOS) or %APPDATA%\Claude\logs (Windows)
  • Verify your PostHog API key has the correct permissions
  • Make sure all paths in claude_desktop_config.json are absolute paths

Contributing 🀝

Feel free to open issues and PRs! We follow PostHog's contribution guidelines.

posthog-mcp FAQ

How do I authenticate the PostHog MCP server?
Use a PostHog API key with 'annotation:write' and 'project:read' scopes from your project settings.
What are the prerequisites for running the PostHog MCP server?
Python 3.10 or higher and the 'uv' package manager are required.
Can I create annotations with specific timestamps?
Yes, the server supports adding annotations with optional timestamps to projects.
How do I install the PostHog MCP server?
Clone the GitHub repo, set up a Python virtual environment, and install dependencies using 'uv pip install .'.
Is the PostHog MCP server compatible with multiple LLM providers?
Yes, it works with models like OpenAI, Claude, and Gemini through the MCP protocol.
Can I list all projects in my PostHog organization?
Yes, the server provides functionality to retrieve and list all available projects.
How do I configure the PostHog MCP server?
Configuration is done via a '.env' file where you specify your API key and other settings.
Does the server support other PostHog API features?
It can be extended to support any PostHog API features beyond annotations and project listing.