Free toolGenerate .mcp.json configs for Claude Code, Cursor & Codex →
PostHog logo

PostHog for AI coding agents

Analytics · posthog.com

Claude Code fit
5/5
Visit site →

PostHog's official plugin puts your product analytics inside the editor. The free hosted MCP server at mcp.posthog.com/mcp lets Claude Code, Cursor, Codex, Antigravity or Gemini CLI query funnels, triage errors, ship feature flags and run HogQL in plain English, with OAuth sign-in and a write-approval gate on sensitive changes. The plugin itself bundles no skills. The MCP server serves them on demand through its learn command, so your agent pulls in exactly the PostHog workflow it needs. The free tier covers 1 million events, 5,000 session recordings and 1 million feature flag requests every month with no card, which makes it the cheapest way to give an agent real product data..

Access PostHog analytics, feature flags, experiments, error tracking, and insights directly from Claude Code.

Who PostHog is for

PostHog is an all-in-one product analytics platform: event analytics, session replay, feature flags, experiments, surveys, error tracking, logs, LLM analytics and a data warehouse under one roof. It fits product teams and solo builders who want to see what users actually do, watch replays of confusing sessions, and roll out features behind flags without buying five separate tools. It is also the rare analytics tool your coding agent can drive directly, because the free hosted MCP server turns plain English into queries, flag changes and error triage inside the editor.

Not for: teams that only need simple pageview counts, or companies needing a contractual SLA from day one. If you only want page analytics, a lighter tool costs less thinking.

Pricing

PlanPriceWhat you get
Free$0 a month, no credit cardFull monthly free tier on every product, unlimited members, 1 project, 1-year retention, community support. Usage stops at the limits, so no surprise bills. Covers 97 percent of companies, per PostHog.
Pay as you go$0 base, pay per unitUnlimited usage, 6 projects, 2-year retention, email support, per-product billing limits.
Free allowances, monthlyIncluded in both plansThe first 1M analytics events free every month, plus 5,000 web session recordings (2,500 mobile), 1M feature flag requests, 1,500 survey responses, 100,000 error tracking exceptions, 1M data warehouse rows, 10 GB of logs and 100,000 AI observability events.
Paid rates, first tierPer unit, above the free allowanceAnonymous analytics events $0.00005 each in the 1M to 2M band, falling with volume to $0.000009 above 250M. Identified-event rates differ between sources, so verify them on the official pricing page before budgeting.

Plan structure and free tier checked Nov 30, 2026 on the official pricing page. No seat fees, no minimums. The PostHog AI free credit allowance differs between sources, so it is not listed here.

Setup and integrations

  • Claude Code: run `claude plugin install posthog`, or `/plugin install posthog@claude-plugins-official`. Authenticate with OAuth by running `/mcp`, selecting plugin:posthog:posthog, and following the browser prompts.
  • Fastest setup for any editor: run `npx @posthog/wizard mcp add`. It installs the free hosted server at https://mcp.posthog.com/mcp into PostHog Desktop, Cursor, Claude Code, Claude Desktop, Codex, VS Code or Zed.
  • Codex: run `codex plugin marketplace add PostHog/ai-plugin`, then inside Codex run `/plugins`, select PostHog and install. Trust the plugin hook at startup and after each update.
  • Cursor: install from the Cursor Marketplace. The MCP connection runs through Cursor's hosted service, so Cursor holds your PostHog sign-in.
  • Antigravity: run `agy plugin install https://github.com/PostHog/ai-plugin`, then `/mcp`, select posthog_posthog, and choose Authenticate.
  • Gemini CLI: run `gemini extensions install https://github.com/PostHog/ai-plugin`.
  • Manual setup: point any MCP client at https://mcp.posthog.com/mcp. The auth server routes you to the US or EU region based on your account.
  • SDKs for JavaScript, React, Next.js, Python, iOS and Android, plus a snippet for any site. Flags and experiments ship with the same SDK. A PostHog CLI covers terminal, scripts and CI, and a VS Code extension adds inline analytics and replay links in the editor.
  • Optional session capture: set POSTHOG_LLMA_CC_ENABLED=true with a POSTHOG_API_KEY to send Claude Code sessions to PostHog LLM Analytics. Set POSTHOG_LLMA_PRIVACY_MODE=true to redact prompt and output content.
  • Self-hosted: set POSTHOG_MCP_URL to your own instance's MCP endpoint.

