MCP.so
Sign In

PostHog MCP Server (Official)

@PostHog

Basic information

Transport

Streamable HTTP

Authentication

OAuth

Category

Data & Analytics

Author

PostHog

About PostHog MCP Server (Official)

PostHog is an open-source product analytics suite with events, session replay, feature flags, and experiments. Its remote MCP server lets assistants query analytics with natural language or HogQL, manage flags, and investigate product behavior conversationally.

Connection details

https://mcp.posthog.com/mcp

Setup

claude mcp add posthog --transport http https://mcp.posthog.com/mcp

PostHog MCP Server tools

Tool list not available yet

This listing does not currently have a tool list to display. This does not mean the server has no tools; check its documentation for supported capabilities.

This server requires authentication. Tool discovery may require signing in or credentials from the provider.

Fetch the live tool list directly from this server's endpoint using the button above.

Overview

What is PostHog MCP Server (Official)?

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 MCP Server (Official)?

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 MCP Server (Official)

  • 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 exec tool, while tools mode registers every tool individually. Mode is auto-detected and can be overridden with ?mode=cli or ?mode=tools.
  • Read-only sessions via ?readonly=true or the x-posthog-read-only header.
  • Tool filtering by category (?features=flags,dashboards,insights) or exact name (?tools=dashboard-get,execute-sql).
  • Context pinning with x-posthog-organization-id and x-posthog-project-id headers.
  • Acts as a proxy: it does not store your analytics data.

PostHog MCP Server (Official) tools

The server exposes hundreds of tools, grouped by PostHog product:

  • Analytics and SQL: execute-sql runs SQL queries, and query tools such as query-trends and query-funnel run 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-create and experiment-results-get let an agent ship and evaluate rollouts.
  • Error tracking: tools such as query-error-tracking-issues-list and error-tracking-issues-partial-update list, inspect, assign and resolve issues.
  • Users and data: persons-list, cohorts-create, session-recording-get, surveys-get-all and survey-create.
  • Logs: query-logs and related log tools for querying and alerting.
  • Workspace and docs: switch-organization, switch-project, projects-get, and docs-search for 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 MCP Server (Official)

  • 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

Troubleshooting PostHog MCP Server (Official)

  • Client has no OAuth support: use a personal API key with the MCP Server preset in an Authorization: Bearer header, or the mcp-remote bridge.
  • Agent writes to the wrong project: pin the connection with x-posthog-project-id (this also removes the switch-* 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 with features/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.

9

What is the PostHog remote MCP server?

The PostHog remote MCP server is a hosted Model Context Protocol endpoint at https://mcp.posthog.com/mcp, so AI assistants can connect to it without installing or running anything locally.

10

How do I connect to the PostHog MCP server?

Add the endpoint https://mcp.posthog.com/mcp to any MCP-compatible client such as Claude Code, Cursor, or VS Code. The setup snippets on this page configure each client in one step.

11

Does the PostHog MCP server require authentication?

Yes. PostHog uses OAuth: the first time you connect, your MCP client opens a browser window to sign in and authorize access, then reuses the credentials for future sessions.

12

Which transport does the PostHog MCP server use?

PostHog exposes a Streamable HTTP endpoint, the transport used by remote MCP servers and supported by all major MCP clients.

Comments