Is there an MCP server for PostHog?

Yes. Agent Planners runs a hosted MCP server at https://www.agentplanners.com/api/mcp that gives Claude, ChatGPT, Codex and other MCP clients 29 PostHog read tools and 20 write tools. Sign in with OAuth or an API key. Writes follow your approval settings; changes you can't take back wait for a person unless an admin exempts a key.

MCP

PostHog MCP server: analytics, flags and experiments in Claude, Codex or Cursor

TL;DR

PostHog reaches Claude, Codex or Cursor through the Agent Planners MCP endpoint with 29 reads and 20 writes, next to every other platform the workspace connected. Reading people is refused over MCP, recordings come back as metadata only, and turning a flag on, changing a rollout, launching or stopping an experiment or survey and deletes are held for a person on every key mode.

What this setup adds

PostHog's own MCP serverAgent Planners MCP
Sign-inPostHog OAuth or a personal API keyOAuth once on the PostHog card (US or EU)
PeopleWhat the key can readMasked in every answer; person reads refused over MCP
ChangesWhat the key allowsLaunches, rollouts, flag activation and deletes held for a person; persons, members, billing and API keys refused
Other platformsPostHog onlyAds, analytics, CRM and stores on the same endpoint, so funnels sit next to spend
PostHog runs its own MCP server too; use it if PostHog is the only tool you need and you want PostHog's own permission model.

How to configure it

  1. 1Connect PostHog on its card on Integrations.
  2. 2Create a key in API & MCP: tools:read for reading, add tools:write for changes. To keep a key to PostHog, choose Only these platforms → PostHog.
  3. 3Add the server to your client with one of the snippets below, run describe_permissions, then posthog__list_projects.
bash
# Claude Code
claude mcp add --transport http agent-planners https://www.agentplanners.com/api/mcp \
  --header "Authorization: Bearer $AGENTPLANNERS_API_KEY"

# Codex (signs in with OAuth in the browser)
codex mcp add agent-planners --url https://www.agentplanners.com/api/mcp

# Cursor (~/.cursor/mcp.json)
{ "mcpServers": { "agent-planners": { "url": "https://www.agentplanners.com/api/mcp", "headers": { "Authorization": "Bearer ${env:AGENTPLANNERS_API_KEY}" } } } }
Every client's setup, including OAuth sign-in without a key: MCP setup guide.

The PostHog tools

