
MCP Hangar
io.mcp-hangar由 mcp-hangar.io 發布v2.36.0更新於 Nov 4, 2026
Policy enforcement plane for MCP: every tool call ends in a verdict. Self-hosted, MIT.
概覽
自架式的 MCP 策略執行層:為工具定義做摘要固定、依上游/工具/參數放行或拒絕呼叫,並稽核每一次呼叫。
- 可以做什麼
- 把工具呼叫統一經由一條受控路徑轉送到多個上游 MCP 伺服器,支援平行扇出
- 依上游、工具與參數執行允許/拒絕策略,並支援依租戶投射工具與角色型存取控制
- 固定工具名稱、描述與輸入輸出結構,定義變更時改為扣留而非照常提供
- 以人工審核作為呼叫前置條件,並轉送受治理的工作生命週期
- 記錄帶身分歸屬的稽核事件,匯出為 SIEM 格式或 OTLP
- 管理伺服器生命週期:延遲啟動、健康檢查、閒置關閉、斷路器與設定熱重載
- 適用情境
- 當你同時執行多個 MCP 伺服器,需要可預測地控制哪些工具能到達模型、誰能呼叫它們,並保留可重現的稽核紀錄時適用。適合想要結構漂移防護與 SIEM 匯出、又不想依賴託管服務的團隊。
- 執行需求
- 以 Python 套件形式在本機透過 stdio 執行(pip 或 uvx)。需要設定檔:由 MCP_CONFIG 指定,否則讀取 ./config.yaml 或 ~/.config/mcp-hangar/config.yaml,可用 mcp-hangar init 產生。上游伺服器在該設定中宣告;HTTP 模式啟用驗證需設定 API key 或 OIDC/JWT。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 MCP Hangar,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
The policy enforcement plane for MCP -- deterministic admission and egress policy, attributable audit, and SIEM export for your MCP server fleet. MIT, self-hosted, no SaaS.
[PyPI] [CI] [License: MIT] [OpenSSF Best Practices] [HVTrust]
Same tool, same arguments, same call — refused because the description changed underneath it.
Real output; regenerate it with vhs demo.tape.
Why
In MCP, the tool list is a hint the client caches; the call path is the only surface a provider mediates in real time. Every governance primitive worth having -- revocation, per-tenant scoping, audit -- attaches there, or attaches to nothing. Hangar puts a policy enforcement plane on that seam: one mediated path for lifecycle, policy, and telemetry across your whole MCP server fleet.
Background: The Advisory List -- Why MCP Governance Lives at the Call Path
Install
Upgrading rather than installing fresh? The migration steps live in the upgrade guide.
Quickstart
To see Hangar withhold a changed tool, give your client one server that can
change: a demo upstream that rewrites its own tool description on request. Run
this where your project's .mcp.json is; it adds a demo entry, or creates the
file if there is none.
Then put your servers behind Hangar:
init finds your MCP clients (Claude Code, Cursor, Claude Desktop) and starts
each server they list once. While it is up, init records a digest pin for
every tool it serves, then moves the server into Hangar's config,
~/.config/mcp-hangar/config.yaml, and out of the client's. A server that does
not start stays in the client, and init says why. The client is left with one
mcp-hangar entry; mcp-hangar init --undo puts its config back.
Restart your client and ask it to call echo. It works, and so do the tools of
the servers you already had: they are where they were, with Hangar in the path of
every call to them.
Now change the demo. An MCP server decides what it advertises every time it connects, and the dangerous change is not a new parameter, it is a new description: same inputs, same outputs, different instructions for the model.
That adds two lines to the demo server in Hangar's config, which you can as
well type in by hand:
Restart the client once more. echo is gone. Hangar withholds a tool whose
definition no longer matches its pin, so the new description never reaches the
model, and a call of it is answered like a call of a tool that does not exist.
hangar_details demo names it, with the reason:
CI runs this quickstart every day on a clean GitHub-hosted Linux runner, with
two servers of its own in .mcp.json. From curl to the withheld echo it
takes about 40 seconds; the client restarts are yours to add.
A pin covers the tool's name, description, inputSchema and
outputSchema. A tool under a pin in block mode is served with those fields
only: its title, annotations, execution, icons and _meta are not part
of the digest, so they are not passed on, and a client falls back to the tool's
name and the spec's cautious defaults (readOnlyHint: false,
destructiveHint: true).
mcp-hangar pin --check prints both digests and exits 1, so it belongs in CI or
a pre-commit hook — there is one to copy at the end of
.pre-commit-config.yaml, commented, with what it
needs before it can check anything; --write adopts the change if you meant it.
The demo upstream is examples/rugpull/; the full
walkthrough is the
quickstart.
Writing the config by hand instead:
Over stdio, the process that spawned Hangar is the trust boundary -- there is no channel for a credential -- so
auth.stdio.principaldeclares the caller (ADR-026). Itsrolesbound thehangar_*management tools withtool_access.mode: front_door, as above, or withauth.enabled: true; with neither, every management tool is allowed and the boot log says so. Over HTTP nothing is declared: Hangar refuses to bind a non-loopback interface without auth. For a quick demo, pass--unsafe-no-auth; for anything real, configure theauthblock.
One line, from nothing to a client wired to a pinned fleet:
What you get
The enforcement plane — what the call path actually decides:
- L7 egress policy -- allow/deny in MCP semantics: which upstream, which tool, which arguments. Deterministic, with no anomaly scores and no learned baselines, so every verdict is reproducible from the policy that produced it.
- Tool-schema digest pinning -- an upstream that changes a pinned tool's schema fails closed instead of quietly serving a different tool. Pin for every caller with
tool_projection.pins, or per tenant, which needs authentication so a caller arrives carrying one. - Auth & RBAC -- API-key and OIDC/JWT identity with role-based access and RFC 8707 audience binding; bootstrap the first administrator with
mcp-hangar auth bootstrap-admin, and every call carries a verified principal into the audit trail. - Per-tenant tool projection -- front-door mode presents a different executable surface per caller, fail-closed on unknown identity.
- Human-in-the-loop approvals -- gate a call on an explicit decision, authorized and attributed to a real principal. Delivery channels are pluggable; core ships no vendor integration.
- Governed task relay -- Hangar interposes on the SEP-2663 task lifecycle and never becomes an executor: no scheduler, no job runner, no result store.
- Attributable audit -- an identity-attributed audit record exported to SIEM as CEF, LEEF 2.0, RFC 5424 syslog or JSON-lines, and to OTLP.
Everything else it takes to run a fleet:
- Parallel tool calls -- one
hangar_callfans out to many MCP servers concurrently; all results returned together. - Lifecycle management -- lazy start, health checks, single-flight cold starts, idle shutdown, and per-server circuit breaking.
- Hot config reload -- add or withdraw servers and tools via file watch, no restart.
- OAuth ingress -- advertise as an RFC 9728 protected resource and challenge external agents for verified tokens.
- Observability built in -- OpenTelemetry traces, Prometheus metrics, and structured logs.
One config gotcha: tools: is overloaded
The per-server tools: key accepts two forms that look similar and mean
opposite things:
The list form only lets a tool be listed before its provider has started.
It is not an access policy, and it does not survive startup: the provider's
dynamic tools/list is authoritative and replaces it entirely, so a
statically-listed tool the provider does not return becomes uncallable and
fails with Tool not found: <name> at invocation.
The dict form is the access policy — glob patterns, three-level merge. Reach for it when you mean to restrict something. Full semantics in the configuration reference.
Documentation
- Getting Started · Configuration · Python API
- Governance & Front Door · Authentication & RBAC · Observability
- Kubernetes operator · Helm charts · All docs
- Release compatibility matrix · which core, operator, and chart versions are released and tested together
MCP Registry
Published in the Official MCP Registry
as io.mcp-hangar/hangar. Clients that consume the registry can install it from
there; the entry describes the PyPI package started over stdio, not a hosted
instance — Hangar is self-hosted only.
Listed on
[MCP Hangar on Glama] [MCP Hangar on LobeHub]
Both scores are computed by the directories themselves, from a live probe of the server. They can go down; that is the point of showing them.
Name and logo
The MCP Hangar name, the gate mark and the wordmarks are not covered by
the MIT licence of this repository. They are licensed
CC BY-ND 4.0: you may
redistribute them unchanged — for example to link to or write about this
project — but not modify them or use them to name or brand a fork or a
derivative product. Source assets live in mcp-hangar/brand.
License
The name and logo are excluded — see "Name and logo" above.
來源:README.md,提交 9cf845a
工具
0版本歷史
25- v2.36.0最新Nov 4, 2026
- v2.35.0Oct 31, 2026
- v2.34.9Oct 30, 2026
- v2.34.8Oct 30, 2026
- v2.34.7Oct 29, 2026
- v2.34.3Oct 26, 2026
- v2.34.0Oct 23, 2026
- v2.33.0Oct 21, 2026
- v2.32.1Oct 21, 2026
- v2.32.0Oct 20, 2026
- v2.31.0Oct 19, 2026
- v2.29.1Oct 18, 2026
- v2.29.0Oct 18, 2026
- v2.28.0Oct 16, 2026
- v2.27.5Oct 14, 2026
- v2.27.3Oct 14, 2026
- v2.26.0Oct 12, 2026
- v2.25.0Oct 6, 2026
- v2.24.0Oct 4, 2026
- v2.23.0Sep 25, 2026
- v2.22.1Sep 23, 2026
- v2.22.0Sep 23, 2026
- v2.21.1Sep 21, 2026
- v2.21.0Sep 17, 2026
- v2.20.0Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分