@orygn/opa-mcp 0.3.0 → 0.5.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 +396 -3
- package/README.md +132 -98
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +8 -3
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +15 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +74 -14
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/lib/bundle-signatures.d.ts +23 -0
- package/dist/lib/bundle-signatures.d.ts.map +1 -0
- package/dist/lib/bundle-signatures.js +152 -0
- package/dist/lib/bundle-signatures.js.map +1 -0
- package/dist/lib/child-env.d.ts +41 -0
- package/dist/lib/child-env.d.ts.map +1 -0
- package/dist/lib/child-env.js +176 -0
- package/dist/lib/child-env.js.map +1 -0
- package/dist/lib/conftest-cli.d.ts +25 -10
- package/dist/lib/conftest-cli.d.ts.map +1 -1
- package/dist/lib/conftest-cli.js +153 -33
- package/dist/lib/conftest-cli.js.map +1 -1
- package/dist/lib/install-id.d.ts.map +1 -1
- package/dist/lib/install-id.js +18 -3
- package/dist/lib/install-id.js.map +1 -1
- package/dist/lib/json-stream.d.ts +26 -0
- package/dist/lib/json-stream.d.ts.map +1 -0
- package/dist/lib/json-stream.js +69 -0
- package/dist/lib/json-stream.js.map +1 -0
- package/dist/lib/opa-cli.d.ts +64 -16
- package/dist/lib/opa-cli.d.ts.map +1 -1
- package/dist/lib/opa-cli.js +99 -28
- package/dist/lib/opa-cli.js.map +1 -1
- package/dist/lib/opa-paths.d.ts +24 -0
- package/dist/lib/opa-paths.d.ts.map +1 -0
- package/dist/lib/opa-paths.js +97 -0
- package/dist/lib/opa-paths.js.map +1 -0
- package/dist/lib/regal-cli.d.ts +16 -1
- package/dist/lib/regal-cli.d.ts.map +1 -1
- package/dist/lib/regal-cli.js +41 -6
- package/dist/lib/regal-cli.js.map +1 -1
- package/dist/lib/rego-ast-walker.d.ts.map +1 -1
- package/dist/lib/rego-ast-walker.js +141 -17
- package/dist/lib/rego-ast-walker.js.map +1 -1
- package/dist/lib/rego-counterexample.d.ts +1 -1
- package/dist/lib/rego-counterexample.d.ts.map +1 -1
- package/dist/lib/rego-counterexample.js +23 -5
- package/dist/lib/rego-counterexample.js.map +1 -1
- package/dist/lib/rego-ir.d.ts +32 -2
- package/dist/lib/rego-ir.d.ts.map +1 -1
- package/dist/lib/rego-smt-encoder.d.ts +53 -5
- package/dist/lib/rego-smt-encoder.d.ts.map +1 -1
- package/dist/lib/rego-smt-encoder.js +192 -26
- package/dist/lib/rego-smt-encoder.js.map +1 -1
- package/dist/lib/rego-type-inferencer.d.ts +1 -1
- package/dist/lib/rego-type-inferencer.d.ts.map +1 -1
- package/dist/lib/rego-type-inferencer.js +3 -3
- 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 +109 -77
- package/dist/lib/rego-verify-engine.js.map +1 -1
- package/dist/lib/rego-z3.d.ts +10 -0
- package/dist/lib/rego-z3.d.ts.map +1 -1
- package/dist/lib/rego-z3.js +38 -0
- package/dist/lib/rego-z3.js.map +1 -1
- package/dist/lib/security.d.ts +8 -0
- package/dist/lib/security.d.ts.map +1 -1
- package/dist/lib/security.js +130 -54
- package/dist/lib/security.js.map +1 -1
- package/dist/lib/subprocess.d.ts +36 -3
- package/dist/lib/subprocess.d.ts.map +1 -1
- package/dist/lib/subprocess.js +121 -20
- package/dist/lib/subprocess.js.map +1 -1
- package/dist/lib/tool-helpers.d.ts.map +1 -1
- package/dist/lib/tool-helpers.js +10 -0
- package/dist/lib/tool-helpers.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 +40 -12
- package/dist/resources/patterns.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +10 -2
- package/dist/server.js.map +1 -1
- package/dist/tools/authoring/check-schema.js +1 -1
- package/dist/tools/authoring/check-schema.js.map +1 -1
- package/dist/tools/bundles/build.d.ts.map +1 -1
- package/dist/tools/bundles/build.js +12 -4
- package/dist/tools/bundles/build.js.map +1 -1
- package/dist/tools/bundles/sign.d.ts +9 -2
- package/dist/tools/bundles/sign.d.ts.map +1 -1
- package/dist/tools/bundles/sign.js +145 -19
- package/dist/tools/bundles/sign.js.map +1 -1
- package/dist/tools/bundles/verify.d.ts +1 -1
- package/dist/tools/bundles/verify.d.ts.map +1 -1
- package/dist/tools/bundles/verify.js +58 -19
- package/dist/tools/bundles/verify.js.map +1 -1
- package/dist/tools/conftest/pull.d.ts.map +1 -1
- package/dist/tools/conftest/pull.js +24 -10
- package/dist/tools/conftest/pull.js.map +1 -1
- package/dist/tools/conftest/push.d.ts.map +1 -1
- package/dist/tools/conftest/push.js +17 -7
- package/dist/tools/conftest/push.js.map +1 -1
- package/dist/tools/conftest/test.d.ts +10 -6
- package/dist/tools/conftest/test.d.ts.map +1 -1
- package/dist/tools/conftest/test.js +47 -24
- package/dist/tools/conftest/test.js.map +1 -1
- package/dist/tools/conftest/verify.d.ts +10 -6
- package/dist/tools/conftest/verify.d.ts.map +1 -1
- package/dist/tools/conftest/verify.js +30 -18
- package/dist/tools/conftest/verify.js.map +1 -1
- package/dist/tools/evaluation/bench.d.ts +16 -0
- package/dist/tools/evaluation/bench.d.ts.map +1 -1
- package/dist/tools/evaluation/bench.js +30 -5
- package/dist/tools/evaluation/bench.js.map +1 -1
- package/dist/tools/evaluation/exec.d.ts +16 -0
- package/dist/tools/evaluation/exec.d.ts.map +1 -1
- package/dist/tools/evaluation/exec.js +35 -2
- package/dist/tools/evaluation/exec.js.map +1 -1
- package/dist/tools/evaluation/test-multiroot.d.ts +4 -0
- package/dist/tools/evaluation/test-multiroot.d.ts.map +1 -1
- package/dist/tools/evaluation/test-multiroot.js +21 -14
- package/dist/tools/evaluation/test-multiroot.js.map +1 -1
- package/dist/tools/evaluation/test.d.ts +45 -0
- package/dist/tools/evaluation/test.d.ts.map +1 -1
- package/dist/tools/evaluation/test.js +146 -27
- package/dist/tools/evaluation/test.js.map +1 -1
- package/dist/tools/helpers/coverage-gaps.d.ts +11 -3
- package/dist/tools/helpers/coverage-gaps.d.ts.map +1 -1
- package/dist/tools/helpers/coverage-gaps.js +4 -3
- package/dist/tools/helpers/coverage-gaps.js.map +1 -1
- package/dist/tools/helpers/explain-undefined.d.ts +9 -3
- package/dist/tools/helpers/explain-undefined.d.ts.map +1 -1
- package/dist/tools/helpers/explain-undefined.js +83 -51
- package/dist/tools/helpers/explain-undefined.js.map +1 -1
- package/dist/tools/helpers/verify.d.ts.map +1 -1
- package/dist/tools/helpers/verify.js +5 -1
- package/dist/tools/helpers/verify.js.map +1 -1
- package/dist/tools/server-management/_shared.d.ts +15 -4
- package/dist/tools/server-management/_shared.d.ts.map +1 -1
- package/dist/tools/server-management/_shared.js +73 -12
- package/dist/tools/server-management/_shared.js.map +1 -1
- package/dist/tools/server-management/data.d.ts.map +1 -1
- package/dist/tools/server-management/data.js +88 -23
- package/dist/tools/server-management/data.js.map +1 -1
- package/dist/tools/server-management/decisions.d.ts.map +1 -1
- package/dist/tools/server-management/decisions.js +16 -3
- package/dist/tools/server-management/decisions.js.map +1 -1
- package/dist/tools/server-management/policies.d.ts.map +1 -1
- package/dist/tools/server-management/policies.js +44 -7
- package/dist/tools/server-management/policies.js.map +1 -1
- package/dist/tools/server-management/status.d.ts.map +1 -1
- package/dist/tools/server-management/status.js +80 -13
- package/dist/tools/server-management/status.js.map +1 -1
- package/dist/types.d.ts +10 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -22,10 +22,20 @@ environment.
|
|
|
22
22
|
+--------------------+ 52 tools +-----------------+ +---------------------+
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
> **Status:** v0.
|
|
25
|
+
> **Status:** v0.4.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.4.0:** subprocesses no longer inherit the server's
|
|
30
|
+
> environment. A policy that read a variable through `opa.runtime().env`
|
|
31
|
+
> will no longer see it; name the variable in `OPA_MCP_PASSTHROUGH_ENV` if
|
|
32
|
+
> it is genuinely needed. See the security section for why.
|
|
33
|
+
|
|
34
|
+
> **Upgrading to 0.3.0:** the bundled OPA is now 1.19, so Rego v0 policies
|
|
35
|
+
> no longer parse (`if` is required before a rule body, `contains` before a
|
|
36
|
+
> partial set). Run `rego_migrate_v1` to convert them. If you supply your own
|
|
37
|
+
> binary via `OPA_BINARY` or `PATH`, nothing changes.
|
|
38
|
+
|
|
29
39
|
---
|
|
30
40
|
|
|
31
41
|
## Table of contents
|
|
@@ -66,7 +76,7 @@ Once an MCP client is connected, an agent can:
|
|
|
66
76
|
deployable bundle, optionally signing it. Output is a regular `.tar.gz`
|
|
67
77
|
the agent can hand to your delivery system.
|
|
68
78
|
- **Lint.** `rego_lint` runs Regal across a directory or a single file
|
|
69
|
-
and returns
|
|
79
|
+
and returns each finding with its category, level and location.
|
|
70
80
|
|
|
71
81
|
A walk-through of a typical session lives in [Cookbook](#cookbook).
|
|
72
82
|
|
|
@@ -225,8 +235,10 @@ which opa && which regal # macOS / Linux
|
|
|
225
235
|
Get-Command opa, regal | Select-Object Source # Windows
|
|
226
236
|
```
|
|
227
237
|
|
|
228
|
-
This does not affect the **Docker**
|
|
229
|
-
|
|
238
|
+
This does not affect the **Docker** install path, which ships `opa` and
|
|
239
|
+
`regal` in the image and bypasses `PATH` entirely. The **MCPB** bundle
|
|
240
|
+
carries neither, and unlike the npm install has no bundled fallback: set
|
|
241
|
+
`OPA_BINARY` or put `opa` on `PATH`.
|
|
230
242
|
See [Troubleshooting](#troubleshooting) for full detail.
|
|
231
243
|
|
|
232
244
|
## Configuration
|
|
@@ -235,20 +247,23 @@ The server reads its configuration from environment variables. Every
|
|
|
235
247
|
variable is optional; defaults are sensible for a local OPA on
|
|
236
248
|
`http://localhost:8181`.
|
|
237
249
|
|
|
238
|
-
| Variable
|
|
239
|
-
|
|
|
240
|
-
| `OPA_URL`
|
|
241
|
-
| `OPA_TOKEN`
|
|
242
|
-
| `OPA_BINARY`
|
|
243
|
-
| `REGAL_BINARY`
|
|
244
|
-
| `CONFTEST_BINARY`
|
|
245
|
-
| `OPA_MCP_ALLOWED_PATHS`
|
|
246
|
-
| `OPA_MCP_LOG_FILE`
|
|
247
|
-
| `OPA_MCP_LOG_LEVEL`
|
|
248
|
-
| `OPA_MCP_MAX_RESPONSE_BYTES`
|
|
249
|
-
| `OPA_MCP_TIMEOUT_MS`
|
|
250
|
-
| `OPA_MCP_HTTP_TIMEOUT_MS`
|
|
251
|
-
| `OPA_MCP_NO_TELEMETRY`
|
|
250
|
+
| Variable | Default | Purpose |
|
|
251
|
+
| ------------------------------ | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
252
|
+
| `OPA_URL` | `http://localhost:8181` | Base URL of an OPA REST endpoint, used by `opa_*` tools. |
|
|
253
|
+
| `OPA_TOKEN` | _(unset)_ | Bearer token for OPA, if your instance requires auth. Treated as a secret. Never echoed in logs or tool responses. |
|
|
254
|
+
| `OPA_BINARY` | `opa` (on `PATH`) | Path to the `opa` CLI, used by `rego_*` tools. |
|
|
255
|
+
| `REGAL_BINARY` | `regal` (on `PATH`) | Path to the `regal` linter. Required by `rego_lint`, `rego_fix`, and `rego_security_audit`. |
|
|
256
|
+
| `CONFTEST_BINARY` | `conftest` (on `PATH`) | Path to the `conftest` binary. Only required by `conftest_*` tools. Returns `CONFTEST_NOT_FOUND` if absent. |
|
|
257
|
+
| `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
|
+
| `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
|
+
| `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. |
|
|
261
|
+
| `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 HTTP requests to the OPA REST API. |
|
|
263
|
+
| `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
|
+
| `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
|
+
| `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
|
+
| `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. |
|
|
252
267
|
|
|
253
268
|
Paths in `OPA_MCP_ALLOWED_PATHS` and the `*_BINARY` variables must be
|
|
254
269
|
absolute. Relative paths and missing binaries are rejected with structured
|
|
@@ -265,11 +280,10 @@ Every tool returns a JSON envelope:
|
|
|
265
280
|
|
|
266
281
|
Stable error codes: `INVALID_INPUT`, `INVALID_REGO`, `INVALID_BUNDLE`,
|
|
267
282
|
`EVAL_ERROR`, `OPA_BINARY_NOT_FOUND`, `REGAL_NOT_FOUND`,
|
|
268
|
-
`
|
|
269
|
-
`
|
|
270
|
-
`
|
|
271
|
-
`
|
|
272
|
-
`Z3_INIT_ERROR`, `GITHUB_TOKEN_MISSING`, `GIST_CREATE_FAILED`, `TIMEOUT`,
|
|
283
|
+
`CONFTEST_NOT_FOUND`, `OPA_UNREACHABLE`, `OPA_AUTH_FAILED`,
|
|
284
|
+
`POLICY_NOT_FOUND`, `DATA_NOT_FOUND`, `PATH_NOT_ALLOWED`, `PATH_NOT_FOUND`,
|
|
285
|
+
`NO_TESTS_FOUND`, `COVERAGE_BELOW_THRESHOLD`, `OPA_VERSION_UNSUPPORTED`,
|
|
286
|
+
`GITHUB_TOKEN_MISSING`, `GIST_CREATE_FAILED`, `OUTPUT_TOO_LARGE`, `TIMEOUT`,
|
|
273
287
|
`CANCELLED`, `UNKNOWN_ERROR`.
|
|
274
288
|
|
|
275
289
|
### Category A: Authoring & static analysis
|
|
@@ -282,10 +296,10 @@ Operate on Rego source code without needing a running OPA server. Wrap
|
|
|
282
296
|
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
283
297
|
| `rego_format` | Format Rego source. Wraps `opa fmt`. Idempotent. |
|
|
284
298
|
| `rego_check` | Type-check and validate Rego. Wraps `opa check`. |
|
|
285
|
-
| `rego_lint` | Run Regal across a file or directory. Returns
|
|
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.** |
|
|
286
300
|
| `rego_parse_ast` | Parse Rego to AST JSON. Wraps `opa parse`. |
|
|
287
301
|
| `rego_inspect` | Inspect a bundle or directory: packages, rules, annotations. Wraps `opa inspect`. |
|
|
288
|
-
| `rego_capabilities` |
|
|
302
|
+
| `rego_capabilities` | List the built-ins and features the resolved `opa` binary understands (`OPA_BINARY`, then `PATH`, then the bundled copy) |
|
|
289
303
|
| `rego_deps` | Static dependency analysis: rule-level data references and cross-package calls. |
|
|
290
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 }`. |
|
|
291
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 or a path to a JSON Schema file on disk. |
|
|
@@ -295,7 +309,7 @@ Operate on Rego source code without needing a running OPA server. Wrap
|
|
|
295
309
|
```jsonc
|
|
296
310
|
// Input
|
|
297
311
|
{
|
|
298
|
-
"source": "package x\nallow
|
|
312
|
+
"source": "package x\nallow if input.user==\"admin\""
|
|
299
313
|
}
|
|
300
314
|
|
|
301
315
|
// Output (ok)
|
|
@@ -338,17 +352,17 @@ Operate on Rego source code without needing a running OPA server. Wrap
|
|
|
338
352
|
Run a query against a policy and input. Wrap `opa eval`, `opa test`, and
|
|
339
353
|
`opa bench`.
|
|
340
354
|
|
|
341
|
-
| Tool | What it does
|
|
342
|
-
| ------------------------- |
|
|
343
|
-
| `rego_eval` | Evaluate a query against a policy and input. The bread-and-butter tool.
|
|
344
|
-
| `rego_eval_with_explain` | Evaluate with `--explain=full` and return a structured trace.
|
|
345
|
-
| `rego_eval_with_profile` | Evaluate with `--profile` and return per-rule timing and evaluation counts.
|
|
346
|
-
| `rego_eval_with_coverage` | Evaluate with `--coverage` and return per-line coverage.
|
|
347
|
-
| `rego_test` | Run `opa test`
|
|
348
|
-
| `rego_bench` | Run `opa bench` and return statistical timing data.
|
|
349
|
-
| `rego_compile_query` | Partially evaluate a query against a policy.
|
|
350
|
-
| `opa_exec` | Batch-evaluate a decision against multiple input files. Returns per-file results with `successCount` and `errorCount`.
|
|
351
|
-
| `rego_test_multiroot` | Run
|
|
355
|
+
| Tool | What it does |
|
|
356
|
+
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
357
|
+
| `rego_eval` | Evaluate a query against a policy and input. The bread-and-butter tool. |
|
|
358
|
+
| `rego_eval_with_explain` | Evaluate with `--explain=full` and return a structured trace. |
|
|
359
|
+
| `rego_eval_with_profile` | Evaluate with `--profile` and return per-rule timing and evaluation counts. |
|
|
360
|
+
| `rego_eval_with_coverage` | Evaluate with `--coverage` and return per-line coverage. |
|
|
361
|
+
| `rego_test` | Run Rego unit tests with `opa test`. Returns pass, fail, skip and error counts plus per-test records; `errored` counts tests OPA could not evaluate. With `coverage` or `threshold` OPA emits a coverage report instead of per-test records. |
|
|
362
|
+
| `rego_bench` | Run `opa bench` and return statistical timing data. |
|
|
363
|
+
| `rego_compile_query` | Partially evaluate a query against a policy. |
|
|
364
|
+
| `opa_exec` | Batch-evaluate a decision against multiple input files. Returns per-file results with `successCount` and `errorCount`. |
|
|
365
|
+
| `rego_test_multiroot` | Run `opa test` once per root and aggregate. Use when `opa test .` hits package conflicts. Totals include `totalErrored`. |
|
|
352
366
|
|
|
353
367
|
#### Featured: `rego_eval`
|
|
354
368
|
|
|
@@ -371,55 +385,55 @@ Run a query against a policy and input. Wrap `opa eval`, `opa test`, and
|
|
|
371
385
|
|
|
372
386
|
### Category C: Bundle operations
|
|
373
387
|
|
|
374
|
-
Package and
|
|
388
|
+
Package, sign, and verify deployable bundles. Wrap `opa build`, `opa sign`, and `opa build --verification-key`.
|
|
375
389
|
|
|
376
|
-
| Tool | What it does
|
|
377
|
-
| ------------------- |
|
|
378
|
-
| `opa_bundle_build` | Build a `.tar.gz` bundle from a policy directory. Supports `optimize` and `revision`.
|
|
379
|
-
| `opa_bundle_sign` | Sign a bundle with a private key. Returns
|
|
380
|
-
| `opa_bundle_verify` | Verify
|
|
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, or an archive beside itself, with a private key. A directory signature stays valid wherever the directory is placed under the same name. Returns the path, algorithm, and file count. |
|
|
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. |
|
|
381
395
|
|
|
382
396
|
### Category D: OPA server management
|
|
383
397
|
|
|
384
398
|
Talk to a running OPA server over its REST API. Require `OPA_URL` to
|
|
385
399
|
point at a reachable server.
|
|
386
400
|
|
|
387
|
-
| Tool | What it does
|
|
388
|
-
| -------------------- |
|
|
389
|
-
| `opa_list_policies` | List
|
|
390
|
-
| `opa_get_policy` | Get a single policy by ID.
|
|
391
|
-
| `opa_put_policy` | Upload or replace a policy.
|
|
392
|
-
| `opa_delete_policy` | Delete a policy by ID.
|
|
393
|
-
| `opa_get_data` | Read a path from the data hierarchy.
|
|
394
|
-
| `opa_put_data` | Write to a path in the data hierarchy.
|
|
395
|
-
| `opa_patch_data` | Apply a JSON Patch to the data hierarchy.
|
|
396
|
-
| `opa_delete_data` | Delete a document from the data hierarchy.
|
|
397
|
-
| `opa_query_decision` | POST to a `/v1/data/...` decision endpoint with input.
|
|
398
|
-
| `opa_compile_query` | Partially evaluate a query against the running server.
|
|
399
|
-
| `opa_health` | Liveness / readiness check.
|
|
400
|
-
| `opa_status` |
|
|
401
|
-
| `opa_config` | Server configuration
|
|
401
|
+
| Tool | What it does |
|
|
402
|
+
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
403
|
+
| `opa_list_policies` | List the policy IDs registered on the server, with a count. `includeSource` and `includeAst` add the Rego text or the parsed AST. |
|
|
404
|
+
| `opa_get_policy` | Get a single policy by ID. Returns the Rego source; `includeAst` adds OPA's parsed AST. |
|
|
405
|
+
| `opa_put_policy` | Upload or replace a policy. |
|
|
406
|
+
| `opa_delete_policy` | Delete a policy by ID. |
|
|
407
|
+
| `opa_get_data` | Read a path from the data hierarchy. |
|
|
408
|
+
| `opa_put_data` | Write to a path in the data hierarchy. |
|
|
409
|
+
| `opa_patch_data` | Apply a JSON Patch to the data hierarchy. |
|
|
410
|
+
| `opa_delete_data` | Delete a document from the data hierarchy. |
|
|
411
|
+
| `opa_query_decision` | POST to a `/v1/data/...` decision endpoint with input. |
|
|
412
|
+
| `opa_compile_query` | Partially evaluate a query against the running server. |
|
|
413
|
+
| `opa_health` | Liveness / readiness check. A server that answers reports `healthy: true` or `healthy: false` with OPA's reason; `OPA_UNREACHABLE` means it could not be reached at all. |
|
|
414
|
+
| `opa_status` | The same `GET /v1/config` document as `opa_config`, under a `status` key. Bundle and decision-log status (`/v1/status`) is not exposed. Service header values are redacted. |
|
|
415
|
+
| `opa_config` | Server configuration from `GET /v1/config`. OPA drops the `credentials` block but returns service headers verbatim, so header values are redacted here and the names kept. |
|
|
402
416
|
|
|
403
417
|
### Category E: Higher-level helpers
|
|
404
418
|
|
|
405
419
|
The differentiation surface. These compose lower-level primitives into
|
|
406
420
|
the tasks agents are actually asked to do.
|
|
407
421
|
|
|
408
|
-
| Tool | What it does
|
|
409
|
-
| ----------------------------- |
|
|
410
|
-
| `rego_explain_decision` |
|
|
411
|
-
| `rego_generate_test_skeleton` | Given a policy, generate a `_test.rego` skeleton covering each rule.
|
|
412
|
-
| `rego_describe_policy` | Summarize
|
|
413
|
-
| `rego_suggest_fix` | For a failed `rego_check` or `rego_lint`, propose minimal patches.
|
|
414
|
-
| `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.
|
|
415
|
-
| `rego_security_audit` | Run regal lint restricted to `security` and `bugs` categories across a directory. Returns severity-grouped findings with remediation guidance.
|
|
416
|
-
| `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`.
|
|
417
|
-
| `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.
|
|
418
|
-
| `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`.
|
|
419
|
-
| `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.
|
|
420
|
-
| `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. Supports `always_true`, `never_true`, and `satisfiable` property kinds. Handles equality, comparison, string built-ins (`startswith`, `endswith`, `contains`, `regex.match`), multi-clause rules, and cross-rule inlining. Reports `INCONCLUSIVE` for negation-as-failure and
|
|
421
|
-
| `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.
|
|
422
|
-
| `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.
|
|
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 minimal patches. |
|
|
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 `security` and `bugs` categories across a directory. Returns severity-grouped findings with remediation guidance. |
|
|
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. Supports `always_true`, `never_true`, and `satisfiable` property kinds. 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. |
|
|
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. |
|
|
423
437
|
|
|
424
438
|
### Category F: Conftest (configuration policy testing)
|
|
425
439
|
|
|
@@ -428,12 +442,12 @@ YAML/JSON/HCL/TOML/INI against Rego policies using
|
|
|
428
442
|
[conftest](https://www.conftest.dev/). Requires `conftest` on `PATH` or
|
|
429
443
|
`CONFTEST_BINARY` set; all four tools return `CONFTEST_NOT_FOUND` otherwise.
|
|
430
444
|
|
|
431
|
-
| Tool | What it does
|
|
432
|
-
| ----------------- |
|
|
433
|
-
| `conftest_test` | Evaluate
|
|
434
|
-
| `conftest_verify` | Run `test_*` rules
|
|
435
|
-
| `conftest_pull` | Pull a policy bundle from an OCI registry or Git repo into a local directory with `conftest pull`. The target directory need not exist; conftest creates it.
|
|
436
|
-
| `conftest_push` | Package a local policy directory as an OCI artifact and push to a registry with `conftest push`. Registry credentials come from the host environment (`docker login`, ORAS keychain, etc.) -- credentials are never passed through tools.
|
|
445
|
+
| Tool | What it does |
|
|
446
|
+
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
447
|
+
| `conftest_test` | Evaluate config files or an inline document against Rego policies with `conftest test`. Per-file, per-namespace results with arrays always present, and a summary that counts files by name. Parser names are a closed set. |
|
|
448
|
+
| `conftest_verify` | Run the `test_*` rules in a conftest policy directory with `conftest verify`. Reports per-rule results and `NO_TESTS_FOUND` when there are none. |
|
|
449
|
+
| `conftest_pull` | Pull a policy bundle from an OCI registry or Git repo into a local directory with `conftest pull`. The target directory need not exist; conftest creates it, and empties it first, so do not point it at one holding anything else. Omitting `policy` uses the conftest default, which must itself sit inside an allowed root. |
|
|
450
|
+
| `conftest_push` | Package a local policy directory as an OCI artifact and push to a registry with `conftest push`. Registry credentials come from the host environment (`docker login`, ORAS keychain, etc.) -- credentials are never passed through tools. |
|
|
437
451
|
|
|
438
452
|
#### Featured: `conftest_test` with inline config
|
|
439
453
|
|
|
@@ -441,7 +455,7 @@ YAML/JSON/HCL/TOML/INI against Rego policies using
|
|
|
441
455
|
// Input
|
|
442
456
|
{
|
|
443
457
|
"inlineConfig": "apiVersion: v1\nkind: Pod\nspec:\n containers:\n - name: app\n image: nginx:latest",
|
|
444
|
-
"inlinePolicy": "package main\ndeny
|
|
458
|
+
"inlinePolicy": "package main\ndeny contains msg if { input.spec.containers[_].image == \"nginx:latest\"; msg := \"pin your image tag\" }"
|
|
445
459
|
}
|
|
446
460
|
|
|
447
461
|
// Output
|
|
@@ -567,18 +581,29 @@ Agent: Done. Policy `rbac` is live on staging at $OPA_URL.
|
|
|
567
581
|
└───────────────────────────────────────────────────────────────────────────────────────┘
|
|
568
582
|
```
|
|
569
583
|
|
|
570
|
-
|
|
584
|
+
Four things worth knowing if you're going to operate this:
|
|
571
585
|
|
|
572
586
|
1. **stdout is the protocol channel.** The server logs to a file via
|
|
573
587
|
`lib/logger.ts` and never writes to stdout. If you see stray stdout
|
|
574
588
|
bytes, the client disconnects; the MCP transport layer is strict.
|
|
575
589
|
2. **No tool throws.** Every tool catches its own exceptions and returns
|
|
576
590
|
a structured `{ ok: false, error: ... }` envelope. The agent sees a
|
|
577
|
-
stable error vocabulary, not a stack trace.
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
`
|
|
581
|
-
|
|
591
|
+
stable error vocabulary, not a stack trace. Decoding subprocess output
|
|
592
|
+
happens inside an async callback, where a throw would bypass those
|
|
593
|
+
handlers entirely, so that path is bounded by bytes rather than left to
|
|
594
|
+
a `try`/`catch` that could not see it.
|
|
595
|
+
3. **Subprocesses are bounded in time, size, and environment.**
|
|
596
|
+
`lib/subprocess.ts` runs the binaries with `shell: false`, a hard
|
|
597
|
+
timeout with `SIGTERM`-then-`SIGKILL` escalation, and a per-stream byte
|
|
598
|
+
cap. There is no path through the server where an agent can construct a
|
|
599
|
+
shell command. The timeout alone is not enough: `opa` buffers a result
|
|
600
|
+
in memory and writes it in one burst at exit, so a command that finishes
|
|
601
|
+
well inside the timeout can still deliver hundreds of megabytes.
|
|
602
|
+
4. **Children do not inherit the server's environment.** `lib/child-env.ts`
|
|
603
|
+
builds an explicit allow-list instead. Rego can read its interpreter's
|
|
604
|
+
environment through `opa.runtime().env`, so anything passed down is
|
|
605
|
+
readable by any policy the server evaluates, the proxy variables on the
|
|
606
|
+
list included.
|
|
582
607
|
|
|
583
608
|
## Security
|
|
584
609
|
|
|
@@ -588,8 +613,22 @@ be exposed on the network.
|
|
|
588
613
|
|
|
589
614
|
- File-based tools refuse to read anything outside `OPA_MCP_ALLOWED_PATHS`.
|
|
590
615
|
When that variable is unset, file tools return `PATH_NOT_ALLOWED`.
|
|
591
|
-
- Subprocesses run with `shell: false
|
|
592
|
-
|
|
616
|
+
- Subprocesses run with `shell: false`, a hard timeout, and a byte cap on
|
|
617
|
+
captured output.
|
|
618
|
+
- **Evaluated policy cannot read the server's environment.** Rego exposes the
|
|
619
|
+
environment of the `opa` process through `opa.runtime().env`, so a child that
|
|
620
|
+
inherited `process.env` would hand `OPA_TOKEN`, `GITHUB_TOKEN`, and every
|
|
621
|
+
other variable to any policy it evaluated. Since `rego_eval` accepts inline
|
|
622
|
+
source, no filesystem access is needed to reach that, which puts it one
|
|
623
|
+
prompt injection away from any untrusted Rego an agent reads. Children get an
|
|
624
|
+
explicit allow-list instead (`lib/child-env.ts`). The list holds no cloud or
|
|
625
|
+
repository token, but it is not free of credentials: `HTTP_PROXY` and its
|
|
626
|
+
siblings are on it, and a proxy URL can embed a username and password.
|
|
627
|
+
They are there because dropping them breaks everyone behind a corporate
|
|
628
|
+
proxy. Name them in `OPA_MCP_BLOCK_ENV` to withhold them anyway.
|
|
629
|
+
`OPA_MCP_PASSTHROUGH_ENV` opts individual variables back in.
|
|
630
|
+
- `OPA_TOKEN` is never echoed in tool responses or log entries, and is not
|
|
631
|
+
passed to any child process.
|
|
593
632
|
- Releases are published with
|
|
594
633
|
[npm provenance](https://docs.npmjs.com/generating-provenance-statements);
|
|
595
634
|
the Docker image is built reproducibly from the committed `Dockerfile`.
|
|
@@ -634,8 +673,9 @@ is not enough -- the spawned server gets a reduced `PATH`. The
|
|
|
634
673
|
[`examples/`](./examples) configs already include these env vars; just
|
|
635
674
|
edit the placeholder paths.
|
|
636
675
|
|
|
637
|
-
This issue does **not** affect the Docker
|
|
638
|
-
|
|
676
|
+
This issue does **not** affect the Docker install path, which bundles
|
|
677
|
+
`opa` and `regal` and bypasses `PATH` entirely. The MCPB bundle resolves
|
|
678
|
+
`opa` from `OPA_BINARY` or `PATH`, so it can hit this.
|
|
639
679
|
|
|
640
680
|
**The server starts, then the client says "disconnected."**
|
|
641
681
|
|
|
@@ -654,12 +694,6 @@ path(s) you want the server to read from, comma-separated.
|
|
|
654
694
|
`OPA_URL` (default `http://localhost:8181`) must point at a running OPA
|
|
655
695
|
server (`opa run --server ...`). Check with `curl $OPA_URL/health`.
|
|
656
696
|
|
|
657
|
-
**Regal "version too old."**
|
|
658
|
-
|
|
659
|
-
We track the current Regal release. If `REGAL_VERSION_TOO_OLD` fires,
|
|
660
|
-
upgrade Regal: `brew upgrade regal` or download from the
|
|
661
|
-
[Regal releases](https://github.com/StyraInc/regal/releases) page.
|
|
662
|
-
|
|
663
697
|
**`directory-package-mismatch` violation when linting inline source.**
|
|
664
698
|
|
|
665
699
|
Since v0.1.1, the server auto-disables this rule for inline-source calls.
|
|
@@ -695,7 +729,7 @@ npm run build # compile to dist/
|
|
|
695
729
|
```
|
|
696
730
|
|
|
697
731
|
CI runs lint, typecheck, build, and unit tests on every push and PR
|
|
698
|
-
across Ubuntu
|
|
732
|
+
across Ubuntu and Windows on Node 20, 22 and 24, plus macOS on Node 22. Integration
|
|
699
733
|
tests run on Linux against pinned `opa` and `regal` releases.
|
|
700
734
|
|
|
701
735
|
For the full contributor workflow (adding tools, naming conventions,
|
|
@@ -716,7 +750,7 @@ Breaking changes will be:
|
|
|
716
750
|
|
|
717
751
|
Pinned versions of the upstream toolchain (`opa` and `regal`) are treated
|
|
718
752
|
as part of the build, not as a dependency the operator manages. The
|
|
719
|
-
Dockerfile
|
|
753
|
+
Dockerfile and CI use the same pin; bumps go through
|
|
720
754
|
Dependabot or a manual PR.
|
|
721
755
|
|
|
722
756
|
## License
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAiC1C,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAiC1C,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAsD/C;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,CAgBxE;AAID,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG;IAC5C,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAMA"}
|
package/dist/cli.js
CHANGED
|
@@ -39,12 +39,17 @@ export function formatHelp(col) {
|
|
|
39
39
|
['OPA_MCP_LOG_FILE', 'log file path', '<tmpdir>/orygn-opa-mcp.log'],
|
|
40
40
|
['OPA_MCP_LOG_LEVEL', 'log level (debug|info|warn|error)', 'info'],
|
|
41
41
|
['OPA_MCP_MAX_RESPONSE_BYTES', 'max response size in bytes', '100000'],
|
|
42
|
+
['OPA_MCP_MAX_SUBPROCESS_BYTES', 'max bytes captured per stream', '33554432'],
|
|
43
|
+
['OPA_MCP_PASSTHROUGH_ENV', 'extra env names to pass to child processes', ''],
|
|
44
|
+
['OPA_MCP_NO_TELEMETRY', 'set to 1 to disable the anonymous startup ping', ''],
|
|
42
45
|
];
|
|
43
|
-
// Pad name to
|
|
46
|
+
// Pad the name to 30 and the description to 40 so the default column lines
|
|
47
|
+
// up. The widest entries are OPA_MCP_MAX_SUBPROCESS_BYTES (28) and its
|
|
48
|
+
// description (39).
|
|
44
49
|
const envLines = rows
|
|
45
50
|
.map(([name, desc, def]) => {
|
|
46
|
-
const namePad = name.padEnd(
|
|
47
|
-
const descPad = desc.padEnd(
|
|
51
|
+
const namePad = name.padEnd(30);
|
|
52
|
+
const descPad = desc.padEnd(40);
|
|
48
53
|
const defStr = def ? `${d('default: ' + def)}` : '';
|
|
49
54
|
return ` ${namePad}${descPad}${defStr}`;
|
|
50
55
|
})
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c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IAC5D,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAClE,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AACpC,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
20
20
|
* default -- file-based tools refuse to read from disk until the
|
|
21
21
|
* operator explicitly opts in via `OPA_MCP_ALLOWED_PATHS`.
|
|
22
22
|
*/
|
|
23
|
-
allowedPaths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
23
|
+
allowedPaths: z.ZodDefault<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
24
24
|
/** Path to the log file. Defaults to OS tmpdir + orygn-opa-mcp.log. */
|
|
25
25
|
logFile: z.ZodDefault<z.ZodString>;
|
|
26
26
|
/** Log level for the file logger. */
|
|
@@ -31,6 +31,16 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
31
31
|
* write to a file path the agent specifies.
|
|
32
32
|
*/
|
|
33
33
|
maxResponseBytes: z.ZodDefault<z.ZodNumber>;
|
|
34
|
+
/**
|
|
35
|
+
* Maximum bytes captured from a subprocess's stdout and stderr, each counted
|
|
36
|
+
* separately. On overflow the stream is clamped and the child is killed.
|
|
37
|
+
*
|
|
38
|
+
* This is a memory bound, distinct from `maxResponseBytes`, which trims the
|
|
39
|
+
* response after the output has already been read into the heap. A capture
|
|
40
|
+
* past V8's max string length cannot be decoded at all, and the throw would
|
|
41
|
+
* land in an async callback where no tool can catch it.
|
|
42
|
+
*/
|
|
43
|
+
maxSubprocessBytes: z.ZodDefault<z.ZodNumber>;
|
|
34
44
|
}, "strip", z.ZodTypeAny, {
|
|
35
45
|
opaUrl: string;
|
|
36
46
|
opaBinary: string;
|
|
@@ -40,8 +50,9 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
40
50
|
httpTimeoutMs: number;
|
|
41
51
|
allowedPaths: string[];
|
|
42
52
|
logFile: string;
|
|
43
|
-
logLevel: "
|
|
53
|
+
logLevel: "error" | "debug" | "info" | "warn";
|
|
44
54
|
maxResponseBytes: number;
|
|
55
|
+
maxSubprocessBytes: number;
|
|
45
56
|
opaToken?: string | undefined;
|
|
46
57
|
}, {
|
|
47
58
|
opaUrl?: string | undefined;
|
|
@@ -53,8 +64,9 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
53
64
|
httpTimeoutMs?: number | undefined;
|
|
54
65
|
allowedPaths?: string[] | undefined;
|
|
55
66
|
logFile?: string | undefined;
|
|
56
|
-
logLevel?: "
|
|
67
|
+
logLevel?: "error" | "debug" | "info" | "warn" | undefined;
|
|
57
68
|
maxResponseBytes?: number | undefined;
|
|
69
|
+
maxSubprocessBytes?: number | undefined;
|
|
58
70
|
}>;
|
|
59
71
|
export type Config = z.infer<typeof ConfigSchema>;
|
|
60
72
|
export declare function loadConfig(): Config;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,QAAA,MAAM,YAAY;IAChB,wEAAwE;;IASxE,2EAA2E;;IAG3E,2DAA2D;;IAG3D,+DAA+D;;IAG/D,qEAAqE;;IAGrE,kEAAkE;;IAQlE,mDAAmD;;IAQnD;;;;;OAKG;;IAcH,uEAAuE;;IAGvE,qCAAqC;;IAGrC;;;;OAIG;;IAGH;;;;;;;;OAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUH,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAyClD,wBAAgB,UAAU,IAAI,MAAM,CAsCnC"}
|