
PostHog connects differently to every other source in SourcetoMCP: instead of signing in through a Google- or Meta-style consent screen, you generate a personal API key inside PostHog and paste it in. Then you add SourcetoMCP as a custom connector in Claude. For what your agent can query once both halves are done, see the PostHog MCP server page.
Before you start
You'll need a SourcetoMCP account with at least one brand created, access to a PostHog account (Cloud or self-hosted) with at least one project you want to connect, and a Claude account. Custom connectors work on Free, Pro, Max, Team and Enterprise, though Free accounts are limited to one at a time.
Start the connection in SourcetoMCP
- 1From your dashboard, go to
Connectors→Add a connection. - 2Find the PostHog card and select Connect.
- 3Choose where your PostHog account lives: PostHog Cloud (US), PostHog Cloud (EU), or Self-hosted (if self-hosted, you'll also need your instance's URL, e.g.
https://posthog.yourcompany.com). If you're not sure which cloud region you're on, check the URL you use to log into PostHog itself.
Generate a personal API key in PostHog
Keep this tab open, and open PostHog in another one.
- 1In PostHog, open your account menu (top left) → Settings.
- 2Go to Personal API Keys, then select + Create personal API key.
- 3Give it a label you'll recognise later, e.g.
SourcetoMCP. - 4Scope it to the projects you want to connect, with read access to queries, persons and feature flags. If you also want Claude to be able to turn a feature flag on or off, the key needs write access to feature flags as well. A read-only key works fine for everything else, and every flag toggle will fail against it.
- 5Save, then copy the key. It starts with
phx_and is only shown once.
Finish connecting
- 1Back in SourcetoMCP, paste the key into the Personal API key field.
- 2Select Connect PostHog. This verifies the key against PostHog directly.
- 3Choose which project(s) to connect, then confirm.
Connected projects then appear on your Connections page like any other source.
Add SourcetoMCP as a connector in Claude
Claude adds every custom connector the same way, under Customize then Connectors. These steps are that flow pointed at SourcetoMCP.
- 1In SourcetoMCP, open
Connect an agentfrom the dashboard sidebar and copy your server address (it looks likehttps://sourcetomcp.com/api/mcp). - 2In Claude, open Customize, then Connectors.
- 3Select +, then Add custom connector.
- 4Paste in your server address. You can leave Advanced settings alone, because SourcetoMCP runs its own OAuth and never needs a client ID or secret from you.
- 5Click Add.
- 6The first time Claude uses it, you'll be asked to sign in to SourcetoMCP and approve access. After that it reconnects on its own.
On a Team or Enterprise plan, only an Owner can add a connector, from Organization settings, then Connectors. Everyone else then opens Customize → Connectors and clicks Connect to sign in with their own SourcetoMCP account.
Ask Claude about your product data
Switch the connector on per conversation: select the + button, choose Connectors, and toggle SourcetoMCP on.
The flagship operation writes HogQL, PostHog's own SQL dialect, against your events, persons and sessions tables. That means questions are not limited to a fixed menu of reports. Try something like:
- 1
How many signups did we get last week, broken down by referrer? - 2
Build me a funnel from landing page view to paid conversion. - 3
Look up everything you know about the person with this email. - 4
Which feature flags are active right now, and who do they target?
A note on the one write action
Three of the four PostHog operations only read. The fourth turns a feature flag on or off, and that takes effect immediately against real users, so treat it like any other production change. It only ever flips the active switch: a flag's targeting, rollout percentage and audience stay exactly as they were, and Claude has to say active or inactive explicitly rather than relying on a default. It cannot create a flag or delete one.
Troubleshooting
“That API key was rejected”: the key is wrong, was revoked, doesn't have project read access, or was created under a different host/region than the one you selected. Double-check the region and generate a fresh key if needed.
“Couldn't reach PostHog at that host”: only shown for self-hosted instances. Confirm the URL is correct, includes https://, and is reachable from the public internet. A host that only resolves on your own network won't work.
No projects showing up: the key is valid but can't see any projects. Confirm the PostHog user the key belongs to is actually a member of the project(s) you expect.
Reads work but toggling a flag fails: the key is read-only. Create a new one with write access to feature flags and reconnect.
Revoking access
You can disconnect PostHog from your Connections page at any time. For extra certainty, delete the personal API key directly in PostHog under Settings → Personal API Keys. Either side revokes access, and deleting the key is the one that cannot be undone from SourcetoMCP.
Still stuck?
Reach us at [email protected].