@orygn/opa-mcp 0.0.0 → 0.1.1

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.
Files changed (184) hide show
  1. package/CHANGELOG.md +150 -0
  2. package/LICENSE +21 -0
  3. package/README.md +622 -2
  4. package/dist/config.d.ts +58 -0
  5. package/dist/config.d.ts.map +1 -0
  6. package/dist/config.js +72 -0
  7. package/dist/config.js.map +1 -0
  8. package/dist/lib/errors.d.ts +18 -0
  9. package/dist/lib/errors.d.ts.map +1 -0
  10. package/dist/lib/errors.js +25 -0
  11. package/dist/lib/errors.js.map +1 -0
  12. package/dist/lib/logger.d.ts +10 -0
  13. package/dist/lib/logger.d.ts.map +1 -0
  14. package/dist/lib/logger.js +57 -0
  15. package/dist/lib/logger.js.map +1 -0
  16. package/dist/lib/opa-cli.d.ts +226 -0
  17. package/dist/lib/opa-cli.d.ts.map +1 -0
  18. package/dist/lib/opa-cli.js +283 -0
  19. package/dist/lib/opa-cli.js.map +1 -0
  20. package/dist/lib/opa-client.d.ts +47 -0
  21. package/dist/lib/opa-client.d.ts.map +1 -0
  22. package/dist/lib/opa-client.js +101 -0
  23. package/dist/lib/opa-client.js.map +1 -0
  24. package/dist/lib/output.d.ts +17 -0
  25. package/dist/lib/output.d.ts.map +1 -0
  26. package/dist/lib/output.js +21 -0
  27. package/dist/lib/output.js.map +1 -0
  28. package/dist/lib/regal-cli.d.ts +79 -0
  29. package/dist/lib/regal-cli.d.ts.map +1 -0
  30. package/dist/lib/regal-cli.js +122 -0
  31. package/dist/lib/regal-cli.js.map +1 -0
  32. package/dist/lib/security.d.ts +16 -0
  33. package/dist/lib/security.d.ts.map +1 -0
  34. package/dist/lib/security.js +64 -0
  35. package/dist/lib/security.js.map +1 -0
  36. package/dist/lib/subprocess.d.ts +26 -0
  37. package/dist/lib/subprocess.d.ts.map +1 -0
  38. package/dist/lib/subprocess.js +72 -0
  39. package/dist/lib/subprocess.js.map +1 -0
  40. package/dist/lib/tool-helpers.d.ts +46 -0
  41. package/dist/lib/tool-helpers.d.ts.map +1 -0
  42. package/dist/lib/tool-helpers.js +73 -0
  43. package/dist/lib/tool-helpers.js.map +1 -0
  44. package/dist/prompts/index.d.ts +4 -0
  45. package/dist/prompts/index.d.ts.map +1 -0
  46. package/dist/prompts/index.js +147 -0
  47. package/dist/prompts/index.js.map +1 -0
  48. package/dist/resources/index.d.ts +12 -0
  49. package/dist/resources/index.d.ts.map +1 -0
  50. package/dist/resources/index.js +107 -0
  51. package/dist/resources/index.js.map +1 -0
  52. package/dist/resources/patterns.d.ts +9 -0
  53. package/dist/resources/patterns.d.ts.map +1 -0
  54. package/dist/resources/patterns.js +375 -0
  55. package/dist/resources/patterns.js.map +1 -0
  56. package/dist/resources/style-guide.d.ts +6 -0
  57. package/dist/resources/style-guide.d.ts.map +1 -0
  58. package/dist/resources/style-guide.js +187 -0
  59. package/dist/resources/style-guide.js.map +1 -0
  60. package/dist/server.d.ts +34 -0
  61. package/dist/server.d.ts.map +1 -0
  62. package/dist/server.js +125 -0
  63. package/dist/server.js.map +1 -0
  64. package/dist/tools/authoring/capabilities.d.ts +11 -0
  65. package/dist/tools/authoring/capabilities.d.ts.map +1 -0
  66. package/dist/tools/authoring/capabilities.js +57 -0
  67. package/dist/tools/authoring/capabilities.js.map +1 -0
  68. package/dist/tools/authoring/check.d.ts +18 -0
  69. package/dist/tools/authoring/check.d.ts.map +1 -0
  70. package/dist/tools/authoring/check.js +71 -0
  71. package/dist/tools/authoring/check.js.map +1 -0
  72. package/dist/tools/authoring/deps.d.ts +8 -0
  73. package/dist/tools/authoring/deps.d.ts.map +1 -0
  74. package/dist/tools/authoring/deps.js +51 -0
  75. package/dist/tools/authoring/deps.js.map +1 -0
  76. package/dist/tools/authoring/format.d.ts +8 -0
  77. package/dist/tools/authoring/format.d.ts.map +1 -0
  78. package/dist/tools/authoring/format.js +44 -0
  79. package/dist/tools/authoring/format.js.map +1 -0
  80. package/dist/tools/authoring/index.d.ts +11 -0
  81. package/dist/tools/authoring/index.d.ts.map +1 -0
  82. package/dist/tools/authoring/index.js +17 -0
  83. package/dist/tools/authoring/index.js.map +1 -0
  84. package/dist/tools/authoring/inspect.d.ts +10 -0
  85. package/dist/tools/authoring/inspect.d.ts.map +1 -0
  86. package/dist/tools/authoring/inspect.js +47 -0
  87. package/dist/tools/authoring/inspect.js.map +1 -0
  88. package/dist/tools/authoring/lint.d.ts +18 -0
  89. package/dist/tools/authoring/lint.d.ts.map +1 -0
  90. package/dist/tools/authoring/lint.js +111 -0
  91. package/dist/tools/authoring/lint.js.map +1 -0
  92. package/dist/tools/authoring/parse.d.ts +7 -0
  93. package/dist/tools/authoring/parse.d.ts.map +1 -0
  94. package/dist/tools/authoring/parse.js +43 -0
  95. package/dist/tools/authoring/parse.js.map +1 -0
  96. package/dist/tools/bundles/build.d.ts +8 -0
  97. package/dist/tools/bundles/build.d.ts.map +1 -0
  98. package/dist/tools/bundles/build.js +87 -0
  99. package/dist/tools/bundles/build.js.map +1 -0
  100. package/dist/tools/bundles/index.d.ts +10 -0
  101. package/dist/tools/bundles/index.d.ts.map +1 -0
  102. package/dist/tools/bundles/index.js +7 -0
  103. package/dist/tools/bundles/index.js.map +1 -0
  104. package/dist/tools/bundles/sign.d.ts +8 -0
  105. package/dist/tools/bundles/sign.d.ts.map +1 -0
  106. package/dist/tools/bundles/sign.js +47 -0
  107. package/dist/tools/bundles/sign.js.map +1 -0
  108. package/dist/tools/evaluation/_shared.d.ts +55 -0
  109. package/dist/tools/evaluation/_shared.d.ts.map +1 -0
  110. package/dist/tools/evaluation/_shared.js +102 -0
  111. package/dist/tools/evaluation/_shared.js.map +1 -0
  112. package/dist/tools/evaluation/bench.d.ts +9 -0
  113. package/dist/tools/evaluation/bench.d.ts.map +1 -0
  114. package/dist/tools/evaluation/bench.js +76 -0
  115. package/dist/tools/evaluation/bench.js.map +1 -0
  116. package/dist/tools/evaluation/compile.d.ts +11 -0
  117. package/dist/tools/evaluation/compile.d.ts.map +1 -0
  118. package/dist/tools/evaluation/compile.js +19 -0
  119. package/dist/tools/evaluation/compile.js.map +1 -0
  120. package/dist/tools/evaluation/eval.d.ts +10 -0
  121. package/dist/tools/evaluation/eval.d.ts.map +1 -0
  122. package/dist/tools/evaluation/eval.js +35 -0
  123. package/dist/tools/evaluation/eval.js.map +1 -0
  124. package/dist/tools/evaluation/index.d.ts +11 -0
  125. package/dist/tools/evaluation/index.d.ts.map +1 -0
  126. package/dist/tools/evaluation/index.js +11 -0
  127. package/dist/tools/evaluation/index.js.map +1 -0
  128. package/dist/tools/evaluation/test.d.ts +28 -0
  129. package/dist/tools/evaluation/test.d.ts.map +1 -0
  130. package/dist/tools/evaluation/test.js +74 -0
  131. package/dist/tools/evaluation/test.js.map +1 -0
  132. package/dist/tools/helpers/describe-policy.d.ts +26 -0
  133. package/dist/tools/helpers/describe-policy.d.ts.map +1 -0
  134. package/dist/tools/helpers/describe-policy.js +76 -0
  135. package/dist/tools/helpers/describe-policy.js.map +1 -0
  136. package/dist/tools/helpers/explain-decision.d.ts +41 -0
  137. package/dist/tools/helpers/explain-decision.d.ts.map +1 -0
  138. package/dist/tools/helpers/explain-decision.js +75 -0
  139. package/dist/tools/helpers/explain-decision.js.map +1 -0
  140. package/dist/tools/helpers/generate-test-skeleton.d.ts +8 -0
  141. package/dist/tools/helpers/generate-test-skeleton.d.ts.map +1 -0
  142. package/dist/tools/helpers/generate-test-skeleton.js +93 -0
  143. package/dist/tools/helpers/generate-test-skeleton.js.map +1 -0
  144. package/dist/tools/helpers/index.d.ts +12 -0
  145. package/dist/tools/helpers/index.d.ts.map +1 -0
  146. package/dist/tools/helpers/index.js +11 -0
  147. package/dist/tools/helpers/index.js.map +1 -0
  148. package/dist/tools/helpers/suggest-fix.d.ts +15 -0
  149. package/dist/tools/helpers/suggest-fix.d.ts.map +1 -0
  150. package/dist/tools/helpers/suggest-fix.js +119 -0
  151. package/dist/tools/helpers/suggest-fix.js.map +1 -0
  152. package/dist/tools/index.d.ts +31 -0
  153. package/dist/tools/index.d.ts.map +1 -0
  154. package/dist/tools/index.js +13 -0
  155. package/dist/tools/index.js.map +1 -0
  156. package/dist/tools/server-management/_shared.d.ts +9 -0
  157. package/dist/tools/server-management/_shared.d.ts.map +1 -0
  158. package/dist/tools/server-management/_shared.js +41 -0
  159. package/dist/tools/server-management/_shared.js.map +1 -0
  160. package/dist/tools/server-management/data.d.ts +4 -0
  161. package/dist/tools/server-management/data.d.ts.map +1 -0
  162. package/dist/tools/server-management/data.js +90 -0
  163. package/dist/tools/server-management/data.js.map +1 -0
  164. package/dist/tools/server-management/decisions.d.ts +4 -0
  165. package/dist/tools/server-management/decisions.d.ts.map +1 -0
  166. package/dist/tools/server-management/decisions.js +87 -0
  167. package/dist/tools/server-management/decisions.js.map +1 -0
  168. package/dist/tools/server-management/index.d.ts +11 -0
  169. package/dist/tools/server-management/index.d.ts.map +1 -0
  170. package/dist/tools/server-management/index.js +11 -0
  171. package/dist/tools/server-management/index.js.map +1 -0
  172. package/dist/tools/server-management/policies.d.ts +4 -0
  173. package/dist/tools/server-management/policies.d.ts.map +1 -0
  174. package/dist/tools/server-management/policies.js +94 -0
  175. package/dist/tools/server-management/policies.js.map +1 -0
  176. package/dist/tools/server-management/status.d.ts +4 -0
  177. package/dist/tools/server-management/status.d.ts.map +1 -0
  178. package/dist/tools/server-management/status.js +82 -0
  179. package/dist/tools/server-management/status.js.map +1 -0
  180. package/dist/types.d.ts +24 -0
  181. package/dist/types.d.ts.map +1 -0
  182. package/dist/types.js +5 -0
  183. package/dist/types.js.map +1 -0
  184. package/package.json +86 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,150 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@orygn/opa-mcp` are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ The public surface, for the purposes of SemVer, is:
9
+
10
+ - the set of registered MCP tools, prompts, and resources
11
+ - the input and output schemas of those tools
12
+ - the set of recognized environment variables
13
+ - the CLI entry point (`opa-mcp`) and its supported flags
14
+
15
+ Internal helpers (`src/lib/**`), type names not re-exported, and log formats are
16
+ not part of the public surface and may change in minor releases.
17
+
18
+ ## [Unreleased]
19
+
20
+ ## [0.1.1] - 2026-05-09
21
+
22
+ ### Fixed
23
+
24
+ - `rego_lint` no longer fires `directory-package-mismatch` as a false
25
+ positive on inline `source`. The rule's verdict depends on the
26
+ on-disk path, but inline source is written to a randomized temp file
27
+ whose path can never match the source's declared package, so the rule
28
+ was guaranteed to fire. It is now auto-disabled when `source` is
29
+ used. Re-enable via the `enable` parameter if your workflow actually
30
+ needs it.
31
+ - `rego_lint` violation locations no longer leak the temp-file path on
32
+ inline source. `location.file` is reported as `<inline>` for
33
+ inline-source calls; row and column are preserved.
34
+
35
+ ### Added
36
+
37
+ - Startup self-check probes the configured `opa` and `regal` binaries
38
+ in the background and writes a warning entry to the log file when
39
+ either is unreachable, with an install-hint pointing at the
40
+ `OPA_BINARY` and `REGAL_BINARY` environment variables. The check is
41
+ fire-and-forget and does not delay the MCP `initialize` handshake.
42
+ Most often hit under Claude Desktop, which spawns MCP servers with a
43
+ reduced PATH on macOS and Windows.
44
+ - `mcpName: "io.github.OrygnsCode/opa-mcp"` in `package.json`. This is
45
+ the npm-side ownership marker the official MCP Registry requires
46
+ before it accepts a published package; it was missing in 0.1.0.
47
+
48
+ ### Changed
49
+
50
+ - README architecture diagram switched from Unicode box-drawing
51
+ characters to plain ASCII (`+`, `-`, `|`) so it renders uniformly on
52
+ npm's web UI; the previous Unicode corners showed visible gaps in
53
+ npm's font.
54
+
55
+ ### Security
56
+
57
+ - Pinned the transitive `hono` dependency to `>= 4.12.18` via a
58
+ `package.json` `overrides` block. This clears three advisories
59
+ (GHSA series for JSX SSR style injection, JWT NumericDate
60
+ validation, and Vary-header handling in cache middleware) reported
61
+ against the version pulled by `@modelcontextprotocol/sdk`. None of
62
+ the affected code paths execute in this server (we run stdio only,
63
+ not the HTTP transport that uses hono), but pinning eliminates the
64
+ `npm audit` noise on user installs.
65
+
66
+ ### Distribution
67
+
68
+ - Listed on the official MCP Registry at
69
+ `io.github.OrygnsCode/opa-mcp`.
70
+
71
+ ## [0.1.0] - initial public release
72
+
73
+ ### Added
74
+
75
+ #### Tools (32)
76
+
77
+ **Authoring (7).** `rego_format`, `rego_check`, `rego_lint`,
78
+ `rego_parse_ast`, `rego_inspect`, `rego_capabilities`, `rego_deps`.
79
+ Operate on Rego source without a running OPA server.
80
+
81
+ **Evaluation (7).** `rego_eval` plus `_with_explain`, `_with_profile`,
82
+ `_with_coverage` variants; `rego_test`, `rego_bench`,
83
+ `rego_compile_query`. Run policies against inputs with optional
84
+ trace, profile, and coverage.
85
+
86
+ **Bundles (2).** `opa_bundle_build`, `opa_bundle_sign`. Build and
87
+ sign deployable bundles.
88
+
89
+ **Server management (12).** `opa_list_policies`, `opa_get_policy`,
90
+ `opa_put_policy`, `opa_delete_policy`, `opa_get_data`, `opa_put_data`,
91
+ `opa_patch_data`, `opa_query_decision`, `opa_compile_query`,
92
+ `opa_health`, `opa_status`, `opa_config`. Manage a running OPA over
93
+ its REST API.
94
+
95
+ **Helpers (4).** `rego_explain_decision` produces a structured
96
+ trace and per-rule fired/not-fired summary; `rego_generate_test_skeleton`
97
+ emits a `*_test.rego` stub from a policy AST; `rego_describe_policy`
98
+ returns a structured summary of package, imports, and rules;
99
+ `rego_suggest_fix` maps known diagnostic codes to mechanical fix
100
+ suggestions.
101
+
102
+ #### Prompts (3)
103
+
104
+ `policy_authoring_assistant`, `policy_review_checklist`,
105
+ `decision_debugging_workflow`. Workflow templates that direct the
106
+ agent through writing, reviewing, or debugging a policy using the
107
+ tools above.
108
+
109
+ #### Resources (3)
110
+
111
+ `opa://builtins`. Categorized OPA builtin function reference,
112
+ derived at read time from `opa capabilities --current` and annotated
113
+ with security-sensitive functions.
114
+
115
+ `opa://style-guide`. Condensed Rego style guide covering
116
+ `rego.v1`, package layout, naming, default-deny, comprehensions vs
117
+ `every`, schema annotations, and tests.
118
+
119
+ `opa://patterns`. Curated pattern library with six worked
120
+ examples: RBAC, ABAC, Kubernetes admission, Terraform IaC gates, API
121
+ authorization, rate limiting. Each pattern includes a working policy,
122
+ a test, and common pitfalls.
123
+
124
+ #### Distribution
125
+
126
+ - npm package `@orygn/opa-mcp`.
127
+ - Multi-arch Docker image `orygn/opa-mcp` bundling pinned `opa`
128
+ 0.69.0 and `regal` 0.30.0 binaries.
129
+ - MCPB bundle (`opa-mcp.mcpb`) attached to GitHub releases.
130
+ - Smithery descriptor for one-click client installs.
131
+
132
+ #### Configuration
133
+
134
+ Environment variables: `OPA_URL`, `OPA_TOKEN`, `OPA_BINARY`,
135
+ `REGAL_BINARY`, `OPA_MCP_ALLOWED_PATHS`, `OPA_MCP_LOG_FILE`,
136
+ `OPA_MCP_LOG_LEVEL`, `OPA_MCP_MAX_RESPONSE_BYTES`,
137
+ `OPA_MCP_TIMEOUT_MS`, `OPA_MCP_HTTP_TIMEOUT_MS`. File-based tools
138
+ fail-secure when `OPA_MCP_ALLOWED_PATHS` is unset.
139
+
140
+ #### Testing
141
+
142
+ 50 unit tests (mocked subprocess) plus 20 integration tests
143
+ (real `opa` 0.69.0 and `regal` 0.30.0 binaries) covering both CLI
144
+ wrappers end-to-end. CI matrix: Ubuntu, macOS, and Windows on Node
145
+ 20 and 22, plus CodeQL security scanning and weekly Dependabot updates
146
+ for npm, GitHub Actions, and Docker base images.
147
+
148
+ [Unreleased]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.1.1...HEAD
149
+ [0.1.1]: https://github.com/OrygnsCode/opa-mcp-server/releases/tag/v0.1.1
150
+ [0.1.0]: https://github.com/OrygnsCode/opa-mcp-server/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Orygn LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.