MCP server wrapping Open Policy Agent CLI and Regal linter for Rego policy authoring, evaluation, and management.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent โ or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag โ we're steadily working through the catalog.
๐ก Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Inspect callable tools, capabilities, and parameters exposed to AI agents by Opa MCP Server.
rego_formatFormat Rego source. Wraps `opa fmt`. Idempotent.
rego_checkType-check and validate Rego. Wraps `opa check`.
rego_lintRun Regal across a file or directory. Returns each violation with its category, level and location. **Requires `regal` on `PATH` or `REGAL_BINARY` set.
rego_parse_astParse Rego to AST JSON. Wraps `opa parse`.
rego_inspectInspect a bundle or directory: packages, rules, annotations. Wraps `opa inspect`.
rego_capabilitiesList the built-ins and features the resolved `opa` binary understands (`OPA_BINARY`, then `PATH`, then the bundled copy); `builtins` names up to 100 to return full records for
A Model Context Protocol (MCP) server that turns any MCP-compatible client (Claude Desktop, Claude Code, Cursor, VS Code, Windsurf, Zed, and others) into a first-class Open Policy Agent and Rego authoring environment.
Status: v0.6.0. Tool surface, error codes, and environment variables follow SemVer from v0.1.0 forward.
Upgrading to 0.6.0:
rego_benchreportsiterations,nsPerOp,allocsPerOpandbytesPerOp. The fields opa prints (N,T,Bytes,MemAllocs,MemBytes,Extra) were top-level and now sit underrawfor a single run, so anything that read them from the top level has to look there. Withcountabove one,rawis omitted: every document is inruns, andfastestindexes the one the top-level figures come from.
Upgrading to 0.4.0: subprocesses no longer inherit the server's environment. A policy that read a variable through
opa.runtime().envwill no longer see it; name the variable inOPA_MCP_PASSTHROUGH_ENVif it is genuinely needed. See the security section for why.
Upgrading to 0.3.0: the bundled OPA is now 1.19, so Rego v0 policies no longer parse (
ifis required before a rule body,containsbefore a partial set). Runrego_migrate_v1to convert them. If you supply your own binary viaOPA_BINARYorPATH, nothing changes.
Once an MCP client is connected, an agent can:
opa fmt and opa parse so output is byte-identical to
what you'd get on the command line, and regal (optional) surfaces
idiomatic suggestions.--explain, --profile, and --coverage flags
surface execution traces, hot rules, and per-line coverage.rego_explain_decision walks the agent through every
rule that fired (and every one that didn't), so it can answer "why was
this rejected" without you reading the trace by hand.opa run --server or a production deployment with bearer-token auth..tar.gz
the agent can hand to your delivery system.rego_lint runs Regal across a directory or a single file
and returns each finding with its category, level and location.A walk-through of a typical session lives in Cookbook.
OPA already has a perfectly good CLI and REST API. So why an MCP wrapper?
rego_eval gets a
validated input schema, a structured output envelope, and stable error
codes, instead of parsing free-form CLI text and inventing its own
failure taxonomy. That alone makes Rego usable to an agent the way a
language server makes a language usable to an IDE.rego_explain_decision,
rego_generate_test_skeleton, rego_describe_policy, and
rego_suggest_fix compose the lower-level primitives into the tasks
agents are actually asked to do. They don't exist in the OPA CLI.If you've ever watched an agent fight opa eval's argument order, you'll
recognize the gap this fills.
The server runs locally over stdio. Pick the install path that matches your client.
Edit claude_desktop_config.json directly (or copy from
examples/claude-desktop.json):
Replace the
/usr/local/bin/...paths with your real ones. See the first-time install gotcha below. Windows users substituteC:\\path\\to\\opa.exe.
Or download opa-mcp.mcpb from the
latest release
and double-click it.
Alternatively, use the Smithery one-liner:
Register the server for the current project with claude mcp add:
This writes the config into .mcp.json at your project root and is
picked up automatically on every claude session in that directory.
Add --scope user to register it globally instead.
Replace the paths with your real absolute paths (same caveat as Claude Desktop above). On Windows use
C:\path\to\opa.exesyntax.
Persistent context and auto-checks for policy repos. If you work in an OPA policy repo regularly, two extra files remove repetitive setup from every session:
examples/CLAUDE.md -- copy to your repo
root or .claude/CLAUDE.md. Claude Code loads it every session,
so the agent always knows which tools to use and what conventions apply.examples/claude-code-hook.json --
merge the hooks block into .claude/settings.json. Runs opa check
automatically after any .rego file is written, so syntax errors
surface immediately without a manual tool call.Drop examples/cursor.json into either
.cursor/mcp.json (project-scoped) or ~/.cursor/mcp.json (user-scoped).
Drop examples/vscode.json into
.vscode/mcp.json, or paste the servers block into your user
settings.json under mcp.servers.
See examples/ for a full set of drop-in configs.
then point your client at the opa-mcp binary.
The image is multi-arch (linux/amd64, linux/arm64), bundles pinned
versions of opa and regal, and runs as a non-root user. No host
install of OPA or Regal is required.
OPA_BINARY_NOT_FOUNDThe npm package carries its own opa for the five platforms it is built
for, so a client PATH without opa on it does not matter there. The MCPB
has no bundled copy, and on any other platform neither does npm: then the
server boots but every tool call returns OPA_BINARY_NOT_FOUND. Neither the
npm package nor the MCPB bundles regal or conftest, and the Docker image
ships regal but not conftest, so their tools need a PATH entry or an
explicit path either way.
Factual signals from GitHub, npm, and our automated checks โ not a rating.
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/orygnscode-opa-mcp-server)<a href="https://allmcps.com/mcp/orygnscode-opa-mcp-server"><img src="https://allmcps.com/api/badge/orygnscode-opa-mcp-server?style=directory" alt="Opa MCP Server on AllMCPs" /></a>