opa-mcp-server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| OPA_URL | No | Base URL of an OPA REST endpoint, used by opa_* tools. | http://localhost:8181 |
| OPA_TOKEN | No | Bearer token for OPA, if your instance requires auth. Treated as a secret. Never echoed in logs or tool responses. | |
| OPA_BINARY | No | Path to the opa CLI, used by rego_* tools. | opa |
| REGAL_BINARY | No | Path to the regal linter. Only required by rego_lint. | regal |
| OPA_MCP_LOG_FILE | No | Path the server appends logs to. The server never writes to stdout; that channel is reserved for the MCP protocol. | <tmpdir>/orygn-opa-mcp.log |
| OPA_MCP_LOG_LEVEL | No | One of debug, info, warn, error. | info |
| OPA_MCP_TIMEOUT_MS | No | Hard timeout for any spawned subprocess (opa, regal). After this, the child gets SIGTERM and then SIGKILL. | 30000 |
| OPA_MCP_ALLOWED_PATHS | No | Comma- or semicolon-separated list of directories the server is allowed to read policies from. When unset, file-based tools refuse to read from disk. | |
| OPA_MCP_HTTP_TIMEOUT_MS | No | Timeout for HTTP requests to the OPA REST API. | 15000 |
| OPA_MCP_MAX_RESPONSE_BYTES | No | Hard cap on a single tool response. Larger payloads are truncated with a __truncated: true marker. | 100000 |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| prompts | {
"listChanged": true
} |
| resources | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| rego_formatA | Format Rego source code using |
| rego_checkA | Type-check Rego with |
| rego_lintA | Lint Rego source with the Regal linter. Returns categorized violations (style, bugs, idiomatic, performance) with file/line locations. Requires |
| rego_parse_astA | Parse Rego source to a JSON AST using |
| rego_inspectA | Inspect an OPA bundle, policy directory, or single Rego file with |
| rego_capabilitiesA | Return OPA capabilities — the available builtins, future keywords, features, and WASM ABI versions. With |
| rego_depsA | Static dependency analysis for a Rego reference. Given a target ref like "data.example.allow", returns the base document references (input/data leaves) and virtual document references (rules) it depends on, transitively. |
| rego_evalB | Evaluate a Rego query against a policy and an input document using |
| rego_eval_with_explainA | Evaluate with |
| rego_eval_with_profileA | Evaluate with |
| rego_eval_with_coverageA | Evaluate with |
| rego_testA | Run Rego unit tests with |
| rego_benchA | Benchmark a Rego query against a policy + input with |
| rego_compile_queryA | Run partial evaluation on a query — substitute known values and return the residual policy. Defaults |
| opa_bundle_buildA | Build a deployable bundle from policy / data paths using |
| opa_bundle_signA | Sign an OPA bundle with a private key using |
| opa_list_policiesA | List policies registered on the running OPA server. Returns an array of |
| opa_get_policyA | Fetch a single policy by ID from the running OPA server. |
| opa_put_policyA | Upload a Rego policy under the given ID. Replaces any existing policy with that ID. The policy is uploaded as raw text/plain — OPA parses it on the server side. |
| opa_delete_policyB | Delete a policy by ID from the running OPA server. |
| opa_get_dataA | Read a path from OPA's data hierarchy. The |
| opa_put_dataB | Write or replace a value at the given data path. Body is sent as JSON. |
| opa_patch_dataA | Apply a JSON Patch (RFC 6902) to the data document. Each operation is |
| opa_query_decisionA | Evaluate a decision against the running OPA server. POSTs to the data path with |
| opa_compile_queryB | Send a query to the OPA server's |
| opa_healthA | Hit the OPA |
| opa_statusB | Return OPA bundle and decision-log status from the running server. Combines |
| opa_configA | Return the running OPA server configuration (sanitized — secrets are not included). |
| rego_explain_decisionA | Evaluate a Rego query with full tracing and return a structured trace plus per-rule fired/not-fired summary. Use this when you need to answer "why was this denied?" — the agent reads the structured trace and narrates the cause without re-implementing the trace parser. |
| rego_generate_test_skeletonA | Generate a |
| rego_describe_policyA | Parse a Rego policy and return a structured summary: package, imports, rules (with default/args/body-length flags), and inline annotations. Useful as the first step in any "what does this policy do" workflow. |
| rego_suggest_fixA | Map common Rego compile errors and Regal lint findings to mechanical fix suggestions. Pass diagnostics from |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| policy_authoring_assistant | Guides an agent through writing a new Rego policy: clarify decision shape, draft, format, check, lint, test, iterate. |
| policy_review_checklist | Review checklist for an existing Rego policy: compile, lint, tests, default-deny, http.send, annotations, input shape. |
| decision_debugging_workflow | Diagnostic flow for an unexpected Rego decision: reproduce, explain trace, identify input vs logic vs default cause, propose minimal fix. |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| opa-builtins | The OPA built-in function catalog, categorized by namespace, with security-sensitive functions flagged. Derived at read time from `opa capabilities --current` so the list stays in sync with the actual OPA binary. |
| opa-style-guide | Condensed Rego style guide adapted from the Styra reference: rego.v1, package layout, naming, default-deny, comprehensions vs every, schema annotations. |
| opa-patterns | Curated Rego patterns: RBAC, ABAC, Kubernetes admission, IaC gates, API authorization, rate limiting. Each pattern includes when to use it, a full working example, a test, and common pitfalls. |
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/OrygnsCode/opa-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server