posthog-mcp
by JiayuuWang
README.md
# PostHog MCP Server
Type 3 DAuth MCP server for the [PostHog](https://posthog.com) product analytics API.
## Tools
| Tool | Description |
|------|-------------|
| `list_projects` | List all projects in the organization |
| `query_events` | Query events with optional filters |
| `query_insights` | Query TRENDS, FUNNELS, or RETENTION insights |
| `list_feature_flags` | List all feature flags |
| `get_feature_flag` | Get a specific feature flag by ID |
| `create_annotation` | Create a graph annotation |
## Auth Setup
1. Go to **PostHog → Settings → Personal API Keys**
2. Create a key with project read access
3. Copy the key (starts with `phc_`)
## Environment Variables
```bash
POSTHOG_API_KEY=phc_your_key_here # Required Credential (DAuth)
```
## Deploy
```bash
pip install -e .
python src/main.py
```
## Usage
```python
result = await runner.run(
input="List my PostHog projects",
mcp_servers=["JiayuWang/posthog-mcp"],
)
```
## Safety Notes
- `create_annotation` writes to PostHog but is non-destructive
- All other tools are read-only
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo issues