PostHog is a Analytics MCP server that lets Claude Code, Cursor, Windsurf and any MCP-compatible AI agent query PostHog events, feature flags, and session replays for product analytics via MCP. Install in 1 minute with mcpizy install posthog.
Analytics
Query PostHog events, feature flags, and session replays for product analytics via MCP.
Official homepageConnect your PostHog account once — MCPizy stores the credentials encrypted and uses them whenever you run a recipe in managed mode.
mcpizy install posthognpx -y @posthog/mcp-serverlist_insightsList product analytics insights
run_insightRun an insight and return the data
Inputs
insight_idstringrequiredlist_feature_flagsList feature flags in the project
update_feature_flagEnable or disable a feature flag
Inputs
flag_keystringrequiredactivebooleanrequiredquery_eventsQuery events with HogQL
Inputs
querystringrequiredlist_cohortsList user cohorts
Works identically across clients. Only the config file path differs.
~/.claude.json{
"mcpServers": {
"posthog": {
"command": "npx",
"args": [
"-y",
"@posthog/mcp-remote"
],
"env": {
"POSTHOG_API_KEY": "phx_...",
"POSTHOG_PROJECT_ID": "12345"
}
}
}
}.cursor/mcp.json{
"mcpServers": {
"posthog": {
"command": "npx",
"args": [
"-y",
"@posthog/mcp-remote"
],
"env": {
"POSTHOG_API_KEY": "phx_...",
"POSTHOG_PROJECT_ID": "12345"
}
}
}
}~/.codeium/windsurf/mcp_config.json{
"mcpServers": {
"posthog": {
"command": "npx",
"args": [
"-y",
"@posthog/mcp-remote"
],
"env": {
"POSTHOG_API_KEY": "phx_...",
"POSTHOG_PROJECT_ID": "12345"
}
}
}
}Paste any of these prompts into Claude Code, Cursor or another MCP-compatible client.
“How many users signed up this week? Break down by source.”
Uses: query_events
“Turn on the `new-checkout-flow` feature flag for 10% of users”
Uses: update_feature_flag
“List all cohorts in my project”
Uses: list_cohorts
If PostHog doesn't fit your stack, these Analytics MCP servers solve similar problems.
The PostHog MCP server is an Analytics Model Context Protocol server that lets Claude Code, Cursor, Windsurf, VS Code with Copilot, and other MCP-compatible AI agents query PostHog events, feature flags, and session replays for product analytics via MCP. It exposes PostHog's capabilities as tools the AI can call directly from your editor or CLI.
The fastest way is the MCPizy CLI: run `mcpizy install posthog` and MCPizy will add the server to your `.claude.json` automatically. You can also install it manually by adding an entry under `mcpServers` in `.claude.json` with the command `npx -y @posthog/mcp-server` and restarting Claude Code.
Yes. The PostHog MCP server is free and open source (see the GitHub repository linked on this page). You may still need a PostHog account or API key to connect the server to the underlying service, but the MCP layer itself has no MCPizy subscription cost.
Yes. Any MCP-compatible client works — including Claude Code, Claude Desktop, Cursor (via `.cursor/mcp.json`), Windsurf, VS Code with Copilot Chat, and custom agents built on the MCP SDK. The same install command targets all of them; only the config file path differs.
Once installed, your AI agent can query PostHog events, feature flags, and session replays for product analytics via MCP directly inside your conversation. Typical use cases include asking Claude Code or Cursor to run PostHog operations, inspect results, chain PostHog with other MCP servers (see our Workflow Recipes), and automate repetitive analytics tasks without leaving your editor.