Protect Mcp

io.github.tomjwxf由 GitHub 帳號 tomjwxf 發布v0.5.3更新於 Oct 24, 2026

Signed receipts and Cedar policies for AI agent tool calls. Claude Code hooks, MCP gateway.

已驗證STDIO僅桌面開發者工具安全與監控

概覽

AI 產生的概覽

一個本機策略閘道,依 Cedar 規則檢查 AI 代理的工具呼叫,攔截違規呼叫,並為每次決策簽發可驗證的簽章回執。

可以做什麼
依 Cedar 策略評估工具呼叫並放行或拒絕,發生錯誤時預設拒絕,執行模式啟動前先做自我測試。包裝 MCP 伺服器或 Claude Code 掛鉤,讓每次呼叫都經過閘道,並可依觀察到的呼叫產生可審閱的策略草稿。將每次決策簽章為 Ed25519 回執,在本機檢視、匯出或離線驗證回執與稽核包。在閘道中保管憑證,代理只看得到標籤,實際值在派送時注入標頭、查詢參數或環境變數。可選擇將回執摘要錨定到託管服務,並使用協作工具處理共享發票或程式碼庫審查工作。
適用情境
當你執行可呼叫工具的 AI 代理,希望有一道本機、出錯即拒絕的防線來攔截違規操作並留下簽章證據時使用。也適合需要可離線驗證的稽核紀錄,或希望讓 API 金鑰不進入代理情境的場合。
執行需求
以 npm 套件形式透過 npx 在本機執行(需要 Node.js)。初始化會產生 Ed25519 金鑰對與策略檔案。可選的託管功能需要 ScopeBlind 帳號、SCOPEBLIND_TOKEN 環境變數與網路存取;閘道本身從行程環境變數讀取密鑰。
安裝前請注意
閘道會攔截、拒絕或放行工具呼叫,並向外部請求注入憑證,從影子模式切換到執行模式前應審閱策略。0.5.x 與 0.6.x 版本出錯時放行且 Cedar 評估不正確,應使用 0.7.0 或更新版本。協作功能會把草稿文字與私有指示傳送給 ScopeBlind,託管錨定會上傳回執摘要與計費中繼資料。私有設定檔保存代理金鑰,必須妥善保密。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

protect-mcp

Local policy enforcement and signed decision receipts for AI agent tool calls.

[npm version] [Monthly npm downloads] [Node.js compatibility] [Package checks] [MIT license]

Developer page · Quickstart · Agent setup · Policy packs · Sample record · Integrations · Documentation · Contribute

Put the gateway between an MCP client and its tool server, or use its hooks in a coding agent. Review a Cedar policy, enable enforcement, and keep a signed record of the decisions. Local evaluation and verification need no ScopeBlind account and send no decision telemetry.

  • Enforce at the tool boundary. Cedar denies on missing policies, engine errors or evaluation errors in fail-closed mode. Shadow mode is the default for the MCP wrapper: use --enforce when ready to block.
  • Check what was signed. Ed25519 receipts include the decision and policy digest. @veritasacta/verify checks the bytes against the public key you trust.
  • Start with existing tools. Use MCP stdio, the HTTP gateway or coding-agent hooks. Optional hosted collaboration has its own permissions and data flows.

A gateway covers calls routed through it. It is not an OS sandbox, and a signed receipt does not establish that an action executed or that no action was omitted. The security policy describes the boundary and reporting process.

See the result

A real local run: evaluate two proposed calls, sign the decisions, verify the receipts, then change a signed decision and check it again.

[Five-step result summary: a read is allowed, a proposed force-push is denied, both decisions are signed, their receipts verify, and a modified denial fails signature verification. No proposed tool is executed.]

Watch the 14-second walkthrough

[Animated result summary of the same five steps, based on captured CLI output.]

Text walkthrough and reproduction · Captured results

Try it without an agent

Use Node.js 22 and npm in a new directory. Install the pinned gateway and verifier:

sh
mkdir protect-mcp-democd protect-mcp-demonpm init -ynpm install --save-exact [email protected] @veritasacta/[email protected]

This example evaluates two proposed calls and signs their decisions. It does not execute either tool or run git push. Everything after installation is local.

sh
# Create a starter policy and a private signing key.npx --no-install protect-mcp init --starter
# A normal read is allowed; a force-push to main is denied (exit 2).npx --no-install protect-mcp evaluate --policy ./protect.cedar --tool Read --input '{"path":"README.md"}'npx --no-install protect-mcp evaluate --policy ./protect.cedar --tool Bash --input '{"command":"git push --force origin main"}' || test "$?" -eq 2
# Evaluate again at signing time and record both decisions, in order.npx --no-install protect-mcp sign --cedar builtin:starter --tool Read --input '{"path":"README.md"}' --key ./protect-mcp.key --receipts ./receiptsnpx --no-install protect-mcp sign --cedar builtin:starter --tool Bash --input '{"command":"git push --force origin main"}' --key ./protect-mcp.key --receipts ./receipts
# Take only the public key from the key you generated, not from the receipt.PROTECT_MCP_PUBLIC_KEY=$(node -p 'JSON.parse(require("fs").readFileSync("protect-mcp.key", "utf8")).publicKey')npx --no-install verify --replay-chain ./receipts/receipts.jsonl --key "$PROTECT_MCP_PUBLIC_KEY" --json
# Change the signed deny to allow. The original receipt log stays intact.node -e 'const fs=require("fs");const r=JSON.parse(fs.readFileSync("receipts/receipts.jsonl","utf8").trim().split("\n")[1]);r.payload.decision="allow";fs.writeFileSync("tampered.json",JSON.stringify(r))'npx --no-install verify tampered.json --key "$PROTECT_MCP_PUBLIC_KEY" --json || test "$?" -eq 1

