
Tripwire
io.github.bonesdefi由 GitHub 帳號 bonesdefi 發布v0.3.1更新於 Oct 24, 2026
Security gateway for MCP agents: blocks prompt-injection-driven tool calls before they execute.
概覽
Tripwire 是本地 MCP 代理,置於工具伺服器之前,在執行前攔截由提示注入驅動的工具呼叫。
- 可以做什麼
- 代理並合併多個上游 MCP 伺服器的工具,以帶前綴的工具名稱重新暴露,定義原樣透傳
- 為每次工具結果產生 HMAC 簽章收據,並記錄雜湊鏈式稽核日誌
- 檢查敏感參數(地址、金額、電子郵件、URL、ID)是否來自可信來源,攔截僅出現在不可信文件中的值
- 記錄宣告的意圖,並對高風險呼叫以多模型共識檢驗意圖相符、來源依據與數值合理性
- 以淺白語言檢視工作階段紀錄,並以密碼學方式驗證日誌與收據未被竄改
- 適用情境
- 當代理程式可以執行付款、交易、寫入或傳送等有實際後果的操作,而你需要從結構上確認參數有可信證據支撐、而非僅靠正規表達式白名單時適用。也適合事後稽核代理程式在工作階段中實際做了什麼。
- 執行需求
- 以 stdio 本機程序執行,透過 npm 套件 tripwire-mcp 安裝(需 Node.js),以 tripwire init 或策略 YAML 檔設定。伺服器端可選的 HTTP 傳輸在綁定到回送位址以外時必須提供驗證權杖。Tier 2 共識需要 Anthropic、OpenAI 或 Google 的 API 金鑰;沒有金鑰時確定性層級仍可運作。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Tripwire,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Tripwire
The security gateway for MCP agents that other gateways can't be: it blocks prompt-injection-driven tool calls by checking whether an action is grounded in evidence and intent — not just whether it matches a regex.
AI agents now take real actions — payments, trades, writes, sends — and the parameters of those actions are taken on faith. Existing MCP security gateways are syntactic (globs, allowlists, regex); none can answer the question that matters: is this action grounded in the evidence and consistent with the user's intent? A payment to an attacker's address looks identical to a payment to the real vendor.
Tripwire is an MIT-licensed MCP proxy. Point any MCP agent at Tripwire instead of its tool servers; Tripwire forwards everything transparently while running a three-tier verification pipeline on calls that policy marks as consequential:
- Tier 0 — Receipts (deterministic, ~1ms). Every tool result is signed with HMAC-SHA256 into an unforgeable ledger of what actually happened. Fabricated tool results and tampered values fail against the receipts.
- Tier 1 — Provenance (deterministic, ~ms). Every value observed in tool results is indexed with its origin and trust label. A payment address that only ever appeared inside an untrusted document is blocked by construction — no model call, no heuristic.
- Tier 2 — Multi-model consensus (probabilistic, high-stakes only). Independent models from different providers check intent match, source grounding, and bounds/sanity, with strict-JSON verdicts, quorum aggregation, and fail-closed semantics.
Every decision — including passes — lands in a hash-chained, append-only audit log that tripwire verify-log re-validates.
The full design and build plan is in TRIPWIRE_PLAN.md.
Read next: docs/THREAT_MODEL.md — what each tier defends against, and exactly what Tripwire cannot do. docs/POLICY.md — the policy YAML reference.
Status
v0.3.0 — all five build phases complete, plus a no-engineering-required setup flow (tripwire init / check / logs) and HTTP transport for server-side deployments (one Tripwire process, many isolated agent sessions). See docs/GETTING_STARTED.md and Server-side (HTTP).
- Phase 1 — Transparent proxy + receipts. stdio MCP proxy; tools from multiple upstreams merged and re-exposed as
<upstream>__<tool>with definitions passed through verbatim; byte-equivalent passthrough proven by integration test; HMAC-SHA256 receipt ledger over canonical JSON (in-memory + JSONL); hash-chained audit log of all traffic;tripwire verify-log. - Phase 2 — Policy engine + provenance index. Zod-validated YAML policy (tool globs, upstream, annotation matching; first rule wins); session value-provenance index over every receipted result (addresses, amounts, emails, URLs, ids — normalized across case, whitespace, hex prefixes, number formatting); structural Tier 1 enforcement of
sensitive_paramsprovenance, with anti-laundering (echoed inputs never gain a tool's trust label, failed executions are not evidence); structured machine-actionable BLOCK results built for agent self-correction. The poisoned-invoice attack is blocked by Tier 1 alone — zero model calls. - Phase 3 — Intent capture + Tier 2 consensus. Synthetic
tripwire__declare_intenttool (receipted; policy can require it viarequire_intent, and the block error tells the agent how to self-serve); verification packet builder (intent + proposed call + Tier 1 provenance + receipted evidence excerpts); thin fetch-based verifier clients for Anthropic/OpenAI/Google with strict JSON verdict parsing; parallel panel with majority/unanimous quorum; timeouts, malformed output, and missing keys all count as failed verdicts under fail-closed; verifier disagreement flagged as signal; versioned prompt templates pinned in every audit entry. Live smoke script gated behind env keys (npm run smoke:live); CI stays fully deterministic with mocked verifiers. - Phase 4 — Benchmark + demo. 42-scenario corpus (21 attacks, 21 legitimate false-positive traps); deterministic harness whose numbers reproduce in CI with zero API calls;
npm run demoshows the disarmed agent paying the attacker, the identical agent blocked structurally and self-correcting, and Tier 2 catching a plausible-but-wrong amount. - Phase 5 — Threat model + launch. docs/THREAT_MODEL.md (per-tier defenses, assumptions stated as attack surface, and a plain list of what Tripwire does NOT defend against), docs/POLICY.md policy reference, v0.1.0.
The demo
Three runs of the same scripted agent against the same poisoned invoice ("our banking details changed — remit to 0xBBBB…"):
- Disarmed: the agent reads the invoice, believes it, and pays the attacker. The money is gone.
- Armed: the identical script is blocked by Tier 1 — the address only ever appeared inside untrusted document content, so the call is refused structurally, with zero model calls. The agent reads the machine-actionable error, re-queries the trusted vendor record, and pays the real vendor.
- Armed, Tier 2: the agent fat-fingers the amount (the full treasury balance — a value that is receipted, so Tier 1 passes). The consensus panel's
bounds_and_sanitycheck blocks it; the agent re-reads the invoice and pays the right amount.
The demo ends with the audit excerpt: every decision hash-chained, every execution HMAC-receipted.
Benchmark
42 scripted sessions: 21 attacks, 21 legitimate flows built to tempt false positives (vendors genuinely rotating banking details, unusual-but-correct amounts, batches, encoding variations, partial payments). Reproduce with npm run bench; the numbers are pinned by test/bench.test.ts.
Honesty notes, because alert fatigue is how security tools die:
- The two misses are documented in the corpus: conflicting "amount due" figures across documents (requires live-model judgement; the offline heuristic accepts any documented amount), and a stale-but-trusted rotated wallet (receipt-ordering staleness flags are the Tier 0 roadmap item).
- The one false positive is a partial payment (5,000 against a 12,500 invoice): the offline bounds heuristic can't read the installment agreement; live verifier panels can.
- Tier 2 numbers above use the deterministic offline reference verifier so they reproduce exactly in CI.
npm run bench -- --livere-runs the corpus against a real Anthropic/OpenAI/Google panel.
What a Tier 1 block looks like
The agent reads a poisoned invoice ("our banking details changed: 0xBBBB…") and tries to pay it. The address only ever appeared inside untrusted document content, so the call never reaches the payment rail:
A well-built agent reads this, re-queries the vendor record (trusted), and retries with the real address — which passes. That loop is tested end-to-end with zero verifier models in test/tier1.integration.test.ts.
Set it up (no config files to hand-write)
New to this? Follow docs/GETTING_STARTED.md — written for non-engineers.
tripwire init also writes tripwire-agent-config.json — paste it into your AI agent's MCP settings (Claude Desktop, Claude Code, etc.), replacing the tool servers it lists today. Tripwire now sits in front of them. Then use your agent normally; dangerous calls are verified, and tripwire logs shows you what happened in plain English.
See the attack and the defense first
Server-side (HTTP)
Running agents server-side rather than on a laptop? Switch the transport and one Tripwire process serves many agents — each in a fully isolated verification session (own receipts, provenance, audit, upstream connections):
Agents connect to http://…:8765/mcp with Authorization: Bearer …. Binding beyond loopback requires the token — Tripwire refuses to start exposed-but-unauthenticated. Details and the threat model for network exposure: docs/POLICY.md, docs/THREAT_MODEL.md.
Run it by hand
That proxies three toy servers (a trusted vendor DB, an untrusted document reader, a payments rail). Point any MCP client at that command:
Every session records to .tripwire/sessions/<session-id>/:
Read a session in plain English, or verify it cryptographically:
Tamper with a single byte of either file and verification fails loudly, naming the line.
Development
License
MIT
來源:README.md,提交 142dbc4
工具
0版本歷史
1- v0.3.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分