Posthog MCP server

Connect Posthog to Claude, ChatGPT, Cursor, Claude Code, Codex, Gemini, GitHub Copilot and any other MCP client, for your whole team. Metorial adds security, governance, and tracing, and gives everyone one Magic MCP URL to connect.

What you can do with the Posthog MCP server

Ask your agent in plain language. Each of these maps to a real tool on the server.

  • Use the create experiment tool in Posthog
  • Use the list session recordings tool in Posthog
  • Use the list insights tool in Posthog
  • Use the list property definitions tool in Posthog
  • Use the list cohorts tool in Posthog
  • Use the capture event tool in Posthog

Supported Tools

create_experiment

Create Experiment

Create a new A/B test experiment. Experiments run on top of feature flags. The feature flag must be implemented in your code first.

list_session_recordings

List Session Recordings

List session recording metadata. Supports filtering by person, date range, and pagination. Note: This returns metadata only, not the raw replay data. Use the PostHog UI to view full replays.

list_insights

List Insights

List analytics insights (trends, funnels, retention, paths, stickiness, lifecycle). Supports searching by name and filtering to saved insights only.

list_property_definitions

List Property Definitions

List all property definitions in the project. Property definitions describe the possible properties that can be attached to events or persons. Use this to discover available properties for filtering, grouping, and analysis.

list_cohorts

List Cohorts

List all cohorts in the project. Cohorts are groups of users that match specific criteria. Static cohorts are manually managed lists, while dynamic cohorts are automatically updated every 24 hours.

capture_event

Capture Event

Send one or more events to PostHog. Supports single event capture or batch capture of multiple events. Use this to track pageviews, custom events, screen views, identify users (`$identify`), create aliases (`$create_alias`), or send any custom event. Person properties can be set or updated via the `set` and `setOnce` fields.

get_feature_flag

Get Feature Flag

Retrieve detailed information about a specific feature flag by its ID.

get_experiment

Get Experiment

Retrieve detailed information about a specific A/B test experiment including its configuration, metrics, and results.

delete_feature_flag

Delete Feature Flag

Permanently delete a feature flag. This cannot be undone.

delete_survey

Delete Survey

Permanently delete a survey.

get_insight

Get Insight

Retrieve detailed information and results for a specific insight by its ID.

create_dashboard

Create Dashboard

Create a new dashboard for organizing insights and analytics visualizations.

list_projects

List Projects

List projects accessible with the current credentials. Provide organizationId to use PostHog's current organization-scoped project endpoint.

list_event_definitions

List Event Definitions

List all event definitions in the project. Event definitions describe the possible event names that have been captured. Use this to discover which events are available for querying, filtering, and analysis.

list_persons

List Persons

Search and list person profiles in PostHog. Supports filtering by search query and person properties. Returns paginated results with person details including distinct IDs and properties.

delete_annotation

Delete Annotation

Delete an annotation from charts/dashboards.

create_cohort

Create Cohort

Create a new cohort. Static cohorts are manually managed user lists; dynamic cohorts automatically include users matching specified criteria.

update_dashboard

Update Dashboard

Update an existing dashboard's name, description, pinned status, or tags.

update_experiment

Update Experiment

Update an existing A/B test experiment's name, description, dates, or configuration. Only provided fields will be updated.

delete_dashboard

Delete Dashboard

Permanently delete a dashboard.

get_dashboard

Get Dashboard

Retrieve detailed information about a specific dashboard by its ID, including its tiles and configuration.

update_survey

Update Survey

Update an existing survey's name, description, questions, targeting, or dates. Only provided fields will be updated.

list_feature_flags

List Feature Flags

List all feature flags in the project. Supports searching by flag key or name. Returns flag configuration including key, active status, rollout percentage, and targeting rules.

get_session_recording

Get Session Recording

Retrieve metadata about a specific session recording by its ID. Returns timing, activity metrics, and user information. Does not include the raw replay JSON.

create_survey

Create Survey

Create a new survey with questions and optional targeting. Surveys can be of various types (e.g. popover) and can be linked to feature flags.

list_annotations

List Annotations

List annotations on charts/dashboards. Annotations mark significant events or deployments with text notes at specific dates.

create_annotation

Create Annotation

