PostHog MCP — Auth Setup
PostHog uses a personal API key and project ID to authenticate requests to your analytics data.
1. Get your credentials
- Open PostHog Project Settings (opens PostHog — we never see your key)
- Navigate to Project Settings > Personal API Keys and click Create personal API key
- Copy the key — it will not be shown in full again after you leave the page
- Your Project ID is shown at the top of the Project Settings page
2. Set environment variables
macOS / Linux — add to ~/.zshrc or ~/.bashrc:
export POSTHOG_API_KEY=YOUR_PERSONAL_API_KEY_HERE
export POSTHOG_PROJECT_ID=YOUR_PROJECT_ID_HERE
Then run source ~/.zshrc (or open a new terminal).
Windows — run in Command Prompt (then restart):
setx POSTHOG_API_KEY "YOUR_PERSONAL_API_KEY_HERE"
setx POSTHOG_PROJECT_ID "YOUR_PROJECT_ID_HERE"
3. Verify
npx claude-skills doctor
You should see ✅ next to the PostHog MCP entry. If you see ❌, confirm the key is set: echo $POSTHOG_API_KEY.
4. Restart Claude Code
Quit and reopen Claude Code (or run /mcp list inside Claude Code to confirm the PostHog MCP appears).

