← Guides·Analytics MCP servers

Analytics MCP servers

PostHog MCP server: setup, tools and limits

Add PostHog’s official MCP server to Claude Code, Claude, Cursor or VS Code, see what it reads and changes, and lock it to read-only before you ask.

David PombarSwiss army knife at Trackingplan
7 min read · 1452 words

TL;DR The PostHog MCP is PostHog’s own server, hosted at https://mcp.posthog.com/mcp. In Claude Code it’s one command, claude mcp add --transport http posthog https://mcp.posthog.com/mcp -s user, and a browser sign-in. It reads and writes: insights, dashboards, flags, experiments, SQL. Add ?readonly=true before you hand it to anyone. And remember what it can’t see: whether the events it queries were tracked right.

PostHog publishes one MCP server, hosts it, and keeps a setup page for each client. The install takes a minute. The decision that takes longer is how much of PostHog the model should be allowed to touch.

This guide is part of our series on analytics MCP servers. It covers the setup in each client, the tools, the switches that make it safer, and the limit no server fixes.

Diagram of the PostHog MCP: one hosted server at mcp.posthog.com reached from Claude Code with one command, from Claude through the connector directory, from Cursor, VS Code or Zed through PostHog’s wizard, and scoped with read-only mode, feature filters and project pinning.
One hosted server, several ways in. The scope you set decides what the model can change.

What the PostHog MCP server is

It’s an official, remote MCP server that PostHog runs. You don’t install code; your client connects over HTTP to https://mcp.posthog.com/mcp and you sign in with your PostHog account.

Three facts from PostHog’s docs worth knowing before you start:

How to use the PostHog MCP with Claude Code

Run one command, then sign in. In a terminal:

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

The first time Claude Code calls PostHog, it asks you to log in through the browser. -s user makes the server available in every project on your machine.

PostHog’s Claude Code page lists two alternatives:

  1. The wizard. npx @posthog/wizard mcp add detects your clients and installs the server in each.
  2. The plugin. claude plugin install posthog adds the same tools plus slash commands such as /posthog:flags, /posthog:insights, /posthog:errors and /posthog:experiments. Run /mcp afterwards to log in.

Claude Code is the better fit when the answer feeds code: a funnel that explains why a feature flag should stay off, an error that points at a file in the same repository.

Claude, Cursor and the other clients

ClientHow PostHog documents it
Claude (web and desktop)The PostHog connector in Claude’s directory: Connect, then sign in
Claude Desktop, manualnpx -y mcp-remote@latest https://mcp.posthog.com/mcp in claude_desktop_config.json
Cursor, VS Code, Zed, Codexnpx @posthog/wizard mcp add, or each client’s own page
Windsurf, PostHog DesktopTheir own setup pages in PostHog’s docs

On Claude Team or Enterprise, an organization owner can set up enterprise-managed authorization, so members don’t sign in one by one. If your client can’t do OAuth, PostHog’s FAQ describes a personal API key with the MCP Server preset, scoped to one project and sent as Authorization: Bearer. OAuth is the route PostHog recommends.

What it can read and change

A lot. PostHog’s tools reference groups the tools into more than 70 categories, from product analytics and SQL to feature flags, experiments, surveys, session replay, error tracking and the data warehouse. These are the ones an analyst reaches for first, from PostHog’s product analytics MCP page:

ToolReads or writesWhat it does
query-trends, query-funnel, query-retentionReadsRun a trends, funnel or retention query
query-paths, query-stickiness, query-lifecycleReadsRun paths, stickiness and lifecycle queries
query-funnel-actors and the other -actors toolsReadsList the persons behind a data point
execute-sqlReadsRun SQL against events and warehouse data
read-data-schemaReadsList tables, columns, events and properties
insight-create, insight-update, insight-deleteWritesSave, change or delete an insight
dashboard-create, dashboard-update, dashboard-deleteWritesBuild, change or delete a dashboard
dashboards-bulk-deleteWritesDelete up to 100 dashboards in one request
feature-flag-enable, feature-flag-disableWritesTurn a flag on or off
experiment-launchWritesLaunch an experiment

Read that last third again. With default settings, a model that misreads a request can disable a flag in production or delete a hundred dashboards.

Lock it down before the first question

PostHog gives you three switches, all set on the URL or as headers. From PostHog’s FAQ:

  1. Read-only. https://mcp.posthog.com/mcp?readonly=true, or the header x-posthog-read-only: true. Every tool that creates, updates or deletes data drops out.
  2. Only the features you need. ?features=insights,dashboards,sql keeps those categories; ?tools=execute-sql,dashboard-get keeps exact tools. Used together, you get the union of both.
  3. One project. ?project_id= (or organization_id) pins the connection, and the switch-project tools go away. One connection is one account and one active project; add separate entries for others.

PostHog’s own warning is the right one: “Be mindful of prompt injection”. Review tool calls before they run. In Claude, set any write tools you keep to Needs approval.

Limits and cost

What to ask once it’s connected

Ask the model to show the query it ran. In PostHog, the same question can be a trends insight or a SQL query, and the two can count differently.

Before you trust the answers

The PostHog MCP hands the model whatever PostHog stored. If a release renamed checkout_completed, if the event fires twice on a slow confirmation page, or if plan arrives as an empty string on iOS, execute-sql sums the damage and the model explains it as fluently as a correct number. It can’t tell. Nothing in the data says the event was wrong.

So validate the tracking before you give the data to an agent. Trackingplan watches the events your site and apps send to PostHog on real traffic, along with the dataLayer and the consent signals, and catches missing properties, duplicate fires and broken triggers as they appear (PostHog in Trackingplan).

Trackingplan MCP brings that context into the same assistant: what fires, what’s broken, the consent state, attribution, and ad spend from connected ad accounts, next to what PostHog returns. You sign in as yourself, with no API key, and any change it proposes to the tracking plan waits for your approval. The MCP endpoint docs have the setup.

If you’re choosing between servers, our PostHog vs Mixpanel vs Amplitude MCP comparison puts them side by side, and the Mixpanel MCP guide covers the closest alternative.

FAQ

How do I use the PostHog MCP with Claude Code?

Run claude mcp add --transport http posthog https://mcp.posthog.com/mcp -s user in a terminal, then sign in to PostHog in the browser the first time Claude Code calls it. PostHog also offers npx @posthog/wizard mcp add and a Claude Code plugin, installed with claude plugin install posthog, that adds slash commands.

Is the PostHog MCP server official?

Yes. PostHog builds and hosts it at mcp.posthog.com and documents it in its own docs. The old github.com/posthog/mcp repository was archived in January 2026; the code now lives in the PostHog monorepo.

Can the PostHog MCP change or delete things?

Yes, unless you turn that off. Its tools create, update and delete insights, dashboards, feature flags, experiments and more. Add ?readonly=true to the server URL, or send the x-posthog-read-only header, and the tools that create, update or delete data disappear.

Does the PostHog MCP cost anything?

Connecting and calling tools is free, according to PostHog’s FAQ. Normal PostHog usage still applies to the data your queries read, and a few tools that use an LLM internally can count as PostHog AI spend.

Does the PostHog MCP work for EU accounts?

Yes. The same URL routes you to the US or EU region based on the account you sign in with. An account in each region needs its own connection.

David PombarSwiss army knife at Trackingplan

Read more from David, a Senior Product Strategist with 18+ years in digital product development and an atypical error detection knack.

Trackingplan

See everything. Miss nothing.

Your implementations audited around the clock with real-time, real-user data. Real-time alerts about errors or changes in your data, campaigns, pixels, privacy and consent. Let AI flag issues before they cost you.