PostHog MCP server

OfficialPostHogConfig last verified Jun 1, 2026

PostHog's official MCP server: query product analytics, manage feature flags and experiments, run HogQL, and triage errors from your editor.

The PostHog MCP server is PostHog's official, hosted integration that lets an AI agent read and write across the PostHog product suite using plain language. Instead of clicking through the PostHog app, an agent can answer analytics questions, build and update insights and dashboards, ship and toggle feature flags, set up and read A/B test experiments, create and analyze surveys, inspect event and property definitions, look at error-tracking issues, and run ad-hoc HogQL queries against your project's data. It can even generate HogQL from a natural-language question and pull LLM-usage cost breakdowns, making it a fast feedback loop for both shipping features and understanding how they perform.

The canonical deployment is the hosted remote endpoint at https://mcp.posthog.com/mcp (with an SSE variant at /sse for clients that need it). Authentication is a personal API key passed as an Authorization: Bearer header, and the auth server automatically routes you to the correct data region (US or EU) for your account. Clients with native streamable-HTTP support connect to the URL directly; others bridge through npx mcp-remote, passing the bearer header via the POSTHOG_AUTH_HEADER environment variable. The simplest path is the official installer, npx @posthog/wizard@latest mcp add, which wires the server into Cursor, Claude, Claude Code, VS Code, or Zed for you. Scope the personal API key to exactly the products you want the agent to touch.

Quick install

Copy-paste configs are provided for all 8 supported clients. Pick your client below.

Add to ~/.claude.json

~/.claude.json
json
{
  "mcpServers": {
    "posthog": {
      "type": "http",
      "url": "https://mcp.posthog.com/mcp",
      "headers": {
        "Authorization": "Bearer <POSTHOG_AUTH_HEADER>"
      }
    }
  }
}
Or via CLI
bash
claude mcp add --transport http posthog https://mcp.posthog.com/mcp

Available tools

ToolDescription
dashboards-get-allGet all dashboards in the project with optional filtering.
dashboard-getGet a specific dashboard by ID, including the insights on it.
dashboard-createCreate a new dashboard in the project.
dashboard-updateUpdate an existing dashboard by ID.
dashboard-deleteDelete a dashboard by ID.
add-insight-to-dashboardAdd an existing insight to a dashboard.
insights-get-allGet all insights in the project with optional filtering.
insight-getGet a specific insight by ID.
insight-create-from-querySave a query as an insight.
insight-updateUpdate an existing insight by ID.
insight-deleteDelete an insight by ID.
insight-queryExecute a query on an existing insight to get its results/data.
query-runRun a trend, funnel, or HogQL query.
query-generate-hogql-from-questionQuery the project's PostHog data from a natural-language question by generating HogQL.
feature-flag-get-allGet all feature flags in the project.
feature-flag-get-definitionGet the definition of a feature flag.
create-feature-flagCreate a new feature flag in the project.
update-feature-flagUpdate a feature flag in the project.
delete-feature-flagDelete a feature flag in the project.
experiment-get-allGet all experiments in the project.
experiment-getGet details of a specific experiment.
experiment-createCreate an A/B test experiment with guided metric and feature-flag setup.
experiment-updateUpdate an existing experiment, including lifecycle management and restart.
experiment-deleteDelete an experiment by ID.
experiment-results-getGet comprehensive experiment results, including metrics and exposure data.
survey-createCreate a new survey in the project.
survey-getGet a specific survey by ID.
surveys-get-allGet all surveys in the project with optional filtering.
survey-updateUpdate an existing survey by ID.
survey-deleteDelete a survey by ID.
survey-statsGet response statistics for a specific survey.
surveys-global-statsGet aggregated response statistics across all surveys.
list-errorsList errors in the project.
error-detailsGet the details of an error in the project.
event-definitions-listList all event definitions in the project with optional filtering.
property-definitionsGet event and property definitions for the project.
properties-listGet properties for events or persons.
get-llm-total-costs-for-projectFetch the total LLM daily costs for each model for a project over a given number of days.
docs-searchSearch the PostHog documentation for information.
organizations-getGet the organizations the user has access to.
organization-details-getGet the details of the active organization.
switch-organizationChange the active organization from the default organization.
projects-getFetch the projects the user has access to in the current organization.
switch-projectChange the active project from the default project.

Required configuration

  • POSTHOG_AUTH_HEADERRequired

    The string 'Bearer <your-personal-api-key>' used to authenticate to the remote endpoint when bridging through mcp-remote.

What you can do with it

Answer product questions without leaving your editor

Ask the agent how a metric is trending; it generates HogQL from your question, runs the query against your project, and can save the result as a reusable insight or pin it to a dashboard.

Ship and manage feature flags and experiments

Create a feature flag from a prompt, launch an A/B test with guided metric setup, then read the experiment results and exposure data back — all through the MCP tools rather than the PostHog UI.

FAQ

Is it free?
Yes. The MCP server is free and open source, and you only need a PostHog account with a personal API key. Underlying PostHog usage is governed by your own plan (PostHog has a generous free tier with monthly event and feature allowances).
Does it support remote/OAuth?
The canonical deployment is the remote endpoint at https://mcp.posthog.com/mcp (with an /sse variant). It authenticates with a personal API key sent as an Authorization: Bearer header rather than a full OAuth flow, and automatically routes you to the correct US or EU data region. Clients without native HTTP support bridge through npx mcp-remote.
← Browse all data-analytics servers