Basic information
About PostHog MCP Server
Official PostHog MCP Server for product analytics, feature flags, experiments, and more.
PostHog is a remote MCP server in the Data & Analytics category listed in the AddMCP.net directory, published by PostHog. It exposes 1 tool, including Logs. Supported transport: Streamable HTTP. Runtime: Python. License: MIT. The repository has 40,577 GitHub stars. Source code is hosted on github.com. Related topics: ab-testing, ai-analytics, analytics, cdp, data-warehouse.
Connection details
https://mcp.posthog.com/mcp
Setup
claude mcp add posthog --transport http https://mcp.posthog.com/mcp
[mcp_servers.posthog] url = "https://mcp.posthog.com/mcp"
{
"mcpServers": {
"posthog": {
"url": "https://mcp.posthog.com/mcp"
}
}
}
{
"servers": {
"posthog": {
"type": "http",
"url": "https://mcp.posthog.com/mcp"
}
}
}
PostHog MCP Server config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"posthog": {
"type": "http",
"url": "https://mcp.posthog.com/mcp"
}
}
}
PostHog MCP Server tools
- Logs — `query-logs` and related log tools for querying and alerting.
Overview
What is PostHog?
The PostHog MCP server is PostHog's official, free, hosted Model Context Protocol endpoint (https://mcp.posthog.com/mcp) that lets AI agents query analytics, run SQL, manage feature flags and experiments, and triage errors in your PostHog project.
It is a remote server with nothing to run locally. You add the URL to an MCP client such as Claude Code, Claude Desktop, Cursor, Codex, VS Code, Windsurf or Zed, sign in to PostHog through OAuth, and the agent can read and write across PostHog products. The source lives in the PostHog monorepo under services/mcp; the older PostHog/mcp repository now only points there.
How to use PostHog?
You need a PostHog account (US or EU Cloud). No API key is required for OAuth-capable clients: the first time the agent uses the server, a browser window opens so you can log in, and the PostHog auth server routes you to the correct data region automatically.
The fastest route is the PostHog Wizard, which installs the PostHog MCP server into PostHog Desktop, Cursor, Claude Code, Claude Desktop, Codex, VS Code and Zed:
npx @posthog/wizard mcp add
Claude Code
claude mcp add --transport http posthog https://mcp.posthog.com/mcp -s user
Alternatively, install the PostHog plugin, which ships the same tools plus slash commands such as /posthog:flags, /posthog:insights and /posthog:errors:
claude plugin install posthog
After installing, run /mcp and follow the browser prompts to log in.
Claude Desktop
Use the PostHog connector in the Claude connector directory and click Connect. To configure it manually, open Settings > Developer > Edit Config and add:
{
"mcpServers": {
"posthog": {
"command": "npx",
"args": ["-y", "mcp-remote@latest", "https://mcp.posthog.com/mcp"]
}
}
}
Cursor
Install the PostHog plugin from the Cursor Marketplace, or add this to mcp.json under Cursor Settings > Tools & Integrations > New MCP Server:
{
"mcpServers": {
"posthog": {
"url": "https://mcp.posthog.com/mcp"
}
}
}
VS Code
Run MCP: Open User Configuration from the command palette and add:
{
"servers": {
"posthog": {
"type": "http",
"url": "https://mcp.posthog.com/mcp"
}
}
}
The server is then available in Copilot chat.
Codex
codex mcp add posthog --url https://mcp.posthog.com/mcp
Codex supports native OAuth, so you are prompted to log in on first use.
Windsurf
Under Windsurf Settings > Cascade > MCP Servers > Manage MCP Servers > View raw config, add the same mcp-remote block shown for Claude Desktop to mcp_config.json.
Using an API key instead of OAuth
If your client cannot do OAuth, create a personal API key with the MCP Server preset and send it as a header:
{
"mcpServers": {
"posthog": {
"url": "https://mcp.posthog.com/mcp",
"headers": {
"Authorization": "Bearer ${POSTHOG_API_KEY}"
}
}
}
}Key features of PostHog
- Official and maintained by PostHog, hosted at a single Streamable HTTP endpoint.
- OAuth sign-in with automatic US/EU region routing; personal API keys as a fallback.
- Covers analytics, SQL (HogQL), dashboards, insights, feature flags, experiments, surveys, session replay, error tracking, logs, CDP destinations and support tickets.
- Two tool modes: CLI mode exposes a single token-saving
exectool, while tools mode registers every tool individually. Mode is auto-detected and can be overridden with?mode=clior?mode=tools. - Read-only sessions via
?readonly=trueor thex-posthog-read-onlyheader. - Tool filtering by category (
?features=flags,dashboards,insights) or exact name (?tools=dashboard-get,execute-sql). - Context pinning with
x-posthog-organization-idandx-posthog-project-idheaders. - Acts as a proxy: it does not store your analytics data.
PostHog tools
The server exposes hundreds of tools, grouped by PostHog product:
- Analytics and SQL:
execute-sqlruns SQL queries, and query tools such asquery-trendsandquery-funnelrun insight-style queries. Dashboard tools (dashboard-get,dashboard-create,dashboards-get-all) read and build dashboards. - Feature flags and experiments:
feature-flag-get-all,create-feature-flag,update-feature-flag,experiment-createandexperiment-results-getlet an agent ship and evaluate rollouts. - Error tracking: tools such as
query-error-tracking-issues-listanderror-tracking-issues-partial-updatelist, inspect, assign and resolve issues. - Users and data:
persons-list,cohorts-create,session-recording-get,surveys-get-allandsurvey-create. - Logs:
query-logsand related log tools for querying and alerting. - Workspace and docs:
switch-organization,switch-project,projects-get, anddocs-searchfor PostHog documentation.
In CLI mode, the agent uses exec to search, inspect and call these tools on demand, and render-ui can draw visualizations in clients that support MCP apps.
Use cases of PostHog
- Debug production errors from the editor: "What are the top 5 errors in my project this week?" then "Show me the full stack trace for the most recent crash, then propose a fix."
- Ship a feature flag from a prompt: "Create a flag called new-checkout rolled out to 10% of users."
- Ask product questions in plain language or SQL: "How many users signed up last week, broken down by country?"
- Check experiment results: "Summarize the results of the pricing-page experiment."
- Triage issues and route ownership: "Mark this issue as resolved and assign all future TypeErrors to the backend team."
- Build dashboards: "Create a dashboard with daily active users and the signup funnel."
PostHog MCP Server (Official) vs alternatives
- Google Analytics MCP Server focuses on reading GA4 reports. The PostHog MCP server can also write: flags, experiments, dashboards and surveys.
- Sentry MCP Server (Official) is dedicated to error monitoring. PostHog covers error tracking alongside product analytics in one connection.
- Grafana MCP Server (Official) targets observability dashboards and metrics rather than product analytics.
Troubleshooting PostHog MCP Server (Official)
- Client has no OAuth support: use a personal API key with the MCP Server preset in an
Authorization: Bearerheader, or themcp-remotebridge. - Agent writes to the wrong project: pin the connection with
x-posthog-project-id(this also removes theswitch-*tools), or add one named server entry per project. - Two accounts or regions: add a separate connection per account. With OAuth in a shared browser session it is easy to authorize both as the same account; a per-entry API key avoids this.
- Too many tools or too much context: use CLI mode (
?mode=cli) or filter withfeatures/tools. - AI-powered tools are missing: they only appear when AI data processing is enabled in your organization settings.
Frequently asked questions
1 Is the PostHog MCP server official?
Yes. It is built and hosted by PostHog and its source is in the PostHog monorepo.
2 Is the PostHog MCP server free?
Connecting and calling tools is free. Normal PostHog usage billing still applies to the data your queries consume, and some AI-powered tools may be billed as PostHog AI spend.
3 Do I need a PostHog API key?
No. OAuth is the recommended path. A personal API key with the MCP Server preset is only needed for clients that cannot do OAuth.
4 Does it work with Claude Code, Cursor and VS Code?
Yes. PostHog documents setup for Claude Code, Claude Desktop, Cursor, Codex, VS Code, Windsurf and Zed, and the wizard installs into most of them in one command.
5 Is it remote or local?
The PostHog MCP server is remote at https://mcp.posthog.com/mcp using Streamable HTTP. For self-hosted PostHog, the README describes running the server yourself with POSTHOG_API_BASE_URL set to your instance.
6 Does it support EU Cloud?
Yes. The auth server routes you to the US or EU region based on the account you sign in with.
7 Are there rate limits?
Tool calls use the PostHog API, so the standard API rate limits apply per team. Some AI-powered tools have lower limits.
8 Is it safe to let an agent change my project?
Review tool calls before running them, as prompt injection is possible. You can restrict the session to read-only tools, filter tools, and pin the connection to one project.
Comments
No comments yet
Be the first to share feedback about this listing. Sign in to leave a comment.
Sign In