A PostHog MCP that answers product questions in SQL
Connect one personal API key and PostHog's analytics surface becomes workflow steps for visual automations and AI agents. The centerpiece is a HogQL node that runs SELECT-only SQL over your events, and the feature flag nodes treat production toggles with the caution of a deploy: create dark, enable deliberately.
What the PostHog MCP connector does
The PostHog connector for Mattering Automations is 33 nodes across the private API: one HogQL query node that runs SQL over events, persons, and sessions, insights and dashboards (create, read, update), persons and cohorts, the full feature flag lifecycle including the production toggle, experiment reads, annotations as deploy markers, session recording metadata, event and property schema discovery, and the organization and project reads that supply the ids everything else needs.
Every node speaks MCP, the open protocol for connecting AI assistants to tools, so Claude, ChatGPT, and any MCP-capable assistant can use them, alongside Matter, the AI assistant built into the platform. An assistant can learn a project's event vocabulary with PostHog: List Event Definitions and PostHog: List Property Definitions, then answer a real product question by writing SQL for PostHog: Run HogQL Query, without anyone opening the PostHog app.
Because Mattering is a work platform rather than middleware, analytics work lands somewhere useful by default: a scheduled set of HogQL queries can become a weekly metrics digest delivered as a report task in Mattering Productivity, query rows can accumulate in a Mattering database for trend history, and a feature flag rollout can wait behind an approval task before the toggle ever flips.
The safety story is explicit. HogQL is SELECT-only, so the workhorse query node reads data and cannot mutate it. PostHog: Create Feature Flag defaults new flags to inactive, PostHog: Update Feature Flag warns that toggling active changes what real users experience immediately, and PostHog: Delete Feature Flag (Soft) is PostHog's own reversible soft delete. Exactly one node in the catalog is destructive: PostHog: Delete Person, the GDPR erasure operation, which queues permanent asynchronous deletion with no undo.
One connection, three surfaces
- Visual automations. Drag PostHog nodes onto the canvas and wire them to triggers, conditions, and other apps.
- AI agents, yours or ours. These nodes speak MCP, the open protocol, so Claude, ChatGPT, and any MCP-capable assistant can use them, and Matter, the agent built into the platform, uses them natively.
- The whole platform. Combine with native tasks, projects, and other connectors, no middleware in between.
Every PostHog node, ready to drop on the canvas
33 nodes, generated from the connector itself so this list always matches what ships. Expand a category to browse.
Read and query nodes 23
PostHog: Get Cohort
Retrieve one cohort by numeric id, including its filter definition, member count, and calculation status. Requires the cohort:read scope.
PostHog: Get Current User
Return the account behind the personal API key: name, email, and the current organization and project context (organization.id and team.id feed every other PostHog node). Zero required parameters, so it doubles as the credential health check. The personal API key is never echoed back.
PostHog: Get Dashboard
Retrieve one dashboard by numeric id, including its tiles and the insights on it. Requires the dashboard:read scope.
PostHog: Get Experiment
Retrieve one experiment by numeric id: its feature flag, variants, timing, and configuration. Requires the experiment:read scope.
PostHog: Get Feature Flag
Retrieve one feature flag by numeric id: key, active state, full rollout filters, and linked experiments. Requires the feature_flag:read scope.
PostHog: Get Insight
Retrieve one insight by numeric id, including its full query definition and latest cached result. Requires the insight:read scope.
PostHog: Get Organization
Retrieve one organization by UUID: name, membership level, and its teams/projects summary. Requires the organization:read scope.
PostHog: Get Person
Retrieve one person by id: all their distinct_ids and person properties. Person records carry personal data that persists in execution records. Requires the person:read scope.
PostHog: Get Project
Retrieve one project by its numeric id: name, timezone, and the phc_ project api_token (the client-side ingestion token, public by design). Requires the project:read scope.
PostHog: Get Session Recording
Retrieve one session recording's METADATA by id (duration, activity counts, person). The raw replay data itself is not served by this API. Requires the session_recording:read scope.
PostHog: List Annotations
List a project's annotations (the markers that appear on insight charts, for example deploy notes). Requires the annotation:read scope. Response is {count, next, previous, results}: page with limit and offset until next is null.
PostHog: List Cohorts
List a project's cohorts with ids, names, member counts, and whether each is static or dynamic. Requires the cohort:read scope. Response is {count, next, previous, results}: page with limit and offset until next is null.
PostHog: List Dashboards
List a project's dashboards with ids, names, and pinned state. The id feeds the insight nodes' dashboards field. Requires the dashboard:read scope. Response is {count, next, previous, results}: page with limit and offset until next is null.
PostHog: List Event Definitions
List the event names a project has ever seen (schema discovery): the vocabulary available to HogQL queries, insights, and cohort filters, with last_seen_at per event. Requires the event_definition:read scope. Response is {count, next, previous, results}: page with limit and offset until next is null.
PostHog: List Experiments
List a project's A/B experiments with ids, names, linked feature flags, and start/end dates. Requires the experiment:read scope. Response is {count, next, previous, results}: page with limit and offset until next is null.
PostHog: List Feature Flags
List a project's feature flags with ids, keys, active state, and rollout filters. Requires the feature_flag:read scope. Response is {count, next, previous, results}: page with limit and offset until next is null.
PostHog: List Insights
List a project's saved insights (trends, funnels, and the rest) with their ids, short_ids, names, and dashboard links. Requires the insight:read scope. Response is {count, next, previous, results}: page with limit and offset until next is null.
PostHog: List Organizations
List the organizations the personal API key can see, with their UUIDs and member counts. The organization id feeds PostHog: List Projects. Requires the organization:read scope. Response is {count, next, previous, results}: page with limit and offset until next is null.
PostHog: List Persons
List a project's persons, filterable by distinct_id, email, free-text search, or property filters. Person records carry personal data (emails, names) that persists in execution records; fetch only what the automation needs. Requires the person:read scope. Response is {count, next, previous, results}: page with limit and offset until next is null.
PostHog: List Projects
List the projects in an organization. Each result's numeric id field is the project_id every project-scoped PostHog node needs. Results also include api_token, the phc_ client-side project token (public by design, but it does persist in execution records). Requires the project:read scope. Response is {count, next, previous, results}: page with limit and offset until next is null.
PostHog: List Property Definitions
List the event or person property names a project has seen (schema discovery), with each property's data type. Pairs with List Event Definitions to let an agent learn a project's analytics schema before writing HogQL. Requires the property_definition:read scope. Response is {count, next, previous, results}: page with limit and offset until next is null.
PostHog: List Session Recordings
List session replay METADATA: who, when, duration, and activity counts. The raw replay video/snapshot data is not available through this API (export it from the PostHog UI); this node is for finding and triaging sessions, for example alerting on long rage-click sessions. Requires the session_recording:read scope. Response is {count, next, previous, results}: page with limit and offset until next is null.
PostHog: Run HogQL Query
Run a HogQL query (PostHog's SQL dialect) against a project's events, persons, and sessions: the current workhorse for pulling analytics data into an automation. Write the SQL in the hogql field; HogQL is SELECT-only, so this node reads data and cannot mutate it. Results come back as data.results (array of rows) with data.columns. Default 100 rows, LIMIT up to 50000; rate limit 2400 queries/hour per organization. Requires the query:read scope.
Action nodes 10
PostHog: Create Annotation
Create an annotation, the classic deploy marker: drop 'Deployed v2.4.0' at a timestamp and it appears on every insight chart, correlating releases with metric changes. Reversible: delete the annotation in PostHog to undo. Requires the annotation:write scope.
PostHog: Create Cohort
Create a cohort. With is_static true you get a static (manually curated) cohort, populated afterwards in the PostHog UI or via CSV; with is_static false, provide filters so membership is computed dynamically. Reversible: delete the cohort in PostHog to undo. Requires the cohort:write scope.
PostHog: Create Dashboard
Create a dashboard, empty or from a PostHog template. Add insights to it afterwards with PostHog: Update Insight (its dashboards field). Reversible: soft-delete via the update node. Requires the dashboard:write scope.
PostHog: Create Feature Flag
Create a feature flag. CAUTION: if your application code already checks this flag key, creating it active changes real production behavior immediately. Reversible (toggle active off or soft-delete), but treat it like a deploy. Requires the feature_flag:write scope.
PostHog: Create Insight
Create a saved insight from a query definition, optionally pinning it onto dashboards at creation. Reversible: update the insight with deleted true (or delete it in the UI) to remove it. Requires the insight:write scope.
PostHog: Delete Feature Flag (Soft)
Soft-delete a feature flag by setting deleted true, which is the only deletion PostHog's API allows (hard DELETE is rejected; the docs mandate this PATCH instead). A soft-deleted flag STOPS EVALUATING, so if it was active this changes production behavior immediately. Reversible: PATCH deleted false (via PostHog: Update Feature Flag's extra_body) restores it. Requires the feature_flag:write scope.
PostHog: Delete Person
DESTRUCTIVE: permanently delete a person from the project, with no undo. With delete_events true, all of the person's historical events are also queued for permanent, asynchronous deletion (processed off-peak). This is the GDPR right-to-erasure operation; deletion is not instant but it is irreversible once queued. Requires the person:write scope.
PostHog: Update Dashboard
Update a dashboard's name, description, pinned state, or tags. Setting deleted true soft-deletes it (deleted false restores). Only fields you fill are changed. Requires the dashboard:write scope.
PostHog: Update Feature Flag
Update a feature flag: the active field is the kill switch and rollout toggle. CAUTION: toggling active or changing filters changes what real users experience in production IMMEDIATELY. Reversible (set it back), but gate this node carefully in automations. Only fields you fill are changed. Requires the feature_flag:write scope.
PostHog: Update Insight
Update an insight: rename it, replace its query, or set dashboards to add it to (or remove it from) dashboards, which is how an insight lands on a dashboard via the API. Setting deleted true soft-deletes it (deleted false restores). Only fields you fill are changed. Requires the insight:write scope.
Connecting PostHog takes one credential
PostHog issues personal API keys from account settings (the Personal API Keys section). A key carries the phx_ prefix, is shown once at creation and never retrievable afterwards, acts as the user who created it, and is sent as a Bearer credential on every request. Keys carry per-resource scopes chosen at creation, and each node's description names the scope it requires. This is a different credential from the phc_ project key your website snippet uses; the two are not interchangeable.
In PostHog, open your account settings, go to Personal API Keys, and create a key with the scopes your automations need (each node's description names its required scope). Copy the key immediately: it is shown once and never again.
In Mattering Automations, open Connectors, click Add Connector, choose PostHog, and create a credential with that key.
Click Test Connection. Mattering calls PostHog's current user endpoint on the US Cloud host and confirms the key authenticates. EU Cloud keys fail this test even though the nodes themselves work once each node's host field is set to eu.posthog.com.
All 33 PostHog nodes appear in the canvas palette. Run PostHog: Get Current User first: it takes no parameters and returns the numeric project id (team.id) that every project-scoped node needs.
Common uses for the PostHog MCP
Product questions answered in SQL
PostHog: Run HogQL Query runs SELECT-only SQL over a project's events, persons, and sessions, and it supersedes the older events APIs as the front door to analytics data. You write plain SQL in the hogql field and the runner wraps it into PostHog's query envelope. Pair it with PostHog: List Event Definitions and PostHog: List Property Definitions so an assistant can learn the schema first, then ask real questions: signups last week, activation by plan, the top events before churn.
Feature flags with deploy discipline
PostHog: Create Feature Flag defaults new flags to inactive, so flags arrive dark and enabling is a separate decision. PostHog: Update Feature Flag is that decision: flipping active changes what real users experience immediately, and the node says so. PostHog: Delete Feature Flag (Soft) is PostHog's own soft delete via PATCH, reversible by restoring the flag, though a soft-deleted active flag stops evaluating the moment it is deleted.
Deploy markers on every chart
PostHog: Create Annotation drops a marker such as Deployed v2.4.0 at a timestamp, and it appears on insight charts so metric movements line up with releases. Wire it in after a deploy step and the correlation work does itself; PostHog: List Annotations reads the history back.
A weekly metrics digest the team actually reads
Run a handful of HogQL queries on a schedule, format the numbers, and deliver the digest as a report task in Mattering Productivity while the raw rows accumulate in a Mattering database for trend history. Nobody has to remember to check a dashboard; the dashboard comes to them.
Session replay triage without the videos
PostHog: List Session Recordings and PostHog: Get Session Recording return replay metadata: who, when, duration, and activity counts. The raw replay data is not served by this API, which makes these nodes a safe triage surface: find the long high-activity sessions, open a task with the recording id, and watch the replay in PostHog itself.
Dashboards and insights built from the canvas
PostHog: Create Dashboard and PostHog: Create Insight assemble reporting surfaces from workflow data, and PostHog: Update Insight's dashboards field is how an insight lands on a dashboard through the API. Insight query definitions run deep, so the practical workflow is copy-from-UI: build one insight in PostHog, read it back with PostHog: Get Insight, and reuse the query object.
Example: A weekly HogQL metrics digest that lands as a report task
Built on the Automations canvas in a few minutes, or described in plain language to Matter and built for you.
Trigger: a schedule fires early Monday morning.
PostHog: Get Current User confirms the credential and supplies the numeric project id every other node needs.
PostHog: Run HogQL Query pulls the week's headline numbers: signups, weekly active users, and conversion, one SELECT per metric.
A second PostHog: Run HogQL Query breaks conversion down by acquisition source, so the digest explains the movement instead of just reporting it.
PostHog: List Feature Flags snapshots which rollouts are currently active, tying metric shifts to what shipped.
The formatted digest lands as a report task in Mattering Productivity ready for Monday standup, and the raw rows append to a Mattering database for trend history.
PostHog MCP questions, answered
What PostHog operations are supported?
33 nodes: 23 queries and 10 actions. The HogQL query node covers reading events, persons, and sessions in SQL; around it sit insights and dashboards (create, read, update), persons (list, get, and the GDPR delete), cohorts (list, get, create), the full feature flag lifecycle (list, get, create, update, soft delete), experiment reads, annotations (list, create), session recording metadata, event and property definition discovery, and the account, organization, and project reads. Deliberately not shipped: event capture (a different credential class, see below), experiment writes, person property edits, bulk person deletion, and admin surfaces like organization members and invites.
Does this work with Claude, ChatGPT, or other AI assistants?
Yes. Mattering exposes these nodes over MCP, an open protocol for connecting AI assistants to tools, so any MCP-capable assistant, including Claude and ChatGPT, can connect to your workspace and use them. Matter, the assistant built into the platform, uses the same nodes natively. The schema discovery reads plus the SELECT-only HogQL node are a particularly good fit for assistants: learn the vocabulary, then query it.
Can this connector send events into PostHog?
No, and that is deliberate. Event capture uses the phc_ project key, a client-side ingestion token sent in the request body against PostHog's separate ingestion hosts: a different credential class from the phx_ personal API key this connector authenticates with. Wiring both into one credential would conflate two key types with different security properties. If you need to capture an event from a workflow today, the honest workaround is a generic HTTP node: PostHog: List Projects even returns the phc_ token (it is public by design) so you can template it in.
What is HogQL and what are its limits?
HogQL is PostHog's SQL dialect over events, persons, and sessions, and PostHog: Run HogQL Query is its node: write SQL in the hogql field and the runner wraps it into PostHog's query envelope. HogQL is SELECT-only, so the node cannot change anything. Practical limits: results default to 100 rows with an explicit LIMIT accepted up to 50000, personal API keys cannot use OFFSET pagination (paginate on a timestamp column instead), and query requests are rate limited to 2400 per hour per organization.
Does this work with EU Cloud or self-hosted PostHog?
Yes. Every node carries a host field defaulting to us.posthog.com; EU Cloud organizations set it to eu.posthog.com, and self-hosted instances set their own domain, since they expose the same API surface. One honest caveat: the connector's Test Connection button calls the US Cloud host, so an EU-only key fails that test even though the nodes work correctly once their host field is set.
Can an automation change what my production users experience?
Through feature flags, yes, and the nodes are explicit about it. PostHog: Update Feature Flag's active field is the rollout toggle and kill switch: flipping it changes real user experience immediately. PostHog: Create Feature Flag defaults to inactive so creation alone changes nothing unless your code already checks that flag key. PostHog: Delete Feature Flag (Soft) stops a flag evaluating, which also changes behavior if the flag was active. All three are reversible, but gate them the way you would gate a deploy: behind a condition, an approval task, or a manual run.
Can anything be permanently deleted?
One node. PostHog: Delete Person is the GDPR right-to-erasure operation: it permanently deletes a person from the project, and with delete_events enabled it also queues all of that person's historical events for permanent asynchronous deletion, processed off-peak. It is not instant, but it is irreversible once queued, and it is the only destructive node in the catalog. Everything else that deletes does so softly and reversibly: feature flags, insights, and dashboards all restore by clearing the deleted field.
Can a PostHog event trigger a workflow?
Not as a trigger node in this connector: there is no inbound PostHog trigger. The honest pattern today is polling on a schedule, and HogQL makes it a good one: run PostHog: Run HogQL Query for events matching your condition since the last run, and act on the rows that come back. For entity changes, the list nodes (flags, experiments, annotations) fill the same role.
Put PostHog to work inside your workspace
Connect once, then use every node in visual automations and AI agent workflows across the Mattering platform.
All product names, logos, and brands are property of their respective owners and are used for identification purposes only. Use of these names, logos, and brands does not imply endorsement or affiliation. PostHog is a product of its respective owner; Mattering is an independent platform.