Skip to main content
Guide2 min read

PostHog MCP server: query analytics & flags from Claude (2026)

Run HogQL, inspect funnels, ship feature flags and triage errors from your editor with PostHog's official hosted MCP server. Setup, auth and scoping.

A PostHog MCP server lets an AI coding agent reach your product analytics directly — query trends, funnels and retention with plain-English questions, ship a feature flag from a prompt, or dig into a stack trace without leaving the editor. PostHog runs the server for you as a free hosted endpoint, so setup is mostly auth. Here's the path.

Install — hosted endpoint

The official server lives at https://mcp.posthog.com/mcp and works with any MCP client: Claude Code, Claude Desktop, Cursor, Codex, VS Code, Zed and more. The fastest install is the PostHog wizard, which writes the config for you:

npx -y @posthog/wizard@latest mcp add

Prefer to wire it by hand? Add it as a remote HTTP server — for Claude Code:

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

The first time the agent calls a tool you'll be prompted to log in to PostHog; the auth server automatically routes you to the right data region (US or EU) based on your account. For a self-hosted PostHog instance, set POSTHOG_MCP_URL to your own endpoint.

What you can ask

Once connected, the agent works across analytics and engineering in one place: "what's the 7-day retention on the new onboarding?", "run a HogQL query for sign-ups by source," "create a feature flag for the beta and roll it to 10%," or "summarise the top errors this week." Because it queries trends, funnels, flags and error tracking, it closes the loop between shipping code and watching what it does.

Scope it safely

Analytics access can expose user-level data, so start read-only: explore queries and insights before granting anything that writes. Feature-flag and CDP actions change live product behaviour — keep a human in the loop for rollouts, and never paste long-lived credentials into shared configs. PostHog's OAuth flow keeps tokens out of your config file, which is the right default. See MCP security best practices and memory privacy for AI agents.

Going further

See the PostHog agent profile, weigh it against rivals in best MCP servers for product analytics, or compare two leaders in Amplitude MCP vs Mixpanel MCP. Wire it into a data-analyst loadout or browse the data-analysis category.

Loadout

Build your AI agent loadout

The directory of MCP servers and AI agents that actually work. Pick the right loadout for Slack, Postgres, GitHub, Figma and 20+ integrations — with install commands ready to paste into Claude Desktop, Cursor or your own stack.

© 2026 Loadout. Built on Angular 21 SSR.