跳过安装。2 分钟内即可运行。
在 cloud.anythingmcp.com 开始免费试用,一键添加 PostHog,然后将你的 AI 客户端(Claude、ChatGPT、Copilot 或 Cursor)指向生成的 MCP 端点。无需 Docker,无需 git clone,无需任何工程经验。
摘要
让你的 AI 基于 PostHog 回答产品分析问题:对事件和用户运行只读 SQL(HogQL),计算趋势、漏斗和留存,读取已保存的洞察和看板,查找用户、群组、注释和实验,并管理洞察和功能开关。支持 PostHog Cloud(US 或 EU)或自托管实例,使用个人 API 密钥。
试试这样问
PostHog 的示例提示
点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。
Claude 是 AI,可能会出错。请核对回答。
💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → PostHog、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无
git clone、无本地服务器。
PostHog + Meta Muse
让你的 AI 基于 PostHog 回答产品分析问题:对事件和用户运行只读 SQL(HogQL),计算趋势、漏斗和留存,读取已保存的洞察和看板,查找用户、群组、注释和实验,并管理洞察和功能开关。支持 PostHog Cloud(US 或 EU)或自托管实例,使用个人 API 密钥。
前提条件
完整的设置说明已内置在连接器中 (在 store 中选择连接器时可见)。所需环境变量:
POSTHOG_HOST, POSTHOG_PERSONAL_API_KEY
步骤 1 — 获取凭证
- 在 PostHog 中打开 Settings → User → Personal API keys(US Cloud:
https://us.posthog.com/settings/user-api-keys,EU Cloud:https://eu.posthog.com/settings/user-api-keys),点击 + Create a personal API key。 - 为密钥设置标签(例如 "AnythingMCP"),并选择 organization and project access:全部、某一个组织或指定项目。仅限指定项目的密钥无法列出组织或项目,但
posthog_get_current_user仍然可用,并会显示当前项目。 - 勾选以下权限范围:
user:read,organization:read,project:readquery:read,person:read,cohort:read,experiment:readinsight:read,insight:write,dashboard:readfeature_flag:read,feature_flag:writeannotation:read,annotation:write
- 立即复制密钥:PostHog 只显示一次。密钥以
phx_开头(以phc_开头的项目令牌在这里无效)。把它填入POSTHOG_PERSONAL_API_KEY,不要带 Bearer 字样。 - 将
POSTHOG_HOST设为你打开 PostHog 时使用的地址:US Cloud 用https://us.posthog.com,EU Cloud 用https://eu.posthog.com,自托管则填你自己实例的地址,末尾不要带斜杠或路径。数据接收地址us.i.posthog.com和eu.i.posthog.com会被拒绝,而且密钥只在创建它的云区域内有效。然后安装连接器。 - 先运行
posthog_get_current_user:它会显示该密钥属于哪个 PostHog 用户、当前项目以及组织下的项目。
只读配置:创建密钥时只勾选 :read 权限范围,并关闭 posthog_create_insight、posthog_update_insight、posthog_create_feature_flag、posthog_update_feature_flag 和 posthog_create_annotation。查询永远不会修改数据,因为 HogQL 只接受 SELECT。AI 能看到和修改的内容与密钥所属用户完全一致。
安装时默认关闭:posthog_delete_insight、posthog_delete_feature_flag 和 posthog_delete_annotation。PostHog 通过 API 从不彻底删除:这些工具只是把洞察、开关或注释标记为已删除,之后可以在 PostHog 应用中恢复。被删除的开关会被关闭,检查其 key 的代码将得到 false。
项目 ID:每个项目级工具都需要 project_id,即 PostHog URL 中的数字(/project/12345/...),也可以在 Settings → Project → General 中找到。@current 也可以使用,但它指的是用户在应用中最后打开的项目,可能随时变化:建议使用数字。其他项目可通过 posthog_list_organizations 和 posthog_list_projects 列出。
查询:posthog_run_hogql_query 对 events、persons、sessions 和 groups 运行一条 HogQL(PostHog 的 SQL)SELECT 语句;属性用 properties.$browser 或 person.properties.email 的方式读取。请始终按时间过滤(例如 WHERE timestamp >= now() - INTERVAL 7 DAY):不加过滤的扫描很慢,还会消耗读取预算。不加 LIMIT 时返回 100 行,加上后最多 50,000 行。OFFSET 会被拒绝,因此 AI 按 timestamp 或 id 分页。日期按项目时区解析,而不是 UTC。趋势、漏斗、留存、粘性、生命周期和路径分析使用 posthog_run_insight_query;转化率和留存率根据 count 值计算。查询接口用于即席分析,不适合批量导出。
洞察、看板和开关:posthog_get_insight 默认返回最近一次缓存的结果;refresh 设为 blocking 时会重新计算过期结果。posthog_get_dashboard 返回看板的卡片及其洞察。功能开关决定真实用户看到的内容:在创建或修改开关之前,AI 会向你展示开关的 key、active 和发布比例,并等待你确认。新开关最安全的做法是 active 设为 false 或发布比例设为 0。修改时会带上最近一次读取到的 version,以免覆盖他人的改动。
分页:列表类工具接受 limit 和 offset,返回 count、next(最后一页为 null)和 results。超过 200 KB 的响应会被截断。
速率限制:按组织计算,所有密钥和用户共享。普通读写为每分钟 480 次、每小时 4,800 次;用户查询和洞察计算等分析接口为每分钟 240 次、每小时 1,200 次。查询接口为每分钟 240 次、每小时 2,400 次,每个项目最多同时运行 3 个查询,并消耗每个项目的每小时读取预算(免费套餐更少)。超出限制时 PostHog 返回 429;预算用尽时返回 api_queries_budget_exceeded,但缓存的结果仍可使用。
常见错误:401 表示密钥错误、已删除或属于另一个云区域:请检查 POSTHOG_HOST。403 "API key missing required scope" 会指出需要添加的权限范围(密钥的权限范围之后可以修改);其他 403 表示密钥仅限其他项目或组织,或者组织不允许成员使用个人 API 密钥。404 "Project not found." 表示 project_id 错误或该用户无权查看。400 会指出无效字段,HogQL 查询还会附带解析器错误。开关返回 409 表示其 version 已过期:请重新读取该开关。
连接器不会发送事件或设置用户属性,不会删除用户,不读取会话回放或问卷,不创建或编辑看板、群组和实验,也不管理批量导出、成员和账单。
步骤 2 — 安装 adapter
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
步骤 3 — 在 Muse 中添加连接器
你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(
https://cloud.anythingmcp.com/mcp/…)。本指南中出现YOUR_SERVER_ID的地方都用它替换。
Muse 以自定义连接器的形式添加远程 MCP 服务器,并通过 OAuth 登录。
- 在 Muse 中打开 Settings → Connectors,选择 Add custom connector。
- 粘贴 MCP 服务器 URL
https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID。 - Muse 会打开 AnythingMCP 的登录页面:登录并批准访问。
- 在聊天中,向 Muse 提出需要用到
PostHog的工具的请求。
你也可以在聊天中完成设置,适用于网页版、iOS 和 Android 应用以及 WhatsApp。给 Muse 发送这条消息:
Create a Custom Connector for a new remote MCP server, then connect to it:
Name: AnythingMCP
Transport: remote streamable HTTP
URL: https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID
Auth: OAuth
自托管?请用你实例的公网 HTTPS 地址替换 https://cloud.anythingmcp.com。Muse 从 Meta 的云端连接,因此 localhost 无法使用。
可用工具
| Tool | What it does |
|---|---|
posthog_get_current_user | Get the user the personal API key belongs to: uuid, email and name, the current project (id, name, project_id, timezone), the current… |
posthog_list_organizations | List the organizations the user belongs to: id (a UUID), name, slug, membership_level, and each organization's projects |
posthog_list_projects | List the projects of an organization: id (the project_id every other tool takes), name, project_id, timezone, tags, is_demo and… |
posthog_get_project | Get one project's settings: name, timezone, week_start_day, base_currency, app_urls, test account filters, group types, whether events… |
posthog_run_hogql_query | Run one read-only HogQL (PostHog SQL) SELECT over events, persons, sessions, groups or warehouse tables and return columns, results (rows… |
posthog_run_insight_query | Run one of PostHog's insight calculations without saving it: TrendsQuery, FunnelsQuery, RetentionQuery, StickinessQuery, LifecycleQuery or… |
posthog_list_persons | List or search persons (identified users and anonymous visitors): id, uuid, name, distinct_ids, properties, created_at and last_seen_at.… |
posthog_get_person | Get one person by numeric id or UUID: name, distinct_ids, all person properties (email, initial UTM and referrer, geo), created_at and… |
posthog_list_insights | List saved insights (charts): id, short_id, name, description, query, tags, favorited, dashboard_tiles, created_by and last_modified_at |
posthog_get_insight | Get one insight by numeric id or 8-character short_id: name, description, query, result, columns, last_refresh, is_cached, the hogql it ran… |
posthog_create_insight | Save a new insight (chart) in the project from a query: a product analytics chart or a SQL insight |
posthog_update_insight | Change a saved insight: name, description, query, tags or favorited |
posthog_delete_insight | Delete a saved insight (PostHog marks it deleted; it disappears from every dashboard and can be restored in the app) |
posthog_list_dashboards | List dashboards: id, name, description, pinned, tags, created_by, created_at and last_viewed_at |
posthog_get_dashboard | Get one dashboard with its filters and tiles: each tile carries its insight (id, short_id, name, query and the last cached result) or a… |
posthog_list_feature_flags | List feature flags: id, key, name (the description), active, filters (release conditions with rollout_percentage, variants, payloads)… |
posthog_get_feature_flag | Get one feature flag by id: key, name, active, filters (release condition groups with properties and rollout_percentage, multivariate… |
posthog_create_feature_flag | Create a feature flag |
posthog_update_feature_flag | Change a feature flag: switch it on or off, change its rollout or targeting, rename its description, archive it or retag it |
posthog_delete_feature_flag | Delete a feature flag (PostHog marks it deleted and switches it off; code that checks the key then gets false) |
posthog_list_cohorts | List cohorts (saved groups of persons): id, name, description, count (persons in it), is_static, is_calculating, filters and created_at |
posthog_get_cohort | Get one cohort by id: name, description, its definition (filters or query), count of persons, whether it is static or behavioral… |
posthog_list_annotations | List annotations (notes on charts such as releases or incidents): id, content, date_marker, scope, the insight or dashboard they belong to… |
posthog_get_annotation | Get one annotation by id: content, date_marker, scope (project, organization, dashboard or insight), emoji, the insight or dashboard it is… |
posthog_create_annotation | Add an annotation, a note shown on charts at a point in time, e.g. a release, a campaign start or an incident |
posthog_delete_annotation | Delete an annotation (PostHog marks it deleted; it disappears from every chart and can be restored) |
posthog_list_experiments | List A/B test experiments: id, name, description, status, start_date, end_date, feature_flag_key, type, conclusion, archived and created_by |
posthog_get_experiment | Get one experiment by id: status, start and end dates, its feature flag and variants, metrics, parameters, exposure cohort, conclusion and… |
示例提示
- “上周每天有多少独立用户访问了我们的价格页面?他们用的是哪些浏览器?”
- “过去 30 天里,我们的注册漏斗从浏览价格页面到完成结账的转化率是多少?”
- “现在哪些功能开关处于开启状态?每个开关的发布比例是多少?”
- “在我们的主项目中添加一条今天的注释:春季活动已上线。”
FAQ
Muse 在哪些地区可用? Meta 目前在美国和加拿大提供 Muse,可在网页版、iOS 和 Android 应用以及 WhatsApp 中使用。
Meta 会审核这个连接器吗? 不会。Meta 不审核自定义连接器。Muse 只能看到你在 AnythingMCP 中为此 MCP 服务器启用的工具,你也可以随时在 Settings → Connectors 中断开它。
下一步
这份指南对你有帮助吗?