PostHog MCP Server
PostHog is an open-source product analytics platform that helps you understand user behavior through events, feature flags, session recordings, cohorts, and experimentation.
What is the PostHog MCP Server?
The PostHog MCP server gives AI agents structured, permission-aware access to PostHog through the Model Context Protocol. With 25 pre-built actions, agents can read, create, and update PostHog data on behalf of authorized users.
Willow ships the PostHog MCP server as part of an enterprise control plane. Every call runs behind SSO (Okta, Azure AD), enforces RBAC and least-privilege at runtime, writes to a full audit trail, and integrates with Splunk and Loki for SIEM visibility. Connect from Claude Desktop, Claude Code, Cursor, ChatGPT, VS Code, n8n, or any custom agent. Install once, distribute org-wide, and see exactly how PostHog is being used by every AI agent in your stack.
Tools
List Projects
Retrieve a list of all projects in your PostHog organization. Use this to discover available projects, understand project structure, and get project IDs for other API calls. Returns project names, IDs, API tokens, and configuration settings.
Get Project
Retrieve detailed information about a specific PostHog project including configuration settings, timezone, feature opt-ins (session recording, surveys, heatmaps), and group types. Use this to understand project settings and capabilities before performing other operations.
Get Current User
Retrieve information about the currently authenticated user including name, email, organization membership, and user UUID. Use this to verify authentication, understand user permissions, or get user details for audit logs.
List Feature Flags
Retrieve a list of feature flags in the project. Filter by active status (true/false/STALE), type (boolean/multivariant/experiment), search by name, or filter by tags and evaluation runtime (client/server). Use this to discover available flags, understand rollout configuration, find flags for specific features, or audit flag usage. Returns flag details including key, filters, variants, rollout percentage, and linked experiments.
Get Feature Flag
Retrieve detailed information about a specific feature flag including its configuration, filters, rollout conditions, variants, and usage analytics. Use this to understand how a flag is configured, check rollout rules, review variant definitions, or see which experiments are linked to the flag.
Create Feature Flag
Create a new feature flag in the project. Specify the flag key (unique identifier), name, rollout conditions, variants for multivariant tests, and targeting filters. Use this to programmatically create flags for new features, set up A/B tests, or configure gradual rollouts. The flag can be boolean, multivariant, or experiment type.
Update Feature Flag
Update an existing feature flag's configuration including name, filters, rollout percentage, variants, active status, or tags. Use this to adjust rollout conditions, modify targeting rules, change variant distributions, or enable/disable flags. Supports partial updates - only provide fields you want to change.
Delete Feature Flag
Delete a feature flag from the project. This permanently removes the flag and its configuration. Use with caution - ensure the flag is no longer referenced in your application code before deletion. Consider deactivating the flag first as a safer alternative.
List Cohorts
Retrieve a list of cohorts (user segments) in the project. Cohorts can be static (manually defined list of persons) or dynamic (automatically updated based on filters). Use this to discover available segments, understand cohort definitions, or find cohorts for targeting in experiments and feature flags. Returns cohort details including filters, person count, and calculation status.
Get Cohort
Retrieve detailed information about a specific cohort including its definition filters, person count, calculation status, and whether it's static or dynamic. Use this to understand cohort membership criteria, check calculation progress for dynamic cohorts, or verify cohort size before using it in targeting.
Create Cohort
Create a new cohort (user segment) in the project. Cohorts can be static (provide a list of person IDs) or dynamic (define filters that automatically include matching users). Use this to create segments for targeting experiments, analyzing specific user groups, or organizing users by behavior or properties. Dynamic cohorts are recalculated automatically as user data changes.
Update Cohort
Update an existing cohort's name, description, or filter criteria. For dynamic cohorts, updating filters will trigger recalculation of cohort membership. For static cohorts, use the add/remove persons endpoints to modify membership. Supports partial updates - only provide fields you want to change.
Get Cohort Persons
Retrieve the list of persons (users) who are members of a specific cohort. Use this to see which users match a cohort's criteria, export cohort membership for analysis, or verify that users are correctly included in segments. Supports pagination for large cohorts and can export to CSV format.
List Persons
Retrieve a list of persons (users/profiles) in the project. Persons represent individual users tracked by PostHog, including their properties, distinct IDs, and metadata. Use this to explore your user base, find specific users, or analyze person properties. Supports pagination for large user sets. Note: For large exports, consider using batch exports instead.
Get Person
Retrieve detailed information about a specific person including all their properties, distinct IDs, creation date, and associated metadata. Use this to understand a user's profile, check property values, or investigate user behavior. The person ID can be either the UUID or the distinct_id.
Update Person Property
Update a specific property on a person's profile. Use this to correct person properties, add metadata, or update user attributes programmatically. The property will be updated immediately and reflected in all analytics queries. Provide the property key and new value.
List Session Recordings
Retrieve a list of session recordings from the project. Session recordings capture user interactions on your website/app including clicks, mouse movements, and page navigation. Use this to find recordings for analysis, debugging user issues, or understanding user behavior. Supports pagination for large datasets. Note: Recording details and playback URLs are included in the response.
Get Session Recording
Retrieve detailed information about a specific session recording including duration, events, user properties, and playback URLs. Use this to investigate a particular user session, analyze user behavior in detail, or retrieve recording metadata for sharing or analysis.
List Dashboards
Retrieve a list of dashboards in the project. Dashboards contain collections of insights (charts, graphs, metrics) for monitoring product analytics. Use this to discover available dashboards, understand analytics organization, or find specific dashboards by name. Returns dashboard metadata including name, description, creation date, and sharing status.
Get Dashboard
Retrieve detailed information about a specific dashboard including all its tiles (insights/charts), filters, variables, and sharing configuration. Use this to understand dashboard contents, check insight configurations, or retrieve dashboard data for reporting. The response includes full insight definitions and current data.
Create Dashboard
Create a new dashboard in the project. Dashboards organize insights (charts, metrics) for monitoring product analytics. Specify the dashboard name, optional description, and whether it should be pinned for quick access. You can add insights/tiles to the dashboard after creation using the insights API or PostHog UI.
List Custom Endpoints
Retrieve a list of custom analytics endpoints in the project. Custom endpoints allow you to create predefined queries from insights or SQL and expose them as optimized API endpoints with better performance and higher rate limits than the standard query API. Use this to discover available custom endpoints, understand their purpose, and get endpoint names for execution.
Run Custom Endpoint
Execute a custom analytics endpoint to retrieve query results. Custom endpoints provide optimized, cached query execution with higher rate limits compared to the standard query API. Specify the endpoint name and optional parameters/variables. Use this for production analytics queries, dashboards, or data-driven APIs where performance and reliability are important.
List Annotations
Retrieve a list of annotations in the project. Annotations are markers on insights/dashboards that highlight important events like releases, incidents, or marketing campaigns. Use this to see what events have been marked, understand context for metrics changes, or audit team communication about product changes.
Create Annotation
Create a new annotation to mark an important event on insights and dashboards. Annotations help teams understand context for metrics changes by marking deployments, incidents, campaigns, or other significant events. Specify the date/time, content (what happened), and optionally scope to specific insights or dashboards.
Customize Tools
Edit descriptions, modify arguments, select tools, or add new ones
Set Up Your PostHog MCP Server in Minutes
Add the following configuration to your MCP client. Authentication is handled via OAuth. Compatible with Claude Desktop, Claude Code, Cursor, ChatGPT, VS Code, n8n, and any MCP-compatible agent.
Claude Desktop
{
"mcpServers": {
"willow-posthog": {
"type": "http",
"url": "https://<org>.mcp-s.com/mcp/mcp/posthog"
}
}
}Cursor
{
"mcpServers": {
"willow-posthog": {
"type": "http",
"url": "https://<org>.mcp-s.com/mcp/mcp/posthog"
}
}
}Claude Code
claude mcp add willow-posthog --transport http https://<org>.mcp-s.com/mcp/mcp/posthogn8n
{
"url": "https://<org>.mcp-s.com/mcp/mcp/posthog",
"method": "POST"
}Or click "Install with Willow" above to set up automatically with SSO and RBAC preconfigured.
Enterprise Governance for PostHog
Willow adds the layer PostHog and every other SaaS doesn't ship out of the box: every call runs behind SSO (Okta, Azure AD), enforces RBAC and least-privilege at runtime, writes to full audit logs, and detects shadow AI usage across your stack. One MCP gateway. Any agent. Every tool.
PostHog MCP Server FAQ
What is the PostHog MCP server?
The PostHog MCP server is a Model Context Protocol implementation that lets AI agents like Claude, Cursor, and ChatGPT read and write PostHog data through a standardized interface. Willow hosts and governs this server so enterprises can roll it out without a security review backlog.
How is Willow's PostHog MCP server different from the official one?
The official PostHog MCP server is scoped to a single user's account and does not include enterprise governance. Willow's version adds SSO, RBAC, audit logging, shadow AI detection, and centralized control over which actions agents can take across the entire org.
Which AI clients work with the PostHog MCP server?
Claude Desktop, Claude Code, Cursor, ChatGPT, VS Code with MCP support, n8n, and any custom agent built with OpenAI Agents SDK, LangChain, Vercel AI SDK, or Anthropic SDK.
Is the PostHog MCP server secure? How does Willow handle authentication?
Every call runs behind your existing SSO (Okta, Azure AD). Per-user OAuth scopes the agent to exactly what that user can do in PostHog, nothing more. No credentials reach the LLM. Every action writes to an audit trail.
Can I limit which PostHog actions agents can take?
Yes. Willow lets you scope agents to specific actions, specific projects, or specific environments. Toggle actions on or off in the dashboard, or enforce policy via infrastructure-as-code through GitHub.
How do I detect shadow PostHog MCP servers in my org?
Willow's browser extension and discovery service surface unmanaged MCP servers, skills, and AI agents across the org. If a developer installed an unapproved PostHog MCP locally, you'll see it.
What does the PostHog MCP server cost?
Pricing depends on org size and deployment model (SaaS, dedicated cloud, self-host). See withwillow.ai/pricing or contact sales for a quote.
How do I install the PostHog MCP server with Willow?
Install via the Willow Connect Panel in one click, or paste the JSON snippet above into your Claude Desktop, Cursor, or Claude Code config. SSO and RBAC inherit from your existing Willow setup.
Compare Willow MCP Gateway
See how Willow stacks up against other MCP platforms on governance, security, and enterprise readiness.
Your agents are already in the wild.
Give them a Basecamp. Go from AI chaos to AI work, in minutes.