PostHog MCP use cases
Contents
Once you've connected the PostHog MCP server, 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 and logs guide 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 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 and experiments guide.
"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.
"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.
Edit workflow graphs
Make surgical edits to a draft workflow's graph without resending the entire action and edge list. Operations apply atomically – the graph is validated before saving.
"Change the email subject in the welcome-email step of my onboarding workflow to 'Welcome aboard, {{person.name}}'." – Sends an update_action op that deep-merges just the subject field, leaving the rest of the node untouched.
"Add a 1-hour delay step between the signup trigger and the welcome email in my onboarding workflow." – Adds a new delay action and rewires the edges so the trigger flows through the delay into the email step.
"Remove the SMS reminder step from my checkout-abandonment workflow." – Removes the action and automatically reconnects incoming edges to the next step in the chain.
"Replace all outgoing edges from the conditional branch step in my trial-expiry workflow so the 'enterprise' branch goes to a custom email instead." – Uses replace_action_edges to swap the branch's outgoing connections in one atomic operation.
Create and manage email templates
Design and edit email templates for Workflows and broadcasts directly from your editor. See the email creation guide for more.
"Create a welcome email template copying the branding from stripe.com for new users with a friendly greeting and a CTA to complete their profile." – Creates an email template with design JSON, renders it, and returns an edit link to PostHog.
"Show me the onboarding email template so I can see what it looks like." – Renders an inline preview of the template's final HTML.
"Update the welcome email template to mention the user's company name in the subject line." – Fetches the current design, modifies it with Liquid personalization, and saves the updated template.
"List all email templates in the library." – Returns template names and IDs for reference in workflows.
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.
Schedule reminders
Set one-off or recurring reminders that fire as in-app notifications. Optionally attach a resource like a dashboard or experiment so the notification links straight to it.
"Remind me every Monday at 9am to review the activation dashboard." – Creates a recurring reminder with a cron schedule and links it to the dashboard.
"Set a reminder for tomorrow at 3pm to check the experiment results." – Creates a one-off reminder that fires once and marks itself completed.
"What reminders do I have?" – Lists your reminders with their schedule, status, and next fire time.
"Change my weekly activation reminder to fire at 10am instead of 9am." – Updates the schedule and recomputes the next fire time.
"Cancel the weekly activation reminder." – Deletes the reminder so it stops firing.
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.
"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.
"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.
"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.
"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.
"Create a feature flag called new-onboarding-flow and roll it out to 50% of users." – Creates the flag with the rollout configured.
"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.
"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.
"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.
"Run a funnel from pageview on /pricing through clicked-checkout to completed-purchase over the last 14 days." – Identifies which step is bleeding users.
"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.
"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.
"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 – every tool the MCP server exposes, grouped by category
- FAQ and advanced setup – auth, scoping, filtering, and other operational details
- Overview – back to the MCP overview and install instructions