{
  "markdown": "# PostHog MCP Server\n\n> Connect AI assistants to [PostHog](https://posthog.com/) — query events, persons, insights, dashboards, feature flags, cohorts, and experiments through the Model Context Protocol.\n\nWorks with **Claude Desktop**, **Cursor**, **Windsurf**, **Cline**, **Continue**, and any MCP-compatible client.\n\n## Features\n\n| Tool | Description |\n|------|-------------|\n| `list_events` | Query events with filters (event name, person, date range, properties) |\n| `get_person` | Get a person (user) by distinct_id — properties, creation date, event count |\n| `list_persons` | Search and list persons with pagination |\n| `list_dashboards` | List all dashboards — names, tags, widget counts |\n| `get_dashboard` | Get a specific dashboard with its insights and widgets |\n| `execute_insight` | Execute a saved insight (trend, funnel, etc.) and get results |\n| `list_feature_flags` | List all feature flags — key, active status, rollout percentage |\n| `evaluate_feature_flag` | Evaluate a flag for a specific user and get variant value |\n| `list_cohorts` | List cohorts — name, type (dynamic/static/SQL), person count |\n| `list_experiments` | List A/B tests — name, status, feature flag, dates |\n| `get_experiment` | Get experiment results with variant data and statistical significance |\n| `list_actions` | List custom event actions/definitions |\n| `get_project_info` | Get project name, ID, settings, and data region |\n\n## Quick Start\n\n### 1. Get a PostHog API Key\n\nGo to **PostHog → Settings → Personal API Keys** and create a key with read access.\n\nOr visit: `https://your-instance.posthog.com/settings/user-api-keys`\n\n### 2. Configure your MCP client\n\n**Claude Desktop** — add to `claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"posthog\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"posthog-mcp-server\"],\n      \"env\": {\n        \"POSTHOG_API_KEY\": \"phx_YOUR_API_KEY_HERE\",\n        \"POSTHOG_HOST\": \"https://us.i.posthog.com\",\n        \"POSTHOG_PROJECT\": \"YOUR_PROJECT_ID\"\n      }\n    }\n  }\n}\n```\n\n**Cursor** — add to MCP settings (`.cursor/mcp.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"posthog\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"posthog-mcp-server\"],\n      \"env\": {\n        \"POSTHOG_API_KEY\": \"phx_YOUR_API_KEY_HERE\",\n        \"POSTHOG_HOST\": \"https://us.i.posthog.com\",\n        \"POSTHOG_PROJECT\": \"YOUR_PROJECT_ID\"\n      }\n    }\n  }\n}\n```\n\n### 3. Run manually (for testing)\n\n```bash\n# Clone and build\ngit clone https://github.com/friendlygeorge/posthog-mcp-server.git\ncd posthog-mcp-server\nnpm install\nnpm run build\n\n# Run\nPOSTHOG_API_KEY=phx_... POSTHOG_PROJECT=12345 node dist/index.js\n```\n\n## Environment Variables\n\n| Variable | Required | Default | Description |\n|----------|----------|---------|-------------|\n| `POSTHOG_API_KEY` | ✅ | — | Your PostHog personal API key (`phx_...`) |\n| `POSTHOG_HOST` | ❌ | `https://us.i.posthog.com` | PostHog instance URL (use `https://eu.i.posthog.com` for EU) |\n| `POSTHOG_PROJECT` | ❌ | `\"\"` | Default project ID. If empty, must be specified per-call. |\n\n### Self-hosted PostHog\n\nIf you run PostHog on your own infrastructure, set `POSTHOG_HOST` to your instance URL:\n\n```\nPOSTHOG_HOST=https://posthog.yourcompany.com\n```\n\n## Example Queries\n\nOnce configured, ask your AI assistant:\n\n- *\"Show me the last 20 pageview events\"*\n- *\"Who are the most active users this week?\"*\n- *\"What's the status of our signup conversion experiment?\"*\n- *\"Is the new-checkout-flow feature flag enabled for user abc123?\"*\n- *\"Show me all active dashboards\"*\n- *\"Execute insight 42 and show me the trend\"*\n- *\"List all feature flags that are currently active\"*\n- *\"How many people are in the 'Power Users' cohort?\"*\n\n## API Reference\n\nThis server wraps the PostHog REST API (v1). Full documentation:\n\n- **PostHog API docs**: https://posthog.com/docs/api\n- **MCP protocol**: https://modelcontextprotocol.io\n- **PostHog**: https://posthog.com\n\n## Development\n\n```bash\nnpm install\nnpm run dev     # Build and run\nnpm run build   # Build only\nnpm start       # Run built output\n```\n\n## License\n\nMIT © Nova\n",
  "bytes": 4063,
  "sha": "20120f98206e6a4a274f26c7c6600e53e2715362c2350cc4ff9106a1b4f6b2d8",
  "repo_slug": "friendlygeorge/posthog-mcp-server",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_friendlygeorge_posthog_mcp_ser_c5d9b1ca/readme"
}