Posthog Mcp Server

io.github.friendlygeorge由 GitHub 帳號 friendlygeorge 發布v1.0.0更新於 Oct 24, 2026

MCP server for PostHog — product analytics for AI assistants. Query events, persons, insights, da...

已驗證STDIO僅桌面效率與工作流資料與分析

概覽

AI 產生的概覽

讓助理查詢 PostHog 產品分析資料,包括事件、使用者、洞察、儀表板、功能旗標、同群組與實驗。

可以做什麼
把 PostHog REST API(v1)包裝成 MCP 工具。讀取類工具有 list_events、get_person、list_persons、list_dashboards、get_dashboard、execute_insight、list_feature_flags、evaluate_feature_flag、list_cohorts、list_experiments、get_experiment、list_actions 與 get_project_info。助理可藉此取得事件與使用者資料、執行已儲存的洞察、查看某位使用者的功能旗標狀態,以及檢視實驗結果。
適用情境
適合想在對話中直接取得 PostHog 產品分析答案的情境,例如最近事件、活躍使用者、儀表板狀態、功能旗標推送比例、同群組人數或 A/B 測試結果,不必切換到 PostHog 介面。
執行需求
以 stdio 在本機執行,通常透過 npx posthog-mcp-server 啟動,因此需要 Node.js。需要 PostHog 個人 API 金鑰,放在 POSTHOG_API_KEY;可選 POSTHOG_HOST(預設 POSTHOG_PROJECT,若專案為空則須在每次呼叫時指定。需要能連線到 PostHog 執行個體的網路。
安裝前請注意
此伺服器會在用戶端設定中保存 PostHog 個人 API 金鑰(POSTHOG_API_KEY),建議只授予讀取權限。查詢會把分析資料(含使用者層級明細)傳送給助理及其模型供應商。文件列出的工具為唯讀,但若金鑰權限更廣,助理可存取的範圍也會擴大。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Posthog Mcp Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

PostHog MCP Server

Connect AI assistants to PostHog — query events, persons, insights, dashboards, feature flags, cohorts, and experiments through the Model Context Protocol.

Works with Claude Desktop, Cursor, Windsurf, Cline, Continue, and any MCP-compatible client.

Features

ToolDescription
list_eventsQuery events with filters (event name, person, date range, properties)
get_personGet a person (user) by distinct_id — properties, creation date, event count
list_personsSearch and list persons with pagination
list_dashboardsList all dashboards — names, tags, widget counts
get_dashboardGet a specific dashboard with its insights and widgets
execute_insightExecute a saved insight (trend, funnel, etc.) and get results
list_feature_flagsList all feature flags — key, active status, rollout percentage
evaluate_feature_flagEvaluate a flag for a specific user and get variant value
list_cohortsList cohorts — name, type (dynamic/static/SQL), person count
list_experimentsList A/B tests — name, status, feature flag, dates
get_experimentGet experiment results with variant data and statistical significance
list_actionsList custom event actions/definitions
get_project_infoGet project name, ID, settings, and data region

Quick Start

1. Get a PostHog API Key

Go to PostHog → Settings → Personal API Keys and create a key with read access.

Or visit: https://your-instance.posthog.com/settings/user-api-keys

2. Configure your MCP client

Claude Desktop — add to claude_desktop_config.json:

json
{  "mcpServers": {    "posthog": {      "command": "npx",      "args": ["-y", "posthog-mcp-server"],      "env": {        "POSTHOG_API_KEY": "phx_YOUR_API_KEY_HERE",        "POSTHOG_HOST": "https://us.i.posthog.com",        "POSTHOG_PROJECT": "YOUR_PROJECT_ID"      }    }  }}

Cursor — add to MCP settings (.cursor/mcp.json):

json
{  "mcpServers": {    "posthog": {      "command": "npx",      "args": ["-y", "posthog-mcp-server"],      "env": {        "POSTHOG_API_KEY": "phx_YOUR_API_KEY_HERE",        "POSTHOG_HOST": "https://us.i.posthog.com",        "POSTHOG_PROJECT": "YOUR_PROJECT_ID"      }    }  }}

3. Run manually (for testing)

bash
# Clone and buildgit clone https://github.com/friendlygeorge/posthog-mcp-server.gitcd posthog-mcp-servernpm installnpm run build
# RunPOSTHOG_API_KEY=phx_... POSTHOG_PROJECT=12345 node dist/index.js

Environment Variables

VariableRequiredDefaultDescription
POSTHOG_API_KEY✅—Your PostHog personal API key (phx_...)
POSTHOG_HOST❌https://us.i.posthog.comPostHog instance URL (use https://eu.i.posthog.com for EU)
POSTHOG_PROJECT❌""Default project ID. If empty, must be specified per-call.

Self-hosted PostHog

If you run PostHog on your own infrastructure, set POSTHOG_HOST to your instance URL:

POSTHOG_HOST=https://posthog.yourcompany.com

Example Queries

Once configured, ask your AI assistant:

  • "Show me the last 20 pageview events"
  • "Who are the most active users this week?"
  • "What's the status of our signup conversion experiment?"
  • "Is the new-checkout-flow feature flag enabled for user abc123?"
  • "Show me all active dashboards"
  • "Execute insight 42 and show me the trend"
  • "List all feature flags that are currently active"
  • "How many people are in the 'Power Users' cohort?"

API Reference

This server wraps the PostHog REST API (v1). Full documentation:

Development

bash
npm installnpm run dev     # Build and runnpm run build   # Build onlynpm start       # Run built output

License

MIT © Nova

來源:README.md,提交 fbae87e

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分