The PostHog MCP Server enables seamless interaction with PostHog from Claude Desktop. This integration allows you to view projects, create annotations, and manage various PostHog features directly through simple prompts in Claude Desktop.
uv
package managerannotation:write
and project:read
scopes from your project settings# Using SSH
git clone [email protected]:PostHog/posthog-mcp.git
# Or using HTTPS
git clone https://github.com/PostHog/posthog-mcp.git
cd posthog-mcp
uv venv
source .venv/bin/activate
# Install dependencies
uv pip install .
Create a .env
file in the project root with your PostHog API key:
PERSONAL_API_KEY=phx_your_posthog_api_key_here
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"posthog": {
"command": "/path/to/uv",
"args": [
"--directory",
"/path/to/your/posthog-mcp",
"run",
"posthog_mcp"
]
}
}
}
Note: Replace /path/to/uv
with the actual path (find with which uv
command) and /path/to/your/posthog-mcp
with the full path to the cloned repository.
After successful setup, you'll see a hammer 🔨 icon in Claude Desktop, indicating the MCP server is ready to use.
Simply ask Claude:
List my PostHog projects
To access PostHog insights, try:
List my PostHog insights
Or search for specific insights:
Search for revenue insights in my PostHog
Create annotations on your projects by specifying the project ID:
Create a PostHog annotation in project 53497 saying 'Deployed v1.2.3'
To add an annotation with a specific date:
Create a PostHog annotation in project 53497 for March 20th saying 'Started new marketing campaign'
You can also use the integration to search for PostHog documentation:
How can I do reverse proxy in NextJS in PostHog?
If you encounter issues with the MCP server:
~/Library/Logs/Claude/mcp*.log
%APPDATA%\Claude\logs
claude_desktop_config.json
are absolute pathsThere are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.