Protect Mcp

com.scopeblind由 scopeblind.com 发布v0.32.5更新于 Nov 22, 2026

Cedar policy checks and signed receipts as MCP tools. To block an agent's calls, use its hooks.

已验证STDIO仅桌面开发者工具安全与监控

概览

AI 生成的概览

以 MCP 工具形式提供 Cedar 策略检查、Ed25519 签名的决策回执以及离线回执验证,用于管控智能体的工具调用。

可以做什么
  • 按 Cedar 策略评估拟执行的工具调用,任何策略或引擎错误都按失败关闭判为拒绝
  • 把允许或拒绝的决策签成规范化 Ed25519 回执(决策回执或限制记录)
  • 用公钥离线验证已签名回执,无需联网或账号
  • 运行自检,确认被禁止的操作会被拒绝,且签名与验证可往返
适用场景
适合希望让助手按书面策略检查拟执行的工具调用,并留下可证明的签名记录,说明哪些操作被允许或被拦截。README 指出,真正拦截智能体调用需要网关包装器或编码智能体钩子,仅靠这些工具不够。
运行要求
作为本地 stdio 进程从 npm 安装运行;README 的示例使用 Node.js 22 和 npm。签名需要由工具 init 命令生成的私钥文件。本地评估与验证不需要账号、API 密钥或环境变量。
安装前请注意
妥善保管生成的签名私钥,并通过独立渠道获取他人的公钥。网关只覆盖经其转发的调用,且不是操作系统沙箱;回执不能证明操作已执行,也不能证明没有遗漏操作。内置 shell 规则只检查命令文本,可能漏掉其他写法,也可能误匹配无害的引号文本。仅安装指导类技能并不会启用强制执行。

安装

在 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:

mkdir protect-mcp-demo
cd protect-mcp-demo
npm init -y
npm 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.

# 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 ./receipts
npx --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):

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:

npx --yes [email protected] init
npx --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

Commercial contact

Running agents where a wrong tool call has regulatory or financial consequences? Email [email protected] or see scopeblind.com.

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,提交 95ecaa3

工具

4

evaluate_action

Evaluate an action against a Cedar policy

Decide whether a proposed agent tool call is allowed by a Cedar policy, fail-closed. Evaluates the call against the policy the same way the protect-mcp gate does at runtime, and on any policy error the decision is DENY (never a silent allow). Inputs: tool (the tool name, e.g. "Bash" or "send_email"), input (the tool's arguments object; the policy sees it at context.input.*), and policy (inline…

输入参数tool必填inputpolicy必填

sign_decision

Sign a decision into a receipt

Turn a gate decision into an Ed25519 signed receipt (Veritas Acta format, JCS-canonical). A denial signs a gateway_restraint artifact; an allow signs a decision_receipt. This is what makes 'what the agent was blocked from doing' provable after the fact. Inputs: tool (required), decision ("allow" | "deny", required), reason_code (optional), policy_digest (optional), and private_key_hex (optional…

输入参数tool必填decision必填reason_codepolicy_digestprivate_key_hex

verify_receipt

Verify a receipt offline

Verify a signed receipt offline against a public key. No network, no accounts: the Ed25519 signature is checked over the canonical bytes. Inputs: receipt (the signed artifact object, required) and public_key_hex (optional; falls back to a public_key embedded in the receipt payload). Returns JSON { valid: boolean, error: string | null (e.g. "invalid_signature", "no_public_key"), type: string, kid:…

输入参数receipt必填public_key_hex

self_test

Prove the gate denies and receipts verify

Prove the gate works, end to end, with no inputs. Runs a known-forbidden action (rm -rf) against a sample deny policy and asserts it is DENIED, then signs a decision and verifies the receipt round-trips. Returns JSON { ok: boolean, gate_denies_forbidden: boolean, sign_verify_roundtrip: boolean, details: object }. This is the 'a gate that cannot prove it denies does not start' check, exposed as a…

无需输入参数。

版本历史

5
  1. v0.32.5最新Nov 22, 2026
  2. v0.32.4Oct 26, 2026
  3. v0.32.3Oct 25, 2026
  4. v0.31.1Oct 12, 2026
  5. v0.13.1Sep 16, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分