PostHog MCP Server
Lets agents query product analytics and SQL, manage feature flags and experiments, and triage errors in PostHog.
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?
Is the PostHog MCP server free?
Do I need a PostHog API key?
Can I stop the agent from changing my PostHog project?
?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
- PostHog docs: Model Context Protocol (MCP)
- PostHog MCP FAQ and advanced setup
- PostHog MCP for Claude Code
- PostHog MCP for Codex
- PostHog MCP for Cursor
- PostHog MCP for VS Code
- Server source: PostHog/posthog, services/mcp
Checked October 15, 2026.
