# PostHog MCP

> PostHog lets your AI agent manage product analytics and feature flags entirely through natural conversation. Instead of jumping between dashboards to check user activity, audit flag rollouts, or review event payloads, you get a single source of truth for understanding how users behave within your app. It connects deep behavioral data analysis directly into your workflow.

## Overview
- **Category:** loved-by-devs
- **Price:** Free
- **Tags:** product-analytics, feature-flags, session-replay, experimentation, user-cohorts, event-tracking

## Description

Connecting your PostHog account gives your agent full control over product analytics, feature flags, and user cohorts without ever opening the main dashboard. You can talk to it about what's happening in your application—from tracking specific user journeys to auditing which features are rolling out where. Want to know if a recent deployment changed conversion rates? Just ask. Need to see why a particular group of users isn't adopting a new feature? The agent finds the cohort and shows you their activity timeline. You can check individual user profiles, browse recent events by type, or even create historical annotations that link metric changes directly to product launches. Because this MCP is hosted on Vinkius, your agent connects once and instantly gains access to all these deep behavioral insights, making it feel like having a dedicated, expert data engineer sitting right next to you.

## Tools

### create_annotation
Marks a specific date or event (like a deployment) on the timeline for easy correlation with metric changes.

### create_feature_flag
Sets up a new feature flag in your project, allowing you to control its rollout percentage and configuration.

### delete_feature_flag
Irreversibly removes an existing feature flag from the system after confirming all associated data is gone.

### get_feature_flag
Retrieves detailed information about a specific feature flag using its numeric ID.

### get_person
Fetches all details and properties for an individual user when provided with their unique identifier.

### get_user
Checks your current API key by returning the basic profile information of the connected account owner.

### list_annotations
Retrieves a list of all historical annotations, showing when and what important events were marked on the timeline.

### list_cohorts
Shows you all defined behavioral cohorts in your account, including their names and how they are filtered.

### list_events
Gets a list of recent tracked events, letting you filter by type or check the properties attached to each event.

### list_feature_flags
Lists every feature flag in your project, helping you audit which flags are active and what their configuration is.

### list_persons
Retrieves a paginated list of all users tracked in the system, including their distinct IDs and last activity times.

### list_projects
Displays a list of all separate analytics workspaces or projects within your PostHog account.

### update_feature_flag
Modifies an existing feature flag's details, such as changing its name, description, or enabled status.

## Prompt Examples

**Prompt:** 
```
Show me all feature flags and which ones are enabled.
```

**Response:** 
```
I found 8 feature flags. 5 are currently enabled: 'new-checkout' (80% rollout), 'dark-mode' (100%), 'ai-suggestions' (25%), 'beta-dashboard' (50%) and 'export-v2' (100%). 3 are disabled: 'legacy-search', 'old-onboarding' and 'deprecated-api'.
```

**Prompt:** 
```
Create an annotation for today's deployment of version 3.2.0.
```

**Response:** 
```
Done! I've created an annotation 'Deployed v3.2.0' pinned to today's date. It will appear on all relevant insights graphs so you can correlate any metric changes with this deployment.
```

**Prompt:** 
```
Show me the profile of user 'user_12345'.
```

**Response:** 
```
Here's the profile for user_12345: email is jane@example.com, signed up 3 months ago, last active 2 hours ago. Properties include plan:premium, company:Acme Inc, and role:admin. They've triggered 847 events including 120 pageviews and 45 purchases.
```

## Capabilities

### Audit feature rollout status
Check the details of any existing or proposed feature flag, including its current enabled state and targeted user percentage.

### Identify specific user activity
Look up a person by their unique ID to see all their properties, last login time, and full event history.

### Analyze behavioral groups
List or review the definitions of dynamic user cohorts based on specific events or property filters.

### Track app events in real-time
Browse recent application events, filtering by event name and inspecting all associated properties for debugging or analysis.

### Mark key product milestones
Create annotations on the timeline to correlate specific metric changes with major deployments, launches, or incidents.

## Use Cases

### A Product Manager needs to audit a new feature.
The PM asks the agent: 'Show me all flags and which ones are running at 50% rollout.' The agent uses `list_feature_flags` and then checks the specific status of the desired flag using `get_feature_flag`, giving immediate confirmation without opening a single tab.

### A Developer is debugging an intermittent bug.
The developer tells the agent: 'Find all events from user X that occurred in the last hour, specifically looking for failed purchase attempts.' The agent uses `get_person` to confirm the ID, and then runs `list_events`, immediately isolating the problematic event payload.

### A Data Analyst needs to prove a marketing campaign worked.
The analyst asks: 'List all cohorts created in Q1.' The agent uses `list_cohorts` to show existing groupings, then helps review the definition of a key cohort by checking its underlying filters for accuracy.

## Benefits

- Stop dashboard hopping. Instead of checking the UI for `list_feature_flags` status, you just ask your agent if a specific flag is enabled and what its current rollout percentage is.
- Deep dive into users instantly. You can use `get_person` to look up any user ID and see their entire property list and activity timeline in one go, skipping manual profile navigation.
- Build better groups faster. Rather than manually defining filters, you can ask the agent to review all behavioral cohorts using `list_cohorts` and understand if your segmentation is accurate.
- Debugging is easier. When an event goes wrong, you don't need to browse; you simply tell the agent to `list_events` and filter by type or time to find the faulty payload properties.
- Contextual reporting. You can use `create_annotation` right from your chat when a major release happens, ensuring that all future metric changes are automatically linked back to that specific product launch date.

## How It Works

The bottom line is you stop switching between dashboards; you just ask your AI client questions about your product data.

1. Subscribe to this MCP and provide your PostHog Personal API Key.
2. Connect your AI client (like Cursor or Claude) to the Vinkius catalog. The agent now has access to all the analytics tools.
3. Ask a natural language question, such as 'Show me all feature flags that are currently set to 50% rollout' and let the agent execute the necessary calls.

## Frequently Asked Questions

**How do I check my permissions using PostHog MCP?**
You run the `get_user` tool. This simply returns details about your connected account, confirming that your API key is valid and showing what access level you currently have.

**Can I list all available analytics workspaces with PostHog MCP?**
Yes, use the `list_projects` tool. This will show every separate project workspace tied to your main PostHog account ID.

**What is the best way to review user activity using PostHog MCP?**
The most direct way is to use `get_person`. Provide the distinct ID, and the agent will return that individual's full property set and comprehensive event history.

**Does PostHog MCP help me manage feature flags?**
Absolutely. You can list all existing features with `list_feature_flags`, create new ones using `create_feature_flag`, or update status via `update_feature_flag`—all conversationally.

**How do I link product launches to metric changes?**
You use the `create_annotation` tool. This allows you to pin a specific event, like 'V4 Launch,' to a date marker so that any future trend analysis automatically links back to it.