Overview
OpenSRE connects to PostHog’s hosted Model Context Protocol (MCP) server. During investigations the agent can call PostHog products — product analytics, feature flags, error tracking, experiments, surveys, and HogQL — through MCP tools. This is separate from the PostHog REST integration, which only stores project credentials for the REST API. The onboarding wizard lists PostHog (REST) and PostHog (MCP) as separate choices. Configure REST withopensre integrations setup posthog.
Prerequisites
- A PostHog account (US or EU — the hosted server routes you automatically)
- A PostHog personal API key created with the MCP Server preset. See PostHog personal API keys.
OpenSRE defaults to read-only access (
x-posthog-read-only: true) so investigations cannot mutate your PostHog project. Set POSTHOG_MCP_READ_ONLY=false only if you explicitly want the agent to perform writes.Setup
Option 1: Interactive CLI
opensre integrations setup and select PostHog (MCP). Paste your personal API key. Setup uses the hosted Streamable HTTP transport; keep the default URL unless you have a reason to change it. For a local server, set POSTHOG_MCP_MODE=stdio (see below).
Option 2: Environment variables
Local PostHog MCP server via
stdio:
Option 3: Persistent store
Credentials
Use a PostHog personal API key created with the MCP Server preset. See PostHog personal API keys. Set it asPOSTHOG_MCP_AUTH_TOKEN (or paste it during interactive setup). Optionally scope with POSTHOG_MCP_PROJECT_ID and POSTHOG_MCP_ORGANIZATION_ID.
Investigation tools
Typical flow: call
list_posthog_tools first, then call_posthog_tool with the chosen name and arguments.
The hosted PostHog MCP server exposes a large vendor catalog of tools (often 240+), each with a full input schema. Returning all of them at once exceeds most model context windows, so list_posthog_tools returns a compact, bounded listing — names plus short descriptions, without schemas.
Verify
Troubleshooting
Security
OpenSRE defaults to read-only access (x-posthog-read-only: true) so investigations cannot mutate your PostHog project. Set POSTHOG_MCP_READ_ONLY=false only if you explicitly want the agent to perform writes.
A successful check connects to the MCP server and reports how many tools it discovered. If it fails, the most common cause is a missing or invalid personal API key — confirm the key was created with the MCP Server preset and that outbound HTTPS to mcp.posthog.com is allowed.
Metric report (scheduled)
Deliver a per-metric PostHog analytics pulse to Telegram, Slack, or Rocket.Chat, on demand or on a schedule — coworker-style digests (what moved and why it matters), not a raw dashboard dump. Slack delivery needs a bot token (a webhook alone cannot honor--chat-id). This uses the headless posthog-summary skill path (schema discovery, then one bounded HogQL query per metric), not the investigation pipeline or generic opensre cron kinds. It requires the PostHog MCP integration above — the REST posthog integration alone cannot serve it.
Example — every Monday at 08:00 London time to Telegram:
C… member/channel id):
SLACK_BOT_TOKEN. A SLACK_WEBHOOK_URL alone will not work here: a webhook always posts to the one channel it was created for, so it cannot honour --chat-id.
--period accepts a relative window (24h, 7d, 30d; default 7d). Optional --metrics narrows the report to a comma-separated set instead of the default metric set.
The gateway daemon picks up scheduled reports automatically when it is running. If the LLM is unavailable, the run fails with an error (no deterministic fallback).
The report compares the current window against the previous comparable window per metric. Real zeros are reported as zeros; failed queries are called out as failures — never silently widened or fabricated, and never presented as zero when the query did not run.