Connect to the PostHog API to query events, feature flags, persons, insights, and more.
- A PostHog account
- A Personal API key
PostHog serves its own OpenAPI spec at /api/schema/:
{
"mcpServers": {
"posthog": {
"command": "npx",
"args": [
"-y",
"anyapi-mcp-server",
"--name", "posthog",
"--spec", "https://us.posthog.com/api/schema/",
"--base-url", "https://us.i.posthog.com",
"--header", "Authorization: Bearer ${POSTHOG_API_KEY}"
],
"env": {
"POSTHOG_API_KEY": "your-posthog-personal-api-key"
}
}
}
}- If you're on the EU region, replace
us.posthog.comandus.i.posthog.comwitheu.posthog.comandeu.i.posthog.com. - For self-hosted PostHog, use your instance URL for both
--specand--base-url. - The spec URL (
/api/schema/) and the base URL (us.i.posthog.com) are different hosts — this is expected.