跳到正文
Skillpedia
智能体48k · #5530

protect-mcp-governance

它能做什么

这个工具可以控制 AI 智能体能执行哪些操作,并确保这些操作被安全地记录下来。它使用规则(策略,policies)来判断某个操作是否被允许,并为每个决定生成一份带签名的记录(回执,receipt)。

适用场景

  • ✓当你想规定 AI 智能体可以使用哪些工具时。
  • ✓当你需要一份安全、不易被篡改的智能体操作日志时。
  • ✓当你想在正式执行新的安全规则之前先进行测试时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/protect-mcp-governance/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/protect-mcp-governance/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请设置访问控制,让智能体只能读取 'data' 文件夹中的文件。”

每周 5 个新技能,1 分钟读完。

工作原理

这个工具会拦截 AI 智能体对其他工具发出的调用,并将这些调用与你定义的规则进行比对。如果调用被允许,它就会生成一份带签名的电子回执,证明该操作已发生且已获批准。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

MCP Agent Governance with protect-mcp

Overview

Guidance for governing AI agent tool calls using Cedar policies and Ed25519 signed receipts. This skill teaches how to write access-control policies for MCP servers, run them in shadow mode for observation, and verify the cryptographic audit trail.

When to Use This Skill

  • Use when you need to control which MCP tools an agent can call and under what conditions
  • Use when you want a tamper-evident audit trail for agent tool executions
  • Use when rolling out governance policies gradually (shadow mode first, then enforce)
  • Use when authoring Cedar policies for MCP tool access control
  • Use when verifying that a receipt or audit bundle has not been tampered with

Do Not Use This Skill

  • When you need general application security auditing (use @security-auditor)
  • When you need to scan code for vulnerabilities (use @security-audit)
  • When you need compliance framework guidance without agent-specific governance

How It Works

protect-mcp intercepts MCP tool calls, evaluates them against Cedar policies (the same policy engine used by AWS Verified Permissions), and signs every decision as an Ed25519 receipt. The receipt is a cryptographic proof that a specific policy was evaluated against a specific tool call at a specific time.

Agent → protect-mcp → Cedar policy evaluation → MCP Server
                ↓
        Ed25519 signed receipt

Three modes of operation:

  1. Shadow mode (default) — logs decisions without blocking. Use this to observe what your policies would do before enforcing them.
  2. Enforce mode — blocks tool calls that violate policy. Use after shadow-mode validation.
  3. Hooks mode — integrates with Claude Code hooks for pre/post tool-call governance.

Core Concepts

Cedar Policies

Cedar is a policy language designed for authorization. Policies are evaluated locally via WASM — no network calls required.

// Allow read-only file operations
permit(
  principal,
  action == Action::"call_tool",
  resource
) when {
  resource.tool_name in ["read_file", "list_directory", "search_files"]
};

// Deny destructive operations
forbid(
  principal,
  action == Action::"call_tool",
  resource
) when {
  resource.tool_name in ["execute_command", "delete_file", "write_file"]
  && resource has args
  && resource.args.contains("rm -rf")
};

Signed Receipts

Every policy decision produces a signed receipt:

{
  "payload": {
    "type": "protectmcp:decision",
    "tool_name": "read_file",
    "decision": "allow",
    "policy_digest": "sha256:9d0fd4c9e72c1d5d",
    "issued_at": "2026-04-05T14:32:04.102Z",
    "issuer_id": "sb:issuer:de073ae64e43"
  },
  "signature": {
    "alg": "EdDSA",
    "kid": "sb:issuer:de073ae64e43",
    "sig": "2a3b5022..."
  }
}

The receipt format follows IETF Internet-Draft draft-farley-acta-signed-receipts.

Step-by-Step Guide

1. Initialize Governance for a Project

# Install and initialize hooks (Claude Code integration)
npx protect-mcp init-hooks

# Or run as a standalone MCP gateway
npx protect-mcp serve

This creates a protect-mcp.config.json and a starter Cedar policy in your project root.

2. Write Your First Policy

Create policy.cedar in your project:

// Start permissive — allow everything in shadow mode
permit(
  principal,
  action == Action::"call_tool",
  resource
);

3. Run in Shadow Mode (Observe First)

# Shadow mode is the default — logs decisions without blocking
npx protect-mcp --policy policy.cedar -- node your-mcp-server.js

Review the shadow log to understand what your agent is doing before writing restrictive policies.

4. Tighten and Enforce

Once you understand the tool-call patterns, write specific policies:

// Allow file reads, deny writes outside src/
permit(
  principal,
  action == Action::"call_tool",
  resource
) when {
  resource.tool_name == "read_file"
};

permit(
  principal,
  action == Action::"call_tool",
  resource
) when {
  resource.tool_name == "write_file"
  && resource has args
  && resource.args.path like "src/*"
};

// Deny everything else
forbid(
  principal,
  action == Action::"call_tool",
  resource
);

Switch to enforce mode:

npx protect-mcp --policy policy.cedar --enforce -- node your-mcp-server.js

5. Verify Receipts

# Verify a single receipt

…
常见问题

什么是“Cedar 策略”?

这是你用来告诉 AI 智能体能做什么、不能做什么的规则。这些规则使用一种名为 Cedar 的专门语言编写。

什么是“带签名的回执”?

它是一份电子记录,证明某个操作是被特定策略允许还是拒绝的。它经过了数字签名,因此之后无法被更改。

“影子模式”和“强制执行模式”有什么区别?

在“影子模式”下,工具只观察并记录如果应用这些规则会发生什么,但不会拦截任何操作。在“强制执行模式”下,违反规则的操作会被真正拦截。

详情

作者的原始描述

Agent governance skill for MCP tool calls — Cedar policy authoring, shadow-to-enforce rollout, and Ed25519 receipt verification.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5530
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能