PostHog MCP Server

PostHog's hosted MCP endpoint for analytics queries, feature flags, experiments, errors and more

Official · PostHog TypeScript Remote (hosted) · Streamable HTTP Data and analyticsDevOps and monitoring

40 popularity score ★ 41k

Connect your client

Remote (hosted)

Add in one click

Opens the app, which asks before it adds the server.

Or add it by command or config

Claude Codeshell
claude mcp add --transport http posthog https://mcp.posthog.com/mcp -s user
Claude (desktop and web)Settings → Connectors → Add custom connector
https://mcp.posthog.com/mcp
Codex~/.codex/config.toml
[mcp_servers.posthog]
url = "https://mcp.posthog.com/mcp"
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "posthog": {
      "url": "https://mcp.posthog.com/mcp"
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "posthog": {
      "type": "http",
      "url": "https://mcp.posthog.com/mcp"
    }
  }
}

What it does

PostHog runs this server itself at https://mcp.posthog.com/mcp. Once connected, an assistant can query product analytics (trends, funnels, raw HogQL/SQL), read and resolve error-tracking issues, create and change feature flags and experiments, build dashboards, insights and notebooks, run surveys, look at session recordings, logs and LLM cost data, and manage CDP destinations, all inside the PostHog project the sign-in belongs to. It is a front end to PostHog's own API, so the data stays in your PostHog project and results go straight back to the client.

The tool catalogue is very large. The tools reference on PostHog's docs lists 1,109 tools in 74 categories (counted on that page in October 2026), far more than the README's examples suggest. Because of that, the server's default "cli" mode exposes a single exec tool that the assistant uses to search, inspect and call the others on demand, plus a render-ui tool for charts in clients that support MCP apps. Cursor is auto-switched to "tools" mode, which registers every tool separately; any client can pin either mode with ?mode=cli|tools or the x-posthog-mcp-mode header.

A session can be narrowed from the URL or headers: ?features= picks tool groups (flags, dashboards, sql and so on), ?tools= allowlists exact names, ?readonly=true drops every tool that creates, updates or deletes, and organization/project ids pin the session and remove the switch-organization and switch-project tools. The code lives in the services/mcp folder of the PostHog monorepo; the older posthog/mcp repository now only points there.

What it needs

A PostHog Cloud account (US or EU; the sign-in routes to the right region). An MCP client that can reach a remote Streamable HTTP server and sign in with OAuth, or else a personal API key made with the "MCP Server" preset sent as a Bearer header. AI-powered tools only appear when AI data processing is enabled in the organization settings. Self-hosted PostHog needs you to run the server yourself from the monorepo with POSTHOG_API_BASE_URL set, plus Node, pnpm and a local Redis.

Limits

One connection signs in as one account with one active organization and project; working across several needs a separate entry per account or project, and an account in each region needs two. Tool calls count against the normal PostHog API rate limits for the team, with lower extra limits on some AI-powered tools (sentiment analysis, trace summarisation). Those AI tools may be billed as PostHog AI spend. Running it outside PostHog's cloud is documented only as a development setup (port 8787 and a Redis on 6379 by default), not as a packaged install. The posthog:posthog-setup prompt's framework resources cover Next.js only for now.

Who it suits

Teams already on PostHog Cloud who want an assistant to answer analytics questions, triage errors or manage flags and experiments without opening the web app; it is official and needs nothing installed beyond the client. Because it can write, pick ?readonly=true or a tools allowlist when the assistant should only look, and pin a project when you work across several. Clients with small context budgets benefit from the default single-tool cli mode. If you run self-hosted PostHog and do not want to run a Node service with Redis, this hosted endpoint will not reach your instance.

Tools 30 of 1109

exec
Default cli-mode entry point: lists, searches, inspects and calls any PostHog tool by command string
render-ui
Draws an interactive chart in clients that support MCP apps (cli mode)
execute-sql
Runs a SQL (HogQL) query against the project
read-data-schema
Browses the project's events, actions, properties and their values
query-trends
Runs a trends query
query-funnel
Runs a funnel query
insight-create
Saves a new insight
insight-get
Fetches one saved insight
dashboard-create
Creates a dashboard
dashboard-get
Fetches a dashboard
feature-flag-get-all
Lists the project's feature flags
create-feature-flag
Creates a feature flag
update-feature-flag
Changes a flag's rollout or settings
delete-feature-flag
Deletes a feature flag
experiment-create
Sets up an A/B experiment
query-error-tracking-issues-list
Lists error-tracking issues with counts
session-recording-get
Fetches a session recording's details
query-logs
Searches logs
get-llm-total-costs-for-project
Daily LLM spend per model over a number of days
survey-create
Creates a survey
surveys-get-all
Lists and filters surveys
persons-list
Lists persons
cohorts-list
Lists cohorts
notebooks-create
Creates a notebook
annotation-create
Adds an annotation to charts
docs-search
Searches PostHog's documentation
organizations-get
Lists organizations the user can reach
projects-get
Lists projects in the current organization
switch-organization
Changes the active organization for later calls
switch-project
Changes the active project for later calls

Similar servers