Chuyển đến nội dung
Skillpedia
Agent48k · #5530

protect-mcp-governance

Skill này làm gì

Công cụ này kiểm soát những hành động mà agent AI có thể thực hiện và đảm bảo các hành động đó được ghi nhật ký an toàn. Nó dùng các quy tắc (policy) để quyết định một hành động có được phép không, và tạo một bản ghi có chữ ký (biên nhận) cho mỗi quyết định.

Khi nào nên dùng

  • ✓Khi bạn muốn xác định agent AI được dùng những công cụ nào.
  • ✓Khi bạn cần một nhật ký an toàn, khó bị sửa đổi về các hành động của agent.
  • ✓Khi bạn muốn thử các quy tắc bảo mật mới trước khi thực thi thật.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/protect-mcp-governance/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Thiết lập kiểm soát truy cập để agent chỉ được đọc file trong thư mục “data”.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ chặn các lệnh gọi mà agent AI thực hiện đến công cụ khác. Nó kiểm tra các lệnh này theo quy tắc bạn đã đặt. Nếu lệnh được phép, nó tạo một biên nhận số có chữ ký để chứng minh hành động đã xảy ra và được duyệt.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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

…
Câu hỏi thường gặp

“Cedar policies” là gì?

Đó là các quy tắc bạn viết để nói cho agent AI biết nó được và không được làm gì. Chúng được viết bằng một ngôn ngữ riêng gọi là Cedar.

“Biên nhận có chữ ký” là gì?

Đó là bản ghi số chứng minh một hành động đã được cho phép hoặc từ chối bởi một quy tắc cụ thể. Nó được ký số để không thể bị thay đổi sau này.

Khác nhau giữa “shadow mode” và “enforce mode” là gì?

Ở “shadow mode”, công cụ chỉ quan sát và ghi lại điều sẽ xảy ra nếu áp dụng quy tắc, mà không chặn hành động. Ở “enforce mode”, các hành động vi phạm quy tắc thực sự bị chặn.

Chi tiết

Mô tả gốc của tác giả

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

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#5530
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự