Analytics

PostHog MCP Server

Use Studio chat to drive this server — credentials stay in your workspace.

PostHog is an open-source product analytics platform for tracking events, feature flags, experiments, session recordings, and user behavior.

46 tools
Agent guide included
API Key
Start Chatting

Opens MCPBundles Studio with this server selected. After sign-in, chat and run tools from the same thread.

Browse all tools

AI Skill
SKILL.md

Domain knowledge for PostHog — workflow patterns, data models, and gotchas for your AI agent.

PostHog

PostHog organizes everything under Organizations → Projects. Most API calls are project-scoped, and the default project is auto-selected. Only switch organization or project if the user explicitly asks.

Data Model

  • Events are the atomic unit — every pageview, click, or custom action is an event with properties.
  • Event Definitions describe what events exist. Always discover available events before writing queries.
  • Properties are metadata on events (event type) or users (person type). Discover them before filtering or breaking down.
  • Insights are saved queries — trends, funnels, retention, paths. Query an existing insight rather than rebuilding it from scratch.
  • Dashboards are collections of insights arranged as tiles.
  • Feature Flags control rollouts with percentage-based or property-based targeting. They can be boolean or multivariate.
  • Experiments are A/B tests tied to feature flags. Each experiment has a linked flag, variants, and success metrics.
  • Surveys are in-app popover or API-based questionnaires with targeting and scheduling.
  • Session Recordings capture user sessions as rrweb replay data. Retrieving snapshot data is a two-step process: first get blob keys, then fetch blob content.

Gotchas

  • $pathname vs $current_url: For URL breakdowns, use $pathname (normalized path) instead of $current_url (includes query params) for cleaner results.
  • Breakdown limits: Default breakdown limit is 25 values. Set breakdown_limit to 100+ to see more.
  • Session snapshots are two-step: First request with only session_id to obtain blob keys, then repeat with source, start_blob_key, and end_blob_key to retrieve snapshot bytes.
  • Experiment results vs experiment details: The experiment object doesn't include statistical results. Fetch the dedicated experiment-results payload when you need outcomes.
  • Feature flag deletion is permanent: Cannot be undone. Prefer disabling (set inactive) over deleting.
  • Insight creation: Always execute an insight query in draft before saving it as an insight. Don't save untested query definitions.

Tools in this Server (46)

Posthog Add Insight To Dashboard

Add an existing insight to a dashboard. Requires insight ID and dashboard ID. Optionally supports layout and color customization.

Posthog Create Dashboard

Create a new dashboard in the project. Requires name and optional description, tags, and other properties.

Posthog Create Experiment

Create a full A/B test experiment. PROCESS: 1) Understand experiment goal and hypothesis 2) Search existing feature flags first 3) Help user define su...

Posthog Create Feature Flag

Creates a new feature flag in the project. Once you have created a feature flag, you should: Ask the user if they want to add it to their codebase, Us...

Posthog Create Insight

Create an insight from a query that you have previously tested with 'posthog_run_query'. You should check the query runs before creating an insight. D...

Posthog Create Survey

Creates a new survey in the project. Surveys can be popover or API-based and support various question types including open-ended, multiple choice, rat...

Posthog Delete Dashboard

Delete a dashboard by ID (soft delete - marks as deleted).

Posthog Delete Experiment

Delete an experiment by ID. CAUTION: This action cannot be undone.

Posthog Delete Feature Flag

Delete a feature flag in the project. CAUTION: This action cannot be undone.

Posthog Delete Insight

Delete an insight by ID (soft delete - marks as deleted).

Posthog Delete Survey

Delete a survey by ID (soft delete - marks as archived).

Posthog Generate Hogql

Generate HogQL (SQL) from natural language questions about your analytics data. Use when you need complex event analytics, custom aggregations, or que...

Posthog Get Dashboard

Get a specific dashboard by ID. The response will include insights / tiles that are on the dashboard.

Posthog Get Dashboards

Get all dashboards in the project with optional filtering. Can filter by pinned status, search term, or pagination.

Posthog Get Error Details

Get detailed information about a specific error issue including stack traces, occurrence counts, affected users/sessions, and metadata. Useful for deb...

Posthog Get Experiment

Get details of a specific experiment by ID.

Posthog Get Experiment Results

Get detailed experiment results including all metrics data (primary and secondary) and exposure data. This tool fetches the experiment details and exe...

Posthog Get Experiments

Get all experiments in the project.

Posthog Get Feature Flag

Get the definition of a feature flag. You can provide either the flag_id or the flag_key. If you provide both, the flag_id will be used.

Posthog Get Feature Flags

Get all feature flags in the project.

Posthog Get Insight

Get a specific insight by ID.

Posthog Get Insights

Get all saved analytics insights (charts, reports, dashboards tiles) in the project. Insights are saved queries showing trends, funnels, retention, pa...

