PostHog MCP Server — Hosted Api Connectors Integration
MCP Server language Hosted language PublicCapture events, manage feature flags, and run experiments in PostHog — AI-driven product analytics and A/B testing.
Use with AI AssistantsMCP
Connect Claude, Cursor, or any MCP-compatible client — then call tools directly
① Add This MCP Server
Paste into your AI client config — then all its tools are available instantly.
{
"mcpServers": {
"posthog": {
"url": "https://mcp.aerostack.dev/s/aerostack/mcp-posthog",
"headers": {
"Authorization": "Bearer YOUR_AEROSTACK_TOKEN"
}
}
}
}Replace YOUR_AEROSTACK_TOKEN with your API token from the dashboard.
② Call a Tool
Ask your AI assistant to call a specific tool, or send raw JSON-RPC:
Natural Language Prompt
“Use the _ping tool to verify posthog credentials by calling a lightweight read endpoint. used internally by aerostack to validate credentials”
Using a Workspace?
Add this MCP to your Workspace — your team shares one token, secrets are stored securely, and every AI agent in the workspace can call it without per-user setup.
description Overview
mcp-posthog — PostHog MCP Server
Capture events, evaluate feature flags, manage cohorts, and query analytics from your AI agents.
PostHog is the open-source product analytics suite with built-in feature flags, A/B testing, and session recording. This MCP server lets your AI agents capture analytics events from server-side workflows, evaluate which feature flags are active for a user, and query insights, cohorts, and experiments — turning PostHog into a live data source for intelligent product workflows.
Live endpoint: https://mcp.aerostack.dev/s/aerostack/mcp-posthog
What You Can Do
- Capture backend events (like a subscription upgrade or API call) directly into PostHog from any agent workflow
- Evaluate feature flags for a specific user to decide which version of a feature to serve in dynamic workflows
- List and inspect A/B experiments to understand which variants are running and their current status
- Query cohort membership to target specific user segments in downstream communication or automation
Available Tools
| Tool | Description |
|---|---|
capture_event |
Capture a custom analytics event for a user |
identify_user |
Identify a user and set their properties |
get_feature_flags |
Evaluate which feature flags are active for a user |
list_persons |
List persons with optional email or name search |
get_person |
Get full details for a person by ID |
list_feature_flags |
List all feature flags (optionally filter by active status) |
get_insights |
List insights reports (TRENDS, FUNNELS, RETENTION, PATHS) |
list_cohorts |
List all cohorts with member counts |
get_experiments |
List all A/B experiments and their variants |
Configuration
| Variable | Required | Description | How to Get |
|---|---|---|---|
POSTHOG_API_KEY |
Yes | Personal API key for REST API access | app.posthog.com → Settings → Personal API Keys → Create personal API key |
POSTHOG_PROJECT_ID |
Yes | Numeric project ID | app.posthog.com → Your Project → Settings → Project → copy Project ID |
POSTHOG_PROJECT_API_KEY |
Yes | Project API key for event capture (starts with phc_) |
app.posthog.com → Your Project → Settings → Project → copy Project API Key |
Quick Start
Add to Aerostack Workspace
- Go to aerostack.dev → Your Project → MCPs
- Search for "PostHog" and click Add to Workspace
- Add all three secrets under Project → Secrets
Once added, every AI agent in your workspace can call PostHog tools automatically — no per-user setup needed.
Example Prompts
"Check which feature flags are enabled for user distinct_id_12345"
"List all active A/B experiments and their current variant assignments"
"Capture a subscription_upgraded event for user u_98765 with property plan: enterprise"
Direct API Call
curl -X POST https://mcp.aerostack.dev/s/aerostack/mcp-posthog \
-H 'Content-Type: application/json' \
-H 'X-Mcp-Secret-POSTHOG-API-KEY: your-personal-api-key' \
-H 'X-Mcp-Secret-POSTHOG-PROJECT-ID: 12345' \
-H 'X-Mcp-Secret-POSTHOG-PROJECT-API-KEY: phc_yourprojectkey' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"list_feature_flags","arguments":{}}}'
License
MIT
terminal Tools (10)
Available tools on this MCP server. Each tool can be called directly from any AI agent.
_ping #1 Verify PostHog credentials by calling a lightweight read endpoint. Used internally by Aerostack to validate credentials.
capture_event #2 Capture a custom event in PostHog for a specific user
identify_user #3 Identify a user and set their properties in PostHog
get_feature_flags #4 Evaluate feature flags for a specific user using the PostHog decide endpoint
list_persons #5 List persons (users) in the PostHog project with optional search
get_person #6 Get full details for a specific person by their PostHog person ID
list_feature_flags #7 List all feature flags in the PostHog project
get_insights #8 List insights (analytics queries) in the PostHog project
list_cohorts #9 List all cohorts defined in the PostHog project
get_experiments #10 List all A/B experiments in the PostHog project
Details
language Live Endpoint
https://mcp.aerostack.dev/s/aerostack/mcp-posthog
Sub-50ms globally · Zero cold start
Publisher
Pre-built functions for the most common MCP tool patterns. Clone, extend, and deploy.
More in API Connectors
Browse API Connectors MCPs →Aerostack Registry
by @aerostack
Discover and invoke any MCP, Function, or Skill published to the Aerostack marketplace — the universal AI capability hub.
Algolia
by @aerostack
Search indexes, manage records, browse data, and configure ranking in Algolia — AI-native instant search access.
Arangodb
by @aerostack
Query documents, run AQL, traverse graphs, and manage collections in your ArangoDB database — AI-native multi-model database access.
Ayrshare
by @aerostack
Post, schedule, and analyze social media across 13 platforms — Facebook, Instagram, X, LinkedIn, TikTok, Bluesky, Threads, Reddit, Pinterest, YouTube, Telegram, Snapchat, Google Business.
Basecamp
by @aerostack
Manage projects, to-dos, messages, schedules, and campfire chats in Basecamp — AI-native project management.
Bigquery
by @aerostack
Run SQL queries, list datasets and tables, inspect schemas, and export results from Google BigQuery — AI-native data warehouse access.
Frequently asked questions
What is the PostHog MCP server and what can it do? +
The PostHog MCP server is hosted on Aerostack and exposes these tools to your AI agent: `_ping`, `capture_event`, `identify_user`, `get_feature_flags`, `list_persons`. You get one hosted URL — no self-hosting — that works from Claude, Cursor, ChatGPT, Gemini, VS Code, or any MCP-compatible client, and you can share it with your team or combine it with other MCP servers in a workspace.
Is the PostHog MCP server hosted, or do I have to run it myself? +
It's hosted on Aerostack's edge infrastructure — you don't deploy or maintain anything. Add it to a workspace and you get one authenticated URL, with secrets encrypted, that any AI agent or editor can connect to. Use it solo or share the same URL across your whole team.
Which AI agents and editors can use the PostHog MCP server? +
Any MCP client: Claude and Claude Code, Cursor, ChatGPT, Gemini, Windsurf, Cline, VS Code, and custom agents. Because it's one hosted URL, the same PostHog MCP server works everywhere — and you can compose it with other MCP servers, skills, and functions behind a single workspace URL.
How do I install the PostHog MCP server in Claude Desktop? +
Add the following to your Claude Desktop config (`claude_desktop_config.json`): ```json { "mcpServers": { "@aerostack/mcp-posthog": { "command": "npx", "args": ["-y", "@aerostack/@aerostack/mcp-posthog"] } } } ``` Then restart Claude Desktop and the tools will appear automatically.
How do I use the PostHog MCP server in Cursor? +
In Cursor, open **Settings → MCP** and add: ```json { "name": "@aerostack/mcp-posthog", "command": "npx", "args": ["-y", "@aerostack/@aerostack/mcp-posthog"] } ``` Save and reload Cursor. The MCP tools will be available in Agent mode.
Does PostHog MCP require authentication? +
Yes. PostHog requires authentication. Check the MCP's documentation for the required credentials.