PostHog logo
Analytics & MarketingAuth: OAuthHosting: Official hosted

PostHog MCP Server

Connect AI agents to PostHog product analytics, feature flags, and error tracking over MCP.

Updated

What is PostHog MCP?

The PostHog MCP server is a Model Context Protocol server that lets AI agents and assistants interact with your PostHog product analytics in plain language — querying events and insights, running HogQL, managing feature flags and experiments, and triaging captured errors.

PostHog runs the server as an official, hosted endpoint at https://mcp.posthog.com/mcp. You connect over OAuth: when your client first calls the server, you log in to PostHog and authorize access, and the server automatically routes you to the correct data region (US or EU) based on the account you sign in with. There is nothing to deploy or host yourself.

Once connected, an MCP-compatible client — Claude, Claude Code, Cursor, VS Code, Zed, and others — can read and act on your PostHog data through the server's grouped toolset, so questions like "which feature flags are rolled out to 50%?" or "show me the top error groups this week" resolve without leaving the editor or chat.

Tools the PostHog MCP server exposes

ToolWhat it does
InsightsQuery analytics data and create, read, update, and manage insights, including HogQL queries.
DashboardsCreate, retrieve, and manage dashboards and add insights to them.
Feature flagsCreate, read, update, and delete feature flags programmatically.
Error trackingList and inspect captured error groups and their details.
ExperimentsManage PostHog experiments.
Organizations & projectsList and switch between organization and project contexts.
Docs searchSearch PostHog documentation from within the client.

Connect the PostHog MCP server

Claude Code

  1. 1

    Run the PostHog wizard

    In your terminal, run: npx @posthog/wizard@latest mcp add — it installs the hosted server (https://mcp.posthog.com/mcp) into Claude Code automatically.

  2. 2

    Authorize over OAuth

    When Claude Code first calls the server, a browser window opens to log in to PostHog and authorize access; your data region (US/EU) is detected from the account.

  3. 3

    Verify

    Ask Claude Code something like "list my PostHog feature flags" to confirm the tools are available.

Cursor

  1. 1

    Run the PostHog wizard

    Run npx @posthog/wizard@latest mcp add and select Cursor, or add the remote server https://mcp.posthog.com/mcp in Cursor's MCP settings.

  2. 2

    Authorize over OAuth

    On first use, complete the PostHog OAuth login in the browser to authorize Cursor; the server routes to your account's region.

  3. 3

    Verify

    Open the MCP panel and confirm the PostHog tools are listed, then prompt Cursor to query an insight or error group.

Sample use cases

A scheduled agent reviews PostHog error groups each week and posts a regression summary to chat.

Faster awareness of new or spiking errors without manual dashboard checks.

An engineer asks their editor's agent to create or update a feature flag rollout.

Feature flags managed from the IDE without context-switching to the PostHog UI.

An analyst prompts the agent to run a HogQL query and build an insight.

Ad-hoc product analytics answered in natural language and saved as reusable insights.

Security & permissions

Authentication is OAuth. On first connection you log in to PostHog and authorize the client; the server then routes to your account's data region (US or EU). The agent acts with the permissions of the authorized PostHog account, so it can read and modify analytics resources (insights, dashboards, feature flags, experiments, error tracking) within that account's scope. Grant access only to clients you trust, and review the connected app under your PostHog organization settings.

Using PostHog MCP with Gamut

In Gamut, the PostHog MCP server is wired in as a tool an agent can call inside an automated, event- or schedule-triggered workflow — Gamut manages the OAuth connection so the agent can reach PostHog without manual login at run time. For example, a scheduled agent can pull weekly error groups and trending insights, summarize regressions, and post them to a chat channel; or an event-triggered agent can check a feature flag's rollout state before taking a downstream action. The agent uses PostHog strictly through the tools the server exposes, scoped to the connected account's permissions.

Frequently asked questions

What is the PostHog MCP server?

It's PostHog's official Model Context Protocol server — a hosted endpoint at https://mcp.posthog.com/mcp that lets AI agents and MCP-compatible clients query analytics, run HogQL, manage feature flags and experiments, and triage errors in your PostHog account using natural language.

Is the PostHog MCP server free?

Yes — connecting to the hosted MCP server and calling its tools is free. Some tools use LLMs internally and may be billed as PostHog AI spend, and standard PostHog account/usage pricing still applies to your underlying analytics.

How do I connect the PostHog MCP server to Claude or Cursor?

Run npx @posthog/wizard@latest mcp add, which installs the hosted server into Claude, Claude Code, Cursor, VS Code, and Zed. On first use you authorize access through PostHog's OAuth login in the browser; no API key file is required.

Is the PostHog MCP server hosted or self-hosted?

It's officially hosted by PostHog at https://mcp.posthog.com/mcp — there's nothing to deploy. The source is open (PostHog/mcp, MIT licensed) if you want to inspect or run it yourself, but the standard path is the hosted endpoint over OAuth.