Expected: allow, then deny; both original receipt signatures and their link verify; the modified receipt reports invalid_signature. Keep protect-mcp.key private. To verify someone else's record, obtain their expected public key through an independent trusted channel.

Verifier exit codes are 0: valid, 1: invalid, 2: not checked/error. An invalid result is not necessarily tampering: the wrong expected key can also fail verification. Chain replay checks the supplied links; it does not establish that you received the entire history.

CI runs this exact example against the packed candidate and the pinned published verifier. See validation and releases.

Connect your agent

Choose the integration that matches your host and the coverage you need. Installing guidance skills does not enable enforcement. doctor checks local configuration; confirm the selected route with a real allowed and blocked call.

For the Claude Code plugin, first prepare and start the local gate, then install it in your project (Claude Code 2.1.295 or later):

sh
claude plugin install protect-mcp --marketplace ScopeBlind/scopeblind-gateway --scope project

The plugin blocks routed tool calls while its gate is unavailable. Choose the plugin or standalone project hooks, so the same call is not recorded twice.

Use caseStart here
Wrap an existing MCP serverMCP setup and shadow-to-enforce workflow
Claude Code enforcement pluginPlugin setup and local gate
Claude Code project hooksHook setup
Cursor project previewExplicit setup, tool mapping and host checks
ChatGPT / Codex assistant previewSetup guidance and a harmless verification demo, with no hooks
Existing Claude directory guidance pluginPublished plugin source, separate from enforcement
Call the policy evaluator as MCP toolsThe gate as an MCP server
Host an HTTP gatewayHTTP deployment notes

Host compatibility and release status separates adapter tests from real-host validation. The Cursor and assistant packages are previews, not public directory listings. The standalone hook-format fixes ship in 0.32.4; its changelog lists what changed for each format. A format flag alone does not establish a working Codex, Gemini or Hermes integration.

For an existing MCP server, initialize its configuration in a separate directory from the example above, then run the wrapper with your server command:

sh
npx --yes [email protected] initnpx --yes [email protected] --policy ./protect-mcp.json -- node your-mcp-server.js

This starts in shadow mode. Review the observed calls and policy before adding --enforce. wrap prints client configuration and exits; it is not the launch command. Full setup instructions.

Starter shell rules inspect command text. They are useful guardrails, but can miss alternate command spellings and can match harmless quoted text. Review the starter policy's coverage and limits before relying on it.

Integrations and contributions

ProjectConnection
Microsoft AI Agents for BeginnersEducational contribution. protect-mcp's maintainer authored Lesson 18 on signing, verifying and chaining agent receipts.
Cedar for AgentsUpstream contribution. Contributed the WASM bindings that expose Cedar's Rust MCP schema generator to JavaScript and TypeScript.
wshobson/agentsDownstream integration. Ships a protect-mcp plugin with Claude Code policy and receipt hooks.
TRACEInteroperability checks. Publishes Acta decision-receipt fixtures; our verifier reports its results against a pinned snapshot.

Sources, versions and check coverage.

Upgrading from 0.31

0.32.0 closes several ways around the gate. Some of them change how you start it:

  • --http listens on 127.0.0.1, and every request except GET /health needs Authorization: Bearer <token>. Set the same PROTECT_MCP_HTTP_TOKEN (at least 32 characters) for the gateway and for the client or ingress that calls it. Use --host only when you mean to expose the port beyond this machine.
  • --enforce refuses to start when signing is configured but its key is missing or unreadable, and refuses an allowed call whose receipt cannot be signed.
  • --cedar with --policy applies both: a call needs a Cedar permit and must also pass that file's block, require_approval, rate limits and min_tier. Signing and credentials come from that file.
  • The dashboard accepts a change only from its own page, which carries a per-launch token.
  • Signing keys are written 0600 in a 0700 folder. For a key made by an earlier version, run chmod 600 keys/gateway.json; the gateway warns until you do.
  • A once approval at POST /approve names the exact action: the Request ID the gateway prints, tool:payload_hash. The approval nonce is on the gateway's stderr only.

See the changelog for every change.

Documentation

Contribute

Start with a bounded help-wanted task: one real host capture, another clean-package runtime, or one tested policy recipe.

Bug reports, minimal reproductions, documentation fixes and compatibility tests are welcome. See CONTRIBUTING.md for setup and checks, and GOVERNANCE.md for maintainership. Report vulnerabilities privately through SECURITY.md, not a public issue.

The shared conformance corpus records compatibility results across receipt producers. A passing corpus is bounded interoperability evidence, not a security certification.

MIT licensed; see LICENSE and the existing patent notice. Maintained by Tom Farley at ScopeBlind. Receipt format: Acta individual Internet-Draft.

來源:README.md,提交 0736060

工具

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

版本歷史

1
  1. v0.5.3最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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