# PostHog MCP use cases - Docs

Once you've [connected the PostHog MCP server](/docs/model-context-protocol.md#get-started-in-30-seconds), your agent can read and write across PostHog's products. Here's a tour of the most useful things to ask – click the copy icon next to any prompt to grab it for your own agent, then adapt it to your project.

## Single-prompt examples

### Investigate bugs and errors

Triage and fix issues from your editor instead of context-switching to a browser. See the [error tracking guide](/docs/error-tracking/debug-errors-mcp.md) and [logs guide](/docs/logs/debug-logs-mcp.md) for deeper walkthroughs.

**"What are the top 5 errors in my project this week?"** – Returns error groups ranked by occurrence with affected user counts.

**"Show me the full stack trace for the most recent crash, then propose a fix."** – Pulls the stack trace, error message, and metadata so the agent can suggest code changes.

**"Show me error logs from the payments service in the last hour."** – Filters logs by severity and service, returning timestamps, messages, and trace IDs.

**"Mark this issue as resolved and assign all future TypeErrors to the backend team."** – Updates issue status and creates an assignment rule in one go.

### Explore product analytics

Ask data questions in plain English and get answers backed by a real PostHog query. See the [analytics guide](/docs/product-analytics/build-insights-mcp.md) for more.

**"How many unique users signed up in the last 7 days, broken down by day?"** – Runs a trends query and returns daily counts.

**"What are the most common paths users take after signing up?"** – Executes a paths query that reveals the dominant journeys after the signup event.

**"Show me the navigation paths from the pricing page to checkout."** – Runs a paths query with start and end points to surface the routes that actually convert.

### Manage feature flags and experiments

Spin up flags, multivariate tests, and full A/B experiments without leaving your code. See the [feature flags guide](/docs/feature-flags/create-flags-mcp.md) and [experiments guide](/docs/experiments/create-experiments-mcp.md).

**"Create a feature flag called new-checkout-flow enabled for 20% of users."** – Creates the flag with a 20% rollout and returns the key and a link to the flag in PostHog.

**"Create a multivariate flag homepage-hero-test with control at 34%, variant\_a at 33%, and variant\_b at 33%."** – Creates a multivariate flag (variant percentages must be integers summing to 100).

**"Create an A/B test for our pricing page that measures conversion to checkout."** – Sets up an experiment with control and test variants and a funnel metric.

**"Create an early access feature called 'Dark Mode' in draft stage."** – Creates the feature and auto-links a dark-mode feature flag.

### Run SQL and HogQL queries

Drop into raw queries when you need precision. See the [SQL guide](/docs/data-warehouse/run-sql-mcp.md).

**"Find all feature flags rolled out to less than 50% of users."** – Queries system.feature\_flags and filters by rollout percentage.

**"Find users who triggered signup but didn't complete onboarding in the last 30 days."** – Constructs a HogQL query against events with subqueries to identify the gap.

**"Which cohorts contain users who made a purchase in the last week?"** – Cross-references system.cohorts with purchase events.

### Build CDP destinations and workflows

Wire up integrations from a single prompt instead of clicking through the UI.

**"Create a Slack destination that sends a message when users sign up."** – Finds the Slack template, then creates a destination function filtered to the signup event.

**"List all my destination functions and show which ones are enabled."** – Returns every destination with its enabled status.

**"Test my webhook destination with a mock purchase event."** – Sends a mock payload and returns execution logs.

### Manage cohorts, prompts, and support

Day-to-day operations your team would otherwise do by hand.

**"Create a dynamic cohort power-users for users who completed the purchase event more than 5 times in the last 30 days."** – Creates a behavioral cohort with the criteria you described.

**"Create a prompt called code-reviewer with instructions for reviewing pull requests."** – Adds a new prompt available across all your MCP-connected agents.

**"List all open support tickets."** – Returns open tickets with numbers, priorities, and message counts.

**"Mark ticket #3 as resolved and set ticket #7 to high priority."** – Updates both tickets in a single call.

## Multi-step recipes

Single prompts get you a long way, but the real value of MCP comes from chaining tool calls into end-to-end workflows. Drop these sequences into your agent one step at a time – each prompt builds on the context the previous one returned.

### Investigate and contain a regression

You've seen an alert about a spike in errors. Triage, ship a kill switch, and clean up – without leaving your editor.

1

**"Show me the top errors from the last 24 hours, sorted by number of affected users."** – Returns the highest-impact issues so you can pick one to dig into.

2

**"Pull the full stack trace and affected sessions for the top issue, then explain the likely root cause."** – The agent grabs the trace plus session replays and reasons about what's failing.

3

**"Create a feature flag called disable-broken-checkout rolled out to 100% of users, and wire it into the failing code path in this repo."** – Creates the flag in PostHog and writes the guard into your codebase.

4

**"Mark the issue as resolved and create an assignment rule so similar TypeErrors go to the backend team automatically."** – Closes the loop on triage and prevents the next incident from going unowned.

### Launch a feature with full experimentation

Ship a new feature, measure its impact, and gate it behind opt-in access for early adopters – in one conversation.

1

**"Create a feature flag called new-onboarding-flow and roll it out to 50% of users."** – Creates the flag with the rollout configured.

2

**"Create an A/B test on top of new-onboarding-flow that measures completion of the onboarding-completed event."** – Sets up an experiment with the flag as the treatment and a funnel metric for completion.

3

**"Create an early access feature called 'New onboarding' in beta stage so users can opt in via our feature previews UI."** – Adds the early access entry and links it to the flag for self-service enrollment.

4

**"Create a dashboard called 'Onboarding launch' with the experiment results, daily active users, and the onboarding funnel."** – Builds a launch dashboard you can share with the team.

### Diagnose a conversion drop

Conversion is down – use MCP to figure out where users are dropping off, why, and what to do about it.

1

**"Run a funnel from pageview on /pricing through clicked-checkout to completed-purchase over the last 14 days."** – Identifies which step is bleeding users.

2

**"For users who dropped off at the worst step, run a paths query showing where they went instead."** – Surfaces the pages users escape to – often a clue to what's confusing them.

3

**"Are there any errors or slow logs correlated with that drop-off page in the same time window?"** – Cross-references error tracking and logs to see if the problem is technical, not just UX.

4

**"Create an alert that pages me if the pricing-to-purchase conversion drops more than 10% week-over-week."** – Sets up a guardrail so the next dip doesn't sit undiscovered.

## Keep exploring

-   [Tools reference](/docs/model-context-protocol/tools.md) – every tool the MCP server exposes, grouped by category
-   [FAQ and advanced setup](/docs/model-context-protocol/faq.md) – auth, scoping, filtering, and other operational details
-   [Overview](/docs/model-context-protocol.md) – back to the MCP overview and install instructions

### Community questions

Ask a question

### Was this page useful?

HelpfulCould be better