UsePostHog withoutthe browser
A hedgehog dressed as the headless horseman, riding a toy horse and holding a flaming pumpkin

PostHog, headless

The PostHog MCP pulls your product data into wherever your agents work. Query analytics, debug errors, roll out flags, and run experiments from any MCP-compatible client.

Are you an agent? Read the plain version.

You don't need to use PostHog to use PostHog

Berkan Cesur

Founder, SoundBoost

SoundBoost
“It's really easy to miss an action, or track it wrong, when you do it manually with code. After I discovered the MCP, I can even fix what's wrong in PostHog from my editor. It's the only way I develop new features with PostHog now.”
Read the story

Lezgin Zilan

CTO, Qred

“Hell yes, I'd recommend PostHog. […] Especially the MCP.”
Read the story

2.5x

PostHog

more insights made by agents through the MCP than by people in the web app, in one month

Read the post

"But I like the PostHog UI." Then carry on. Try the new navigation beta and tell Surfaces mini crestSurfaces Team (they'll be thrilled).

What can you do with the PostHog MCP?

Your agent selects from 1200+ tools across 76 categories, then reads or updates your PostHog project for you.

claude — ~/hogflix

✻ Welcome to Claude Code!

cwd: ~/hogflix

>

? for shortcuts

Which agents can use it?

Any MCP client can connect. PostHog hosts the server, so you run nothing. Sign in with your PostHog account, and it sends you to your US or EU data region.

Want skills too? The PostHog AI plugin installs the same MCP server plus more than 30 PostHog skills in one step. It works in Claude Code, Codex, Cursor, and Gemini CLI. If you connect the server by hand, you get the same tools without the bundled skills.

ToastHog
Part of a balanced agent's diet

Your agent gets the full spread

Every product, read and write

Build, ship, and measure from one UI. Your agent can find a bug, ship the fix behind a flag, and check the result.

Scale and Enterprise add-on

Approve change requests from your agent, and manage access with enterprise-managed authorization.

Uses your metric definitions

Ask for MRR, and get the real thing from your semantic layer.

Light on context

Most agent clients only look up tools as needed (tokenminning is tokenwinning).

Use cases

Prompts to copy, from one-line questions to multi-step jobs.

Browse the recipes →

MCP tools reference

Every tool your agent can call, sorted by product.

See every tool →

FAQ and advanced setup

How sign-in works, what it costs, and how to limit what your agent can touch.

Read the FAQ →

No PostHog in your app yet? Your agent can add it

Connect the MCP, then ask your agent to install PostHog in your GitHub repository. The PostHog wizard runs in the cloud, makes the code changes, and opens a pull request for you to review.

Install the PostHog MCP

npx @posthog/wizard mcp add
A hedgehog toy with its arm, ear, shoe, and hat in pieces on the floor around it
Some assembly required (by your agent)

Questions people ask before connecting

The PostHog MCP is a free, hosted Model Context Protocol (MCP) server that lets your AI agent use PostHog. From Claude, Cursor, Codex, VS Code, and other MCP clients, your agent can query analytics, debug errors, roll out feature flags, and run experiments in plain English.

Setup guide

Any AI tool that supports MCP works. We tested and documented setup for Claude Code, Claude Desktop, Cursor, Codex, VS Code, Windsurf, Zed, and PostHog Desktop.

Supported clients

Run npx @posthog/wizard mcp add in your terminal and select your client. The wizard adds the server and signs you in with OAuth. To set it up manually, add the server URL https://mcp.posthog.com/mcp to the MCP settings of your client.

Client setup guides

You need a PostHog account, because your agent signs in to it. It is free to sign up. You do not need to install the PostHog SDK to connect the MCP. But to ask questions about your product data, your project must have events. If you do not send events yet, the PostHog Wizard can add the SDK to your app.

Install PostHog

Yes. Connecting to the MCP server and calling its tools is free. Standard PostHog usage and billing still apply to the data your queries use. Some tools use LLMs internally and can add PostHog AI spend. Those tools need AI data processing to be enabled in your organization, and they are hidden when it is off.

Cost details

It can do both. Your agent can read data, for example to run queries, look at errors, or find session replays. It can also make changes, for example to create dashboards and insights, roll out or turn off feature flags, and set up experiments and surveys. If you want your agent to only read data, use read-only mode. It removes the tools that create, update, or delete data.

All MCP tools

PostHog AI is the AI agent inside the PostHog app. The PostHog MCP brings PostHog to the AI agent that you already use, such as Claude Code, Cursor, or Codex. Use PostHog AI when you work in PostHog. Use the MCP when you work in your editor, terminal, or chat client and want your agent to use your product data next to your code.

About PostHog AI

Review tool calls before they run, because an LLM can be tricked into following untrusted commands. You can also limit the session to read-only tools, filter the tools by feature or name, and pin the agent to one organization or project.

Read-only mode

No. The server is a proxy to your PostHog instance, and it does not store your analytics data. It routes to the US or EU region of the account you sign in with. Queries run against your project, and the results go straight to your AI client.

Data and privacy

Yes. The server allows 480 requests per minute and 4,800 per hour. The limits count per credential, which is the OAuth token or personal API key that your client uses. A request over the limit gets a 429 response with a Retry-After header.

Rate limits

No. OAuth is the recommended way, and the wizard sets it up. If your client does not support OAuth, use a personal API key with the MCP Server preset.

API key setup

Yes, with one MCP connection for each. A single connection signs in as one account and has one active organization and project.

Multiple accounts and projects

Yes, with the Scale or Enterprise platform add-on. Enterprise-managed authorization (ID-JAG) lets Okta, Entra ID, and other identity providers control MCP access, instead of per-user OAuth or API keys.

Enterprise-managed authorization

The waiting room

For agents waiting to be tool-called into the next chat window. Help yourself to something to read.

Go on, pick one up.

Don't keep your agent waiting

Get started – free. One command connects the PostHog MCP to Claude Code, Codex, Cursor, VS Code, and Zed.

Install the PostHog MCP

npx @posthog/wizard mcp add