PostHog MCP for VS Code

The PostHog MCP server enables VS Code to directly interact with your PostHog data – managing feature flags, querying analytics, investigating errors, and more.

Note: This is different from the PostHog VS Code extension, which provides inline analytics, flag management, and session replay links directly in your editor. They complement each other.

Server URL

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.

Quick install

The PostHog Wizard can install the MCP server directly into VS Code:

Terminal
npx @posthog/wizard mcp add

Manual setup

  1. Open Visual Studio Code. In the command palette, run: MCP: Open User Configuration to open the configuration file
  2. Update mcp.json with the following configuration:

JSON
{
"servers": {
"posthog": {
"type": "http",
"url": "https://mcp.posthog.com/mcp"
}
}
}

  1. Save the configuration file
  2. The MCP server will now be available the next time you chat with Copilot

When you first use the MCP server, you'll be prompted to log in to PostHog to authenticate.

Be mindful of prompt injection – LLMs can be tricked into following untrusted commands, so always review tool calls before executing them.

What's next

  • 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

Community questions

Was this page useful?

Questions about this page? or post a community question.