Skip the install. Get this working in under 2 minutes.
Start a free trial on cloud.anythingmcp.com, add the PostHog in one click, then point your AI client (Claude, ChatGPT, Copilot or Cursor) at the generated MCP endpoint. No Docker, no git clone, zero engineering experience required.
Summary
Let your AI answer product analytics questions from PostHog: run read-only SQL (HogQL) over events and persons, compute trends, funnels and retention, read saved insights and dashboards, look up persons, cohorts, annotations and experiments, and manage insights and feature flags. PostHog Cloud (US or EU) or self-hosted, with a personal API key.
Try asking
Example prompts for PostHog
Click any prompt to copy it. Paste into Claude, ChatGPT, Cursor, Gemini, Copilot or OpenClaw to run it against this connector.
Claude is AI and can make mistakes. Please double-check responses.
💡 No install? Use cloud.anythingmcp.com directly. Sign in, click Connectors → PostHog, paste your credentials, mint an MCP API key and you're done. No Docker, no
git clone, no local server.
PostHog + ChatGPT
Let your AI answer product analytics questions from PostHog: run read-only SQL (HogQL) over events and persons, compute trends, funnels and retention, read saved insights and dashboards, look up persons, cohorts, annotations and experiments, and manage insights and feature flags. PostHog Cloud (US or EU) or self-hosted, with a personal API key.
Prerequisites
See the full setup instructions baked into the connector (visible in the in-app store when you select the connector). The required environment variables for this connector are:
POSTHOG_HOST, POSTHOG_PERSONAL_API_KEY
Step 1 — Get credentials
- In PostHog, open Settings → User → Personal API keys (US Cloud:
https://us.posthog.com/settings/user-api-keys, EU Cloud:https://eu.posthog.com/settings/user-api-keys) and click + Create a personal API key. - Give the key a label (for example "AnythingMCP") and choose its organization and project access: all, one organization, or specific projects. A key limited to specific projects cannot list organizations or projects, but
posthog_get_current_userstill works and names the current project. - Select these scopes:
user:read,organization:read,project:readquery:read,person:read,cohort:read,experiment:readinsight:read,insight:write,dashboard:readfeature_flag:read,feature_flag:writeannotation:read,annotation:write
- Copy the key right away: PostHog shows it only once. It starts with
phx_(a project token starting withphc_does not work here). Paste it intoPOSTHOG_PERSONAL_API_KEY, without the word Bearer. - Set
POSTHOG_HOSTto the address you open PostHog at:https://us.posthog.comfor US Cloud,https://eu.posthog.comfor EU Cloud, or your self-hosted address, without a trailing slash or path. The ingestion hostsus.i.posthog.comandeu.i.posthog.comare refused, and a key only works in the cloud region where it was created. Then install the connector. - Start with
posthog_get_current_user: it shows which PostHog user the key belongs to, the current project and the projects of the organization.
Read-only setup: create the key with only the :read scopes and switch off posthog_create_insight, posthog_update_insight, posthog_create_feature_flag, posthog_update_feature_flag and posthog_create_annotation. Queries never change data, as HogQL only accepts SELECT. The AI sees and changes exactly what the key's user can.
Switched off at install: posthog_delete_insight, posthog_delete_feature_flag and posthog_delete_annotation. PostHog never hard-deletes through the API: these tools mark the insight, flag or annotation as deleted, and it can be restored in the PostHog app. A deleted flag is switched off, so code that checks its key gets false.
Project ids: every project tool takes project_id, the number in the PostHog URL (/project/12345/...), also shown under Settings → Project → General. @current is accepted too, but it means the project the user last opened in the app, which can change: prefer the number. posthog_list_organizations and posthog_list_projects list the others.
Queries: posthog_run_hogql_query runs one HogQL (PostHog's SQL) SELECT over events, persons, sessions and groups; properties are read as properties.$browser or person.properties.email. Always filter on time (for example WHERE timestamp >= now() - INTERVAL 7 DAY): unfiltered scans are slow and use up the read budget. Without a LIMIT you get 100 rows, with one up to 50,000. OFFSET is refused, so the AI pages by timestamp or id. Date literals are read in the project's timezone, not UTC. For trends, funnels, retention, stickiness, lifecycle and paths there is posthog_run_insight_query; conversion and retention percentages are computed from its count values. The query endpoint is meant for ad hoc analysis, not bulk exports.
Insights, dashboards and flags: posthog_get_insight returns the last cached result by default; refresh blocking recalculates a stale one. posthog_get_dashboard returns the tiles with their insights. Feature flags decide what live users see: before creating or changing one, the AI shows you the flag key, active and the rollout and waits for your yes. A new flag is safest with active false or a rollout of 0. Changes send the flag's version from the last read, so nobody else's change is overwritten.
Pagination: list tools take limit and offset and return count, next (null on the last page) and results. Answers over 200 KB are cut.
Rate limits: they apply per organization and are shared by every key and user. Ordinary reads and writes allow 480 requests a minute and 4,800 an hour; analytics such as persons and insight calculations 240 a minute and 1,200 an hour. The query endpoint allows 240 a minute and 2,400 an hour, at most 3 running queries per project, and draws on an hourly read budget per project (smaller on the free plan). Over a limit PostHog answers 429; an exhausted budget says api_queries_budget_exceeded, while cached results keep working.
Common errors: 401 means the key is wrong, deleted, or from the other cloud region: check POSTHOG_HOST. 403 "API key missing required scope" names the scope to add (you can edit the key's scopes later); other 403s mean the key is limited to other projects or organizations, or the organization does not allow personal API keys for members. 404 "Project not found." is a wrong project_id or one the user cannot see. 400 names the invalid field, and for HogQL carries the parser error. 409 on a flag means its version is stale: read the flag again.
The connector does not capture events or set person properties, delete persons, read session replays or surveys, create or edit dashboards, cohorts and experiments, or manage batch exports, members and billing.
Step 2 — Install the adapter
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
Step 3 — Add the connector in ChatGPT
Your server URL: in AnythingMCP, open MCP Servers → the server this connector is on, and copy its URL (
https://cloud.anythingmcp.com/mcp/…). Use it wherever this guide showsYOUR_SERVER_ID.
ChatGPT connects to MCP servers as custom apps in developer mode, available on paid plans (not on Free). On Business and Enterprise workspaces an admin may have to allow it first.
- In ChatGPT, open Settings → Security and login and turn on Developer mode.
- Go to chatgpt.com/plugins and click +.
- Enter a name and a short description, e.g. Name:
PostHog. - Under Connection, enter the MCP server URL
https://cloud.anythingmcp.com/mcp/YOUR_SERVER_IDand create the connection. - When ChatGPT asks, sign in to AnythingMCP (OAuth) and allow access.
Available tools
| Tool | What it does |
|---|---|
posthog_get_current_user | Get the user the personal API key belongs to: uuid, email and name, the current project (id, name, project_id, timezone), the current… |
posthog_list_organizations | List the organizations the user belongs to: id (a UUID), name, slug, membership_level, and each organization's projects |
posthog_list_projects | List the projects of an organization: id (the project_id every other tool takes), name, project_id, timezone, tags, is_demo and… |
posthog_get_project | Get one project's settings: name, timezone, week_start_day, base_currency, app_urls, test account filters, group types, whether events… |
posthog_run_hogql_query | Run one read-only HogQL (PostHog SQL) SELECT over events, persons, sessions, groups or warehouse tables and return columns, results (rows… |
posthog_run_insight_query | Run one of PostHog's insight calculations without saving it: TrendsQuery, FunnelsQuery, RetentionQuery, StickinessQuery, LifecycleQuery or… |
posthog_list_persons | List or search persons (identified users and anonymous visitors): id, uuid, name, distinct_ids, properties, created_at and last_seen_at.… |
posthog_get_person | Get one person by numeric id or UUID: name, distinct_ids, all person properties (email, initial UTM and referrer, geo), created_at and… |
posthog_list_insights | List saved insights (charts): id, short_id, name, description, query, tags, favorited, dashboard_tiles, created_by and last_modified_at |
posthog_get_insight | Get one insight by numeric id or 8-character short_id: name, description, query, result, columns, last_refresh, is_cached, the hogql it ran… |
posthog_create_insight | Save a new insight (chart) in the project from a query: a product analytics chart or a SQL insight |
posthog_update_insight | Change a saved insight: name, description, query, tags or favorited |
posthog_delete_insight | Delete a saved insight (PostHog marks it deleted; it disappears from every dashboard and can be restored in the app) |
posthog_list_dashboards | List dashboards: id, name, description, pinned, tags, created_by, created_at and last_viewed_at |
posthog_get_dashboard | Get one dashboard with its filters and tiles: each tile carries its insight (id, short_id, name, query and the last cached result) or a… |
posthog_list_feature_flags | List feature flags: id, key, name (the description), active, filters (release conditions with rollout_percentage, variants, payloads)… |
posthog_get_feature_flag | Get one feature flag by id: key, name, active, filters (release condition groups with properties and rollout_percentage, multivariate… |
posthog_create_feature_flag | Create a feature flag |
posthog_update_feature_flag | Change a feature flag: switch it on or off, change its rollout or targeting, rename its description, archive it or retag it |
posthog_delete_feature_flag | Delete a feature flag (PostHog marks it deleted and switches it off; code that checks the key then gets false) |
posthog_list_cohorts | List cohorts (saved groups of persons): id, name, description, count (persons in it), is_static, is_calculating, filters and created_at |
posthog_get_cohort | Get one cohort by id: name, description, its definition (filters or query), count of persons, whether it is static or behavioral… |
posthog_list_annotations | List annotations (notes on charts such as releases or incidents): id, content, date_marker, scope, the insight or dashboard they belong to… |
posthog_get_annotation | Get one annotation by id: content, date_marker, scope (project, organization, dashboard or insight), emoji, the insight or dashboard it is… |
posthog_create_annotation | Add an annotation, a note shown on charts at a point in time, e.g. a release, a campaign start or an incident |
posthog_delete_annotation | Delete an annotation (PostHog marks it deleted; it disappears from every chart and can be restored) |
posthog_list_experiments | List A/B test experiments: id, name, description, status, start_date, end_date, feature_flag_key, type, conclusion, archived and created_by |
posthog_get_experiment | Get one experiment by id: status, start and end dates, its feature flag and variants, metrics, parameters, exposure cohort, conclusion and… |
Example prompts
- "How many unique users visited our pricing page each day last week, and which browsers did they use?"
- "What was the conversion rate of our signup funnel, from pricing page view to completed checkout, over the last 30 days?"
- "Which feature flags are active right now, and what rollout percentage does each one have?"
- "Add an annotation for today in our main project: Spring campaign launched."
FAQ
Does the free ChatGPT plan work with custom MCP connectors? No. Custom MCP connections need developer mode, which is only on paid plans.
Next steps
Was this guide helpful?