PostHog MCP 服务器 📊
用于与 PostHog 交互的模型上下文协议 (MCP) 服务器。直接通过 Claude Desktop 创建注释并管理项目!
特点🚀
列出项目:查看组织中所有可用的 PostHog 项目
创建注释:使用可选时间戳向您的 PostHog 项目添加注释[此列表可以更长,我们的 api 基本上包含任何内容...]
设置🛠️
先决条件
Python 3.10 或更高版本
uv包管理器从您的项目设置中获取带有
annotation:write和project:read范围的 PostHog API 密钥
安装
# clone the repo git clone git@github.com:PostHog/posthog-mcp.git # or if https, use: git clone https://github.com/PostHog/posthog-mcp.git cd posthog-mcp uv venv source .venv/bin/activate # Install dependencies uv pip install .配置
在项目根目录中创建一个
.env文件:PERSONAL_API_KEY=phx_your_posthog_api_key_here
Claude 桌面设置
打开 Claude Desktop 设置,然后点击“编辑配置”。或者,您也可以从以下位置打开文件:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
将其添加到您的
claude_desktop_config.json(根据您的系统调整路径):{ "mcpServers": { "posthog": { "command": "/path/to/uv", # Get this by running: which uv "args": [ "--directory", "/path/to/your/posthog-mcp", # Full path to this project "run", "posthog_mcp" ] } } }如果您遇到任何问题,请查看有关将 Claude Desktop 设置为 MCP 客户端的最新文档。
使用方法💡
设置完成后,您会在 Claude Desktop 中看到一个锤子🔨图标。可以使用以下命令:
列出项目
问克劳德:
获取并搜索见解
问克劳德:
“列出我的 PostHog 洞察”或“在我的 PostHog 中搜索收入洞察”
在线搜索文档
您可以询问:
“如何在 posthog 中的 nextjs 中进行反向代理?”
创建注释
使用从项目列表中获取的项目 ID,询问 Claude:
或者指定具体日期:
故障排除🔍
如果没有出现锤子图标,请重新启动 Claude Desktop
检查
~/Library/Logs/Claude/mcp*.log(macOS) 或%APPDATA%\Claude\logs(Windows) 中的日志验证您的 PostHog API 密钥是否具有正确的权限
确保
claude_desktop_config.json中的所有路径都是绝对路径
贡献🤝
欢迎随时提交问题和 PR!我们遵循 PostHog 的贡献指南。
local-only server
The server can only run on the client's local machine because it depends on local resources.
模型上下文协议服务器使 Claude Desktop 用户能够直接与 PostHog 交互,从而允许他们通过自然语言命令查看项目和创建注释。
Related Resources
Related MCP Servers
- -security-license-qualityA Model Context Protocol server for Claude Desktop that provides structured memory management across chat sessions, allowing Claude to maintain context and build a knowledge base within project directories.Last updated -3
- -security-license-qualityA Model Context Protocol server that allows Claude to interact with Warpcast accounts, enabling actions like posting casts, reading content, searching by keywords, and managing channel interactions through natural language.Last updated -3MIT License
- Asecurity-licenseAqualityA collection of Model Context Protocol servers that enable Claude Desktop to provide development assistance capabilities with filesystem, Git, shell command, and web search functionality without incurring API usage costs.Last updated -219MIT License
- Asecurity-licenseAqualityA Model Context Protocol server that allows Claude Desktop to manage and execute tasks in a queue-based system, supporting planning, execution, and completion phases.Last updated -103916MIT License