A favicon of PostHog MCP Server

PostHog MCP Server

A minimal posthog mcp to retrive insights and add annotations

Installation

Installing for Claude Desktop

Manual Configuration Required

This MCP server requires manual configuration. Run the command below to open your configuration file:

npx mcpbar@latest edit -c claude

This will open your configuration file where you can add the PostHog MCP Server MCP server manually.

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 [email protected]: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.

Share:
Details:
  • Stars


    32
  • Forks


    8
  • Last commit


    3 months ago
  • Repository age


    3 months
  • License


    MIT
View Repository

Auto-fetched from GitHub .

MCP servers similar to PostHog MCP Server:

ย 

ย 
ย 
  • Stars


  • Forks


  • Last commit


ย 

ย 
ย 
  • Stars


  • Forks


  • Last commit


ย 

ย 
ย 
  • Stars


  • Forks


  • Last commit


PostHog MCP Server: MCP Server โ€“ MCP.Bar