Query revenue with MCP

The PostHog MCP server lets your AI coding agent query revenue data directly from your code editor. Check MRR, analyze revenue by segment, and build revenue dashboards – without switching to the PostHog app.

This works in any MCP client – Cursor, Windsurf, Claude Code, VS Code, and others.

How it works

With MCP, your coding agent can:

  • Check revenue impact of changes – "What's the MRR for the enterprise plan?" before adjusting pricing logic
  • Monitor revenue health – "Compare this month's revenue to last month" to spot trends
  • Analyze customer segments – "Which plan drives the most revenue?" to inform product decisions
  • Query Stripe data directly – "Show me the latest charges from stripe_charges" to inspect raw payment data

Revenue tools

The MCP server uses these tools for querying revenue data:

ToolDescription
query-runRun a HogQL query against your revenue data, including connected sources like Stripe. Supports MRR calculations, cohort analysis, and custom breakdowns.
query-generate-hogql-from-questionGenerate a HogQL query from a natural language question about revenue. Returns the query for review before running.
insight-create-from-queryCreate a saved insight from a revenue query and add it to a dashboard.

Example prompts

Try these with your MCP-enabled agent:

  • What's our current MRR?
  • Show revenue broken down by plan for the past 6 months.
  • Which customer segments have the highest ARPU?
  • Compare revenue this quarter vs last quarter.
  • Query stripe_subscriptions to find all active enterprise subscriptions.
  • Create a revenue dashboard with MRR trend, churn rate, and ARPU by plan.

Install the MCP server

The recommended way to install is with the AI wizard:

Terminal
npx @posthog/wizard mcp add

The wizard supports Claude, Cursor, Windsurf, VS Code, and more. You can also configure it manually.

See the MCP server docs for full setup instructions.

Community questions

Was this page useful?

Questions about this page? or post a community question.