PostHog MCP Server — Claude Code MCP server: setup and tools
Connects PostHog analytics and feature flag management to AI assistants via Streamable HTTP.
claude mcp add --transport http mcp https://mcp.posthog.com/mcpWhat PostHog MCP Server does
This remote server connects AI clients to PostHog data through https://mcp.posthog.com/mcp. The assistant can query event trends and inspect active dashboards. It also handles operational tasks like generating feature flags or launching experiments with custom funnels.
Communication runs over HTTP. Clients must pass a personal PostHog API key in the Authorization header as a Bearer token. Tools can be filtered by appending parameters to the endpoint URL, such as ?features=flags,workspace,dashboards.
Without a personal PostHog API token, requests to the remote endpoint will fail.
What it helps with
- inspect daily signup trends and aggregated user counts
- create feature flags with targeting rules and percentage rollouts
- set up A/B tests with custom funnel metrics
- fetch recent error groups and identify affected user counts
Example prompts for the agent
- Create a feature flag named checkout-v2 with a 20% rollout and print its settings
- Count unique users who signed up over the last 7 days grouped by day
- List the top 5 error issues this week along with affected user counts
How to install PostHog MCP Server
Platform CLI: remote server
claude mcp add --transport http mcp https://mcp.posthog.com/mcpPlatform CLI: remote server
codex mcp add mcp --url https://mcp.posthog.com/mcpConfig file
{
"mcpServers": {
"mcp": {
"url": "https://mcp.posthog.com/mcp"
}
}
}Config file
{
"servers": {
"mcp": {
"type": "http",
"url": "https://mcp.posthog.com/mcp"
}
}
}Platform CLI: remote server
gemini mcp add -t http mcp https://mcp.posthog.com/mcpStep by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about PostHog MCP Server
How do I install PostHog MCP Server in Claude Code?
Run claude mcp add --transport http mcp https://mcp.posthog.com/mcp in your CLI. You can also run npx @posthog/wizard@latest mcp add for interactive onboarding.
What does PostHog MCP Server do?
It exposes PostHog event queries, error tracking issues, feature flags, and experiment configuration directly to your coding assistant.
How can I restrict which tools the server exposes?
Add query parameters to the URL, such as https://mcp.posthog.com/mcp?features=flags,workspace,dashboards. Only tools associated with the specified features will be loaded.