
segment-mcp
io.github.katekruger由 GitHub 帳號 katekruger 發布v0.1.2更新於 Nov 3, 2026
Read-first MCP server for Twilio Segment: routing, stale sources, delivery health, governance.
概覽
針對 Twilio Segment 的唯讀 MCP 伺服器,可回答哪些目的地收到哪些事件、哪些來源已失效,以及投遞與治理哪裡出了問題。
- 可以做什麼
- 稽核事件在各目的地與來源之間的路由
- 追蹤單一事件名稱的去向,以及是否受任何治理規則約束
- 找出長期沒有資料的來源,並區分失效埋點與新建立來源
- 檢查某個目的地是否正在無聲失敗
- 找出未受治理、或放行非預期事件的來源
- 每個工具都會組合多次 Segment Public API 呼叫,回傳單一結構化答案
- 適用情境
- 適合管理 Segment 工作區的人讓助理直接回答路由、來源失效、投遞健康與治理相關問題,不必在大量畫面之間反覆點選。它著重稽核與排查,而非變更設定,因為目前不提供任何寫入工具。
- 執行需求
- 透過 stdio 在本機執行,使用 uvx 從 PyPI 安裝(需要 Python/uv)。需要 Team 或 Business 等級的 Segment 工作區、由工作區擁有者建立的 Public API 權杖(放在 SEGMENT_API_TOKEN),並明確設定 SEGMENT_REGION 為 us 或 eu。權杖、區域或等級不符時伺服器會拒絕啟動。需要連線至 Segment API 的網路。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 segment-mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
segment-mcp
A read-first MCP server for Twilio Segment. Answers which destinations get which events, which sources are dead, and which are governed by nothing — the questions nobody can answer without clicking through forty screens.
Read-only by default
SEGMENT_MCP_MODE defaults to read, and every tool this server ships
today is a read. Shipping with zero write tools is a feature, not a
limitation — see BUILD-PLAN.md §2. write and admin modes exist in
the tier model (src/segment_mcp/modes.py) for when gated writes land;
right now there is nothing for them to unlock.
What this refuses to do — permanently, not "for now"
POST /regulations and POST /regulations/sources/{id} — workspace-scoped,
irreversible deletion or suppression of user data across every source —
are unreachable in every mode, with no configuration path to enable
them. Three independent things enforce this: the mode-authorization
layer refuses it before even checking the current mode, the API client
refuses to send the request before it reaches the network, and no tool
this server registers references it in any form.
This isn't a gate waiting for the right permission level. It's a line, because these endpoints accept an array of subjects and one malformed or hallucinated call can permanently delete thousands of profiles with no undo. Full reasoning: docs/what-this-refuses-to-do.md.
Quick start
Requires a Segment workspace on Team or Business tier and a Public API token (see Prerequisites below).
Point an MCP client (Claude Desktop, Claude Code, etc.) at it over stdio. The server refuses to start — loudly, with a clear message — if the token, region, or workspace tier isn't right; see Startup checks.
The five tools
Each composes several Public API calls into one structured answer, not a raw endpoint dump:
Prerequisites
- Team or Business tier. The Public API is not available on Free or Add-on plans. There is no workaround, and the server's startup checks fail with a clear message rather than a raw 403 if your workspace doesn't qualify.
- A Public API token. Only a Workspace Owner can mint one: Segment App → Workspace Settings → Access Management → Tokens → Create Token → Public API (not Config API).
Region configuration
There is no default — you must set this explicitly. An EU workspace whose API calls are pointed at the US endpoint doesn't error; it just silently returns nothing, which is a far worse failure mode than a crash. This server's startup checks call the API once with your configured region and fail loudly if the token doesn't actually belong to it, naming the region that does.
Startup checks
All fatal — the server refuses to start rather than fail confusingly on the first tool call:
SEGMENT_REGIONis set and one ofus/eu.SEGMENT_API_TOKENis present and actually authenticates against that region.- The workspace's tier supports the Public API — a Free-tier workspace gets a clear "requires Team or Business tier" message, not a raw 403.
Modes
read— every tool above. No mutation reachable, at any mode.write— would add Tier 3 replace-semantics changes (none shipped yet), each echoed back for confirmation before executing.admin— would add Tier 2 deletes (none shipped yet), gated behind a typed confirmation naming the exact resource — not justconfirm=true.
See src/segment_mcp/modes.py for the full tier model and
docs/what-this-refuses-to-do.md for
what stays out of scope regardless of mode.
Profile API — a separate, higher trust tier
The Profile API returns PII on named individuals — traits, external IDs, event history, and identity links for a specific person. This is the most privacy-sensitive read anywhere in this server's surface, so it is walled off from everything else:
- A separate credential,
SEGMENT_PROFILE_TOKEN— never the mainSEGMENT_API_TOKEN. Also requiresSEGMENT_PROFILE_SPACE_ID(your Unify Space ID, not your workspace ID). - Explicit opt-in. If
SEGMENT_PROFILE_TOKENis unset, no profile tool is registered — the capability doesn't exist for that server instance. - Every lookup is logged — collection, id_type, and the caller —
before the request is even sent, via
client/profile_api.py'ssegment_mcp.profile_apilogger. The log records that a lookup happened and which profile, as a truncated SHA-256 digest of the lookup key, never the raw identifier — this client never logs the raw identifier itself, and it silenceshttpx's own request-URL log process-wide at construction so the identifier doesn't leak that way either, since the Profile API puts it in the URL path. The digest cannot be reversed back to the identifier, but repeated lookups of the same profile are still correlatable across log lines for auditing. - Lookups are case-sensitive. The wrong case returns an empty result, not an error — this client lowercases every lookup value at its boundary and logs a warning when it had to.
No profile-lookup MCP tool is wired into server.py yet — this is the
client and trust-boundary machinery a future tool will be built on, per
BUILD-PLAN.md's v0.2 scope.
Development
See CONTRIBUTING.md and AGENTS.md.
See also
Every project here shares one idea: a GTM system should refuse to act on data it cannot verify.
campaign-preflight — the same refusal to coerce missing evidence into a pass. insufficient_data is its own state in both.
pipeline-waterfall — downstream of this. Reconciles the bookings and pipeline waterfall, and fails the build rather than reporting a bridge that does not tie out.
License
MIT — see LICENSE.
來源:README.md,提交 22d531d
工具
0版本歷史
1- v0.1.2最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分