{"_id":"@arvoretech/posthog-mcp","_rev":"7-9ae61678d64b47822e4cfeb406058ca1","name":"@arvoretech/posthog-mcp","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@arvoretech/posthog-mcp","version":"1.0.0","keywords":["mcp","posthog","analytics","feature-flags","experiments","error-tracking","llm","ai","arvore"],"author":{"name":"Arvore"},"license":"MIT","_id":"@arvoretech/posthog-mcp@1.0.0","maintainers":[{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"}],"homepage":"https://github.com/arvoreeducacao/arvore-mcp-servers#readme","bugs":{"url":"https://github.com/arvoreeducacao/arvore-mcp-servers/issues"},"bin":{"posthog-mcp":"dist/index.js"},"dist":{"shasum":"418fb612ef5cc54f7ab0480463f20a759501dee7","tarball":"https://registry.npmjs.org/@arvoretech/posthog-mcp/-/posthog-mcp-1.0.0.tgz","fileCount":7,"integrity":"sha512-Ad51d0R9x0IOC83fbOUKNoTSsSedLepAppgThX5YYOOY3cTiZdmkMwfg7C3aS+yRLB6VtGrH0rk1wpTWWJ11fw==","signatures":[{"sig":"MEUCIHjXu3i5wTbczXAHFDLN9qx1xosSaWgQw8xk1DIICR19AiEAq5IMHmOhxkdNMgAJX7F71WI3inmrY/tY+4It76gx0+Y=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34592},"main":"dist/index.js","type":"module","_from":"file:arvoretech-posthog-mcp-1.0.0.tgz","scripts":{"dev":"tsx src/index.ts","lint":"eslint src/**/*.ts","build":"tsc","start":"node dist/index.js","lint:fix":"eslint src/**/*.ts --fix"},"_npmUser":{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"},"_resolved":"/private/var/folders/4c/6zh0tf292w134k7bn_7vsd4w0000gn/T/8ee8e9e89e72f170cd54f9fc3e8b331a/arvoretech-posthog-mcp-1.0.0.tgz","_integrity":"sha512-Ad51d0R9x0IOC83fbOUKNoTSsSedLepAppgThX5YYOOY3cTiZdmkMwfg7C3aS+yRLB6VtGrH0rk1wpTWWJ11fw==","repository":{"url":"git+https://github.com/arvoreeducacao/arvore-mcp-servers.git","type":"git","directory":"packages/posthog"},"_npmVersion":"10.9.4","description":"PostHog MCP Server for analytics, feature flags, experiments, error tracking and more (self-hosted compatible)","directories":{},"_nodeVersion":"22.21.1","dependencies":{"zod":"^3.22.4","@modelcontextprotocol/sdk":"~1.22.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/posthog-mcp_1.0.0_1777408479399_0.6889194053937213","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@arvoretech/posthog-mcp","version":"1.0.1","keywords":["mcp","posthog","analytics","feature-flags","experiments","error-tracking","llm","ai","arvore"],"author":{"name":"Arvore"},"license":"MIT","_id":"@arvoretech/posthog-mcp@1.0.1","maintainers":[{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"}],"homepage":"https://github.com/arvoreeducacao/arvore-mcp-servers#readme","bugs":{"url":"https://github.com/arvoreeducacao/arvore-mcp-servers/issues"},"bin":{"posthog-mcp":"dist/index.js"},"dist":{"shasum":"1c80b8dc1f788eaf2d8597e2f17e854ccc4c5cf7","tarball":"https://registry.npmjs.org/@arvoretech/posthog-mcp/-/posthog-mcp-1.0.1.tgz","fileCount":14,"integrity":"sha512-f3GgrKRSSCT2KSOiYom5y2bSt0GCim5nKfmWynBGAnkMOp9lt5iVZCDGcquPUYtTsbe9NRMVF/T1htTRvb4OZQ==","signatures":[{"sig":"MEYCIQCsNNtd6dH2KCqHhZj6Q5K48HblJgKsak8RwJ3pmVMqZgIhAONjexNVZqkgDqwBUFQUE4I7G6aIxxR4Vg/wnmVc3Tbj","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@arvoretech%2fposthog-mcp@1.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":64933},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"cd14d4c8afd97d8a5d893cc6b1b10ea2b8287f4e","scripts":{"dev":"tsx src/index.ts","lint":"eslint src/**/*.ts","build":"tsc","start":"node dist/index.js","lint:fix":"eslint src/**/*.ts --fix","prepublishOnly":"npm run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ba2d0200-a487-4241-91ef-567c12228c47"}},"repository":{"url":"git+https://github.com/arvoreeducacao/arvore-mcp-servers.git","type":"git","directory":"packages/posthog"},"_npmVersion":"11.14.1","description":"PostHog MCP Server for analytics, feature flags, experiments, error tracking and more (self-hosted compatible)","directories":{},"_nodeVersion":"20.20.2","dependencies":{"zod":"^3.22.4","@modelcontextprotocol/sdk":"~1.22.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/posthog-mcp_1.0.1_1778512270412_0.6153922459227845","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-04-28T20:34:39.332Z","modified":"2026-06-16T21:13:23.972Z","1.0.0":"2026-04-28T20:34:39.558Z","1.0.1":"2026-05-11T15:11:10.565Z"},"bugs":{"url":"https://github.com/arvoreeducacao/arvore-mcp-servers/issues"},"author":{"name":"Arvore"},"license":"MIT","homepage":"https://github.com/arvoreeducacao/arvore-mcp-servers#readme","keywords":["mcp","posthog","analytics","feature-flags","experiments","error-tracking","llm","ai","arvore"],"repository":{"url":"git+https://github.com/arvoreeducacao/arvore-mcp-servers.git","type":"git","directory":"packages/posthog"},"description":"PostHog MCP Server for analytics, feature flags, experiments, error tracking and more (self-hosted compatible)","maintainers":[{"email":"joao.barros@arvore.com.br","name":"joao.barros.arvore"},{"email":"rafasouza@protonmail.com","name":"rafsouza"},{"email":"pedro.adas@gmail.com","name":"pedro.adas"},{"email":"guilhermebscontact@gmail.com","name":"guilhermebs"},{"email":"ricardorbxx1@gmail.com","name":"ricardoraposorfox"},{"email":"jvgcunha2002@gmail.com","name":"jott4"},{"email":"vitor.piovezan@arvore.com.br","name":"vitor.piovezan"}],"readme":"# PostHog MCP Server\n\nA Model Context Protocol (MCP) server for PostHog that provides access to analytics, feature flags, experiments, dashboards, and more. Works with both PostHog Cloud and self-hosted instances.\n\n## Features\n\n- **Analytics**: Run HogQL queries and structured queries (Trends, Funnels, Retention, Lifecycle, Paths, Stickiness)\n- **Feature Flags**: Create, update, list, and delete feature flags with rollout control\n- **Experiments**: List and inspect A/B test experiments with variants and metrics\n- **Dashboards & Insights**: Create, list, and inspect dashboards and saved insights\n- **Events & Properties**: Explore event definitions and property definitions\n- **Persons & Cohorts**: Search users and manage segments\n- **Surveys & Early Access**: List surveys and early access features\n- **Annotations**: Create and list chart annotations for deployments and events\n- **Search**: Search across all PostHog entities\n- **Self-Hosted**: Direct API connection with static credentials — no OAuth needed\n- **TypeScript**: Fully typed with Zod validation\n\n## Installation\n\n```bash\nnpm install -g @arvoretech/posthog-mcp\n```\n\n## Configuration\n\nThe server is configured via environment variables:\n\n```bash\nexport POSTHOG_BASE_URL=https://posthog.example.com  # or https://app.posthog.com\nexport POSTHOG_API_KEY=phx_your_personal_api_key\nexport POSTHOG_PROJECT_ID=1                           # optional, defaults to 1\n```\n\n### Getting your API Key\n\n1. Go to PostHog → Settings → Personal API Keys\n2. Click \"Create personal API key\"\n3. Select the scopes you need (or use the \"MCP Server\" preset if available)\n4. Copy the generated key (starts with `phx_`)\n\n## Usage\n\n```bash\n# Development\npnpm dev\n\n# Production\nnode dist/index.js\n```\n\n## Available MCP Tools\n\n### Feature Flags\n\n| Tool | Description |\n|------|-------------|\n| `list_feature_flags` | List all feature flags with search and pagination |\n| `get_feature_flag` | Get details of a specific flag by ID |\n| `create_feature_flag` | Create a new flag with optional rollout percentage |\n| `update_feature_flag` | Update flag key, name, or active state |\n| `delete_feature_flag` | Delete a feature flag by ID |\n\n### Experiments\n\n| Tool | Description |\n|------|-------------|\n| `list_experiments` | List all A/B test experiments |\n| `get_experiment` | Get experiment details including variants and metrics |\n\n### Insights & Analytics\n\n| Tool | Description |\n|------|-------------|\n| `list_insights` | List saved insights (trends, funnels, retention, etc.) |\n| `get_insight` | Get a specific insight by ID |\n| `create_insight` | Create a new insight and optionally add to dashboards |\n| `execute_sql` | Execute a HogQL query against PostHog data |\n| `execute_query` | Run structured queries (TrendsQuery, FunnelsQuery, RetentionQuery, etc.) |\n\n### Dashboards\n\n| Tool | Description |\n|------|-------------|\n| `list_dashboards` | List all dashboards with optional search |\n| `get_dashboard` | Get dashboard details including its tiles |\n\n### Events & Properties\n\n| Tool | Description |\n|------|-------------|\n| `list_event_definitions` | List all tracked event types |\n| `list_property_definitions` | List event or person property definitions |\n\n### Persons & Cohorts\n\n| Tool | Description |\n|------|-------------|\n| `list_persons` | Search users by email, name, or distinct ID |\n| `list_cohorts` | List all cohorts (user segments) |\n\n### Annotations\n\n| Tool | Description |\n|------|-------------|\n| `list_annotations` | List all chart annotations |\n| `create_annotation` | Create a new annotation marker |\n\n### Surveys & Early Access\n\n| Tool | Description |\n|------|-------------|\n| `list_surveys` | List all surveys |\n| `list_early_access_features` | List early access features |\n\n### Organization & Search\n\n| Tool | Description |\n|------|-------------|\n| `list_projects` | List all projects for the current API key |\n| `search` | Search across all PostHog entities |\n\n## HogQL Examples\n\nDaily event counts for the last 7 days:\n\n```sql\nSELECT toDate(timestamp) as day, count() as events\nFROM events\nWHERE timestamp > now() - INTERVAL 7 DAY\nGROUP BY day ORDER BY day\n```\n\nUnique users by browser:\n\n```sql\nSELECT properties.$browser as browser, uniq(distinct_id) as users\nFROM events\nWHERE event = 'pageview' AND timestamp > now() - INTERVAL 30 DAY\nGROUP BY browser ORDER BY users DESC\n```\n\nDaily active users:\n\n```sql\nSELECT toDate(timestamp) as day, uniq(distinct_id) as dau\nFROM events\nWHERE timestamp > now() - INTERVAL 30 DAY\nGROUP BY day ORDER BY day\n```\n\n## Programmatic Usage\n\n```typescript\nimport { PostHogMCPServer } from \"@arvoretech/posthog-mcp\";\n\nconst server = new PostHogMCPServer({\n  baseUrl: \"https://posthog.example.com\",\n  apiKey: \"phx_your_key\",\n  projectId: \"1\",\n});\n\nserver.setupGracefulShutdown();\nawait server.start();\n```\n\n## Claude Desktop / Kiro Integration\n\n```json\n{\n  \"mcpServers\": {\n    \"posthog\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@arvoretech/posthog-mcp\"],\n      \"env\": {\n        \"POSTHOG_BASE_URL\": \"https://posthog.example.com\",\n        \"POSTHOG_API_KEY\": \"phx_your_personal_api_key\"\n      }\n    }\n  }\n}\n```\n\n## Development\n\n```bash\npnpm install\npnpm dev\npnpm build\npnpm lint\n```\n\n## Limitations\n\n- Stdio transport only (no HTTP/WebSocket)\n- HogQL queries are read-only by design (PostHog API restriction)\n- Requires a Personal API Key (`phx_` prefix), not a project API key\n","readmeFilename":"README.md"}