Skip to content

PostHog MCP Server

Query product analytics with HogQL, manage feature flags and experiments, investigate errors with stack traces, and triage issues directly in PostHog.

Capabilities
Analytics Queries Feature Flags Error Tracking Experiments
Maintained by
PostHog
Hosting
Hosted by the vendor
Authentication
API key
Last checked

Uses a PostHog personal API key; source moved into the PostHog monorepo (services/mcp). Quick install: npx @posthog/wizard@latest mcp add.

How to connect the PostHog MCP server

Pick your AI client and paste the snippet. Swap the YOUR_… placeholders for your own values. New to this? Our guide to how MCP clients and servers fit together explains what each piece does.

Claude Code

Terminal
claude mcp add --transport http posthog https://mcp.posthog.com/mcp \
  --header 'Authorization: Bearer YOUR_PERSONAL_API_KEY'
Full Claude Code setup guide →

Claude Desktop and claude.ai

Settings → Connectors
Custom connectors in Claude accept OAuth or no-auth servers only.
This server expects an API key in a header, so use Claude Code,
Cursor or VS Code instead.
Full Claude Desktop setup guide →

Cursor

~/.cursor/mcp.json (or .cursor/mcp.json in a project)
{
  "mcpServers": {
    "posthog": {
      "url": "https://mcp.posthog.com/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_PERSONAL_API_KEY"
      }
    }
  }
}
Full Cursor setup guide →

VS Code

.vscode/mcp.json
{
  "servers": {
    "posthog": {
      "type": "http",
      "url": "https://mcp.posthog.com/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_PERSONAL_API_KEY"
      }
    }
  }
}
Full VS Code setup guide →

Frequently asked questions

What is the PostHog MCP server?

It is a Model Context Protocol (MCP) server — a small piece of software that gives AI assistants like Claude a secure, governed connection to PostHog. Query product analytics with HogQL, manage feature flags and experiments, investigate errors with stack traces, and triage issues directly in PostHog.

Is there an official PostHog MCP server?

Yes. The PostHog MCP server is an official integration, maintained by the vendor or the Model Context Protocol project, which makes it the safest default for business use. It is maintained by PostHog.

Is the PostHog MCP server hosted, or do I run it myself?

It is hosted. PostHog runs the endpoint at https://mcp.posthog.com/mcp, so there is nothing to install: you add the URL to your AI client and supply an API key.

Do I need an API key for the PostHog MCP server?

Yes. The hosted server expects an API key from your PostHog account, sent in the Authorization header. Store it in your client's secret settings rather than pasting it into shared config files.

What can an AI assistant actually do with PostHog?

Through this server an assistant can work with analytics queries, feature flags, error tracking, experiments — reading from and acting on PostHog directly instead of you copy-pasting between windows. What you allow it to do is controlled by the permissions you grant.

How do I set this up for my business?

The setup section above has copy-paste config for Claude Code, Claude Desktop, Cursor and VS Code. If you want it rolled out across a team with permissions, governance and support handled, that is what Crox's Build engagement covers.

New to MCP? Start with our plain-English guide to the Model Context Protocol or see how to connect AI to your business tools without writing code .

Done-for-you integration

Want this connected to your business — with governance handled?

Crox maps your processes, connects AI to the tools you already use, and keeps it working as models change. Start with a readiness assessment or talk to us about a build.