Integration · PostHog

The open-source product OS, agent-controllable.

PostHog combines product analytics, experiments, feature flags, surveys, session replays, error tracking, and LLM analytics in one platform.

The MCP surface is the largest of any vendor in this catalog: more than two hundred tools across the full product. Use the ?features= query parameter to scope the connection to just the tools the agent needs, so context windows stay tight and tool selection stays accurate.

Official MCPOAuth or API key. Hosted at mcp.posthog.com/mcp.

What you can do via MCP

Example prompts the agent runs.

  • How many users completed signup in the last 7 days, broken down by day?

    Issues a HogQL query against the events table, returns a daily count series, and offers to chart it.

  • Create a feature flag 'new-checkout' enabled for 20% of users.

    Creates the flag with a percentage rollout filter, returns the key and SDK snippet for the client integration.

  • Pull the experiment results for pricing-page-v2 and recommend whether to ship.

    Fetches results, surfaces lift and confidence interval, and ships a ship/iterate recommendation grounded in the primary metric.

  • List my session recordings from the last hour where users hit a 404.

    Filters session recordings by network errors and recency; returns a triage list ordered by user impact.

  • Run a HogQL query: SELECT count() FROM events WHERE event = 'signup' AND timestamp > now() - INTERVAL 7 DAY

    Executes the raw HogQL, returns the result, and offers to save it as a saved insight.

PostHog · MCP

Scoping the connection to flags and experiments only. The ?features= filter keeps the tool list short so the agent picks the right tool reliably.

PostHog MCP
docs
# PostHog MCP, scoped connection
# Connect to: https://mcp.posthog.com/mcp?features=flags,experiments

mcp.posthog.create_feature_flag({
  key: "new-checkout",
  name: "New checkout flow",
  active: true,
  filters: {
    groups: [{
      properties: [],
      rollout_percentage: 20
    }]
  }
})

# Returns flag id, key, and SDK integration snippet
One command sample showing how the agent talks to PostHog. The MCP exposes the platform's primitives as tools; the agent translates the prompt into the right call.

MCP integration

PostHog MCP server.

Server
https://mcp.posthog.com/mcp
Auth
OAuth (preferred) or API key (Bearer header)
Hosting
Hosted by PostHog
Scoping note
Use ?features=flags,experiments,analytics in the URL to scope tools. Default exposes 200+ tools, which can crowd the agent's tool selection on smaller models.
  • 200+ tools across the entire PostHog product
  • Pinned org/project via OAuth scopes or API key headers
  • OAuth routing handles US vs EU regions automatically
  • HogQL queries exposed as a tool for advanced analytics

PostHog MCP docs

Visual demonstration

What this looks like in practice.

PostHog/Experiment results
Ship treatment

pricing-page-v2

Primary metric: paid_signup

VariantMetricLift95% CIp
Controlcontrol4.20%baseline
Treatment4.78%+13.81%[6.40, 21.20]0.001
Running
21d
N
62,400

Treatment beat control across all geographies. Mobile lift slightly larger than desktop. Recommendation: ship.

PostHog experiment result returned by the MCP. The agent reads this and produces the recommendation alongside the underlying numbers.
PostHog/Feature flag
Release

new-checkout

New checkout flow with single-step billing

Environment

production

On20% rollout

Targeting rules

  • user.country IN ('US', 'CA') ENABLE 100%
  • ELSE ENABLE 20%
A flag created via the MCP. Targeting rules and rollout percentages match what the dashboard would show; the agent edits both the same way.

CLI alternative

REST API for direct integration; MCP for AI workflows.

PostHog has a comprehensive REST API for programmatic integration outside an agent runtime. For AI-driven analytics and feature work the MCP is the right interface. There is no separate PostHog CLI for the AI flow; the MCP plus the REST API cover both modes.

Pairs with these skills

The PM-experimentation skill suite.

This integration pairs with the forthcoming experiment-design, experimentation-analytics, feature-flagging skills. The skill landing pages and SKILL.md sources land in subsequent dispatches; cross-link hyperlinks are added when the skill pages ship.