Posthog Get Llm Costs

Fetches the total LLM daily costs for each model for a project over a given number of days. If no number of days is provided, it defaults to 7. The re...

Posthog Get Organization Details

Get the details of the active organization.

Posthog Get Organizations

Get the organizations the user has access to.

Posthog Get Projects

Fetches projects that the user has access to in the current organization.

Posthog Get Session Recording

Get details of a specific session recording by ID, including person info, duration, click/keypress counts, console log counts, start/end URLs, and act...

Posthog Get Session Snapshots

Get raw rrweb snapshot data for a session recording. Set auto_fetch_blobs=true to retrieve all snapshot data in a single call (fetches all blob_v2 pag...

Posthog Get Survey

Get a specific survey by ID. Returns the survey configuration including questions, targeting, and scheduling details.

Posthog Get Surveys

Get all surveys in the project with optional filtering. Can filter by search term or use pagination.

Posthog Get Surveys Global Stats

Get aggregated response statistics across all surveys in the project. Includes event counts (shown, dismissed, sent), unique respondents, conversion r...

Posthog Get Survey Stats

Get response statistics for a specific survey. Includes detailed event counts (shown, dismissed, sent), unique respondents, conversion rates, and timi...

Posthog List Errors

List error tracking issues grouped by fingerprint. Returns aggregated statistics including exception types, counts, first/last seen timestamps, and un...

Posthog List Event Definitions

Retrieve all event definitions for the project. Events are the foundation of PostHog analytics - use this to discover what events are being tracked be...

Posthog List Properties

Retrieve property definitions for events, persons, or groups. Properties are metadata attached to events and users - use this to discover available di...

Posthog List Session Recordings

List session recordings with metadata including person info, duration, click/keypress counts, start URL, and activity score. Use this to discover reco...

Posthog Query Insight

Execute a query on an existing insight to get its results/data. Provide the insight ID to retrieve the current query results.

Posthog Run Query

Run analytics queries to analyze events, pageviews, sessions, and user behavior. Use this to answer questions about event volume, metrics, conversion ...

Posthog Search Docs

Search the PostHog documentation for how to implement features, integrate SDKs, or use PostHog features. Use this when you need to help users add Post...

Posthog Switch Organization

Change the active organization from the default organization. You should only use this tool if the user asks you to change the organization - otherwis...

Posthog Switch Project

Change the active project from the default project. You should only use this tool if the user asks you to change the project - otherwise, the default ...

Posthog Update Dashboard

Update an existing dashboard by ID. Can update name, description, pinned status or tags.

Posthog Update Experiment

Update an existing experiment by ID. Can update name, description, lifecycle state, variants, metrics. To restart a concluded experiment, set end_date...

Posthog Update Feature Flag

Update a feature flag in the project. To enable a feature flag, you should make sure it is active and the rollout percentage is set to 100 for the gro...

Posthog Update Insight

Update an existing insight by ID. Can update name, description, filters, and other properties. You should get the insight before updating it to see it...

Posthog Update Survey

Update an existing survey by ID. Can update name, description, questions, scheduling, and other survey properties.

Frequently Asked Questions

What is the PostHog MCP server?

PostHog is an open-source product analytics platform for tracking events, feature flags, experiments, session recordings, and user behavior. It provides 46 tools that AI agents can use through the Model Context Protocol (MCP).

How do I connect PostHog to my AI agent?

Add the MCPBundles server URL to your MCP client configuration (Claude Desktop, Cursor, VS Code, etc.). The URL format is: https://mcp.mcpbundles.com/bundle/posthog. Authentication is handled automatically.

How many tools does PostHog provide?

PostHog provides 46 tools that can be called by AI agents, along with a SKILL.md that gives your AI agent domain knowledge about when and how to use them.

What authentication does PostHog require?

PostHog uses API Key. PostHog requires credentials. Connect via MCPBundles and authentication is handled automatically.

Setup Instructions

Connect PostHog to any MCP client in minutes

https://mcp.mcpbundles.com/bundle/posthog

What is MCP?

Model Context Protocol lets AI tools call external capabilities securely through a single URL. This bundle groups tools behind an MCP endpoint that many clients can use.

Use this bundle in 3 steps

  1. Copy the MCP URL above
  2. Open your AI tool and add a new MCP/connector
  3. Paste the URL and follow any auth prompts

Claude Desktop Users

Skip the manual setup! Use the .mcpb file format for one-click installation. Check the Claude Desktop tab for setup instructions.

Pick your tool tab for exact steps

Select ChatGPT, Cursor, Claude Code, or another tab for copy-paste config.

Ready to chat with PostHog?

Same flow: Studio opens on this server after sign-in. Keep chatting to call tools from the conversation.

PostHog MCP Server & Skill — 46 Tools