Authorization answers from real policy code: evaluate Rego locally, or ask an AuthZEN 1.0 PDP.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Stop letting your agent guess at authorization. This is an MCP server that answers "is this allowed?" from real policy code β either Rego you hand it, or the OpenID AuthZEN 1.0 PDP that actually governs your system.
Ask a model whether Alice may delete that document and it will produce a confident, plausible, unfalsifiable answer. Give it these tools and the answer comes from the policy.
That is enough for evaluate_policy. Point it at a PDP to get the rest:
| Tool | Answers | Needs |
|---|---|---|
evaluate_policy | "What does this Rego say?" Evaluated in-process by OPA. | Nothing external |
authzen_evaluate | "What does the PDP that governs this system say?" | A reachable PDP |
authzen_evaluate_batch | The same, over a list β which of these may the subject touch? | A reachable PDP |
authzen_discover | "Which endpoints does this PDP offer?" | A reachable PDP |
Use evaluate_policy while authoring or debugging a policy you have the source of. Use authzen_evaluate when the decision has to come from production, not from a policy pasted into the chat. The server's MCP instructions tell the model the same thing, so it usually picks correctly on its own.
opa eval in a shell toolAn agent given shell access can already run opa eval. What it cannot do is get an answer it is allowed to trust:
[]. Every model reads that as a deny. evaluate_policy returns defined alongside value, so "the policy denied" and "the policy has no opinion" stop being the same answer.decision a required member. A response missing it decodes into a Go bool as false β a broken PDP would look like a strict one. This server treats a missing decision as a failure, never as a deny. Same for a 401: that means this server failed to authenticate, not that the subject was denied, and the error says so.http.send would let that policy make arbitrary HTTP requests from your laptop, and opa.runtime() would hand it your environment. Both are compiled out. See Security.permit_on_first_permit legitimately returns fewer decisions than you sent. Zipping the arrays would attach a decision to the wrong resource.Debugging a policy that is denying when it should not:
Then confirming against the PDP that actually runs:
evaluate_policy| Param | Required | Description |
|---|---|---|
rego | yes | Rego source with a package declaration. |
query | yes | Rego query, e.g. data.example.allow. |
input_json | no | JSON-encoded input document. |
data_json | no | JSON-encoded base document for the data namespace. |
rego_version | no | v1 (default) or v0 for pre-OPA-1.0 syntax. |
trace | no | Return a pretty-printed evaluation trace. Verbose; bounded at 4000 events, 200 lines, 1 KiB per line. |
Returns defined, value, the raw OPA result_set (omitted with result_set_omitted past 256 KiB encoded), any print() output (200 lines of 1 KiB), and the trace when asked for.
authzen_evaluate| Param | Required | Description |
|---|---|---|
subject | yes | JSON object. AuthZEN requires type and id. |
action | yes | JSON object. AuthZEN requires name. |
resource | yes | JSON object. AuthZEN requires type and id. |
context | no | JSON object with runtime context (IP, time, MFA strength). |
pdp_url | no | Override AUTHZEN_PDP_URL for this call. |
Returns decision, the PDP's context if any, the pdp_url that answered, and the request_id sent as X-Request-ID β so a decision in a transcript can be found in the PDP's logs.
authzen_evaluate_batchSame arguments, plus evaluations (a JSON array whose entries override the top-level defaults) and evaluations_semantic (execute_all, deny_on_first_deny, permit_on_first_permit). Capped at 100 entries per call.
authzen_discoverFetches /.well-known/authzen-configuration from a PDP root. pdp_url may be a root or an evaluation endpoint β the known AuthZEN path suffix is stripped, and a PDP mounted under a prefix keeps its prefix.
Implements Authorization API 1.0, approved as an OpenID Final Specification in January 2026:
| Section | Status |
|---|---|
Access Evaluation (POST /access/v1/evaluation) | authzen_evaluate |
Access Evaluations, batch (POST /access/v1/evaluations) | authzen_evaluate_batch |
PDP Metadata (GET /.well-known/authzen-configuration) | authzen_discover |
| Subject / Action / Resource information model | Required members validated before the request is sent |
X-Request-ID correlation | Sent on every call, returned in the result |
| Search APIs (subject / resource / action) | Not implemented β open an issue if you need them |
Related work worth knowing about: the AuthZEN working group's COAZ profile binds AuthZEN to MCP tool calls themselves, so a gateway can authorize tools/call with an x-authzen-mapping declared in a tool's inputSchema. That is the enforcement side of the same problem β this server is the inspection side, and the two compose.
| Variable | Default | Description |
|---|---|---|
AUTHZEN_PDP_URL | β | Default Access Evaluation endpoint. |
AUTHZEN_PDP_TOKEN | β | Authorization header value. A value with no scheme is sent as Bearer <token>. |
AUTHZEN_PDP_TIMEOUT | 10s | Per-request timeout. |
AUTHZEN_PDP_MAX_RESPONSE_BYTES | 1048576 | Response read limit. |
MCP_OPA_EVAL_TIMEOUT | 5s | Wall-clock limit on one Rego evaluation. |
MCP_MAX_ARG_BYTES | 1048576 | Per-argument size limit. |
MCP_OPA_ALLOW_NETWORK_BUILTINS | false | Re-enable the network built-ins. See below. |
A malformed value stops the server at startup rather than being silently replaced by the default β a bound an operator believes is in place should be in place.
evaluate_policy compiles and runs Rego that a model produced, inside this process. Three OPA built-ins are removed from the capability set for that reason:
| Built-in | Why |
|---|---|
http.send | Arbitrary HTTP from wherever the server runs β a laptop or CI runner, inside whatever network boundary that sits behind. It is the whole SSRF surface, and it contradicts the tool's own description. |
net.lookup_ip_addr | Enough to exfiltrate input one DNS label at a time, with no port reachable. |
opa.runtime | Returns the runtime configuration, including the process environment and every credential in it. |
Time, JWT, UUID and random built-ins are untouched β those appear in real authorization policies. A policy using a removed built-in fails to compile with a message naming it, and pointing at MCP_OPA_ALLOW_NETWORK_BUILTINS for the cases where you genuinely want it.
The PDP client is constrained too: pdp_url must be an absolute http(s) URL with a host and no userinfo, redirects are refused rather than followed with the Authorization header attached, responses are read through a byte cap, and PDP error bodies are truncated before they reach the model's context.
Reporting a vulnerability: see SECURITY.md.
Builds the binary, stands up a fake AuthZEN PDP, drives one real MCP stdio session through all four tools, and asserts each answered β including that http.send is still rejected. No MCP client and no real PDP needed.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/mcp-opa-authz)<a href="https://allmcps.com/mcp/mcp-opa-authz"><img src="https://allmcps.com/api/badge/mcp-opa-authz?style=directory" alt="MCP Opa Authz on AllMCPs" /></a>