原型 · 预览版:收录官方注册中心里的全部服务器,每 30 分钟同步一次。评价和账户功能将在后续阶段推出。
PopNx MCP为使用 AI 的人准备的 MCP 服务器 · 用大白话讲清楚

OPA MCP

作者:OrygnsCode版本 0.9.1i★ –i在你的电脑上运行
注册名称io.github.OrygnsCode/opa-mcp

安装

概览

作者提供的说明(英文原文)

Author, validate, debug, and explain OPA Rego policies through any MCP-compatible client.

PopNx MCP 的三大支柱

这三项永远不会合并成一个分数:意见、测量和人气是不同的东西。

它能帮你做什么

我们还没有为它写通俗的介绍。下面是我们从注册中心读取到的事实。

  • 连接方式: 在你的电脑上运行
  • 传输方式: stdio
  • 分类: 其他
  • 你需要填写:OPA_TOKEN, GITHUB_TOKEN

安装

选择你使用的 AI 应用,然后复制设置。

安装之前

  • 基础检查:1 项中通过 1 项
  • 在你的电脑上运行,拥有你的用户账户的权限(文件、网络、应用)。
  • 需要你自己填写: OPA_URL, OPA_TOKEN, OPA_BINARY, REGAL_BINARY, CONFTEST_BINARY, OPA_MCP_ALLOWED_PATHS, GITHUB_TOKEN

标为机密的值是你账户的钥匙。千万不要分享给别人,也不要粘贴到聊天里。

你需要

  • npm已安装 Node.js(用于 npx 命令)

你用的是哪个应用?

在上方选择你的应用。我们会记住它,下次按钮会显示“安装到 …”。

打开 Claude Desktop → Settings → Developer → Edit Config,把下面的内容粘贴到 claude_desktop_config.json

{
  "mcpServers": {
    "opa": {
      "command": "npx",
      "args": [
        "-y",
        "@orygn/opa-mcp"
      ],
      "env": {
        "OPA_URL": "your-value",
        "OPA_TOKEN": "your-value",
        "OPA_BINARY": "your-value",
        "REGAL_BINARY": "your-value",
        "CONFTEST_BINARY": "your-value",
        "OPA_MCP_ALLOWED_PATHS": "your-value",
        "GITHUB_TOKEN": "your-value"
      }
    }
  }
}

在终端中运行这条命令

claude mcp add opa --env OPA_URL=your-value --env OPA_TOKEN=your-value --env OPA_BINARY=your-value --env REGAL_BINARY=your-value --env CONFTEST_BINARY=your-value --env OPA_MCP_ALLOWED_PATHS=your-value --env GITHUB_TOKEN=your-value -- npx -y @orygn/opa-mcp

运行前请先填写空着的值。

在 Cursor 中打开

或者自己复制设置

粘贴到项目中的 .cursor/mcp.json,或 ~/.cursor/mcp.json

{
  "mcpServers": {
    "opa": {
      "command": "npx",
      "args": [
        "-y",
        "@orygn/opa-mcp"
      ],
      "env": {
        "OPA_URL": "your-value",
        "OPA_TOKEN": "your-value",
        "OPA_BINARY": "your-value",
        "REGAL_BINARY": "your-value",
        "CONFTEST_BINARY": "your-value",
        "OPA_MCP_ALLOWED_PATHS": "your-value",
        "GITHUB_TOKEN": "your-value"
      }
    }
  }
}

浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。

在 VS Code 中打开

或者自己复制设置

粘贴到项目中的 .vscode/mcp.json

{
  "servers": {
    "opa": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@orygn/opa-mcp"
      ],
      "env": {
        "OPA_URL": "your-value",
        "OPA_TOKEN": "your-value",
        "OPA_BINARY": "your-value",
        "REGAL_BINARY": "your-value",
        "CONFTEST_BINARY": "your-value",
        "OPA_MCP_ALLOWED_PATHS": "your-value",
        "GITHUB_TOKEN": "your-value"
      }
    }
  }
}

浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。

这个服务器在你的电脑上运行,而 ChatGPT 只能连接互联网上的服务器。请选择其他应用。

你的选择通过 Cookie 保存在这台设备上,无需账户。

需要你填写的值

  • OPA_URL env
    Base URL of a running OPA server. Required only for opa_* runtime tools, not for rego_* language tools.
  • OPA_TOKEN 机密 env
    Bearer token for OPA running with --authentication=token.
  • OPA_BINARY env
    Path to the opa binary. Defaults to 'opa' on PATH.
  • REGAL_BINARY env
    Path to the regal binary (optional; used by rego_lint, rego_security_audit and rego_fix). Defaults to 'regal' on PATH.
  • CONFTEST_BINARY env
    Path to the conftest binary (optional, used by conftest_* tools). Defaults to 'conftest' on PATH.
  • OPA_MCP_ALLOWED_PATHS env
    Comma-separated list of root directories tools may read/write. When unset, file-based tools refuse to access the disk.
  • GITHUB_TOKEN 机密 env
    GitHub personal access token with the "gist" scope. Required only for rego_playground_share.