Create a new annotation to mark a significant event or deployment on PostHog charts and dashboards.

evaluate_feature_flags

Evaluate Feature Flags

Evaluate all feature flags for a specific user (distinct ID). Returns the computed flag values based on the user's properties and targeting rules. Optionally pass person properties and group properties inline for server-side evaluation without requiring prior identification.

update_feature_flag

Update Feature Flag

Update an existing feature flag's name, active status, rollout percentage, or targeting configuration. Only provided fields will be updated.

get_person

Get Person

Retrieve detailed information about a specific person by their PostHog person ID. Returns the person's distinct IDs, all properties, and creation timestamp.

get_survey

Get Survey

Retrieve detailed information about a specific survey by its ID, including questions, targeting, and status.

create_feature_flag

Create Feature Flag

Create a new feature flag. Supports boolean flags, multivariate flags (for A/B test variants), and remote config flags. Provide the key, name, and optionally configure rollout percentage and targeting filters.

list_experiments

List Experiments

List A/B test experiments in the project. Returns experiment metadata, status, and associated feature flag keys.

get_cohort

Get Cohort

Retrieve detailed information about a specific cohort by its ID.

list_surveys

List Surveys

List all surveys in the project with their configuration, questions, and status.

list_dashboards

List Dashboards

List all dashboards in the project. Supports searching by name.

run_query

Run HogQL Query

Execute an ad-hoc HogQL query against your PostHog data. HogQL is PostHog's SQL-like query language that supports querying events, persons, sessions, and more. Use this for custom analytics queries, aggregations, and data exploration that go beyond predefined insights.

delete_person

Delete Person

Permanently delete a person profile from PostHog. This removes the person and all their associated data. To create or update persons, use the Capture Event tool with `$identify` event and `set`/`setOnce` properties instead.

get_annotation

Get Annotation

Retrieve a specific PostHog annotation by ID.

update_group_property

Update Group Property

Set or update properties for a PostHog group.

create_action

Create Action

Create a PostHog action from event, selector, URL, or property matching steps.

create_group

Create Group

Create or update a PostHog group for a configured group type.

delete_cohort

Delete Cohort

Permanently delete a cohort from PostHog.

delete_action

Delete Action

Delete a PostHog action.

get_action

Get Action

Retrieve a specific PostHog action by ID, including its step rules.

list_actions

List Actions

List PostHog actions. Actions group one or more event patterns into reusable analytics definitions.

list_group_types

List Group Types

List configured PostHog group types. Use the returned groupTypeIndex with group list/find/update tools.

update_annotation

Update Annotation

Update an annotation's content, date marker, or scope.

list_groups

List Groups

List groups for a specific PostHog group type. Uses PostHog's forward-only cursor pagination.

update_cohort

Update Cohort

Update an existing cohort's name, description, static state, or filter groups.

get_current_user

Get Current User

Retrieve the current PostHog user, current organization, and current team/project context.

delete_experiment

Delete Experiment

Permanently delete an experiment from PostHog.

delete_group_property

Delete Group Property

Delete one or more properties from a PostHog group.

update_action

Update Action

Update a PostHog action's metadata, tags, deletion state, or step rules.

list_organizations

List Organizations

List PostHog organizations accessible with the current credentials. Use an organization ID with List Projects for the current documented project API.

find_group

Find Group

Find a specific PostHog group by group type index and group key.

Connect Posthog to your AI client

Every client uses the same Magic MCP URL, and so does any other MCP client. Add it once and sign in with SSO.

  1. Enable Posthog in Metorial. In your Metorial portal, enable the Posthog MCP server and sign in with the account that owns the data. Access stays governed by your team policies.
  2. Add a custom connector. Open Customize, then Connectors. Select Add, then Custom, then Web.
  3. Paste your Metorial MCP URL. Name it Metorial, paste your Magic MCP URL (<your-magic-mcp-url>) and continue.
  4. Sign in. Select Add and sign in to load Posthog tools.

Run Posthog through the Metorial gateway

One governed layer for every app your agents reach, not a separate connector per tool.

  • Give Posthog and every other app to your whole team through one MCP gateway, behind your SSO.
  • Scope which teams and agents can use Posthog tools with role-based access control, and trace every call.
  • Prefer to run it yourself? Metorial is open source and self-hostable.

