此技能的功能
此技能通过protect-mcp包装OpenClaw代理的MCP工具调用,添加:
- 影子模式 — 记录每个工具调用并附带签名收据(默认不阻止任何操作)
- 每工具策略 — 阻止、限速或要求审批特定工具
- 签名收据 — Ed25519签名、JCS规范化每个决策的证明
- 信任层级 — 可用于高级配置,按验证过的记录限制工具访问
- 本地每日摘要 — 人类可读的代理活动摘要
任何平台都可以记录其代理的行为。很少有平台能让您在不信任它们的情况下验证这些日志。
何时使用此技能
在以下情况下使用此技能:
- 您想知道代理在您不在时做了什么
- 您需要签名、可篡改的代理行为证明以用于合规或审计
- 您想阻止危险工具(delete_database、send_email_as_ceo、rm_rf)
- 您想对昂贵或 risky 的操作进行限速
- 您想要代理活动的每日摘要
何时不使用此技能
- 您只想要基本的OpenClaw内置允许列表(这些对简单情况很有效)
- 您不需要签名加密证明(只要日志,不要收据)
设置
快速路径(推荐)
如果您已有OpenClaw配置先生成带passport的包装包:
npx @scopeblind/passport wrap --runtime openclaw --config ./openclaw.json --policy email-safe
这会写入:
wrapped-config.json
manifest.json
passport.bundle.json
protect-mcp.json
keys/gateway.json
VERIFY.md
将wrapped-config.json中的mcpServers条目复制到您的OpenClaw配置中。
首次运行(生成签名密钥+默认策略)
npx protect-mcp init
这会创建:
keys/gateway.json — Ed25519签名密钥对(在当前目录)
protect-mcp.json — 默认影子模式策略(记录一切,不阻止任何操作)
包装您的MCP服务器
对于代理使用的每个MCP服务器,通过protect-mcp包装它。在您的OpenClaw MCP配置中:
之前:
{
"mcpServers": {
"filesystem": {
"command": "node",
"args": ["filesystem-server.js"]
}
}
}
之后:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["protect-mcp", "--policy", "protect-mcp.json", "--", "node", "filesystem-server.js"]
}
}
}
就是这样。每个工具调用现在都会产生签名收据。
应用策略包
要从影子模式切换到强制模式,复制策略模板并添加--enforce:
# 复制策略模板
cp policies/email-safe.json protect-mcp.json
然后更新您的MCP配置参数以包含--enforce:
"args": ["protect-mcp", "--policy", "protect-mcp.json", "--enforce", "--", "node", "server.js"]
请参阅policies/目录了解预建模板。
命令
当用户要求您执行这些操作时,请执行它们:
"显示我的passport" / "我的代理身份是什么?"
npx protect-mcp status
显示输出,包括:
- 总决策数(允许/拒绝/限速)
- 活动时间范围
- 使用最多的工具
- 看到的信任层级
"你今天做了什么?" / "显示我的每日报告"
npx protect-mcp digest --today
显示本地摘要,包括:
- 采取的行动(允许、阻止、等待审批)
- 使用的工具及频率
- 信任层级状态
- 被阻止的工具及原因
"显示我的收据" / "证明你做了什么"
npx protect-mcp receipts --last 20
显示最近20个决策,包括工具名称、决策和时间戳。
"为什么那个被阻止了?"
当工具调用被阻止或限速时,解释:
- 哪个策略规则触发了阻止
- 代理的当前信任层级
- 使用该工具需要什么层级
- 如何请求审批或更改策略
审批流程
当protect-mcp阻止具有策略中require_approval: true的高风险操作时,它返回:
REQUIRES_APPROVAL: The tool "send_email" requires human approval before execution. Tell the user you need their approval to use "send_email" and will retry when granted. Do NOT retry this tool call until the user explicitly approves it.
当您收到此响应时:
- 告诉用户:"我需要您的批准才能使用[tool_name]。是否继续?"
- 等待用户响应批准。
- 当用户批准时,通过运行以下命令授予批准:
# 一次性批准(仅限于此特定请求):
curl -s -X POST http://127.0.0.1:9876/approve -H 'Content-Type: application/json' -d '{"request_id":"REQUEST_ID","tool":"TOOL_NAME","mode":"once","nonce":"NONCE"}'# 始终允许此工具(会话范围,24小时TTL):
curl -s -X POST http://127.0.0.1:9876/approve -H 'Content-Type: application/json' -d '{"tool":"TOOL_NAME","mode":"always","nonce":"NONCE"}'
将REQUEST_ID、TOOL_NAME和NONCE替换为REQUIRES_APPROVAL响应中的值。
当用户拒绝时:
告诉他们该操作被阻止并解释被阻止的内容。
检查当前批准:
curl -s http://127.0.0.1:9876/approvals
策略包
policies/目录中提供预建策略:
| 包 | 功能 |
|---|
shadow.json | 记录一切,不阻止任何操作(默认) |
web-browsing-safe.json | 限速浏览,要求表单审批,阻止JS |
email-safe.json | 自由读取,要求发送审批,阻止删除 |
strict.json | 阻止除读取外的所有操作(只读模式) |
验证
每个收据都可以独立验证。MIT许可的验证器无需信任ScopeBlind。
快速测试(不需要收据)
npx @veritasacta/verify --self-test
获取要验证的收据
当protect-mcp运行时,收据可从本地HTTP状态服务器获取:
# 获取最新的收据
curl -s http://127.0.0.1:9876/receipts/latest | jq -r '.receipt' > receipt.json# 获取所有最近的收据
curl -s http://127.0.0.1:9876/receipts | jq -r '.receipts[0].receipt' > receipt.json
如果本地状态服务器不可用,使用持久化的收据文件:
tail -n 1 .protect-mcp-receipts.jsonl > receipt.json
验证收据
# 从状态获取公钥(显示在"Passport Identity"下)
npx protect-mcp status# 使用公钥验证
npx @veritasacta/verify receipt.json --key
验证器检查针对公钥的Ed25519签名。无API调用,无账户,无ScopeBlind服务器参与。
链接
What This Skill Does
This skill wraps your OpenClaw agent's MCP tool calls through protect-mcp, adding:
- Shadow mode — logs every tool call with a signed receipt (blocks nothing by default)
- Per-tool policies — block, rate-limit, or require approval for specific tools
- Signed receipts — Ed25519-signed, JCS-canonicalized proof of every decision
- Trust tiers — available for advanced configurations to gate tool access by verified track record
- Local daily digest — human-readable summary of what your agent did
Any platform can log what its agents do. Very few will let you verify those logs without trusting them.
When to Use This Skill
Use this skill when:
- You want to know what your agent did while you weren't watching
- You need signed, tamper-proof proof of agent actions for compliance or auditing
- You want to block dangerous tools (delete_database, send_email_as_ceo, rm_rf)
- You want rate limits on expensive or risky operations
- You want a daily summary of your agent's activity
Do NOT Use This Skill When
- You only want basic OpenClaw built-in allowlists (those work fine for simple cases)
- You don't need signed cryptographic proof (just want logs, not receipts)
Setup
Fast path (recommended)
If you already have an OpenClaw config, generate a passported wrapper pack first:
npx @scopeblind/passport wrap --runtime openclaw --config ./openclaw.json --policy email-safe
That writes:
wrapped-config.json
manifest.json
passport.bundle.json
protect-mcp.json
keys/gateway.json
VERIFY.md
Copy the mcpServers entries from wrapped-config.json into your OpenClaw config.
First Run (generates signing keys + default policy)
npx protect-mcp init
This creates:
keys/gateway.json — Ed25519 signing keypair (in current directory)
protect-mcp.json — default shadow-mode policy (logs everything, blocks nothing)
Wrapping Your MCP Servers
For each MCP server your agent uses, wrap it through protect-mcp. In your OpenClaw MCP config:
Before:
{
"mcpServers": {
"filesystem": {
"command": "node",
"args": ["filesystem-server.js"]
}
}
}
After:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["protect-mcp", "--policy", "protect-mcp.json", "--", "node", "filesystem-server.js"]
}
}
}
That's it. Every tool call now produces a signed receipt.
Applying a Policy Pack
To move from shadow mode to enforce mode, copy a policy template and add --enforce:
# Copy a policy template
cp policies/email-safe.json protect-mcp.json
Then update your MCP config args to include --enforce:
"args": ["protect-mcp", "--policy", "protect-mcp.json", "--enforce", "--", "node", "server.js"]
See the policies/ directory for pre-built templates.
Commands
When the user asks you to perform these actions, execute them:
"Show my passport" / "What's my agent identity?"
npx protect-mcp status
Display the output, which shows:
- Total decisions (allow/deny/rate-limited)
- Time range of activity
- Top tools used
- Trust tiers seen
"What did you do today?" / "Show my daily report"
npx protect-mcp digest --today
Display the local summary, which includes:
- Actions taken (allowed, blocked, awaiting approval)
- Tools used and frequency
- Trust tier status
- Blocked tools with reasons
"Show my receipts" / "Prove what you did"
npx protect-mcp receipts --last 20
Shows the 20 most recent decisions with tool name, decision, and timestamp.
"Why was that blocked?"
When a tool call is blocked or rate-limited, explain:
- Which policy rule triggered the block
- The agent's current trust tier
- What tier would be needed to use that tool
- How to request an approval or policy change
Approval Flow
When protect-mcp blocks a high-risk action that has require_approval: true in the policy, it returns:
REQUIRES_APPROVAL: The tool "send_email" requires human approval before execution.
Tell the user you need their approval to use "send_email" and will retry when granted.
Do NOT retry this tool call until the user explicitly approves it.
When you receive this response:
- Tell the user: "I need your approval to use [tool_name]. Should I proceed?"
- Wait for the user to respond with approval.
- When the user approves, grant the approval by running:
# For one-time approval (scoped to this specific request):
curl -s -X POST http://127.0.0.1:9876/approve -H 'Content-Type: application/json' -d '{"request_id":"REQUEST_ID","tool":"TOOL_NAME","mode":"once","nonce":"NONCE"}'# For always-allow this tool (session-scoped, 24h TTL):
curl -s -X POST http://127.0.0.1:9876/approve -H 'Content-Type: application/json' -d '{"tool":"TOOL_NAME","mode":"always","nonce":"NONCE"}'
Replace REQUEST_ID, TOOL_NAME, and NONCE with the values from the REQUIRES_APPROVAL response.
- After granting approval, retry the original tool call. It will now succeed.
When the user denies: Tell them the action was blocked and explain what was prevented.
Check current approvals:
curl -s http://127.0.0.1:9876/approvals
Policy Packs
Pre-built policies are available in the policies/ directory:
| Pack | What it does |
|---|
shadow.json | Log everything, block nothing (default) |
web-browsing-safe.json | Rate-limit browsing, require approval for forms, block JS |
email-safe.json | Read freely, require approval to send, block delete |
strict.json | Block everything except reads (read-only mode) |
Verification
Every receipt is independently verifiable. The MIT-licensed verifier requires zero trust in ScopeBlind.
Quick test (no receipts needed)
npx @veritasacta/verify --self-test
Getting receipts to verify
Receipts are available from the local HTTP status server while protect-mcp is running:
# Get the most recent receipt
curl -s http://127.0.0.1:9876/receipts/latest | jq -r '.receipt' > receipt.json# Get all recent receipts
curl -s http://127.0.0.1:9876/receipts | jq -r '.receipts[0].receipt' > receipt.json
If the local status server is unavailable, use the persisted receipt file:
tail -n 1 .protect-mcp-receipts.jsonl > receipt.json
Verifying a receipt
# Get the public key from status (shown under "Passport Identity")
npx protect-mcp status# Verify with the public key
npx @veritasacta/verify receipt.json --key
The verifier checks Ed25519 signatures against public keys. No API calls, no accounts, no ScopeBlind servers involved.
Links