Model Context Protocol (MCP)

The PostHog Model Context Protocol (MCP) server is a free, hosted endpoint that lets your AI agent use PostHog – with just plain text questions your agents can ship a feature flag from a prompt, dig into a stack trace without leaving your editor, run a HogQL query through Claude, triage a support ticket, set up a CDP destination, and much more.

It works with any MCP-compatible client, including PostHog Code, Claude Code, Claude Desktop, Cursor, Codex, VS Code, Windsurf, and Zed.

Get started in 30 seconds

The fastest way to setup the MCP is the PostHog Wizard, which installs the MCP server directly into PostHog Code, Cursor, Claude Code, Claude Desktop, Codex, VS Code, and Zed:

Terminal
npx @posthog/wizard mcp add

Using something else? Pick your client to set it up manually:

Code editors

Platforms

The server URL is https://mcp.posthog.com/mcp. The PostHog authentication server automatically routes you to the correct data region (US or EU) based on the account you log in with.

What can you do with the PostHog MCP?

Using Claude Code to debug and fix errors via the PostHog MCP server

Once connected, your agent can read and write across PostHog's products. Here's a taste – triaging errors from inside your editor instead of context-switching to a browser:

"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.

"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.

There's a lot more – analytics queries, feature flag and experiment management, SQL, CDP destinations, support ticket triage, and multi-step recipes that chain it all together.

Browse all use cases →

Go deeper

  • Use cases – 20+ example prompts and multi-step recipes for the most useful MCP workflows
  • Tools reference – every tool the MCP server exposes, grouped by category
  • FAQ and advanced setup – auth, scoping, filtering, safety, and other operational details

Next steps

Community questions

Was this page useful?

Questions about this page? or post a community question.