ToolKindWhat it does
posthog__getReadANY PostHog REST GET by path, bound to the selected project: api/projects/{selected}/… (insights, dashboards, feature_flags, experiments, surveys, cohorts, error_tracking/issues, event_definitions, session_recordings …
posthog__list_projectsReadThe PostHog organizations and projects the connected sign-in reaches (GET /api/users/@me/ + each organization's projects): id, name, organization, time zone, region.
posthog__get_projectReadThe selected project: name, organization, time zone, whether events were ever ingested, base currency.
posthog__run_queryReadA read-only HogQL (SQL) query on the selected project (POST /api/projects/{id}/query/ with a HogQLQuery): { accountId?, query (one SELECT / WITH statement), limit? (default 100, max 10000 — a LIMIT is added or capped)…
posthog__trendsReadA Trends query (TrendsQuery): { accountId?, events: [{ event (e.g. "$pageview"), math? (total | dau | weekly_active | monthly_active | unique_session | sum | avg | min | max | median, with mathProperty), name?, proper…
posthog__funnelReadA Funnel (FunnelsQuery): { accountId?, steps: [{ event, name?, properties? }] (2–20, in order), conversionWindow? (default 14) + conversionWindowUnit? (minute | hour | day | week | month), orderType? (ordered | strict…
posthog__retentionReadA Retention table (RetentionQuery): { accountId?, startEvent? (default $pageview), returnEvent? (default the start event), period? (Day | Week | Month, default Week), totalIntervals? (default 8, ≤ 30), retentionType? …
posthog__pathsReadUser paths (PathsQuery): { accountId?, includeEventTypes? ($pageview default | $screen | custom_event | hogql), startPoint?, endPoint?, stepLimit? (2–10, default 5), pathGroupings? }.
posthog__lifecycleReadLifecycle (LifecycleQuery): new / returning / resurrecting / dormant users per interval for one event: { accountId?, event? (default $pageview), interval? (day | week | month) }.
posthog__stickinessReadStickiness (StickinessQuery): how many users did the event on 1, 2, … intervals: { accountId?, events: [{ event (e.g. "$pageview"), math? (total | dau | weekly_active | monthly_active | unique_session | sum | avg | mi…
posthog__session_analysisReadSessions in aggregate (HogQL on the sessions table): sessions, average duration (s), bounce rate, pageviews per session — total or grouped by: groupBy? (day | channel | entry_path | device | country).
posthog__heatmapsReadClick / scroll heatmap aggregates for one page (GET /api/projects/{id}/heatmaps/): { accountId?, url (exact page URL) or urlPattern (a regex), type? (click default | rageclick | mousemove | scrolldepth), viewportWidth…
posthog__list_insightsReadSaved insights (GET …/insights/): id, short_id, name, description, the query kind, dashboards, last refresh.
posthog__get_insightReadONE insight with its query and (refresh? = false) its cached result (GET …/insights/{id}/).
posthog__list_dashboardsReadDashboards (GET …/dashboards/): id, name, description, pinned, tile count.
posthog__get_dashboardReadONE dashboard with its tiles (insight id, name, query kind) (GET …/dashboards/{id}/).
posthog__list_feature_flagsReadFeature flags (GET …/feature_flags/): id, key, name, active, rollout percentage per release condition, variants, tags.
posthog__get_feature_flagReadONE flag with its release conditions, variants and payloads (GET …/feature_flags/{id}/).
posthog__list_experimentsReadExperiments (GET …/experiments/): id, name, status (draft | running | complete — from start_date / end_date), feature flag key, metrics.
posthog__get_experimentReadONE experiment (GET …/experiments/{id}/) and, includeResults? (default true), its results when PostHog answers them (else said unavailable).
posthog__list_surveysReadSurveys (GET …/surveys/): id, name, type, status (draft | running | complete), questions (type + text), targeting flag.
posthog__get_surveyReadONE survey and, includeResponses? (default true), a response SUMMARY: total responses and counts per choice / rating answer (open-text answers and respondents are never returned).
posthog__list_cohortsReadCohorts (GET …/cohorts/): id, name, description, static or dynamic, count (people), last calculated.
posthog__list_error_issuesReadError-tracking issues (GET …/error_tracking/issues/): id, name, description, status (active | resolved | suppressed | archived), first seen, assignee.
posthog__get_error_issueReadONE error issue (GET …/error_tracking/issues/{id}/).
posthog__list_session_recordingsReadSession recording METADATA (GET …/session_recordings/): id, start / end, duration, active seconds, clicks, keypresses, console errors, the start URL's page (no query string).
posthog__get_session_recording_summaryReadONE recording's metadata (the list's fields), masked the same way.
posthog__list_event_definitionsReadEvent definitions (GET …/event_definitions/): name, volume (30 days), last seen, verified.
posthog__get_account_healthReadProject health in one read: reachable (no_access on 401 / 403), ever ingested, events in the last 24 h and 7 days.
posthog__create_insightWriteSave an insight (POST …/insights/): { accountId?, name, description?, query (a query node such as { kind: "TrendsQuery", … }, or the InsightVizNode wrapping it), dashboardIds? (dashboards of this project) }.
posthog__update_insightWriteChange an insight's name, description or query (PATCH …/insights/{id}/): { accountId?, insightId, name?, description?, query? }.
posthog__create_dashboardWriteCreate a dashboard (POST …/dashboards/): { accountId?, name, description?, pinned? }.
posthog__update_dashboardWriteRename / describe / pin a dashboard (PATCH …/dashboards/{id}/): { accountId?, dashboardId, name?, description?, pinned? }.
posthog__add_insight_to_dashboardWriteAdd a saved insight as a tile on a dashboard (the insight's dashboards list gains the dashboard): { accountId?, insightId, dashboardId }.
posthog__create_feature_flagWrite — always a personCreate a feature flag INACTIVE by default (POST …/feature_flags/): { accountId?, key (letters, digits, - _), name? (description), rolloutPercentage? (0–100, default 0), properties? (release-condition filters), variant…
posthog__update_feature_flagWrite — always a personChange a flag (PATCH …/feature_flags/{id}/): { accountId?, flagId | key, name?, rolloutPercentage?, properties?, variants?, filters? (the whole filters object), tags? }. ★ A rollout, release-condition or variant chang…
posthog__set_feature_flag_activeWrite — always a personTurn ONE flag on or off: { accountId?, flagId | key, active: true | false }.
posthog__create_experimentWriteCreate an experiment as a DRAFT (no start date): { accountId?, name, featureFlagKey (a new key for its flag), description?, variants? ([{ key, rollout_percentage }], default control / test 50 / 50), metrics? (PostHog …
posthog__launch_experimentWrite — always a personLaunch a draft experiment (sets start_date to now, which activates its flag for real users): { accountId?, experimentId }.
posthog__stop_experimentWrite — always a personEnd a running experiment (sets end_date to now): { accountId?, experimentId, conclusion? }.
posthog__create_surveyWriteCreate a survey as a DRAFT (no start date): { accountId?, name, type? (popover default | api | widget), questions ([{ type: open | single_choice | multiple_choice | rating | link, question, choices?, scale? }] 1–10), …
posthog__launch_surveyWrite — always a personLaunch a draft survey (start_date = now — it starts showing to real users): { accountId?, surveyId }.
posthog__stop_surveyWrite — always a personStop a running survey (end_date = now): { accountId?, surveyId }.
posthog__create_cohortWriteCreate a DYNAMIC cohort (POST …/cohorts/): { accountId?, name, description?, filters (PostHog cohort filters: { properties: { type: AND | OR, values: [...] } }) }.
posthog__update_cohortWriteChange a dynamic cohort's name, description or filters (PATCH …/cohorts/{id}/): { accountId?, cohortId, name?, description?, filters? }.
posthog__update_error_issueWriteSet an error issue's status: { accountId?, issueId, status: active | resolved | suppressed }.
posthog__assign_error_issueWriteAssign an error issue to a user (id, or "me" for the connected sign-in) or unassign (assignee: null): { accountId?, issueId, assignee }.
posthog__delete_objectWrite — always a personSoft-delete ONE insight, dashboard, feature flag, experiment, survey or cohort (PATCH deleted: true — PostHog keeps it restorable from its trash for a while): { accountId?, kind: insight | dashboard | feature_flag | e…
posthog__mutateWrite — always a personAny other PostHog write on the selected project by path: method POST | PATCH, path = api/projects/{selected}/{insights | dashboards | feature_flags | experiments | surveys | cohorts | error_tracking/issues}/…, body = …

What waits for a person, whatever the key allows

  • Turning a flag on or off, and a rollout, release-condition or variant change.
  • Launching or stopping an experiment or a survey.
  • Deleting an insight, dashboard, flag, experiment, survey or cohort, and a gateway write that sets any of the above.
Refused outright: persons, deleting recordings, members, billing, API keys, settings, batch exports, destinations and webhooks. Not yet tested on a live PostHog account. PostHog setup guide · PostHog platform page · PostHog MCP server

Frequently asked questions

How do I connect Claude to PostHog?
Connect PostHog on its card on Integrations (choose US or EU), create an Agent Planners key in API & MCP, add the MCP server to Claude and call posthog__list_projects.
Can an MCP client turn a feature flag on?
It can ask; a person approves it every time, on every key mode.

About this platform

Put a human-approved agent on your ad ops

Start free — 2,500 credits a month, no credit card. Reads run at once; by default every write waits for your approval.

Related reading