Pros and limitations

Pros

  • The free tier stacks across products: every product has its own monthly free allowance, all free at once.
  • No seats, no base fee, no minimums: you pay only for the products you use, and per-product billing limits cap each one separately.
  • One platform replaces five tools, sharing one install and one data model, and it is open source (MIT) with a self-host option.
  • The MCP server is free and hosted, so nothing runs on your machine, and your agent can read and write across products in plain English: flags, experiments, dashboards, errors, surveys and HogQL.
  • A write-approval gate asks before deletions and sensitive writes, and cross-project calls prompt while the gate is on.
  • Skills are served on demand through the server's learn command, so the agent pulls in only the workflow it needs instead of loading every skill into context.

Limitations

  • Per-unit rates vary by product and volume, and anonymous and identified events bill at different rates. Verify the current rates on the official pricing page before budgeting.
  • Usage-based pricing is hard to predict at scale, since every product meters separately.
  • On the free plan, usage past the limit is dropped, not billed, which protects your wallet but loses data in the week a launch goes well.
  • The default SDK records a $pageleave event per pageview, so 1M pageviews can burn about 2M events. Turn off page-leave capture if you want pageviews to match events.
  • Some MCP tools use LLMs internally and bill as PostHog AI spend, and they only appear when AI data processing is enabled in your organization settings.
  • In Cursor, the MCP connection runs through Cursor's hosted service, and you may need to sign in again after a plugin update. In Codex, you must re-trust the plugin hook after each update.
  • Server SDK v1 releases (Node 6, Python 8, Go v2, Rust 1.0) carry breaking changes. Check the migration guides before upgrading.

Alternatives

Pick Amplitude instead for dedicated product analytics with deeper funnel tooling. Pick Plausible instead for lightweight, privacy-friendly page analytics. Pick Fullstory instead when session replay is the whole job. Setup guide: How to add PostHog analytics with Claude Code. Compare: PostHog vs Amplitude and PostHog vs Plausible.

Builder's Verdict

PostHog is the best free analytics stack for a builder: one install, five products, and a free tier that genuinely covers an MVP, now with an agent that can query it and ship flags from the editor. Set a billing limit on every product the day you add a card, turn off $pageleave capture if you want pageviews to match events, and keep the write gate on so the agent asks before it deletes anything. For a small team that wants analytics plus flags plus replay without five vendors, it is hard to beat.

How PostHog works in each agent

Scores appear only after we verify them, with a source and date. Methodology

Agent-Ready
3.7/5
AgentScoreMCPRemote / OAuthSkill / pluginVerified
C Claude Code 5/5 Yes Unknown Yes Oct 16, 2026
X OpenAI Codex 3/5 Yes Unknown Unknown Oct 16, 2026
▲ Cursor 3/5 Yes Unknown Unknown Oct 16, 2026
G GitHub Copilot 3/5 Yes Unknown Unknown Oct 16, 2026
A Google Antigravity Not verified.

Setup by agent

Claude Code
/plugin install posthog@claude-plugins-official

Source: https://code.claude.com/docs/en/discover-plugins

Trust: Official Listed in Anthropic's official plugin marketplace

Evidence

Checked plugin README at https://github.com/PostHog/ai-plugin and MCP docs at https://posthog.com/docs/model-context-protocol (plugin bundles no skills; MCP server provides skills on demand), November 30, 2026

Claude Code support

Plugin
Yes
Official marketplace
Yes
MCP server
Yes
Skills
Via MCP