← Back to MCP servers

PostHog

PostHog MCP Server

Query product analytics, manage feature flags, and explore user data from PostHog.

API key requiredGet credentials →

Last reviewed Mar 2, 2026

Install

claude mcp add posthog --transport sse -- https://mcp.posthog.com/sse
Scope: project

Environment variables required:

POSTHOG_API_KEY=your-personal-api-key

Available tools

ToolDescription
query_insightsQuery analytics insights and trends
list_dashboardsList all dashboards in your PostHog project
create_feature_flagCreate a new feature flag with targeting rules
list_eventsList recent events with filtering
search_personsSearch for users and their properties

What it does

The PostHog MCP Server connects your AI coding assistant to PostHog's product analytics platform via their hosted SSE endpoint. It enables you to query analytics data, manage feature flags, explore user behavior, and review dashboards -- all without leaving your development environment.

This integration is particularly useful when you need analytics context during development. Your assistant can check how users interact with existing features before you build new ones, verify that events are being tracked correctly, and manage feature flag rollouts alongside your code changes.

Use cases

  • Query analytics data to understand user behavior before implementing new features
  • Create and manage feature flags for gradual rollouts directly from your editor
  • Check event tracking to verify your instrumentation is working correctly
  • Explore user properties and segments to inform personalization logic
  • Review dashboard metrics during sprint planning or retrospectives

Getting started

  1. Create a PostHog Personal API Key at app.posthog.com/settings/user-api-keys. This is different from your project API key -- it provides access to the management API.
  2. Set the POSTHOG_API_KEY environment variable to your personal API key.
  3. The server connects to PostHog's hosted MCP endpoint via SSE, so no local process is needed.
  4. Your API key determines which projects and data you can access. Ensure your PostHog user account has the necessary permissions for the projects you want to query.