More integrations teams use with Posthog

Google Sheets

Create, read, and update spreadsheets and their cell data. Read and write values to individual cells, ranges, or multiple ranges using A1 notation or named ranges. Apply cell formatting including text styles, backgrounds, borders, number formats, and conditional formatting. Manage sheets (tabs) within a spreadsheet—add, delete, copy, rename, and reorder them. Create and manage embedded charts, pivot tables, filter views, data validation rules, protected ranges, named ranges, and merged cells. Perform batch operations to apply multiple updates atomically.

GitHub

Manage repositories, issues, and pull requests. Create and configure branches, star repositories, review code, and merge changes. Automate CI/CD workflows with GitHub Actions, manage workflow runs, secrets, and artifacts. Track issues with labels, milestones, and assignees. Search across code, repositories, issues, and users. Manage organizations, teams, and memberships. Create and manage projects, gists, packages, deployments, and environments. Access security alerts including code scanning, secret scanning, and Dependabot alerts. Read and write file contents in repositories. Manage webhooks, notifications, and codespaces.

Salesforce

Manage CRM data including Accounts, Contacts, Leads, Opportunities, Cases, and custom objects. Create, read, update, and delete records. Query data using SOQL and search across objects using SOSL. Perform bulk data operations for large-scale imports, exports, and migrations. Execute composite requests to batch multiple operations in a single API call. Access analytics, reports, and dashboards. Manage files and attachments associated with records. Interact with Chatter feeds, posts, and groups for social collaboration. Manage org metadata including custom objects, fields, layouts, and workflows. Query data using GraphQL for precise data retrieval across related objects.

Sharepoint

Manage SharePoint sites, document libraries, lists, and files. Create, read, update, and delete lists and list items with custom columns. Resolve site users to numeric Person/Group LookupId values. Upload, download, move, copy, and version files in document libraries. Search across sites, files, folders, lists, and list items using Microsoft Search. Manage permissions at site, list, and item levels with granular access control. Define and manage content types and site columns. Retrieve site properties and search for sites across Microsoft 365.

Airtable

Create, read, update, and delete records in Airtable bases and tables. Manage base schemas including creating tables and fields. Filter records using formulas, sort by fields, and scope queries to specific views. Upsert records to find, create, or update in a single call. Upload attachments to records, read and write record comments, list accessible bases, and receive real-time base change events through webhooks.

Google Drive

Upload, download, create, copy, move, rename, trash, and permanently delete files and folders in Google Drive. Search for files using complex queries filtering by name, MIME type, owner, modification date, labels, and other metadata. Share files and folders with specific users, groups, or domains with role-based permissions (owner, writer, commenter, reader). Manage shared drives and their members. Export Google Workspace files (Docs, Sheets, Slides) to standard formats like PDF, DOCX, and XLSX. Track file revision history and restore earlier versions. Create, read, update, and delete threaded comments and replies on files. Read label definitions and search files by label. Browse the Drive apps installed for your account. Store app-specific data in a hidden per-user folder.

Technical notes for Posthog

Capture and analyze product usage events, manage feature flags, run A/B test experiments, and create user surveys. Track persons and groups, evaluate feature flags for specific users, query analytics data using HogQL, and manage cohorts. Retrieve session recording metadata, create and manage insights and dashboards (trends, funnels, retention, paths). Manage projects, organizations, annotations, actions, and event/property definitions.

Frequently asked questions

Common questions about connecting Posthog to AI agents with Metorial.

  1. How many tools does the Posthog MCP server have?
    The Posthog MCP server exposes 56 tools, including Create Experiment, List Session Recordings, List Insights. Each one is governed and traced through Metorial.
  2. Posthog exposes tools your agents call on demand; it does not publish event triggers yet. Everything still runs through one governed MCP URL.
  3. Any MCP client, including VS Code, Windsurf, Zed, OpenCode and Grok. Each one reaches the Posthog MCP server through the same Metorial URL.
  4. Use role-based access control to decide which teams, users, and agents can use Posthog and which of its tools they can call.
  5. Yes. Metorial is open source, so you can run the Posthog MCP server yourself or use the hosted gateway.

Connect Posthog to production AI agents

See how Metorial gives your team governed access to Posthog, with tracing and security controls built in.