
PostHog AI Plugin
https://github.com/posthog/ai-plugin- Category
- Developer Tools
- Rank
- No. 667Tools index
- Pricing
- Open Source
- Type
- TOOL
- Builder
- posthog
- GitHub
- 80 stars
- Date
About
Official PostHog plugin for Claude Code, Cursor, Gemini, Codex and other AI coding tools so your agent can query product analytics.
What it does
It lets an AI assistant inspect and change PostHog resources through natural-language requests. Supported work includes analytics queries, visualizations, feature flags, experiments, dashboards, surveys, error tracking, documentation search, and LLM usage analysis. Bundled task guides supply PostHog-specific practices when relevant.
Why it's ranked here
This is a substantial bridge into PostHog, not a thin query shortcut. Its broad tool coverage supports both investigation and administrative changes, while focused guides help agents handle specialized workflows. The optional Claude Code telemetry path adds unusually detailed session, token, tool, error, and Git context.
What's good
OAuth keeps interactive authentication straightforward, and self-hosted deployments can redirect the MCP endpoint. More than thirty task guides cover areas such as experiment lifecycles, warehouse troubleshooting, session replay, and SDK instrumentation. Claude Code telemetry includes privacy redaction, payload truncation, custom properties, stable deduplication identifiers, and automated tests for parsing and event construction.
Tradeoffs
The richer session telemetry is specific to Claude Code logs, even though the core PostHog connection supports several clients. Telemetry requires explicit enablement and an API key, then sends sessions only when Claude Code exits. Without privacy mode, prompts, responses, tool inputs, and tool outputs may be included. Failures can silently skip ingestion to avoid disrupting work.
How to use it well
Use it when engineers and product teams already work in PostHog and want analytics, experiments, flags, dashboards, surveys, or errors inside an agent workflow. Enable session telemetry deliberately, choose privacy mode based on data policy, and set a self-hosted endpoint when needed. It does not supply a standalone analytics service outside PostHog.
Technical notes+
mcp.json and .mcp.json register an HTTP MCP server at https://mcp.posthog.com/mcp with an x-posthog-mcp-consumer header. hooks/session-end-llma.py gates ingestion on POSTHOG_LLMA_CC_ENABLED and POSTHOG_API_KEY, locates Claude Code JSONL, builds events, posts a batch, and records status without crashing the host workflow. posthog_llma/parser.py performs two-pass transcript parsing and merges streamed assistant blocks. posthog_llma/event_builder.py creates $ai_generation, $ai_span, and $ai_trace events, supports session or message grouping, attaches Git context, and derives deterministic UUIDv5 deduplication keys. posthog_llma/sender.py uses Python's standard-library HTTP client to post to /batch. tests/test_posthog_llma.py and tests/test_session_parser.py cover privacy behavior, timestamps, deduplication, path variations, streamed content, and prompt association.
Observed
- License
- MIT
- Primary language
- Python
- Interface
- HTTP MCP server plus optional Claude Code SessionEnd telemetry hook
- Client support
- Installation documented for Claude Code, Cursor, Codex, Gemini CLI, and Grok
- Authentication
- OAuth is documented for interactive PostHog access; LLM telemetry uses a PostHog API key
- Self-hosting
- A configurable MCP URL supports self-hosted PostHog instances
- Dependencies
- The LLM analytics package describes itself as zero-dependency and uses Python standard-library networking
- Tests
- Dedicated pytest files cover the telemetry event builders, sender, session parser, and event builder
Read from README.md, posthog_llma/config.py, posthog_llma/events.py, posthog_llma/parser.py, posthog_llma/sender.py, posthog_llma/__init__.py, hooks/session-end-llma.py, scripts/llma_cc_ingest.py, scripts/dev_test_session.py, posthog_llma/trace_naming.py, posthog_llma/event_builder.py, tests/test_posthog_llma.py, tests/test_session_parser.py, mcp.json, .mcp.json.
What it can do
Query product analytics data
Analytics query from AI coding tool → Product analytics results and metrics
Retrieve user behavior insights
User behavior query parameters → User interaction data and patterns
Access feature usage statistics
Feature or event name → Usage statistics and performance metrics
Generate analytics-driven code suggestions
Code context and analytics requirements → Code recommendations based on user data
Integrate PostHog data into AI coding workflows
AI coding tool requests → Real-time analytics data for development decisions
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.