这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。

它能做什么

它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。

基础检查i

我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月6日

  • ✓ 通过

    作者与仓库一致

    注册名称已通过 GitHub 账户 OrygnsCode 验证,该账户拥有此仓库

  • … 尚未检查

    仍在维护

    我们还没有从 GitHub 读取这个仓库

  • … 尚未检查

    有许可证

    我们还没有从 GitHub 读取这个仓库

  • – 不适用

    端点有响应

    它在你的电脑上运行,没有互联网端点

  • – 不适用

    使用 OAuth 登录

    在你的电脑上运行,改用本地设置

  • … 尚未检查

    工具描述中没有隐藏指令

    它在你的电脑上运行;我们只能读取互联网端点的工具列表

与“其他”中的其他服务器比较i

  • 星标数多于此分类中其他 32531 个服务器的 0%
  • 发布到注册中心的时间比此分类中其他 32531 个服务器的 73% 更新
  • 基础检查结果等于或优于此分类中其他 32531 个服务器的 100%

与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。

常见问题

OPA MCP 安全吗?

它在 1 项适用的基础检查中通过了 1 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。

它需要哪些密钥或代码?

你需要填写:OPA_TOKEN, GITHUB_TOKEN

它在我的电脑上运行还是在云端?

它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。

它还在维护吗?

GitHub 仓库最后更新于–,最新版本(0.9.1)于14天前进入注册中心。

哪些应用可以使用它?

支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Node.js, Docker。

有什么可以替代它?

同一分类中有:Spec Driven Development, Remote Desktop Commander, Reelsaw

替代选择

同一分类中其他作者的服务器,按星标数排序。

如何看卡片:★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i

Spec Driven Development

作者:formulahendry

MCP Server that facilitates spec-driven development workflows, not just Vibe Coding.

在你的电脑上运行★ 440MIT14个月前更新
安装

Remote Desktop Commander

作者:desktop-commander

Remote Desktop Commander: use files, terminal and processes on your own computers from any AI app.

在云端运行★ 211昨天更新
安装

Reelsaw

作者:osbytes

Drive a self-hosted Reelsaw: turn long videos into vertical clips, edit, re-render and export them.

在你的电脑上运行今天更新
安装

作者的 README

打开 README

按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。

OPA MCP Server

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.

+--------------------+ MCP/stdio  +-----------------+ spawn/HTTP +---------------------+

| Claude · Cursor · |----------> | @orygn/opa-mcp |----------> | opa · regal | | VS Code · ... |<---------- | |<---------- | conftest · REST API | +--------------------+ 52 tools +-----------------+ +---------------------+

Status: v0.9.1. Tool surface, error codes, and

environment variables follow SemVer from

v0.1.0 forward.

Upgrading to 0.9.0: a tool refuses an argument it does not declare,

and the error names it; it used to be dropped. A policy or query that does

not compile is INVALID_REGO in every tool that runs opa, where several

returned EVAL_ERROR. rego_explain_decision returns the trace as

readable lines, not OPA's raw events. conftest_test reports a run that

evaluated no rule as passed: false, and rego_generate_test_skeleton

writes todo_test_ stubs, which opa test skips until they are filled in.

Responses are compact JSON.

Upgrading to 0.8.0: opa_exec loads dataPaths as opa eval --data

does, so a directory that also holds test fixtures, or JSON and YAML that

is not data, can now fail to load; pass it as bundle to load it as

before. A policy that does not load is INVALID_REGO in opa_exec and

the conftest tools, where it was EVAL_ERROR and UNKNOWN_ERROR.

Upgrading to 0.7.0: Node.js 22 or later is required. The bundled OPA

is 1.21, which reads YAML against the 1.2 schema: bare yes, no, on

and off in data files are strings now, not booleans. If you supply your

own binary via OPA_BINARY or PATH, only the Node requirement applies.

Upgrading to 0.6.0: rego_bench reports iterations, nsPerOp,

allocsPerOp and bytesPerOp. The fields opa prints (N, T, Bytes,

MemAllocs, MemBytes, Extra) were top-level and now sit under raw

for a single run, so anything that read them from the top level has to

look there. With count above one, raw is omitted: every document is in

runs, and fastest indexes 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().env

will no longer see it; name the variable in OPA_MCP_PASSTHROUGH_ENV if

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 (if is required before a rule body, contains before a

partial set). Run rego_migrate_v1 to convert them, or pass

