PostHog MCP
PostHog MCP: PostHog's server, and product events next to ad spend
PostHog runs its own MCP server, and so does Adrails. PostHog's reads and writes PostHog: insights, HogQL, feature flags, experiments, error tracking. Adrails reads your PostHog event counts next to ad spend by campaign and Stripe or RevenueCat revenue, so an assistant can say what a trial or an activation cost. This page says which to connect, or both, and how.
Reviewed Oct 4, 2026
Side by side
PostHog's MCP server and the Adrails MCP server, criterion by criterion
Two servers, two jobs. PostHog's is the full tool set for a PostHog project. Adrails reads PostHog as one source among the ad accounts, billing and store data it sets together.
| Criterion | PostHog's MCP server | Adrails MCP server |
|---|---|---|
| Address | https://mcp.posthog.com/mcp, with an EU host at mcp-eu.posthog.com. Open source in the PostHog repository under services/mcp. | https://adrails.ai/api/mcp, one URL for every client. Streamable HTTP, POST only. |
| Sign-in | OAuth with your PostHog account, the path PostHog recommends; the authentication server routes you to the US or EU region. Or a personal API key with the MCP Server preset, sent as an Authorization Bearer header. | OAuth 2.1 with your Adrails account. The consent screen asks for one workspace and the permissions; read access is always included, write permissions only if you select them. |
| What it reads | Insights and HogQL queries, dashboards, error tracking, experiments, feature flags, surveys, LLM observability, CDP destinations, support tickets and governed metrics from the semantic layer. | Spend, results, CPA and ROAS by campaign on the connected ad accounts, daily PostHog event counts, Stripe and RevenueCat subscription figures, store orders, and the workspace's own findings. |
| What it writes | Feature flags, experiments, dashboards, workflows and CDP destinations, unless you restrict the session to read-only tools. | Nothing in PostHog. An advertising change is a proposal you apply in Adrails; drafts, automations and Knowledge need their own permission. |
| Ad spend next to it | No. PostHog's server reads PostHog and has no view of an ad account. | Yes. saas_performance returns the product events, trials and MRR of a period; performance_period returns the spend of the same dates by campaign. |
| Clients | PostHog Desktop, Claude Code, Claude Desktop, Cursor, VS Code, Windsurf, Zed and Codex, plus Lovable, Replit and v0. | Claude, Claude Code, ChatGPT in Developer mode, Codex, Cursor, and any remote MCP client with OAuth and PKCE. |
| Price | Free to connect and call. Standard PostHog usage billing applies, and tools that call an LLM internally may be billed as PostHog AI spend. | Included in every Adrails plan, from $149 a month with unlimited ad accounts. A tool call uses no agent credit. |
| Who runs it | PostHog, as a proxy to your PostHog project: it stores none of your analytics data, and calls count against the PostHog API rate limits. | Adrails, as a remote server with 63 tools, 60 calls a minute per token, one workspace per connection. |
PostHog facts from PostHog's Model Context Protocol docs, its MCP FAQ and the server's GitHub repository. Adrails facts from the Adrails MCP docs and the PostHog integration doc.
01
Is there a PostHog MCP server, and what does it do
Yes. PostHog hosts an official MCP server at https://mcp.posthog.com/mcp, with an EU host at mcp-eu.posthog.com, and publishes its code in the PostHog repository under services/mcp. PostHog MCP gives an assistant the whole PostHog project: the docs describe tools for error tracking, feature flags and experiments, HogQL queries and insights, CDP destinations, support ticket triage, and governed metrics from the semantic layer.
Sign-in is OAuth with your PostHog account, the path PostHog recommends and the one its wizard uses: run npx @posthog/wizard mcp add, or add the URL to your client and log in at first use. The authentication server routes you to the US or EU region of the account you sign in with. A personal API key works too, created with the MCP Server preset and sent as an Authorization Bearer header, for clients that cannot do OAuth.
PostHog documents the setup for PostHog Desktop, Claude Code, Claude Desktop, Cursor, VS Code, Windsurf, Zed and Codex, plus Lovable, Replit and v0. Connecting and calling the tools is free; standard PostHog usage billing applies, and the tools that call an LLM internally may be billed as PostHog AI spend, once AI data processing is enabled in your organization settings.
02
What PostHog's server reads and writes
The tools are grouped by product: analytics, SQL queries, dashboards, experiments, feature flags, surveys, error tracking and LLM observability. The examples PostHog gives are the ones a product team types: how many unique users signed up in the last 7 days by day, the most common paths after sign-up, the top 5 errors this week with their stack trace, the users who triggered signup but never completed onboarding in the last 30 days.
It writes. The same examples create a feature flag enabled for 20% of users, a multivariate flag with control at 34% and variant_a at 33%, or a workflow that sends a Slack notification when a user completes checkout. PostHog's FAQ says you can restrict the session to read-only tools when an agent should not write to the project. Queries run against your PostHog project, the server stores none of your analytics data, and calls count against the PostHog API rate limits.
What it does not hold is the spend that produced those users. PostHog has no view of a Meta or Google Ads account, so a question such as what an activated user cost last month has no answer there, however good the event data is.
- Reads: insights, HogQL, dashboards, error tracking, experiments, surveys, LLM observability
- Writes: feature flags, experiments, dashboards, workflows, CDP destinations
- Restrict a session to read-only tools when an agent should only look
03
What the Adrails MCP server reads from PostHog
Adrails connects PostHog as a data source, not as a tool server. In PostHog you create a personal API key with the project:read and query:read scopes, limited to one project; in Adrails you open Integrations, choose PostHog and paste the phx_ key. Adrails finds the project and the region, US or EU, from the key and verifies query access before saving the connection.
From then on Adrails reads the daily counts of your product events and their breakdowns, every 6 hours. The key only reads, and Adrails never changes anything in PostHog: no flag, no insight, no dashboard. If you need those, PostHog's own server is the one to connect.
An AI client connected to https://adrails.ai/api/mcp gets the figures through saas_performance, which returns Stripe billing, RevenueCat revenue metrics and PostHog product events for a period: active subscriptions, trials, normalized MRR, ARR, collected payments, refunds and daily product events, each source and currency kept separate. integrations_status says what is connected and how fresh each data stream is.
04
Product events next to ad spend by campaign
The question a growth team asks is not how many users activated but what each one cost, by campaign. Adrails holds both sides. performance_period returns one ad account's spend, results, CPA and ROAS for exact dates at the campaign, ad set or ad level, with a second range for the change; saas_performance returns the trials, the daily product events and the MRR of the same dates; metrics_daily adds the daily series the other integrations measure.
planning_calculate does the division: first-order acquisition unit economics from the inputs given, in one currency, with the sources and periods stated, and it returns the arithmetic and its limits rather than a forecast. business_review checks a calculation you or the assistant wrote and refuses any number that does not quote its source word for word from the conversation's own tool results. Ask what a trial cost on Meta last month: the answer names the spend, the trial count, their periods, and stops where the data does.
The same figures feed the agents and the automations in Adrails. The agent reads product performance next to Stripe or RevenueCat figures for SaaS and app questions, a weekly review automation with an agent step emails the ads worth a look, and a threshold automation checks cost per result every hour. PostHog event counts are daily totals, so the match of a customer to an ad comes from Adrails tracking and the Tracking tab, with Stripe or RevenueCat connected, never from PostHog.
- Spend by campaign for exact dates: performance_period
- Trials, MRR and daily product events for the same dates: saas_performance
- Cost per trial or per activated user, sources stated: planning_calculate
05
When to connect which, or both
Connect PostHog's server when the work is in PostHog: writing a HogQL query, reading a funnel, shipping a flag, debugging an error, building a dashboard. It is the complete tool set for the product, and it changes things in PostHog, so give it a read-only session or a scoped key where an agent should only look.
Connect Adrails when the question has ad spend in it: cost per trial by campaign, whether the activation rate of the users a campaign brought justifies its budget, which campaign to pause, what the weekly review should say. Adrails never writes to PostHog, and it brings Meta Ads and, once your workspace can connect it, Google Ads, together with Stripe, RevenueCat and the store sources, into the same conversation. Every advertising change is a proposal you apply in Adrails, and a budget move is capped at 30% per change.
Both at once is the usual setup in Claude or Claude Code: the two servers do not overlap. Ask PostHog's server for the activation funnel of a cohort, ask Adrails what the campaign that brought the cohort spent, and let the assistant hold both answers. Each server signs in on its own account and keeps its own permissions.
06
Set up PostHog MCP and Adrails in Claude, Claude Code and ChatGPT
For PostHog's server, the quickest path is npx @posthog/wizard mcp add. By hand, Claude Code takes claude mcp add --transport http posthog https://mcp.posthog.com/mcp -s user, and Claude Desktop takes a mcp-remote entry pointing at the same URL; you log in to PostHog at first use.
For Adrails, add https://adrails.ai/api/mcp as a custom connector in Claude under Customize, then Connectors; run claude mcp add --transport http adrails https://adrails.ai/api/mcp in Claude Code; in ChatGPT, turn on Developer mode and add a custom MCP server with OAuth as its authentication. Sign in to Adrails, choose the workspace and the permissions, and allow access. Read access cannot be left out, write permissions are selected only if you choose them, and each connection works in one workspace.
Then connect PostHog inside Adrails, under Integrations, with the one-project key described above, or ask the assistant for a setup link with integrations_connect, valid for 10 minutes and opened by an owner or admin. Ask which integrations are connected: integrations_status lists PostHog with the freshness of its data, and the first saas_performance call returns the daily event counts next to the subscription figures.
- PostHog's server: npx @posthog/wizard mcp add, or the URL plus OAuth
- Adrails: https://adrails.ai/api/mcp as a custom connector, OAuth sign-in
- PostHog in Adrails: Integrations, a phx_ key with project:read and query:read
Five questions
What to ask, and which server answers it
The split is simple: anything inside PostHog goes to PostHog's server; anything with ad spend in it goes to Adrails.
| Question | PostHog's MCP server | Adrails MCP server |
|---|---|---|
| How many unique users signed up in the last 7 days, by day? | Yes, as an insight or a HogQL query, with the paths users took afterwards. | Yes, as the daily count of your sign-up event, read every 6 hours, without person-level detail. |
| Which campaign brought the users who activated? | Only as far as your events carry the campaign; it never sees what the campaign spent. | Spend by campaign and daily activation counts for the same dates. The match of a customer to an ad comes from Adrails tracking and the Tracking tab, with Stripe or RevenueCat connected. |
| Create a feature flag for the new paywall at 20% of users | Yes, a write tool, with multivariate flags and experiments alongside. | No. Adrails never writes to PostHog. |
| What did a trial cost on Meta last month? | No. There is no ad spend in PostHog. | Yes. performance_period gives the spend, saas_performance the trials, planning_calculate the division with its sources and periods stated. |
| Pause the campaign whose cost per activation doubled | No. | A proposal you apply in Adrails, prepared with the campaigns_pause tool, or a threshold automation that checks cost per result every hour. |
PostHog's example prompts come from its MCP use cases page. Adrails tool names come from the MCP tools reference.
Go further
Read more
- PostHog connectorWhat Adrails reads from PostHog, the key it needs and how often it refreshes.
- Meta Ads MCP serverRead results, prepare a launch and change what runs on Meta from your assistant.
- Claude integrationAdd Adrails to Claude as a custom connector, step by step.
- MCP tools referenceEvery tool the Adrails server registers, with its inputs, access and limits.
FAQ
Common questions
Is there a PostHog MCP server?
Yes. PostHog hosts one at https://mcp.posthog.com/mcp, with OAuth sign-in or a personal API key, and tools across analytics, SQL, dashboards, experiments, feature flags, surveys, error tracking and LLM observability. Adrails runs a separate server that reads your PostHog event counts next to ad spend.
Does the PostHog MCP server need a personal API key?
No. PostHog recommends OAuth, which its wizard sets up and which routes you to the US or EU region of your account. A personal API key with the MCP Server preset works as an Authorization Bearer header for clients without OAuth.
Can Claude read PostHog and my ad spend in one conversation?
Yes, with both servers connected: PostHog's for insights and HogQL, Adrails for spend by campaign and the daily event counts it reads from PostHog. Adrails alone answers cost per trial or per activation, because it holds the spend and the events for the same dates.
Does Adrails create feature flags or write anything in PostHog?
No. The key Adrails uses has project:read and query:read only, and the Adrails MCP server has no PostHog write tool. Use PostHog's own server for flags, insights and dashboards.
How fresh are PostHog figures in Adrails?
Daily event counts and their breakdowns are read every 6 hours. integrations_status tells your assistant when each data stream was last read, and an owner or admin can queue a refresh with integrations_sync.