v0 integration
Contents
The PostHog MCP lets v0 query your analytics data, investigate errors, manage feature flags, and run experiments - all through natural language.
Connect PostHog to v0
- In a v0 chat, click the + button in the bottom left
- Click MCPs
- Click Add MCP
- Select Custom MCP
- Enter the name
PostHogand URLhttps://mcp.posthog.com/mcp - Under Authentication, select OAuth
- Click Add, then authorize with PostHog when prompted
The PostHog MCP server is now available in your v0 chats.
If your PostHog project is on EU Cloud, use https://mcp-eu.posthog.com/mcp instead.
Set up PostHog in your project
Once connected, give v0 this prompt to add PostHog with the Vercel Flags SDK:
The agent will set up PostHog with the client owning identity via localStorage+cookie persistence, ensuring reliable experiment attribution.
What you can do with the MCP
Once connected, you can ask v0 to interact with your PostHog data directly:
Query your analytics
Prompt: "How many unique users signed up in the last 7 days, broken down by day?"
The agent will run a trends query and return daily signup counts with a breakdown.
Prompt: "What's the conversion rate from signup to first purchase?"
The agent will build a funnel query and calculate the conversion percentage between those two events.
Investigate errors
Prompt: "What are the top 5 errors in my project this week?"
The agent will fetch error groups sorted by occurrence count, including how many users were affected.
Prompt: "Show me details about the most recent TypeError"
The agent will pull the stack trace, affected users, and browser/OS context for that error.
Manage feature flags
Prompt: "Create a feature flag called 'new-checkout' enabled for 10% of users"
The agent will create the flag with a 10% rollout and return the configuration with a link to the flag in PostHog.
Prompt: "Update the 'beta-features' flag to 50% rollout"
The agent will modify the existing flag and confirm the new rollout percentage.
Run experiments
Prompt: "Create an A/B test for the pricing page that measures conversion to checkout"
The agent will set up an experiment with control/test variants and configure a funnel metric measuring pricing page to checkout conversion.
See all available MCP tools for the complete list.
Troubleshooting
OAuth not refreshing
If the OAuth token expires and won't refresh, you can use a personal API key instead:
- Create a personal API key with the MCP Server preset
- In v0, go to Manage MCPs and edit the PostHog connection
- Change authentication to Bearer and enter your API key
MCP not connecting
Try disconnecting and reconnecting the PostHog MCP server. Make sure you're logged into the correct PostHog account.
Next steps
- Vercel Flags SDK docs - Full Vercel Flags SDK setup guide
- MCP tools reference - All available MCP tools
- Feature flags - Set up feature flags in your code
Have feedback or questions? Let us know on GitHub or ask a question.