← PostHog MCP server

PostHog × Codex

Use the PostHog MCP server
in Codex

Query analytics, insights, and feature flags in PostHog. This guide connects PostHog to Codex (OpenAI's coding agent) through a governed gateway — one URL that also works in every other MCP client you use, with your rules and a full log attached.

Live-probed · Security-scanned · OAuth sign-in

Setup: PostHog in Codex

Codex adds MCP servers via `~/.codex/config.toml`. The gateway route takes about two minutes:

  1. Connect PostHog to your free gate gateway from the directory (one click).
  2. Add gate once to the agent; the sign-in screen asks which agent it is, and its rules follow it everywhere.
  3. Every call is logged; allow, ask-me-first or block any action; pause the agent with one click.
  4. Ask Codex something PostHog can answer; the call runs through your gateway, with your rules applied and logged.
[mcp_servers.gate]
url = "https://gateturbo.com/api/mcp"

The gate URL, in Codex’s own format. Direct config for PostHog alone is on its server page.

What to ask once it’s connected

“How did signups trend this week?”
“Which feature flags are currently active?”
“Show the funnel from landing page to signup.”
“Which pages convert best?”

Why route it through a gateway

One URL, every client

The same PostHog connection works in Claude Code, Claude, Claude Desktop, ChatGPT, Cursor, Windsurf, VS Code, Gemini CLI, OpenClaw, n8n, A script or server too — no per-client re-wiring.

Rules before regret

Allow, ask, or block every tool PostHog exposes — reads can flow freely while writes require your approval.

Every call logged

A plain-language activity log of everything Codex did with PostHog — searchable, exportable, auditable.

Scanned and probed

PostHog passed a live handshake probe and a security scan before listing — and drift detection watches it after you connect.

Also available: PostHog in Claude Code · PostHog in Claude · PostHog in Claude Desktop · PostHog in ChatGPT · PostHog in Cursor · PostHog in Windsurf · PostHog in VS Code · PostHog in Gemini CLI · PostHog in OpenClaw · PostHog in n8n · PostHog in A script or server