@orygn/opa-mcp 0.0.0 → 0.1.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.
Files changed (184) hide show
  1. package/CHANGELOG.md +99 -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 +65 -0
  29. package/dist/lib/regal-cli.d.ts.map +1 -0
  30. package/dist/lib/regal-cli.js +99 -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 +22 -0
  61. package/dist/server.d.ts.map +1 -0
  62. package/dist/server.js +82 -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 +84 -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 +82 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,99 @@
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.0] — initial public release
21
+
22
+ ### Added
23
+
24
+ #### Tools (32)
25
+
26
+ **Authoring (7)** — `rego_format`, `rego_check`, `rego_lint`,
27
+ `rego_parse_ast`, `rego_inspect`, `rego_capabilities`, `rego_deps`.
28
+ Operate on Rego source without a running OPA server.
29
+
30
+ **Evaluation (7)** — `rego_eval` plus `_with_explain`, `_with_profile`,
31
+ `_with_coverage` variants; `rego_test`, `rego_bench`,
32
+ `rego_compile_query`. Run policies against inputs with optional
33
+ trace, profile, and coverage.
34
+
35
+ **Bundles (2)** — `opa_bundle_build`, `opa_bundle_sign`. Build and
36
+ sign deployable bundles.
37
+
38
+ **Server management (12)** — `opa_list_policies`, `opa_get_policy`,
39
+ `opa_put_policy`, `opa_delete_policy`, `opa_get_data`, `opa_put_data`,
40
+ `opa_patch_data`, `opa_query_decision`, `opa_compile_query`,
41
+ `opa_health`, `opa_status`, `opa_config`. Manage a running OPA over
42
+ its REST API.
43
+
44
+ **Helpers (4)** — `rego_explain_decision` produces a structured
45
+ trace and per-rule fired/not-fired summary; `rego_generate_test_skeleton`
46
+ emits a `*_test.rego` stub from a policy AST; `rego_describe_policy`
47
+ returns a structured summary of package / imports / rules;
48
+ `rego_suggest_fix` maps known diagnostic codes to mechanical fix
49
+ suggestions.
50
+
51
+ #### Prompts (3)
52
+
53
+ `policy_authoring_assistant`, `policy_review_checklist`,
54
+ `decision_debugging_workflow` — workflow templates that direct the
55
+ agent through writing, reviewing, or debugging a policy using the
56
+ tools above.
57
+
58
+ #### Resources (3)
59
+
60
+ `opa://builtins` — categorized OPA builtin function reference,
61
+ derived at read time from `opa capabilities --current` and annotated
62
+ with security-sensitive functions.
63
+
64
+ `opa://style-guide` — condensed Rego style guide covering
65
+ `rego.v1`, package layout, naming, default-deny, comprehensions vs
66
+ `every`, schema annotations, and tests.
67
+
68
+ `opa://patterns` — curated pattern library with six worked
69
+ examples: RBAC, ABAC, Kubernetes admission, Terraform IaC gates, API
70
+ authorization, rate limiting. Each pattern includes a working policy,
71
+ a test, and common pitfalls.
72
+
73
+ #### Distribution
74
+
75
+ - npm package `@orygn/opa-mcp`
76
+ - Multi-arch Docker image `orygn/opa-mcp` bundling pinned `opa`
77
+ 0.69.0 and `regal` 0.30.0 binaries
78
+ - MCPB bundle (`opa-mcp.mcpb`) attached to GitHub releases
79
+ - MCP registry entry under `io.github.orygnscode/opa-mcp`
80
+ - Smithery descriptor for one-click client installs
81
+
82
+ #### Configuration
83
+
84
+ Environment variables: `OPA_URL`, `OPA_TOKEN`, `OPA_BINARY`,
85
+ `REGAL_BINARY`, `OPA_MCP_ALLOWED_PATHS`, `OPA_MCP_LOG_FILE`,
86
+ `OPA_MCP_LOG_LEVEL`, `OPA_MCP_MAX_RESPONSE_BYTES`,
87
+ `OPA_MCP_TIMEOUT_MS`, `OPA_MCP_HTTP_TIMEOUT_MS`. File-based tools
88
+ fail-secure when `OPA_MCP_ALLOWED_PATHS` is unset.
89
+
90
+ #### Testing
91
+
92
+ 50 unit tests (mocked subprocess) plus 20 integration tests
93
+ (real `opa` 0.69.0 and `regal` 0.30.0 binaries) covering both CLI
94
+ wrappers end-to-end. CI matrix: Ubuntu / macOS / Windows on Node 20
95
+ and 22, plus CodeQL security scanning and weekly Dependabot updates
96
+ for npm, GitHub Actions, and Docker base images.
97
+
98
+ [Unreleased]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.1.0...HEAD
99
+ [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.