@orygn/opa-mcp 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +291 -1
- package/README.md +104 -52
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +13 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +35 -5
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts +1 -6
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +17 -3
- package/dist/constants.js.map +1 -1
- package/dist/lib/child-env.d.ts +2 -2
- package/dist/lib/child-env.d.ts.map +1 -1
- package/dist/lib/child-env.js +6 -2
- package/dist/lib/child-env.js.map +1 -1
- package/dist/lib/conftest-cli.d.ts +2 -2
- package/dist/lib/conftest-cli.d.ts.map +1 -1
- package/dist/lib/conftest-cli.js +88 -18
- package/dist/lib/conftest-cli.js.map +1 -1
- package/dist/lib/errors.d.ts +4 -5
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +15 -3
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/inline-paths.d.ts +37 -0
- package/dist/lib/inline-paths.d.ts.map +1 -0
- package/dist/lib/inline-paths.js +162 -0
- package/dist/lib/inline-paths.js.map +1 -0
- package/dist/lib/opa-cli.d.ts +10 -0
- package/dist/lib/opa-cli.d.ts.map +1 -1
- package/dist/lib/opa-cli.js +9 -2
- package/dist/lib/opa-cli.js.map +1 -1
- package/dist/lib/opa-client.d.ts +27 -1
- package/dist/lib/opa-client.d.ts.map +1 -1
- package/dist/lib/opa-client.js +98 -14
- package/dist/lib/opa-client.js.map +1 -1
- package/dist/lib/opa-paths.d.ts +11 -1
- package/dist/lib/opa-paths.d.ts.map +1 -1
- package/dist/lib/opa-paths.js +30 -21
- package/dist/lib/opa-paths.js.map +1 -1
- package/dist/lib/output.d.ts.map +1 -1
- package/dist/lib/output.js +83 -10
- package/dist/lib/output.js.map +1 -1
- package/dist/lib/regal-cli.d.ts +18 -7
- package/dist/lib/regal-cli.d.ts.map +1 -1
- package/dist/lib/regal-cli.js +30 -8
- package/dist/lib/regal-cli.js.map +1 -1
- package/dist/lib/rego-ast-walker.d.ts +0 -6
- package/dist/lib/rego-ast-walker.d.ts.map +1 -1
- package/dist/lib/rego-ast-walker.js +48 -46
- package/dist/lib/rego-ast-walker.js.map +1 -1
- package/dist/lib/rego-counterexample.d.ts +14 -1
- package/dist/lib/rego-counterexample.d.ts.map +1 -1
- package/dist/lib/rego-counterexample.js +40 -10
- package/dist/lib/rego-counterexample.js.map +1 -1
- package/dist/lib/rego-input-path.d.ts +20 -0
- package/dist/lib/rego-input-path.d.ts.map +1 -0
- package/dist/lib/rego-input-path.js +70 -0
- package/dist/lib/rego-input-path.js.map +1 -0
- package/dist/lib/rego-ir.d.ts +2 -1
- package/dist/lib/rego-ir.d.ts.map +1 -1
- package/dist/lib/rego-smt-encoder.d.ts +35 -0
- package/dist/lib/rego-smt-encoder.d.ts.map +1 -1
- package/dist/lib/rego-smt-encoder.js +81 -8
- package/dist/lib/rego-smt-encoder.js.map +1 -1
- package/dist/lib/rego-type-inferencer.d.ts +26 -1
- package/dist/lib/rego-type-inferencer.d.ts.map +1 -1
- package/dist/lib/rego-type-inferencer.js +68 -0
- package/dist/lib/rego-type-inferencer.js.map +1 -1
- package/dist/lib/rego-verify-engine.d.ts.map +1 -1
- package/dist/lib/rego-verify-engine.js +171 -90
- package/dist/lib/rego-verify-engine.js.map +1 -1
- package/dist/lib/rego-z3.d.ts +56 -0
- package/dist/lib/rego-z3.d.ts.map +1 -1
- package/dist/lib/rego-z3.js +276 -7
- package/dist/lib/rego-z3.js.map +1 -1
- package/dist/lib/subprocess.d.ts +13 -0
- package/dist/lib/subprocess.d.ts.map +1 -1
- package/dist/lib/subprocess.js +153 -18
- package/dist/lib/subprocess.js.map +1 -1
- package/dist/lib/tool-helpers.d.ts +12 -25
- package/dist/lib/tool-helpers.d.ts.map +1 -1
- package/dist/lib/tool-helpers.js +67 -41
- package/dist/lib/tool-helpers.js.map +1 -1
- package/dist/prompts/index.js +2 -2
- package/dist/resources/index.js +1 -1
- package/dist/resources/index.js.map +1 -1
- package/dist/resources/patterns.d.ts +1 -1
- package/dist/resources/patterns.d.ts.map +1 -1
- package/dist/resources/patterns.js +2 -3
- package/dist/resources/patterns.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +40 -5
- package/dist/server.js.map +1 -1
- package/dist/tools/authoring/capabilities.d.ts +4 -0
- package/dist/tools/authoring/capabilities.d.ts.map +1 -1
- package/dist/tools/authoring/capabilities.js +42 -5
- package/dist/tools/authoring/capabilities.js.map +1 -1
- package/dist/tools/authoring/check-schema.d.ts +6 -0
- package/dist/tools/authoring/check-schema.d.ts.map +1 -1
- package/dist/tools/authoring/check-schema.js +56 -3
- package/dist/tools/authoring/check-schema.js.map +1 -1
- package/dist/tools/authoring/format.d.ts.map +1 -1
- package/dist/tools/authoring/format.js +2 -2
- package/dist/tools/authoring/format.js.map +1 -1
- package/dist/tools/authoring/lint.d.ts.map +1 -1
- package/dist/tools/authoring/lint.js +8 -6
- package/dist/tools/authoring/lint.js.map +1 -1
- package/dist/tools/authoring/migrate-v1.d.ts.map +1 -1
- package/dist/tools/authoring/migrate-v1.js +20 -4
- package/dist/tools/authoring/migrate-v1.js.map +1 -1
- package/dist/tools/authoring/parse.d.ts.map +1 -1
- package/dist/tools/authoring/parse.js +3 -3
- package/dist/tools/authoring/parse.js.map +1 -1
- package/dist/tools/bundles/sign.d.ts.map +1 -1
- package/dist/tools/bundles/sign.js +14 -34
- package/dist/tools/bundles/sign.js.map +1 -1
- package/dist/tools/conftest/index.d.ts +5 -0
- package/dist/tools/conftest/index.d.ts.map +1 -1
- package/dist/tools/conftest/index.js.map +1 -1
- package/dist/tools/conftest/test.d.ts.map +1 -1
- package/dist/tools/conftest/test.js +16 -17
- package/dist/tools/conftest/test.js.map +1 -1
- package/dist/tools/conftest/verify.d.ts.map +1 -1
- package/dist/tools/conftest/verify.js +14 -18
- package/dist/tools/conftest/verify.js.map +1 -1
- package/dist/tools/evaluation/_shared.js +9 -12
- package/dist/tools/evaluation/_shared.js.map +1 -1
- package/dist/tools/evaluation/bench.d.ts +20 -9
- package/dist/tools/evaluation/bench.d.ts.map +1 -1
- package/dist/tools/evaluation/bench.js +31 -12
- package/dist/tools/evaluation/bench.js.map +1 -1
- package/dist/tools/evaluation/compile.js +4 -4
- package/dist/tools/evaluation/compile.js.map +1 -1
- package/dist/tools/evaluation/eval.d.ts.map +1 -1
- package/dist/tools/evaluation/eval.js +12 -16
- package/dist/tools/evaluation/eval.js.map +1 -1
- package/dist/tools/evaluation/exec.d.ts.map +1 -1
- package/dist/tools/evaluation/exec.js +3 -4
- package/dist/tools/evaluation/exec.js.map +1 -1
- package/dist/tools/evaluation/test-multiroot.d.ts +2 -0
- package/dist/tools/evaluation/test-multiroot.d.ts.map +1 -1
- package/dist/tools/evaluation/test-multiroot.js +23 -6
- package/dist/tools/evaluation/test-multiroot.js.map +1 -1
- package/dist/tools/evaluation/test.d.ts.map +1 -1
- package/dist/tools/evaluation/test.js +8 -6
- package/dist/tools/evaluation/test.js.map +1 -1
- package/dist/tools/helpers/coverage-gaps.d.ts.map +1 -1
- package/dist/tools/helpers/coverage-gaps.js +4 -5
- package/dist/tools/helpers/coverage-gaps.js.map +1 -1
- package/dist/tools/helpers/describe-policy.d.ts.map +1 -1
- package/dist/tools/helpers/describe-policy.js +2 -2
- package/dist/tools/helpers/describe-policy.js.map +1 -1
- package/dist/tools/helpers/explain-decision.d.ts.map +1 -1
- package/dist/tools/helpers/explain-decision.js +3 -4
- package/dist/tools/helpers/explain-decision.js.map +1 -1
- package/dist/tools/helpers/explain-undefined.d.ts.map +1 -1
- package/dist/tools/helpers/explain-undefined.js +131 -22
- package/dist/tools/helpers/explain-undefined.js.map +1 -1
- package/dist/tools/helpers/fix.d.ts +11 -5
- package/dist/tools/helpers/fix.d.ts.map +1 -1
- package/dist/tools/helpers/fix.js +100 -51
- package/dist/tools/helpers/fix.js.map +1 -1
- package/dist/tools/helpers/generate-test-skeleton.d.ts.map +1 -1
- package/dist/tools/helpers/generate-test-skeleton.js +105 -21
- package/dist/tools/helpers/generate-test-skeleton.js.map +1 -1
- package/dist/tools/helpers/playground-share.d.ts +4 -2
- package/dist/tools/helpers/playground-share.d.ts.map +1 -1
- package/dist/tools/helpers/playground-share.js +13 -3
- package/dist/tools/helpers/playground-share.js.map +1 -1
- package/dist/tools/helpers/policy-diff.d.ts.map +1 -1
- package/dist/tools/helpers/policy-diff.js +3 -4
- package/dist/tools/helpers/policy-diff.js.map +1 -1
- package/dist/tools/helpers/security-audit.d.ts.map +1 -1
- package/dist/tools/helpers/security-audit.js +32 -21
- package/dist/tools/helpers/security-audit.js.map +1 -1
- package/dist/tools/meta/index.d.ts +1 -1
- package/dist/tools/server-management/_shared.d.ts.map +1 -1
- package/dist/tools/server-management/_shared.js +13 -1
- package/dist/tools/server-management/_shared.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -17,6 +17,293 @@ not part of the public surface and may change in minor releases.
|
|
|
17
17
|
|
|
18
18
|
## [Unreleased]
|
|
19
19
|
|
|
20
|
+
## [0.7.0] - 2026-09-26
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- `conftest_test` accepts the `cyclonedx`, `groovy` and `jsonc` parsers,
|
|
25
|
+
which conftest offers and the closed list here lacked.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- The bundled OPA is now 1.21.0, from 1.19.0. Three upstream changes reach
|
|
30
|
+
users through it. OPA reads YAML against the 1.2 core schema, so the bare
|
|
31
|
+
words `yes`, `no`, `on` and `off` in data files and `yaml.unmarshal` are
|
|
32
|
+
strings now rather than booleans; quote them or use `true` and `false`.
|
|
33
|
+
The type checker types an empty `{}`, `[]` or `set()` literal as empty and
|
|
34
|
+
checks `in` against the collection's type, so a policy that indexes,
|
|
35
|
+
iterates or tests membership in an empty literal now fails `rego_check`
|
|
36
|
+
with `rego_type_error` where it compiled before; OPA suggests
|
|
37
|
+
`count(x) == 0` for an emptiness test. Coverage reports from `rego_test`,
|
|
38
|
+
`rego_eval_with_coverage` and `rego_coverage_gaps` may tag a not-covered
|
|
39
|
+
range with a `kind` of `index_excluded` or `early_exit`, which says why
|
|
40
|
+
evaluation skipped it, at the cost of up to two extra evaluation passes
|
|
41
|
+
when coverage is requested. Nothing changes when `OPA_BINARY` or `PATH`
|
|
42
|
+
supplies the binary.
|
|
43
|
+
- Node.js 22 or later is required. Node 20 reached end of life in April
|
|
44
|
+
2026, and the CI matrix now covers 22, 24 and 26, the last being what the
|
|
45
|
+
Docker image runs.
|
|
46
|
+
- The Docker image ships Regal 0.42.0, from 0.30.0, and CI tests against
|
|
47
|
+
Regal 0.42.0 and conftest 0.70.1.
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
|
|
51
|
+
- `rego_security_audit` failed outright on Regal 0.31 and later, which refuse
|
|
52
|
+
a category no rule defines; the tool always enabled `security` as the home
|
|
53
|
+
for a project's custom rules. When Regal rejects it, the sweep runs again
|
|
54
|
+
with `bugs` alone.
|
|
55
|
+
- `rego_fix` with `force: true` sent Regal 0.41 and later a flag those
|
|
56
|
+
releases deprecated, since they no longer refuse files with uncommitted
|
|
57
|
+
changes. The flag now goes only to a Regal that still has that check. The
|
|
58
|
+
tool's description names the nine rules Regal 0.42 can fix; it named the
|
|
59
|
+
five of 0.30.
|
|
60
|
+
- The hint on `REGAL_NOT_FOUND` pointed at a Regal documentation site that
|
|
61
|
+
no longer resolves; it points at the project's page on openpolicyagent.org.
|
|
62
|
+
- Regal's own update check is switched off in the subprocesses the server
|
|
63
|
+
runs (`REGAL_DISABLE_VERSION_CHECK`), so `mcp_server_info` and `rego_fix`
|
|
64
|
+
no longer make a network request through it.
|
|
65
|
+
|
|
66
|
+
## [0.6.0] - 2026-09-07
|
|
67
|
+
|
|
68
|
+
### Security
|
|
69
|
+
|
|
70
|
+
- `rego_playground_share` created public Gists, listed on the account and
|
|
71
|
+
searchable, while the README described them as secret. Anyone who shared a
|
|
72
|
+
policy with it should assume the policy was public from the moment it was
|
|
73
|
+
posted. Gists are now secret unless `public: true` is passed: reachable by
|
|
74
|
+
their link, listed nowhere. The change is not retroactive: GitHub cannot make
|
|
75
|
+
an existing Gist secret, so a Gist created earlier that should not have been
|
|
76
|
+
public has to be deleted at github.com/gists and shared again.
|
|
77
|
+
|
|
78
|
+
### Changed
|
|
79
|
+
|
|
80
|
+
- `rego_bench` reports `iterations`, `nsPerOp`, `allocsPerOp` and
|
|
81
|
+
`bytesPerOp`, whole numbers as opa's own summary prints them, and keeps the
|
|
82
|
+
document opa printed under `raw` for a single run. Its fields `N`, `T`,
|
|
83
|
+
`Bytes`, `MemAllocs`, `MemBytes` and `Extra` were top-level before and now
|
|
84
|
+
sit under `raw`; the type had promised `iterations` and `metrics`, which
|
|
85
|
+
were never set. With `count` above one, `runs` holds every document and
|
|
86
|
+
`fastest` indexes the one the figures come from, so none is repeated.
|
|
87
|
+
|
|
88
|
+
### Added
|
|
89
|
+
|
|
90
|
+
- `rego_capabilities` takes a `builtins` filter of up to 100 names and returns
|
|
91
|
+
their full records under `builtins`, with a `matched` count and the
|
|
92
|
+
`missing` names. When the records would not fit the response cap it returns
|
|
93
|
+
`OUTPUT_TOO_LARGE` rather than a truncated result, and `names_only: true`
|
|
94
|
+
alongside it is refused as a contradiction; `names_only: false`
|
|
95
|
+
returns every record and is documented as needing the cap raised.
|
|
96
|
+
|
|
97
|
+
### Fixed
|
|
98
|
+
|
|
99
|
+
- Windows: a Rego module on a different drive from the server's working
|
|
100
|
+
directory was reported missing. The 0.5.0 drive-letter fix respelled data
|
|
101
|
+
documents relative to a working directory on their drive but left modules
|
|
102
|
+
absolute, since a module mounts at its own `package` whatever path it
|
|
103
|
+
arrives by. OPA still opens the module by the remainder after the colon, a
|
|
104
|
+
root-relative path it resolves against the drive the child is running on, so
|
|
105
|
+
a module on any other drive failed with a file-not-found. Every load path now
|
|
106
|
+
takes part in choosing the working directory; only data documents are
|
|
107
|
+
respelled.
|
|
108
|
+
- Windows: `rego_check` with inline source and `rego_inspect` reported a
|
|
109
|
+
module missing when the server's temp directory was on a different drive
|
|
110
|
+
from its working directory, and `conftest_test` and `conftest_verify` failed
|
|
111
|
+
the same way through `--policy`. OPA and conftest open an absolute path by
|
|
112
|
+
the part after its first colon, resolved on the drive the process runs on;
|
|
113
|
+
each command now runs from the path's own drive. The configs under test are
|
|
114
|
+
read by conftest itself and may sit on any drive; a policy and a data
|
|
115
|
+
directory spread across two drives are refused with a message saying so.
|
|
116
|
+
- The subprocess timeout is now hard on Linux and macOS. The SIGKILL escalation
|
|
117
|
+
fired on a flag Node sets when a signal is sent rather than when the child
|
|
118
|
+
ends, so a child that ignored SIGTERM hung the tool call for good, and a
|
|
119
|
+
wrapper script that left a grandchild holding the pipes kept the result from
|
|
120
|
+
ever settling. A child killed from outside the server is reported as
|
|
121
|
+
`SUBPROCESS_KILLED` naming the signal, not as a missing binary. On SIGINT or
|
|
122
|
+
SIGTERM the server now signals the children it started before exiting.
|
|
123
|
+
- `rego_eval`, `rego_eval_with_explain`, `rego_eval_with_profile`,
|
|
124
|
+
`rego_eval_with_coverage`, `rego_compile_query`, `rego_explain_decision`: a
|
|
125
|
+
string input that happened to parse as JSON, such as `"42"`, `"true"` or a
|
|
126
|
+
quoted string, was retyped or unwrapped before evaluation. Strings now reach
|
|
127
|
+
the policy as strings; only an object or array that arrived serialized as a
|
|
128
|
+
string is still repaired, the way `rego_bench` and the server-management
|
|
129
|
+
tools already did.
|
|
130
|
+
- `rego_fix`: a real run reported zero fixes and no changed files after
|
|
131
|
+
changing them, because only the dry-run wording of regal's summary was read.
|
|
132
|
+
Both forms are read now.
|
|
133
|
+
- `opa_*` server tools: a request that OPA did not answer within
|
|
134
|
+
`OPA_MCP_HTTP_TIMEOUT_MS` was reported as `OPA_UNREACHABLE`, with a hint to
|
|
135
|
+
start a server that was already running. It is now `TIMEOUT`, naming the
|
|
136
|
+
limit, and the timer covers the response body as well as the headers.
|
|
137
|
+
- `conftest_test`: a denial reported under `failOnWarn` came back as a tool
|
|
138
|
+
error rather than as a failed check, because conftest exits 2 for it. Any
|
|
139
|
+
exit code with results on stdout is now an outcome, and only output without
|
|
140
|
+
results is treated as a command error, whose message now carries conftest's
|
|
141
|
+
own text; `conftest_verify` shares that last part.
|
|
142
|
+
- `rego_verify`: a policy that exhausted the Z3 WASM heap took the whole
|
|
143
|
+
server down, since the abort surfaced outside every try/catch. The solver is
|
|
144
|
+
now bounded at 768 MB, under a 1 GiB ceiling on Z3's allocations, so an
|
|
145
|
+
oversized problem comes back inconclusive.
|
|
146
|
+
- `rego_verify`: a helper whose body contains a literal `false` was inlined as
|
|
147
|
+
an always-true body, so a rule that can never fire was reported proven always
|
|
148
|
+
true, and a negated literal (`not false`, `not true`) was read as the bare
|
|
149
|
+
one in helpers and rule bodies alike. Boolean literals are now read as what
|
|
150
|
+
they say, and a helper with a true default and a body that never holds is
|
|
151
|
+
recognised as always holding.
|
|
152
|
+
- Every tool that evaluates Rego, including the Regal tools that run a
|
|
153
|
+
project's custom rules, now declares `openWorldHint: true` and no longer
|
|
154
|
+
claims `readOnlyHint`, since a policy's own `http.send` can reach, and write
|
|
155
|
+
to, a remote system. A client that gates on the hints will ask before running
|
|
156
|
+
one. The destructive and idempotent hints on those tools are left to the
|
|
157
|
+
spec's defaults, since a policy chooses its own HTTP method.
|
|
158
|
+
- Docker: the `opa` and `regal` downloads in the image build are now checked
|
|
159
|
+
against the digests published with their releases. The image was described
|
|
160
|
+
as reproducible while nothing verified those downloads; the wording now says
|
|
161
|
+
what the build does.
|
|
162
|
+
- `rego_security_audit` was described as running regal's `security` and
|
|
163
|
+
`bugs` categories; regal ships no `security` category, so that half of the
|
|
164
|
+
sweep matched nothing. The description now says what runs: the `bugs`
|
|
165
|
+
category, plus any custom rules a project places in a `security` category.
|
|
166
|
+
- `rego_explain_undefined`: on the path where OPA's indexer skips the rule, the
|
|
167
|
+
blocking condition was chosen from each body expression evaluated on its own,
|
|
168
|
+
so an expression that needs an earlier local or a sibling rule came back
|
|
169
|
+
unevaluable and was blamed ahead of the guard that really failed. The body is
|
|
170
|
+
now evaluated as cumulative prefixes inside the rule's package, with its
|
|
171
|
+
imports, and the first condition that stops holding is the one reported; the
|
|
172
|
+
conditions after it are left unevaluated, as on the traced path.
|
|
173
|
+
- `rego_check_schema` reported `valid: true` when `schemaPath` was a
|
|
174
|
+
directory, since opa reads a schema directory only through `schemas:`
|
|
175
|
+
annotations in the policy. A directory is now accepted when the policy
|
|
176
|
+
carries them (read from the source, or reported by `opa inspect` for files
|
|
177
|
+
on disk) and refused before opa runs when it does not, with the file form,
|
|
178
|
+
`inlineSchema` and the annotation named as the ways to make it work.
|
|
179
|
+
- `opa_bundle_sign` reported `signed: true` for a `.tar.gz` archive after
|
|
180
|
+
writing a `.signatures.json` beside it, which OPA never reads, so the
|
|
181
|
+
archive stayed unsigned. An archive is now refused with a pointer to
|
|
182
|
+
`opa_bundle_build`, which produces a signed one. The `outputDir` input,
|
|
183
|
+
which only applied to archives, is gone.
|
|
184
|
+
- `OPA_MCP_MAX_RESPONSE_BYTES` now bounds error envelopes as well as
|
|
185
|
+
results. An oversize error was sent whole with `truncated: true` set; its
|
|
186
|
+
details are now dropped first and its message cut last, so the code and
|
|
187
|
+
the message stay readable within the cap.
|
|
188
|
+
The cap bounds a success envelope's warnings as well, and
|
|
189
|
+
`OPA_MCP_MAX_RESPONSE_BYTES` refuses a value below 512, which sits above
|
|
190
|
+
the smallest complete envelope, rather than exceeding it.
|
|
191
|
+
- The temp directory inline source is written to could appear in the error
|
|
192
|
+
details of a dozen tools, in the message a binary printed about the file.
|
|
193
|
+
Every error envelope now passes through the sanitiser, which also covers a
|
|
194
|
+
JSON-encoded spelling, a directory name with a space, the inline schema and
|
|
195
|
+
bundle-verify temp files, and takes linear time on any input.
|
|
196
|
+
The server's own temp directory is matched by its exact spelling first,
|
|
197
|
+
so no guess about where a path begins is involved for the files it writes.
|
|
198
|
+
- `rego_explain_undefined` turned a spawn failure during its per-condition
|
|
199
|
+
evals or its parse step into a per-condition note or an empty analysis. A
|
|
200
|
+
binary that cannot run or a run that timed out now returns the tool's
|
|
201
|
+
`OPA_BINARY_NOT_FOUND` or `TIMEOUT` like every other tool.
|
|
202
|
+
- `rego_explain_undefined` validated `inputPath` and then passed the argument
|
|
203
|
+
as written to opa instead of the resolved path.
|
|
204
|
+
- The `*_BINARY` variables now refuse a relative path at startup, which the
|
|
205
|
+
README said they did, a drive-relative or root-relative name included; a
|
|
206
|
+
bare command name or an absolute path is accepted.
|
|
207
|
+
- Docs: the install note described a missing-`opa` failure that the npm
|
|
208
|
+
package's bundled binary already prevents, and now says where it still
|
|
209
|
+
applies; CONTRIBUTING said input fields are `snake_case` when the surface
|
|
210
|
+
is `camelCase`; two prompts sent readers to `rego_describe_policy` for input
|
|
211
|
+
refs, which `rego_infer_input_schema` reports.
|
|
212
|
+
- `rego_migrate_v1` reported a built-in that v1 removed, which fails type
|
|
213
|
+
checking in the `opa fmt --rego-v1` phase, as a parse failure with advice to
|
|
214
|
+
fix syntax. The type error opa gives is now the message, with a hint to
|
|
215
|
+
replace the built-in first; the description says so.
|
|
216
|
+
- `rego_verify`: a quoted key holding a dot, `input["a.b"]`, and the nested
|
|
217
|
+
path `input.a.b` were treated as one field, so a rule reading both was
|
|
218
|
+
proved never true, and a witness for the quoted key was built as the nested
|
|
219
|
+
object. Paths are now rendered the way Rego writes them and read back the
|
|
220
|
+
same way.
|
|
221
|
+
The soundness fuzz now carries quoted keys, so it exercises this.
|
|
222
|
+
- `conftest_test`, `conftest_verify`: an error from conftest named the temp
|
|
223
|
+
file an inline config or policy had been written to, a file the tool had
|
|
224
|
+
already removed. The path is replaced in stderr as it already was in the
|
|
225
|
+
results.
|
|
226
|
+
- `rego_verify`: a witness holding a non-ASCII string came back in Z3's
|
|
227
|
+
escape text, one escape per byte, which OPA did not accept as the string
|
|
228
|
+
the policy compares against. The escapes are decoded now. A backslash in a
|
|
229
|
+
policy literal is escaped on the way into Z3, so a literal that spells such
|
|
230
|
+
an escape itself is no longer read as one.
|
|
231
|
+
- Docs: the README now says an argument that fails a tool's input schema is
|
|
232
|
+
rejected by the MCP layer before the handler runs, names `rego_verify`'s
|
|
233
|
+
`kind` field, and describes `rego_suggest_fix` as returning suggestions with
|
|
234
|
+
a confidence level; the `opa://builtins` resource says which `opa` binary
|
|
235
|
+
it reflects.
|
|
236
|
+
- `rego_verify`: a field compared as a string, number or boolean and also read
|
|
237
|
+
as the object holding a deeper field was modelled as two unrelated values,
|
|
238
|
+
so a rule no input can satisfy was reported satisfiable with a witness OPA
|
|
239
|
+
rejects. The solver now knows that a field the rule compared equal to a
|
|
240
|
+
scalar, or fed to a string built-in, is never present alongside a path
|
|
241
|
+
beneath it. A rule that compares such a field in any other way (an
|
|
242
|
+
inequality, an ordering, a bare read, a comparison against another field)
|
|
243
|
+
and also reads beneath it is reported inconclusive, since the model gives
|
|
244
|
+
the field one scalar value that no input holding the deeper field can
|
|
245
|
+
match; before, that produced a counterexample OPA rejects. Both readings
|
|
246
|
+
are taken from the rule under test alone, so another rule in the module
|
|
247
|
+
does not decide either.
|
|
248
|
+
- `rego_verify` built its witness from every input path in the policy, so a
|
|
249
|
+
field only another rule reads was given a value and placed in the input.
|
|
250
|
+
Where that field was the parent of one the rule under test reads, the two
|
|
251
|
+
collided and the witness no longer satisfied the rule: `allow if input.x.y
|
|
252
|
+
== 2` beside `other if input.x > 1` returned `{"x": 0}`, which the policy
|
|
253
|
+
evaluates to undefined, and reported it as proof the rule can be true. A
|
|
254
|
+
witness now names only the fields its own rule reads. The witness
|
|
255
|
+
search that prefers every field present also re-checks after backing out,
|
|
256
|
+
rather than reading a stale model.
|
|
257
|
+
- `rego_test` with `coverage` or `threshold` and `count` above 1 returned no
|
|
258
|
+
coverage and reported the threshold as met: opa prints one report per
|
|
259
|
+
repetition and the concatenation did not parse as JSON, so none was read.
|
|
260
|
+
One is read now.
|
|
261
|
+
- `rego_test_multiroot` in coverage mode reported a root holding a `todo_`
|
|
262
|
+
test as failed and dropped its report, as `rego_test` used to; the report is
|
|
263
|
+
kept and the root passes.
|
|
264
|
+
- `rego_generate_test_skeleton` referenced every rule the same way, so a
|
|
265
|
+
function rule made the generated file fail to compile and a set, object or
|
|
266
|
+
value rule was compared to `true`. Each stub now follows the rule's head: a
|
|
267
|
+
function is called with placeholder arguments, a set or object is compared
|
|
268
|
+
to an empty one, a value rule to its literal when the head is one; a
|
|
269
|
+
computed head, which offers nothing to assert, becomes a `todo_test_` that
|
|
270
|
+
opa test skips rather than a placeholder that passes. The generated file no longer
|
|
271
|
+
imports the package it references by full path, which `opa check --strict`
|
|
272
|
+
reported as an unused import.
|
|
273
|
+
- A username and password embedded in `OPA_URL` were echoed into every
|
|
274
|
+
`opa_*` error envelope and the startup log, and made every call fail as
|
|
275
|
+
`OPA_UNREACHABLE`, since the HTTP client refuses such a URL. They are now
|
|
276
|
+
redacted wherever the URL is shown, and such a URL is refused with
|
|
277
|
+
`OPA_URL_INVALID` and a hint to use `OPA_TOKEN`.
|
|
278
|
+
Only the credentials are removed from the URL shown; its case, port and
|
|
279
|
+
path stay as the operator wrote them.
|
|
280
|
+
- `rego_verify` never gave the Z3 engine's memory back: its solver and
|
|
281
|
+
model were left to the JavaScript collector, which cannot see Z3's heap and
|
|
282
|
+
so had no reason to run, and the engine grew by half to one megabyte per
|
|
283
|
+
solve until its ceiling, between 600 MB and 1.7 GB over 1500 solves in the
|
|
284
|
+
same process depending on the run, with verdicts degrading to inconclusive
|
|
285
|
+
along the way. The solver is released as each solve ends, and its model
|
|
286
|
+
with it; 1500 solves now hold at about 210 MB.
|
|
287
|
+
- `rego_verify` could fault Z3 intermittently, which disabled verification
|
|
288
|
+
until the server restarted: z3-solver frees its objects from finalizers on
|
|
289
|
+
the main thread while a solve runs on a worker over the same shared
|
|
290
|
+
memory, and one landing mid-solve corrupted the heap. Finalizers are now
|
|
291
|
+
held while a solve runs, and a fault brings up a fresh Z3 on the next call,
|
|
292
|
+
three times per process, with the interrupted call retried once.
|
|
293
|
+
- The server reported itself as 0.4.0 on the 0.5.0 release, in the MCP
|
|
294
|
+
handshake, `mcp_server_info`, `--version` and the startup log: the version
|
|
295
|
+
was a constant kept apart from package.json. It is now read from
|
|
296
|
+
package.json, a test holds package.json, manifest.json and server.json to
|
|
297
|
+
one version, and a release stops before publishing when its tag names a
|
|
298
|
+
version package.json does not carry.
|
|
299
|
+
- The startup warning and hint for a missing `regal` named `rego_lint` alone;
|
|
300
|
+
`rego_security_audit` and `rego_fix` need it too, and the manifest, the
|
|
301
|
+
registry entry and the Smithery config say so now. `--help` lists
|
|
302
|
+
`OPA_MCP_BLOCK_ENV`. `conftest_verify` said an omitted `namespace` both
|
|
303
|
+
defaulted to `main` and verified all namespaces; it verifies all.
|
|
304
|
+
`rego_check_schema` and `rego_playground_share` describe the schema
|
|
305
|
+
directory form and the `public` field they already had.
|
|
306
|
+
|
|
20
307
|
## [0.5.0] - 2026-09-04
|
|
21
308
|
|
|
22
309
|
### Security
|
|
@@ -1364,7 +1651,10 @@ wrappers end-to-end. CI matrix: Ubuntu, macOS, and Windows on Node
|
|
|
1364
1651
|
20 and 22, plus CodeQL security scanning and weekly Dependabot updates
|
|
1365
1652
|
for npm, GitHub Actions, and Docker base images.
|
|
1366
1653
|
|
|
1367
|
-
[Unreleased]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.
|
|
1654
|
+
[Unreleased]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.7.0...HEAD
|
|
1655
|
+
[0.7.0]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.6.0...v0.7.0
|
|
1656
|
+
[0.6.0]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.5.0...v0.6.0
|
|
1657
|
+
[0.5.0]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.4.0...v0.5.0
|
|
1368
1658
|
[0.4.0]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.3.0...v0.4.0
|
|
1369
1659
|
[0.3.0]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.2.1...v0.3.0
|
|
1370
1660
|
[0.2.1]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.2.0...v0.2.1
|
package/README.md
CHANGED
|
@@ -22,10 +22,22 @@ environment.
|
|
|
22
22
|
+--------------------+ 52 tools +-----------------+ +---------------------+
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
> **Status:** v0.
|
|
25
|
+
> **Status:** v0.7.0. Tool surface, error codes, and
|
|
26
26
|
> environment variables follow [SemVer](https://semver.org/) from
|
|
27
27
|
> v0.1.0 forward.
|
|
28
28
|
|
|
29
|
+
> **Upgrading to 0.7.0:** Node.js 22 or later is required. The bundled OPA
|
|
30
|
+
> is 1.21, which reads YAML against the 1.2 schema: bare `yes`, `no`, `on`
|
|
31
|
+
> and `off` in data files are strings now, not booleans. If you supply your
|
|
32
|
+
> own binary via `OPA_BINARY` or `PATH`, only the Node requirement applies.
|
|
33
|
+
|
|
34
|
+
> **Upgrading to 0.6.0:** `rego_bench` reports `iterations`, `nsPerOp`,
|
|
35
|
+
> `allocsPerOp` and `bytesPerOp`. The fields opa prints (`N`, `T`, `Bytes`,
|
|
36
|
+
> `MemAllocs`, `MemBytes`, `Extra`) were top-level and now sit under `raw`
|
|
37
|
+
> for a single run, so anything that read them from the top level has to
|
|
38
|
+
> look there. With `count` above one, `raw` is omitted: every document is in
|
|
39
|
+
> `runs`, and `fastest` indexes the one the top-level figures come from.
|
|
40
|
+
|
|
29
41
|
> **Upgrading to 0.4.0:** subprocesses no longer inherit the server's
|
|
30
42
|
> environment. A policy that read a variable through `opa.runtime().env`
|
|
31
43
|
> will no longer see it; name the variable in `OPA_MCP_PASSTHROUGH_ENV` if
|
|
@@ -216,11 +228,15 @@ The image is multi-arch (`linux/amd64`, `linux/arm64`), bundles pinned
|
|
|
216
228
|
versions of `opa` and `regal`, and runs as a non-root user. No host
|
|
217
229
|
install of OPA or Regal is required.
|
|
218
230
|
|
|
219
|
-
### ⚠
|
|
231
|
+
### ⚠ If every tool call returns `OPA_BINARY_NOT_FOUND`
|
|
220
232
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
233
|
+
The npm package carries its own `opa` for the five platforms it is built
|
|
234
|
+
for, so a client `PATH` without `opa` on it does not matter there. The MCPB
|
|
235
|
+
has no bundled copy, and on any other platform neither does npm: then the
|
|
236
|
+
server boots but every tool call returns `OPA_BINARY_NOT_FOUND`. Neither the
|
|
237
|
+
npm package nor the MCPB bundles `regal` or `conftest`, and the Docker image
|
|
238
|
+
ships `regal` but not `conftest`, so their tools need a `PATH` entry or an
|
|
239
|
+
explicit path either way.
|
|
224
240
|
|
|
225
241
|
**Fix:** add `OPA_BINARY` and `REGAL_BINARY` env entries to your client
|
|
226
242
|
config with the absolute path to each binary. The example configs under
|
|
@@ -257,17 +273,18 @@ variable is optional; defaults are sensible for a local OPA on
|
|
|
257
273
|
| `OPA_MCP_ALLOWED_PATHS` | _(unset)_ | 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.** |
|
|
258
274
|
| `OPA_MCP_LOG_FILE` | `<tmpdir>/orygn-opa-mcp.log` | Path the server appends logs to. The server never writes to stdout; that channel is reserved for the MCP protocol. |
|
|
259
275
|
| `OPA_MCP_LOG_LEVEL` | `info` | One of `debug`, `info`, `warn`, `error`. |
|
|
260
|
-
| `OPA_MCP_MAX_RESPONSE_BYTES` | `100000` | Hard cap on a single tool response. Larger payloads are truncated with a `__truncated: true` marker.
|
|
276
|
+
| `OPA_MCP_MAX_RESPONSE_BYTES` | `100000` | Hard cap on a single tool response. Larger payloads are truncated with a `__truncated: true` marker. Values below 512 are refused. |
|
|
261
277
|
| `OPA_MCP_TIMEOUT_MS` | `30000` | Hard timeout for any spawned subprocess (`opa`, `regal`). After this, the child gets `SIGTERM` and then `SIGKILL`. |
|
|
262
|
-
| `OPA_MCP_HTTP_TIMEOUT_MS` | `15000` | Timeout for
|
|
278
|
+
| `OPA_MCP_HTTP_TIMEOUT_MS` | `15000` | Timeout for each request to the OPA REST API, from the connection attempt to the last byte of the response; reported as `TIMEOUT`. |
|
|
263
279
|
| `OPA_MCP_NO_TELEMETRY` | _(unset)_ | Set to `1` to disable the anonymous startup ping. The ping sends the server version, OS platform, and a random install ID. The install ID is stored at `~/.orygn/opa-mcp/install-id` and is generated once on first run. No policy content or file paths are ever sent. |
|
|
264
280
|
| `OPA_MCP_MAX_SUBPROCESS_BYTES` | `33554432` (32 MiB) | Maximum bytes captured from a subprocess's stdout and stderr, counted separately. On overflow the stream is clamped, the child is stopped, and the tool returns `OUTPUT_TOO_LARGE`. Distinct from `OPA_MCP_MAX_RESPONSE_BYTES`, which trims the reply after the output is already in memory. |
|
|
265
281
|
| `OPA_MCP_PASSTHROUGH_ENV` | _(unset)_ | Comma-separated variable names to pass through to `opa`, `regal` and `conftest`. Everything else is withheld. **Anything named here is readable by any policy the server evaluates**, via `opa.runtime().env`, so use it only for values that are safe in that position. |
|
|
266
282
|
| `OPA_MCP_BLOCK_ENV` | _(unset)_ | Comma-separated variable names to withhold from `opa`, `regal` and `conftest` even when they are on the built-in allow-list. Applied last, so it also overrides `OPA_MCP_PASSTHROUGH_ENV`. Use it to drop the proxy variables, which can carry credentials, at the cost of proxy support. |
|
|
267
283
|
|
|
268
|
-
Paths in `OPA_MCP_ALLOWED_PATHS` and
|
|
269
|
-
|
|
270
|
-
|
|
284
|
+
Paths in `OPA_MCP_ALLOWED_PATHS` must be absolute, and a `*_BINARY` value is
|
|
285
|
+
either a bare command name looked up on `PATH` or an absolute path; anything
|
|
286
|
+
else stops the server at startup. A binary that cannot be run is reported by
|
|
287
|
+
each tool call with a structured error.
|
|
271
288
|
|
|
272
289
|
## Tool reference
|
|
273
290
|
|
|
@@ -283,7 +300,7 @@ Stable error codes: `INVALID_INPUT`, `INVALID_REGO`, `INVALID_BUNDLE`,
|
|
|
283
300
|
`CONFTEST_NOT_FOUND`, `OPA_UNREACHABLE`, `OPA_AUTH_FAILED`,
|
|
284
301
|
`POLICY_NOT_FOUND`, `DATA_NOT_FOUND`, `PATH_NOT_ALLOWED`, `PATH_NOT_FOUND`,
|
|
285
302
|
`NO_TESTS_FOUND`, `COVERAGE_BELOW_THRESHOLD`, `OPA_VERSION_UNSUPPORTED`,
|
|
286
|
-
`GITHUB_TOKEN_MISSING`, `GIST_CREATE_FAILED`, `OUTPUT_TOO_LARGE`, `TIMEOUT`,
|
|
303
|
+
`GITHUB_TOKEN_MISSING`, `GIST_CREATE_FAILED`, `OUTPUT_TOO_LARGE`, `SUBPROCESS_KILLED`, `OPA_URL_INVALID`, `TIMEOUT`,
|
|
287
304
|
`CANCELLED`, `UNKNOWN_ERROR`.
|
|
288
305
|
|
|
289
306
|
### Category A: Authoring & static analysis
|
|
@@ -292,17 +309,17 @@ Operate on Rego source code without needing a running OPA server. Wrap
|
|
|
292
309
|
`opa fmt`, `opa parse`, `opa check`, `opa inspect`, `opa capabilities`,
|
|
293
310
|
`opa deps`, and `regal`.
|
|
294
311
|
|
|
295
|
-
| Tool | What it does
|
|
296
|
-
| ------------------- |
|
|
297
|
-
| `rego_format` | Format Rego source. Wraps `opa fmt`. Idempotent.
|
|
298
|
-
| `rego_check` | Type-check and validate Rego. Wraps `opa check`.
|
|
299
|
-
| `rego_lint` | Run Regal across a file or directory. Returns each violation with its category, level and location. **Requires `regal` on `PATH` or `REGAL_BINARY` set.**
|
|
300
|
-
| `rego_parse_ast` | Parse Rego to AST JSON. Wraps `opa parse`.
|
|
301
|
-
| `rego_inspect` | Inspect a bundle or directory: packages, rules, annotations. Wraps `opa inspect`.
|
|
302
|
-
| `rego_capabilities` | List the built-ins and features the resolved `opa` binary understands (`OPA_BINARY`, then `PATH`, then the bundled copy)
|
|
303
|
-
| `rego_deps` | Static dependency analysis: rule-level data references and cross-package calls.
|
|
304
|
-
| `rego_migrate_v1` | Migrate Rego v0 source to v1 syntax. Runs `opa fmt --rego-v1` then validates with `opa check --v1-compatible`. Returns `{ original, migrated, changed, valid, errors }`.
|
|
305
|
-
| `rego_check_schema` | Check Rego against a JSON Schema. Validates that every `input.*` field the policy reads exists in the schema using `opa check --schema`. Accepts inline schema
|
|
312
|
+
| Tool | What it does |
|
|
313
|
+
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
314
|
+
| `rego_format` | Format Rego source. Wraps `opa fmt`. Idempotent. |
|
|
315
|
+
| `rego_check` | Type-check and validate Rego. Wraps `opa check`. |
|
|
316
|
+
| `rego_lint` | Run Regal across a file or directory. Returns each violation with its category, level and location. **Requires `regal` on `PATH` or `REGAL_BINARY` set.** |
|
|
317
|
+
| `rego_parse_ast` | Parse Rego to AST JSON. Wraps `opa parse`. |
|
|
318
|
+
| `rego_inspect` | Inspect a bundle or directory: packages, rules, annotations. Wraps `opa inspect`. |
|
|
319
|
+
| `rego_capabilities` | List 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 |
|
|
320
|
+
| `rego_deps` | Static dependency analysis: rule-level data references and cross-package calls. |
|
|
321
|
+
| `rego_migrate_v1` | Migrate Rego v0 source to v1 syntax. Runs `opa fmt --rego-v1` then validates with `opa check --v1-compatible`. Returns `{ original, migrated, changed, valid, errors }`. |
|
|
322
|
+
| `rego_check_schema` | Check Rego against a JSON Schema. Validates that every `input.*` field the policy reads exists in the schema using `opa check --schema`. Accepts an inline schema, a path to a JSON Schema file, or a schema directory when the policy declares `schemas:` annotations. |
|
|
306
323
|
|
|
307
324
|
#### Featured: `rego_format`
|
|
308
325
|
|
|
@@ -387,11 +404,11 @@ Run a query against a policy and input. Wrap `opa eval`, `opa test`, and
|
|
|
387
404
|
|
|
388
405
|
Package, sign, and verify deployable bundles. Wrap `opa build`, `opa sign`, and `opa build --verification-key`.
|
|
389
406
|
|
|
390
|
-
| Tool | What it does
|
|
391
|
-
| ------------------- |
|
|
392
|
-
| `opa_bundle_build` | Build a `.tar.gz` bundle from a policy directory. Supports `optimize` and `revision`.
|
|
393
|
-
| `opa_bundle_sign` | Sign a bundle directory in place
|
|
394
|
-
| `opa_bundle_verify` | Verify a signed bundle with a public key through `opa build --verification-key`. Failures name the reason: wrong key, scope, modified, added, missing or unparseable file, unsigned, or a bundle that does not load.
|
|
407
|
+
| Tool | What it does |
|
|
408
|
+
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
409
|
+
| `opa_bundle_build` | Build a `.tar.gz` bundle from a policy directory. Supports `optimize` and `revision`. |
|
|
410
|
+
| `opa_bundle_sign` | Sign a bundle directory in place with a private key; an archive is refused, since OPA reads the signature from inside it, and comes signed from `opa_bundle_build`. A directory signature stays valid wherever the directory is placed under the same name. Returns the path, algorithm, and file count. |
|
|
411
|
+
| `opa_bundle_verify` | Verify a signed bundle with a public key through `opa build --verification-key`. Failures name the reason: wrong key, scope, modified, added, missing or unparseable file, unsigned, or a bundle that does not load. |
|
|
395
412
|
|
|
396
413
|
### Category D: OPA server management
|
|
397
414
|
|
|
@@ -419,21 +436,21 @@ point at a reachable server.
|
|
|
419
436
|
The differentiation surface. These compose lower-level primitives into
|
|
420
437
|
the tasks agents are actually asked to do.
|
|
421
438
|
|
|
422
|
-
| Tool | What it does
|
|
423
|
-
| ----------------------------- |
|
|
424
|
-
| `rego_explain_decision` | Turn an evaluation trace into a structured per-rule summary of what fired and what did not
|
|
425
|
-
| `rego_generate_test_skeleton` | Given a policy, generate a `_test.rego` skeleton covering each rule.
|
|
426
|
-
| `rego_describe_policy` | Summarize a policy's package, imports and per-rule structure from its AST. For the input references a policy reads, use `rego_infer_input_schema`
|
|
427
|
-
| `rego_suggest_fix` | For a failed `rego_check` or `rego_lint`, propose
|
|
428
|
-
| `rego_coverage_gaps` | Run `opa test --coverage` and return per-file uncovered line ranges, sorted worst first. Use `threshold` to focus on files below a target percentage.
|
|
429
|
-
| `rego_security_audit` | Run regal lint restricted to `
|
|
430
|
-
| `rego_infer_input_schema` | Statically analyse a policy (or directory of policies) with `opa parse` and return a JSON Schema describing every `input.*` field the policy reads. No running OPA required. Correct starting point for writing integration tests or configuring `opa check --schema`.
|
|
431
|
-
| `rego_fix` | Run `regal fix` to auto-apply mechanical fixes: `opa-fmt`, `use-rego-v1`, `use-assignment-operator`, `no-whitespace-comment`, and `directory-package-mismatch`. Use `dryRun: true` to preview changes first. Returns a per-file breakdown of which rules were applied and, for `directory-package-mismatch`, the new path the file was moved to.
|
|
432
|
-
| `rego_format_write` | Run `opa fmt --write` to canonically format one or more Rego files or directories in place. Use `dryRun: true` to list which files would change without modifying them. Validates all files parse successfully before writing any. Supports `regoV1`, `v0Compatible`, and `v1Compatible` flags. Only requires `opa`.
|
|
433
|
-
| `rego_policy_diff` | Evaluate the same query against two policies in parallel and compare the results. Returns `equal: true/false`, the raw value from each side (`resultA`/`resultB`), and `changedPaths` -- dot/bracket JSON paths that differ. Each side takes inline source or a file/directory path. Useful for verifying refactor equivalence or mapping divergence between two policy versions.
|
|
434
|
-
| `rego_verify` | Formally verify a property about a Rego rule using SMT solving (Microsoft Z3 via WASM). Unlike testing, this checks ALL possible inputs mathematically and either proves the property holds or returns a concrete counterexample.
|
|
435
|
-
| `rego_explain_undefined` | Explain why a Rego query is undefined. Combines a plain eval, a full-trace eval, and per-condition AST analysis to identify the exact body expression blocking each rule. Returns a structured breakdown of which conditions blocked each rule plus a human-readable summary.
|
|
436
|
-
| `rego_playground_share` | Publish a policy (and optional input) as a secret GitHub Gist and return the link, for sharing a reproduction. Requires `GITHUB_TOKEN` with the `gist` scope; returns `GITHUB_TOKEN_MISSING` otherwise.
|
|
439
|
+
| Tool | What it does |
|
|
440
|
+
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
441
|
+
| `rego_explain_decision` | Turn an evaluation trace into a structured per-rule summary of what fired and what did not |
|
|
442
|
+
| `rego_generate_test_skeleton` | Given a policy, generate a `_test.rego` skeleton covering each rule. |
|
|
443
|
+
| `rego_describe_policy` | Summarize a policy's package, imports and per-rule structure from its AST. For the input references a policy reads, use `rego_infer_input_schema` |
|
|
444
|
+
| `rego_suggest_fix` | For a failed `rego_check` or `rego_lint`, propose fix suggestions with a confidence level. |
|
|
445
|
+
| `rego_coverage_gaps` | Run `opa test --coverage` and return per-file uncovered line ranges, sorted worst first. Use `threshold` to focus on files below a target percentage. |
|
|
446
|
+
| `rego_security_audit` | Run regal lint restricted to its `bugs` category, plus any custom rules in a `security` category, across a directory. Returns severity-grouped findings with remediation guidance. |
|
|
447
|
+
| `rego_infer_input_schema` | Statically analyse a policy (or directory of policies) with `opa parse` and return a JSON Schema describing every `input.*` field the policy reads. No running OPA required. Correct starting point for writing integration tests or configuring `opa check --schema`. |
|
|
448
|
+
| `rego_fix` | Run `regal fix` to auto-apply mechanical fixes: `opa-fmt`, `use-rego-v1`, `use-assignment-operator`, `no-whitespace-comment`, and `directory-package-mismatch`. Use `dryRun: true` to preview changes first. Returns a per-file breakdown of which rules were applied and, for `directory-package-mismatch`, the new path the file was moved to. |
|
|
449
|
+
| `rego_format_write` | Run `opa fmt --write` to canonically format one or more Rego files or directories in place. Use `dryRun: true` to list which files would change without modifying them. Validates all files parse successfully before writing any. Supports `regoV1`, `v0Compatible`, and `v1Compatible` flags. Only requires `opa`. |
|
|
450
|
+
| `rego_policy_diff` | Evaluate the same query against two policies in parallel and compare the results. Returns `equal: true/false`, the raw value from each side (`resultA`/`resultB`), and `changedPaths` -- dot/bracket JSON paths that differ. Each side takes inline source or a file/directory path. Useful for verifying refactor equivalence or mapping divergence between two policy versions. |
|
|
451
|
+
| `rego_verify` | Formally verify a property about a Rego rule using SMT solving (Microsoft Z3 via WASM). Unlike testing, this checks ALL possible inputs mathematically and either proves the property holds or returns a concrete counterexample. The `kind` field takes `always_true`, `never_true` or `satisfiable`. Handles equality, comparison, string built-ins (`startswith`, `endswith`, `contains`, `regex.match`), multi-clause rules, rule defaults, non-boolean head values, and cross-rule inlining. Reports `INCONCLUSIVE` rather than guessing for negation-as-failure, comprehensions, partial set and object rules, functions, else chains, and complex regex. A body reading an absent field is undefined rather than true, so `always_true` requires the rule to hold for an empty input too. |
|
|
452
|
+
| `rego_explain_undefined` | Explain why a Rego query is undefined. Combines a plain eval, a full-trace eval, and per-condition AST analysis to identify the exact body expression blocking each rule. Returns a structured breakdown of which conditions blocked each rule plus a human-readable summary. |
|
|
453
|
+
| `rego_playground_share` | Publish a policy (and optional input) as a secret GitHub Gist (pass `public: true` to list it) and return the link, for sharing a reproduction. Requires `GITHUB_TOKEN` with the `gist` scope; returns `GITHUB_TOKEN_MISSING` otherwise. |
|
|
437
454
|
|
|
438
455
|
### Category F: Conftest (configuration policy testing)
|
|
439
456
|
|
|
@@ -474,7 +491,14 @@ YAML/JSON/HCL/TOML/INI against Rego policies using
|
|
|
474
491
|
"exceptions": []
|
|
475
492
|
}
|
|
476
493
|
],
|
|
477
|
-
"summary": {
|
|
494
|
+
"summary": {
|
|
495
|
+
"passed": 0,
|
|
496
|
+
"failed": 1,
|
|
497
|
+
"warnings": 0,
|
|
498
|
+
"skipped": 0,
|
|
499
|
+
"successes": 0,
|
|
500
|
+
"failures": 1
|
|
501
|
+
}
|
|
478
502
|
}
|
|
479
503
|
}
|
|
480
504
|
```
|
|
@@ -568,10 +592,12 @@ Agent: Done. Policy `rbac` is live on staging at $OPA_URL.
|
|
|
568
592
|
│ ├── tools/bundles/ ─┼─── lib/opa-cli.ts ──┐ │
|
|
569
593
|
│ ├── tools/server-management/ ─┤ │ │
|
|
570
594
|
│ ├── tools/helpers/ ─┤ │ │
|
|
595
|
+
│ ├── tools/conftest/ ─┤ │ │
|
|
571
596
|
│ ├── tools/meta/ ─┘ │ │
|
|
572
597
|
│ │ ▼ │
|
|
573
598
|
│ │ lib/subprocess.ts ──┴── opa │
|
|
574
599
|
│ │ lib/regal-cli.ts ───── regal│
|
|
600
|
+
│ │ lib/conftest-cli.ts ─ conftest│
|
|
575
601
|
│ │ lib/opa-client.ts ───── HTTP │
|
|
576
602
|
│ │ │
|
|
577
603
|
│ └── lib/output.ts (envelope + truncation) │
|
|
@@ -586,12 +612,16 @@ Four things worth knowing if you're going to operate this:
|
|
|
586
612
|
1. **stdout is the protocol channel.** The server logs to a file via
|
|
587
613
|
`lib/logger.ts` and never writes to stdout. If you see stray stdout
|
|
588
614
|
bytes, the client disconnects; the MCP transport layer is strict.
|
|
589
|
-
2. **No tool throws.** Every
|
|
590
|
-
a structured `{ ok: false, error: ... }` envelope
|
|
591
|
-
stable error vocabulary, not a stack trace.
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
615
|
+
2. **No tool handler throws.** Every handler catches its own exceptions and
|
|
616
|
+
returns a structured `{ ok: false, error: ... }` envelope, so the agent
|
|
617
|
+
sees a stable error vocabulary, not a stack trace. An argument that fails
|
|
618
|
+
the tool's input schema never reaches the handler: the MCP layer rejects
|
|
619
|
+
it and returns a tool result with `isError: true` whose text begins
|
|
620
|
+
`MCP error -32602: Input validation error:`, rather than the envelope.
|
|
621
|
+
Decoding subprocess output happens inside an async callback, where a throw
|
|
622
|
+
would bypass those handlers entirely, so that path is bounded by bytes
|
|
623
|
+
rather than left to a `try`/`catch` that could not see it.
|
|
624
|
+
|
|
595
625
|
3. **Subprocesses are bounded in time, size, and environment.**
|
|
596
626
|
`lib/subprocess.ts` runs the binaries with `shell: false`, a hard
|
|
597
627
|
timeout with `SIGTERM`-then-`SIGKILL` escalation, and a per-stream byte
|
|
@@ -629,9 +659,23 @@ be exposed on the network.
|
|
|
629
659
|
`OPA_MCP_PASSTHROUGH_ENV` opts individual variables back in.
|
|
630
660
|
- `OPA_TOKEN` is never echoed in tool responses or log entries, and is not
|
|
631
661
|
passed to any child process.
|
|
662
|
+
- **Tools that evaluate Rego are annotated open-world and not read-only.**
|
|
663
|
+
`rego_eval` and its variants, `rego_test`, `rego_test_multiroot`,
|
|
664
|
+
`rego_bench`, `rego_compile_query`, `opa_exec`, the explain, diff and
|
|
665
|
+
coverage helpers, the conftest tools, and the Regal tools (`rego_lint`,
|
|
666
|
+
`rego_security_audit`, `rego_fix`, which run a project's custom rules) all
|
|
667
|
+
run Rego, and OPA's `http.send` lets a policy reach, and write to, any
|
|
668
|
+
network address. A client that gates on the hints will ask before running
|
|
669
|
+
one. `opa_query_decision` and `opa_compile_query` are the exception: the
|
|
670
|
+
remote OPA evaluates a policy it already holds, and their hints describe
|
|
671
|
+
what the call does to that server. No evaluating tool passes or accepts a
|
|
672
|
+
capabilities file, so `http.send` cannot be restricted for evaluation;
|
|
673
|
+
`rego_check` and `opa_bundle_build` accept one, which affects only checking
|
|
674
|
+
and building.
|
|
632
675
|
- Releases are published with
|
|
633
676
|
[npm provenance](https://docs.npmjs.com/generating-provenance-statements);
|
|
634
|
-
the Docker image is built
|
|
677
|
+
the Docker image is built from the committed `Dockerfile`, with pinned
|
|
678
|
+
versions of `opa` and `regal` checked against their published digests.
|
|
635
679
|
|
|
636
680
|
To report a vulnerability, follow [SECURITY.md](./SECURITY.md). **Please
|
|
637
681
|
do not open a public issue for security problems.**
|
|
@@ -694,6 +738,13 @@ path(s) you want the server to read from, comma-separated.
|
|
|
694
738
|
`OPA_URL` (default `http://localhost:8181`) must point at a running OPA
|
|
695
739
|
server (`opa run --server ...`). Check with `curl $OPA_URL/health`.
|
|
696
740
|
|
|
741
|
+
**`TIMEOUT` when calling `opa_*` tools.**
|
|
742
|
+
|
|
743
|
+
The request did not finish within `OPA_MCP_HTTP_TIMEOUT_MS` (default 15 s).
|
|
744
|
+
Either OPA is up but slow, or nothing is answering at `OPA_URL` and the
|
|
745
|
+
connection attempt is being dropped rather than refused, which looks the
|
|
746
|
+
same from here. Check `OPA_URL` and the server's load, or raise the limit.
|
|
747
|
+
|
|
697
748
|
**`directory-package-mismatch` violation when linting inline source.**
|
|
698
749
|
|
|
699
750
|
Since v0.1.1, the server auto-disables this rule for inline-source calls.
|
|
@@ -729,8 +780,9 @@ npm run build # compile to dist/
|
|
|
729
780
|
```
|
|
730
781
|
|
|
731
782
|
CI runs lint, typecheck, build, and unit tests on every push and PR
|
|
732
|
-
across Ubuntu and Windows on Node
|
|
733
|
-
tests run on Linux
|
|
783
|
+
across Ubuntu and Windows on Node 22, 24 and 26, plus macOS on Node 22. Integration
|
|
784
|
+
tests run on Linux, and on Windows as a non-required check, against pinned
|
|
785
|
+
`opa`, `regal` and `conftest` releases.
|
|
734
786
|
|
|
735
787
|
For the full contributor workflow (adding tools, naming conventions,
|
|
736
788
|
logging discipline, release process), see [CONTRIBUTING.md](./CONTRIBUTING.md).
|