This section contains complete, production-ready examples demonstrating the power and flexibility of the Manetu PolicyEngine. Each example includes:
mpe test decision to verify behavior<SectionHeader icon="storage" level={2}>Featured Examples
Implements classic Unix-style permission bits (read/write for owner/group/other) using MPE's annotation system. Demonstrates how to:
Protects Model Context Protocol (MCP) servers with fine-grained access control for both metadata operations (tool:list, prompt:list) and data-path operations (tool:call, resource:read). Demonstrates:
Implements tenant isolation for a SaaS application where users belong to organizations and can only access resources within their tenant. Features:
Models HIPAA-compliant access control for electronic health records (EHR) with role-based access, patient consent, and break-glass emergency procedures. Includes:
Demonstrates using MPE for API quota enforcement and tiered access levels. Shows how to:
<SectionHeader icon="terminal" level={2}>Running the Examples
Each example includes a complete PolicyDomain YAML file and test input. Download links are available on each example page.
mpe lint -f policydomain.yml
# Test a specific scenario
mpe test decision -b policydomain.yml -i input.json
# Check just the decision
mpe test decision -b policydomain.yml -i input.json | jq .decision
# See all policy references and phase evaluations
mpe test decision -b policydomain.yml -i input.json | jq .
<SectionHeader icon="build" level={2}>Building Your Own
These examples are designed to be starting points. Feel free to:
<SectionHeader icon="school" level={2}>Best Practices Demonstrated
These examples showcase several recommended patterns:
default allow = -1 with positive grants instead of explicit denieshas_principal into a shared utils librarysome x in {...} for concise, maintainable Regomcp: to enable meaningful identity phase checksFor more details on these patterns, see Writing Concise Rego and The Utils Library Pattern.
For more information on building PolicyDomains, see:
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |