Back
Marketplace/PostHog

TL;DR

PostHog is a Analytics MCP server that lets Claude Code, Cursor, Windsurf and any MCP-compatible AI agent query PostHog events, feature flags, and session replays for product analytics via MCP. Install in 1 minute with mcpizy install posthog.

🦔

PostHog

Verified 6 tools Supports hosted execution →

Analytics

Last updated June 1, 2026 · By MCPizy team

Query PostHog events, feature flags, and session replays for product analytics via MCP.

Official homepage

Run PostHog without any local install

Connect your PostHog account once — MCPizy stores the credentials encrypted and uses them whenever you run a recipe in managed mode.

Checking connection…

Install PostHog

Via MCPizy CLI (recommended):
mcpizy install posthog
Or run directly:
npx -y @posthog/mcp-server
View on GitHub

Tools exposed

6 tools available
list_insights

List product analytics insights

run_insight

Run an insight and return the data

Inputs

  • insight_idstringrequired
list_feature_flags

List feature flags in the project

update_feature_flag

Enable or disable a feature flag

Inputs

  • flag_keystringrequired
  • activebooleanrequired
query_events

Query events with HogQL

Inputs

  • querystringrequired
list_cohorts

List user cohorts

Configuration

Works identically across clients. Only the config file path differs.

Claude Code~/.claude.json
{
  "mcpServers": {
    "posthog": {
      "command": "npx",
      "args": [
        "-y",
        "@posthog/mcp-remote"
      ],
      "env": {
        "POSTHOG_API_KEY": "phx_...",
        "POSTHOG_PROJECT_ID": "12345"
      }
    }
  }
}
Cursor.cursor/mcp.json
{
  "mcpServers": {
    "posthog": {
      "command": "npx",
      "args": [
        "-y",
        "@posthog/mcp-remote"
      ],
      "env": {
        "POSTHOG_API_KEY": "phx_...",
        "POSTHOG_PROJECT_ID": "12345"
      }
    }
  }
}
Windsurf~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "posthog": {
      "command": "npx",
      "args": [
        "-y",
        "@posthog/mcp-remote"
      ],
      "env": {
        "POSTHOG_API_KEY": "phx_...",
        "POSTHOG_PROJECT_ID": "12345"
      }
    }
  }
}

Authentication setup

  1. 1

    Create a personal API key with the necessary scopes

    Get it POSTHOG_API_KEY
  2. 2

    Copy your Project ID from PostHog settings

    Get it POSTHOG_PROJECT_ID

What you can do with PostHog MCP

Paste any of these prompts into Claude Code, Cursor or another MCP-compatible client.

“How many users signed up this week? Break down by source.”

Uses: query_events

“Turn on the `new-checkout-flow` feature flag for 10% of users”

Uses: update_feature_flag

“List all cohorts in my project”

Uses: list_cohorts

Works with

Claude Code
Claude Desktop
Cursor
Windsurf
VS Code + Copilot
Any MCP Client

More Analytics MCPs

📉

Mixpanel

Query Mixpanel events, funnels, and cohorts for product analytics from AI agents.

Alternatives to PostHog

If PostHog doesn't fit your stack, these Analytics MCP servers solve similar problems.

📊

Google Analytics

Official Google Analytics MCP Server. Query traffic data, user behavior, and conversion metrics.

📊

PlainSignal

Real-time website analytics data. Privacy-friendly, lightweight analytics.

📊

Amplitude

Query Amplitude product analytics, cohorts, and funnels from AI-powered workflows.

Key Takeaways

  • PostHog exposes 6 tools for analytics workflows in Claude Code, Cursor and Windsurf.
  • Authentication: 2 steps (POSTHOG_API_KEY, POSTHOG_PROJECT_ID).
  • Install in 1 command: mcpizy install posthog — config written to your client automatically.
  • Free and open source (GitHub source linked above) — verified compatible with every MCP client (Claude Code, Claude Desktop, Cursor, Windsurf, VS Code + Copilot).
  • Best use case: "How many users signed up this week? Break down by source.".

Frequently asked questions

What is the PostHog MCP server?

The PostHog MCP server is an Analytics Model Context Protocol server that lets Claude Code, Cursor, Windsurf, VS Code with Copilot, and other MCP-compatible AI agents query PostHog events, feature flags, and session replays for product analytics via MCP. It exposes PostHog's capabilities as tools the AI can call directly from your editor or CLI.

How do I install PostHog MCP with Claude Code?

The fastest way is the MCPizy CLI: run `mcpizy install posthog` and MCPizy will add the server to your `.claude.json` automatically. You can also install it manually by adding an entry under `mcpServers` in `.claude.json` with the command `npx -y @posthog/mcp-server` and restarting Claude Code.

Is PostHog MCP free?

Yes. The PostHog MCP server is free and open source (see the GitHub repository linked on this page). You may still need a PostHog account or API key to connect the server to the underlying service, but the MCP layer itself has no MCPizy subscription cost.

Does PostHog MCP work with Cursor and Windsurf?

Yes. Any MCP-compatible client works — including Claude Code, Claude Desktop, Cursor (via `.cursor/mcp.json`), Windsurf, VS Code with Copilot Chat, and custom agents built on the MCP SDK. The same install command targets all of them; only the config file path differs.

What can I do with PostHog MCP?

Once installed, your AI agent can query PostHog events, feature flags, and session replays for product analytics via MCP directly inside your conversation. Typical use cases include asking Claude Code or Cursor to run PostHog operations, inspect results, chain PostHog with other MCP servers (see our Workflow Recipes), and automate repetitive analytics tasks without leaving your editor.

Manage all your MCPs in one place

Monitor usage, track costs, and discover new MCPs.

Get Started Free