OfficialObservabilityremote HTTP

PostHog MCP Server

Lets agents query product analytics and SQL, manage feature flags and experiments, and triage errors in PostHog.

Install

Any supported client

(the PostHog Wizard installs into Claude Code, Claude Desktop, Codex, Cursor, VS Code, Zed and PostHog Desktop)

npx @posthog/wizard mcp add

Claude Code

claude mcp add --transport http posthog https://mcp.posthog.com/mcp -s user

Or install the PostHog plugin, which adds the same tools plus slash commands such as /posthog:flags and /posthog:errors; then run /mcp and log in:

claude plugin install posthog

Codex

(Codex supports native OAuth, so it prompts you to log in on first use)

codex mcp add posthog --url https://mcp.posthog.com/mcp

Or add the plugin marketplace, then pick PostHog from /plugins inside codex:

codex plugin marketplace add PostHog/ai-plugin

Cursor

(Cursor Settings > Tools & Integrations > New MCP Server; the plugin is also on the Cursor Marketplace)

{
  "mcpServers": {
    "posthog": {
      "url": "https://mcp.posthog.com/mcp"
    }
  }
}

VS Code with GitHub Copilot

(run MCP: Open User Configuration and add this to mcp.json)

{
  "servers": {
    "posthog": {
      "type": "http",
      "url": "https://mcp.posthog.com/mcp"
    }
  }
}

Commands and configuration as given in PostHog’s per-client pages: Claude Code, Codex, Cursor and VS Code.

The PostHog MCP server is PostHog’s hosted server that lets coding agents query analytics, flags and errors.

The PostHog MCP server is PostHog’s own hosted Model Context Protocol endpoint at https://mcp.posthog.com/mcp. It exposes feature flags, product analytics, error tracking, experiments, SQL queries, CDP, surveys and more as MCP tools, so an agent can answer “What are the top 5 errors in my project this week?” or ship a feature flag from a prompt (PostHog docs). The source lives in the PostHog/posthog repository under services/mcp, as the @posthog/mcp package with an MIT license in its package.json.

Sign-in is OAuth by default: the first time the agent uses the server you log in to PostHog in the browser, and the auth server routes you to the US or EU region of your account. A client without OAuth can send a personal API key created with the MCP Server preset as an Authorization: Bearer header (PostHog MCP FAQ). Connecting and calling tools is free; PostHog says some tools run LLMs internally and may be billed as PostHog AI spend, and those appear only when AI data processing is enabled for the organization.

PostHog warns: “Be mindful of prompt injection – LLMs can be tricked into following untrusted commands, so always review tool calls before executing them.” To limit what an agent can change, the FAQ documents read-only mode (https://mcp.posthog.com/mcp?readonly=true or the x-posthog-read-only header), a features parameter that exposes only chosen tool categories, and headers that pin the session to one organization or project.

Questions

Is the PostHog MCP server official?
Yes. PostHog documents it on posthog.com and publishes its source in the PostHog/posthog repository, where the README calls it “The official MCP server for PostHog.”
Is the PostHog MCP server free?
Connecting to it and calling its tools is free. Standard PostHog usage and billing still apply to the data your queries consume, and AI-powered tools may be billed as PostHog AI spend.
Do I need a PostHog API key?
No. OAuth is the recommended path and works with the wizard. A personal API key with the MCP Server preset is the fallback for clients that do not support OAuth.
Can I stop the agent from changing my PostHog project?
Yes. Add ?readonly=true to the server URL or send the x-posthog-read-only header, and only read tools are exposed. You can also narrow the tool list with features and pin one project.

Sources

Checked October 15, 2026.

Observability

View all
Aftergradient

What are you looking for?

Search commands, errors, tools