v0Compatible: true to load one as it is. If you supply your own binary via

OPA_BINARY or PATH, nothing changes.


Table of contents

  • What you can do with it
  • Why this MCP
  • Install
  • Configuration
  • Tool reference
  • Prompts
  • Resources
  • Cookbook
  • Architecture
  • Security
  • Troubleshooting
  • Development
  • Versioning & support
  • License

What you can do with it

Once an MCP client is connected, an agent can:

  • Author Rego. Generate, format, and refactor policies. The server runs the real 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.
  • Evaluate against data. Run a query against a policy and an input document. Optional --explain, --profile, and --coverage flags surface execution traces, hot rules, and per-line coverage.
  • Debug a deny. 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.
  • Manage policies on a running OPA. List, get, put, delete policies on an OPA server through its REST API. Works against a local opa run --server or a production deployment with bearer-token auth.
  • Build & sign bundles. Package a directory of policies into a deployable bundle, optionally signing it. Output is a regular .tar.gz the agent can hand to your delivery system.
  • Lint. 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.

Why this MCP

OPA already has a perfectly good CLI and REST API. So why an MCP wrapper?

  • Schema-shaped tool surface. An agent calling 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.
  • Higher-level helpers. 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.
  • Curated knowledge. The bundled MCP resources expose the OPA built-in function catalog, the official Rego style guide (formatted for LLMs), and a curated pattern library covering RBAC, ABAC, Kubernetes admission, IaC gates, API authz, and rate limiting, so the agent has authoritative context without needing to scrape it.
  • Safety boundaries the agent can rely on. Path allow-list, subprocess timeouts, and response-size caps. Defaults are conservative; running the server doesn't quietly grant the agent more reach than the operator intended.

If you've ever watched an agent fight opa eval's argument order, you'll recognize the gap this fills.

Install

The server runs locally over stdio. Pick the install path that matches your client.

Claude Desktop

Edit claude_desktop_config.json directly (or copy from examples/claude-desktop.json):

{

"mcpServers": { "opa": { "command": "npx", "args": ["-y", "@orygn/opa-mcp"], "env": { "OPA_BINARY": "/usr/local/bin/opa", "REGAL_BINARY": "/usr/local/bin/regal", "OPA_URL": "http://localhost:8181", "OPA_MCP_ALLOWED_PATHS": "/path/to/your/policies" } } } }

Replace the /usr/local/bin/... paths with your real ones. See the

first-time install gotcha

below. Windows users substitute C:\\path\\to\\opa.exe.

Or download opa-mcp.mcpb from the latest release and double-click it.

Claude Code (CLI)

Register the server for the current project with claude mcp add:

claude mcp add \

--env OPA_BINARY=/usr/local/bin/opa \ --env REGAL_BINARY=/usr/local/bin/regal \ --env OPA_MCP_ALLOWED_PATHS=/path/to/your/policies \ opa -- npx -y @orygn/opa-mcp

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.exe syntax.

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 after Claude writes or edits a .rego file and hands any error back to Claude, without a manual tool call.
Cursor

Drop examples/cursor.json into either .cursor/mcp.json (project-scoped) or ~/.cursor/mcp.json (user-scoped).

VS Code (GitHub Copilot Chat)

Drop examples/vscode.json into .vscode/mcp.json, or paste the servers block into your user settings.json under mcp.servers.

Windsurf, Zed, and others

See examples/ for a full set of drop-in configs.

Manual install (any MCP client)
npm install -g @orygn/opa-mcp

opa-mcp --version

then point your client at the opa-mcp binary.

Docker
docker pull orygn/opa-mcp:latest

docker run --rm -i \ -v /path/to/your/policies:/policies:ro \ -e OPA_MCP_ALLOWED_PATHS=/policies \ orygn/opa-mcp

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.

⚠ If every tool call returns OPA_BINARY_NOT_FOUND

The 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.

Fix: add OPA_BINARY and REGAL_BINARY env entries to your client config with the absolute path to each binary. The example configs under examples/ ship with placeholder paths you replace. Find the real paths with:

which opa && which regal                                    # macOS / Linux
Get-Command opa, regal | Select-Object Source              # Windows

This does not affect the Docker install path, which ships opa and regal in the image and bypasses PATH entirely. The MCPB bundle carries neither, and unlike the npm install has no bundled fallback: set OPA_BINARY or put opa on PATH. See Troubleshooting for full detail.

Configuration

The server reads its configuration from environment variables. Every variable is optional; defaults are sensible for a local OPA on http://localhost:8181.

| Variable | Default | Purpose

只显示了开头部分;其余内容请在仓库中阅读

问 PopNx