PostHog MCP server
Last verified: 2026-09
Events and insights from PostHog.
Community Cloud & infra Needs a secret Claude Desktop, Cursor, Windsurf, Claude Code
What it does
Official PostHog MCP. Product analytics, feature flags, and project data through a personal API key. The README is short — connect and list tools, or use their hosted install.
It sits in Cloud & infra: Most of these are admin APIs.
Good for
- Read one insight you already have, not 'dump all events'.
- Inspect a feature flag on staging.
- Keep flag-write off production cohorts.
- Set POSTHOG_HOST if you are not on US cloud.
Tools
- insights / flags / project tools — Read (and maybe write) analytics. Confirm names after connect.
Config (Claude Desktop / Cursor / Windsurf)
Paste the JSON below. Same mcpServers shape. Replace placeholder paths and secrets.
Windows paths look like C:\\Users\\you\\project, not /path/to.
Host-side steps →
Claude Desktop
| OS | Config file |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json
(usually C:\Users\<you>\AppData\Roaming\Claude\) |
| Linux | ~/.config/Claude/claude_desktop_config.json |
Cursor
| Scope | macOS / Linux | Windows |
|---|---|---|
| This project | .cursor/mcp.json in the repo root | |
| This user | ~/.cursor/mcp.json |
%USERPROFILE%\.cursor\mcp.json |
Windsurf
| OS | Config file |
|---|---|
| macOS / Linux | ~/.codeium/windsurf/mcp_config.json |
| Windows | %USERPROFILE%\.codeium\windsurf\mcp_config.json |
{
"mcpServers": {
"posthog": {
"command": "npx",
"args": [
"-y",
"posthog-mcp"
],
"env": {
"POSTHOG_API_KEY": "phx_...",
"POSTHOG_HOST": "https://us.i.posthog.com"
}
}
}
}
Windsurf remote MCP: use serverUrl instead of url if the block below is HTTP.
One-liner: npx -y posthog-mcp
Secrets it wants: POSTHOG_API_KEY, POSTHOG_HOST
How to get started
- Create a PostHog personal API key with the smallest scopes. Set POSTHOG_HOST if you are not on app.posthog.com.
- Ask for one insight you already know exists.
- Do not give flag-write on production until you have seen the tool list.
Access risk
Analytics export is user behavior. Feature-flag write changes production cohorts.
When to skip it
Skip it for Datadog infra metrics or for Stripe billing events.
Vs alternatives
| Server | Official? | Needs a secret? | Best for |
|---|---|---|---|
| PostHog | No | Yes | Events and insights from PostHog. |
| Datadog | No | Yes | Metrics, logs, and monitors. |
| Grafana | No | Yes | Dashboards and datasources. |
| Stripe | No | Yes | Look up customers, payments, and products. |
More in Cloud & infra
FAQ
Which key?
A personal API key with the smallest scopes. Analytics export is user behavior.
Can it change flags?
If the connected tools include flag write, yes — that changes production cohorts.
PostHog or Datadog?
Product analytics vs infra. Different questions.
Official?
Yes — PostHog/mcp. README is short; list tools after connect.