Skip to content

Cedar WASM integration for MCP server governance (protect-mcp) #2266

@tomjwxf

Description

@tomjwxf

We built a Cedar WASM integration for governing AI agent tool calls in the MCP (Model Context Protocol) ecosystem.

What we built

protect-mcp is a transparent stdio proxy that wraps MCP servers with runtime policy enforcement. It supports three policy engines — JSON presets, external PDP (OPA/Cerbos), and local Cedar evaluation via @cedar-policy/cedar-wasm.

# Run with Cedar policies
npx protect-mcp --cedar ./policies/ --enforce -- node mcp-server.js

How Cedar is used

Each .cedar file in the policy directory is loaded and evaluated locally via WASM. The evaluation context maps MCP tool calls to Cedar authorization requests:

  • Principal: the agent identity (from signed manifests)
  • Action: the MCP method (tools/call)
  • Resource: the specific tool being called (read_file, execute_command, etc.)

Example policy:

// Block command execution — prevents Clinejection (CVE-2025-6514)
// @incident("Clinejection: 437K developer environments compromised")
// @controls("OWASP-MCP-03")
forbid(
  principal,
  action == Action::"execute_command",
  resource
);

// Allow reads, constrain writes
permit(
  principal,
  action == Action::"read_file",
  resource
);

Every Cedar evaluation decision (permit/forbid) produces an Ed25519-signed receipt — a structured, content-addressed JSON record that can be independently verified offline. The receipt format is specified in an IETF Internet-Draft.

Why this might be interesting to the Cedar community

  • Cedar policies running locally via WASM for real-time AI agent governance
  • Policy evaluation results are cryptographically signed (not just logged)
  • Maps OWASP MCP security controls to Cedar policies
  • Works with Claude Desktop, Cursor, VS Code — any MCP stdio client

Links

Happy to answer questions about the integration or contribute documentation if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions