# Query revenue with MCP - Docs

The [PostHog MCP server](/docs/model-context-protocol.md) lets your AI coding agent query [revenue data](/docs/revenue-analytics.md) 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:

| Tool | Description |
| --- | --- |
| query-run | Run a HogQL query against your revenue data, including connected sources like Stripe. Supports MRR calculations, cohort analysis, and custom breakdowns. |
| query-generate-hogql-from-question | Generate a HogQL query from a natural language question about revenue. Returns the query for review before running. |
| insight-create-from-query | Create 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](/docs/ai-engineering/ai-wizard.md):

Terminal

PostHog AI

```bash
npx @posthog/wizard mcp add
```

The wizard supports Claude, Cursor, Windsurf, VS Code, and more. You can also [configure it manually](/docs/model-context-protocol.md#manual-install).

See the [MCP server docs](/docs/model-context-protocol.md) for full setup instructions.

### Community questions

Ask a question

### Was this page useful?

HelpfulCould be better