Install mcp-opa-authz, connect it to an MCP client, then drive it by hand over stdio with no model in the loop: ask evaluate_policy whether bob may delete a document under the RBAC policy in examples/, get a deny, change the policy, and get an allow. The policy runs in-process, so this needs no PDP and no network. The stdio commands need jq.
Install
Section titled “Install”Homebrew
macOS and Linux.
brew install kanywst/tap/mcp-opa-authzGo
Needs Go 1.26.6 or later (the go line in go.mod). Installs to $(go env GOPATH)/bin.
go install github.com/dyokto/mcp-opa-authz@latestLinux and macOS binary
Pick the archive for your platform from the releases page: darwin-arm64, darwin-amd64, linux-amd64 or linux-arm64.
gh release download -R dyokto/mcp-opa-authz -p 'mcp-opa-authz-*-linux-amd64.tar.gz'tar xzf mcp-opa-authz-*-linux-amd64.tar.gz mcp-opa-authzsudo install mcp-opa-authz /usr/local/bin/Container
linux/amd64 and linux/arm64, on ghcr.io. This is also the package the MCP registry lists as io.github.dyokto/mcp-opa-authz.
docker pull ghcr.io/dyokto/mcp-opa-authz:0.8.0@sha256:88e0bfd39bc27b28dae795ae541a598dac557b3cd1a14d8559642551a4010a9dCheck it is on your PATH. A release binary, the Homebrew formula and the image print the release version; a go install build prints the module version (v0.8.0).
$ mcp-opa-authz --versionmcp-opa-authz 0.8.0Connect an MCP client
Section titled “Connect an MCP client”evaluate_policy and coaz_map without evaluate work with no configuration. The other tools need AUTHZEN_PDP_URL; Configuration lists every variable.
Claude Code
claude mcp add opa-authz -- mcp-opa-authzWith a PDP:
claude mcp add opa-authz \ --env AUTHZEN_PDP_URL=http://localhost:8181/access/v1/evaluation \ -- mcp-opa-authzClaude Desktop
Add the server to ~/Library/Application Support/Claude/claude_desktop_config.json and restart Claude Desktop. If it cannot find the command, give the absolute path that command -v mcp-opa-authz prints.
{ "mcpServers": { "opa-authz": { "command": "mcp-opa-authz", "env": { "AUTHZEN_PDP_URL": "http://localhost:8181/access/v1/evaluation" } } }}Leave out env if you have no PDP.
Cursor
Add the same block to ~/.cursor/mcp.json, or to .cursor/mcp.json in a project to scope it there.
{ "mcpServers": { "opa-authz": { "command": "mcp-opa-authz", "env": { "AUTHZEN_PDP_URL": "http://localhost:8181/access/v1/evaluation" } } }}Container
Any client that takes a command and arguments. -i keeps stdin open, which the stdio transport needs.
{ "mcpServers": { "opa-authz": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "AUTHZEN_PDP_URL", "ghcr.io/dyokto/mcp-opa-authz:0.8.0@sha256:88e0bfd39bc27b28dae795ae541a598dac557b3cd1a14d8559642551a4010a9d" ], "env": { "AUTHZEN_PDP_URL": "https://pdp.example.com/access/v1/evaluation" } } }}Get the example policy
Section titled “Get the example policy”The policies below are in examples/. rbac.rego gives alice the editor role and bob only viewer, and only editor may delete.
git clone --depth 1 https://github.com/dyokto/mcp-opa-authzcd mcp-opa-authzA request the policy denies
Section titled “A request the policy denies”MCP is JSON-RPC over stdin and stdout, so the tools can be called without a client. The server needs the initialize handshake before any tools/call, and it cancels calls still running when stdin closes, so the sleep keeps stdin open until the answer is back. The last jq keeps the two members that carry the decision.
$ { printf '%s\n' \ '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"cli","version":"0"}}}' \ '{"jsonrpc":"2.0","method":"notifications/initialized"}' \ "$(jq -nc --rawfile rego examples/rbac.rego \ --arg input '{"user":"bob","action":"delete","resource":"doc-1"}' \ '{jsonrpc:"2.0",id:2,method:"tools/call",params:{name:"evaluate_policy",arguments:{rego:$rego,query:"data.rbac.allow",input_json:$input}}}')"; \ sleep 2; } \ | mcp-opa-authz | jq 'select(.id==2) | .result.structuredContent | {defined, value}'{ "defined": true, "value": false}"defined": true, "value": false is a deny: a rule answered, and it said no. bob's only role is viewer, which has read and nothing else, so the default allow := false answered.
The same request, fixed policy
Section titled “The same request, fixed policy”Give bob the editor role:
roles := { "alice": {"editor"}, "bob": {"viewer"}, "bob": {"viewer", "editor"}, "carol": {"viewer", "auditor"},}The command below makes that edit with sed on the way in, so the file in the repository stays as it is:
$ { printf '%s\n' \ '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"cli","version":"0"}}}' \ '{"jsonrpc":"2.0","method":"notifications/initialized"}' \ "$(jq -nc --rawfile rego <(sed 's/"bob": {"viewer"}/"bob": {"viewer", "editor"}/' examples/rbac.rego) \ --arg input '{"user":"bob","action":"delete","resource":"doc-1"}' \ '{jsonrpc:"2.0",id:2,method:"tools/call",params:{name:"evaluate_policy",arguments:{rego:$rego,query:"data.rbac.allow",input_json:$input}}}')"; \ sleep 2; } \ | mcp-opa-authz | jq 'select(.id==2) | .result.structuredContent | {defined, value}'{ "defined": true, "value": true}Undefined is not a deny
Section titled “Undefined is not a deny”Ask for a rule the policy does not have, here data.authz.allow instead of data.rbac.allow:
$ { printf '%s\n' \ '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"cli","version":"0"}}}' \ '{"jsonrpc":"2.0","method":"notifications/initialized"}' \ "$(jq -nc --rawfile rego examples/rbac.rego \ --arg input '{"user":"bob","action":"delete","resource":"doc-1"}' \ '{jsonrpc:"2.0",id:2,method:"tools/call",params:{name:"evaluate_policy",arguments:{rego:$rego,query:"data.authz.allow",input_json:$input}}}')"; \ sleep 2; } \ | mcp-opa-authz | jq 'select(.id==2) | .result.structuredContent | {defined, value}'{ "defined": false, "value": null}opa eval returns an empty result here, which reads like a deny. "defined": false says the policy has no answer for this query, which is a different bug from a deny.
In a client, the model sends the same tools/call: ask it "evaluate examples/rbac.rego for bob deleting doc-1, and why", and it picks the query, builds the input, and can pass trace: true to see which rule body failed.
Verify a release
Section titled “Verify a release”Each release has a checksum file signed keylessly with cosign (one Sigstore bundle holds the signature and certificate) and a CycloneDX SBOM per archive. The container image is not signed.
$ gh release download v0.8.0 -R dyokto/mcp-opa-authz -p '*-checksums.txt*' -p '*-linux-amd64.tar.gz'$ cosign verify-blob \ --bundle mcp-opa-authz-0.8.0-checksums.txt.sigstore.json \ --certificate-identity https://github.com/dyokto/mcp-opa-authz/.github/workflows/release.yml@refs/tags/v0.8.0 \ --certificate-oidc-issuer https://token.actions.githubusercontent.com \ mcp-opa-authz-0.8.0-checksums.txtVerified OK$ sha256sum --ignore-missing -c mcp-opa-authz-0.8.0-checksums.txtmcp-opa-authz-0.8.0-linux-amd64.tar.gz: OKReleases up to v0.7.0 were signed from kanywst/mcp-opa-authz, the repository's earlier name; use that in --certificate-identity for them.
- Tools: every tool's parameters and results, including the AuthZEN tools that ask a PDP
- Running it: the container, other MCP clients, and PDPs it works with
- Sandbox and PDP client: what the Rego sandbox removes and how the PDP client is constrained
- Examples: the other example policies and how to call them
© 2026 The mcp-opa-authz Authors. Licensed under Apache-2.0. Part of dyokto.