@orygn/opa-mcp 0.1.0 → 0.1.2

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 CHANGED
@@ -5,7 +5,7 @@ All notable changes to `@orygn/opa-mcp` are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- The public surface for the purposes of SemVer is:
8
+ The public surface, for the purposes of SemVer, is:
9
9
 
10
10
  - the set of registered MCP tools, prompts, and resources
11
11
  - the input and output schemas of those tools
@@ -17,67 +17,129 @@ not part of the public surface and may change in minor releases.
17
17
 
18
18
  ## [Unreleased]
19
19
 
20
- ## [0.1.0] initial public release
20
+ ## [0.1.2] - 2026-05-18
21
+
22
+ ### Fixed
23
+
24
+ - `rego_capabilities` with `current: true` or a `version` argument now
25
+ returns only builtin names, a count, future keywords, and features by
26
+ default (`names_only: true`). Previously the full spec payload -- type
27
+ signatures, documentation, and metadata for every builtin -- routinely
28
+ exceeded the 100 KB `maxResponseBytes` cap and returned a useless
29
+ `__truncated` envelope. Pass `names_only: false` to retrieve the
30
+ complete payload when type signatures or documentation are needed.
31
+
32
+ ## [0.1.1] - 2026-05-09
33
+
34
+ ### Fixed
35
+
36
+ - `rego_lint` no longer fires `directory-package-mismatch` as a false
37
+ positive on inline `source`. The rule's verdict depends on the
38
+ on-disk path, but inline source is written to a randomized temp file
39
+ whose path can never match the source's declared package, so the rule
40
+ was guaranteed to fire. It is now auto-disabled when `source` is
41
+ used. Re-enable via the `enable` parameter if your workflow actually
42
+ needs it.
43
+ - `rego_lint` violation locations no longer leak the temp-file path on
44
+ inline source. `location.file` is reported as `<inline>` for
45
+ inline-source calls; row and column are preserved.
46
+
47
+ ### Added
48
+
49
+ - Startup self-check probes the configured `opa` and `regal` binaries
50
+ in the background and writes a warning entry to the log file when
51
+ either is unreachable, with an install-hint pointing at the
52
+ `OPA_BINARY` and `REGAL_BINARY` environment variables. The check is
53
+ fire-and-forget and does not delay the MCP `initialize` handshake.
54
+ Most often hit under Claude Desktop, which spawns MCP servers with a
55
+ reduced PATH on macOS and Windows.
56
+ - `mcpName: "io.github.OrygnsCode/opa-mcp"` in `package.json`. This is
57
+ the npm-side ownership marker the official MCP Registry requires
58
+ before it accepts a published package; it was missing in 0.1.0.
59
+
60
+ ### Changed
61
+
62
+ - README architecture diagram switched from Unicode box-drawing
63
+ characters to plain ASCII (`+`, `-`, `|`) so it renders uniformly on
64
+ npm's web UI; the previous Unicode corners showed visible gaps in
65
+ npm's font.
66
+
67
+ ### Security
68
+
69
+ - Pinned the transitive `hono` dependency to `>= 4.12.18` via a
70
+ `package.json` `overrides` block. This clears three advisories
71
+ (GHSA series for JSX SSR style injection, JWT NumericDate
72
+ validation, and Vary-header handling in cache middleware) reported
73
+ against the version pulled by `@modelcontextprotocol/sdk`. None of
74
+ the affected code paths execute in this server (we run stdio only,
75
+ not the HTTP transport that uses hono), but pinning eliminates the
76
+ `npm audit` noise on user installs.
77
+
78
+ ### Distribution
79
+
80
+ - Listed on the official MCP Registry at
81
+ `io.github.OrygnsCode/opa-mcp`.
82
+
83
+ ## [0.1.0] - initial public release
21
84
 
22
85
  ### Added
23
86
 
24
87
  #### Tools (32)
25
88
 
26
- **Authoring (7)** `rego_format`, `rego_check`, `rego_lint`,
89
+ **Authoring (7).** `rego_format`, `rego_check`, `rego_lint`,
27
90
  `rego_parse_ast`, `rego_inspect`, `rego_capabilities`, `rego_deps`.
28
91
  Operate on Rego source without a running OPA server.
29
92
 
30
- **Evaluation (7)** `rego_eval` plus `_with_explain`, `_with_profile`,
93
+ **Evaluation (7).** `rego_eval` plus `_with_explain`, `_with_profile`,
31
94
  `_with_coverage` variants; `rego_test`, `rego_bench`,
32
95
  `rego_compile_query`. Run policies against inputs with optional
33
96
  trace, profile, and coverage.
34
97
 
35
- **Bundles (2)** `opa_bundle_build`, `opa_bundle_sign`. Build and
98
+ **Bundles (2).** `opa_bundle_build`, `opa_bundle_sign`. Build and
36
99
  sign deployable bundles.
37
100
 
38
- **Server management (12)** `opa_list_policies`, `opa_get_policy`,
101
+ **Server management (12).** `opa_list_policies`, `opa_get_policy`,
39
102
  `opa_put_policy`, `opa_delete_policy`, `opa_get_data`, `opa_put_data`,
40
103
  `opa_patch_data`, `opa_query_decision`, `opa_compile_query`,
41
104
  `opa_health`, `opa_status`, `opa_config`. Manage a running OPA over
42
105
  its REST API.
43
106
 
44
- **Helpers (4)** `rego_explain_decision` produces a structured
107
+ **Helpers (4).** `rego_explain_decision` produces a structured
45
108
  trace and per-rule fired/not-fired summary; `rego_generate_test_skeleton`
46
109
  emits a `*_test.rego` stub from a policy AST; `rego_describe_policy`
47
- returns a structured summary of package / imports / rules;
110
+ returns a structured summary of package, imports, and rules;
48
111
  `rego_suggest_fix` maps known diagnostic codes to mechanical fix
49
112
  suggestions.
50
113
 
51
114
  #### Prompts (3)
52
115
 
53
116
  `policy_authoring_assistant`, `policy_review_checklist`,
54
- `decision_debugging_workflow` workflow templates that direct the
117
+ `decision_debugging_workflow`. Workflow templates that direct the
55
118
  agent through writing, reviewing, or debugging a policy using the
56
119
  tools above.
57
120
 
58
121
  #### Resources (3)
59
122
 
60
- `opa://builtins` categorized OPA builtin function reference,
123
+ `opa://builtins`. Categorized OPA builtin function reference,
61
124
  derived at read time from `opa capabilities --current` and annotated
62
125
  with security-sensitive functions.
63
126
 
64
- `opa://style-guide` condensed Rego style guide covering
127
+ `opa://style-guide`. Condensed Rego style guide covering
65
128
  `rego.v1`, package layout, naming, default-deny, comprehensions vs
66
129
  `every`, schema annotations, and tests.
67
130
 
68
- `opa://patterns` curated pattern library with six worked
131
+ `opa://patterns`. Curated pattern library with six worked
69
132
  examples: RBAC, ABAC, Kubernetes admission, Terraform IaC gates, API
70
133
  authorization, rate limiting. Each pattern includes a working policy,
71
134
  a test, and common pitfalls.
72
135
 
73
136
  #### Distribution
74
137
 
75
- - npm package `@orygn/opa-mcp`
138
+ - npm package `@orygn/opa-mcp`.
76
139
  - 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
140
+ 0.69.0 and `regal` 0.30.0 binaries.
141
+ - MCPB bundle (`opa-mcp.mcpb`) attached to GitHub releases.
142
+ - Smithery descriptor for one-click client installs.
81
143
 
82
144
  #### Configuration
83
145
 
@@ -91,9 +153,11 @@ fail-secure when `OPA_MCP_ALLOWED_PATHS` is unset.
91
153
 
92
154
  50 unit tests (mocked subprocess) plus 20 integration tests
93
155
  (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
156
+ wrappers end-to-end. CI matrix: Ubuntu, macOS, and Windows on Node
157
+ 20 and 22, plus CodeQL security scanning and weekly Dependabot updates
96
158
  for npm, GitHub Actions, and Docker base images.
97
159
 
98
- [Unreleased]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.1.0...HEAD
160
+ [Unreleased]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.1.2...HEAD
161
+ [0.1.2]: https://github.com/OrygnsCode/opa-mcp-server/releases/tag/v0.1.2
162
+ [0.1.1]: https://github.com/OrygnsCode/opa-mcp-server/releases/tag/v0.1.1
99
163
  [0.1.0]: https://github.com/OrygnsCode/opa-mcp-server/releases/tag/v0.1.0
package/README.md CHANGED
@@ -14,15 +14,15 @@ VS Code, Windsurf, Zed, and others) into a first-class
14
14
  environment.
15
15
 
16
16
  ```
17
- ┌────────────────────┐ MCP / stdio ┌─────────────────┐ spawn / HTTP ┌──────────────────┐
18
- Claude · Cursor · ────────────▶ @orygn/opa-mcp ─────────────▶ opa · regal ·
19
- VS Code · ... ◀──────────── ◀───────────── OPA REST API
20
- └────────────────────┘ 32 tools └─────────────────┘ └──────────────────┘
17
+ +--------------------+ MCP / stdio +-----------------+ spawn / HTTP +------------------+
18
+ | Claude · Cursor · | ------------> | @orygn/opa-mcp | -------------> | opa · regal · |
19
+ | VS Code · ... | <------------ | | <------------- | OPA REST API |
20
+ +--------------------+ 32 tools +-----------------+ +------------------+
21
21
  ```
22
22
 
23
- > **Status:** v0.1.0. First stable release. Tool surface, error codes, and
24
- > environment variables follow [SemVer](https://semver.org/) from this
25
- > version forward.
23
+ > **Status:** v0.1.1. Tool surface, error codes, and
24
+ > environment variables follow [SemVer](https://semver.org/) from
25
+ > v0.1.0 forward.
26
26
 
27
27
  ---
28
28
 
@@ -1,5 +1,13 @@
1
1
  import type { Config } from '../config.js';
2
2
  import { type SpawnResult } from './subprocess.js';
3
+ /**
4
+ * Rules whose verdict depends on the on-disk path of the file being
5
+ * linted. When a caller passes inline `source`, the file lives at a
6
+ * randomized temp path that can never match the source's declared
7
+ * package, so these rules always fire as false positives. Auto-disabled
8
+ * for inline source unless the caller explicitly re-enables them.
9
+ */
10
+ export declare const INLINE_SOURCE_FALSE_POSITIVE_RULES: readonly ["directory-package-mismatch"];
3
11
  /** Input for `regal lint`. */
4
12
  export interface LintInput {
5
13
  /** Inline Rego source. Mutually exclusive with `paths`. */
@@ -53,6 +61,12 @@ export declare class RegalCli {
53
61
  * - 0 — no findings at or above `failLevel`
54
62
  * - 3 — findings present
55
63
  * - non-zero other — Regal-internal failure (config error, etc.)
64
+ *
65
+ * When called with inline `source`, location-bound rules whose
66
+ * verdict depends on the on-disk path (currently
67
+ * `directory-package-mismatch`) are auto-disabled because the
68
+ * randomized temp-file path makes those rules false positives.
69
+ * Callers that want them anyway can re-enable via `enable`.
56
70
  */
57
71
  lint(input: LintInput): Promise<SpawnResult>;
58
72
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"regal-cli.d.ts","sourceRoot":"","sources":["../../src/lib/regal-cli.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s/promises';
10
10
  import { tmpdir } from 'node:os';
11
11
  import { join } from 'node:path';
12
12
  import { runBinary } from './subprocess.js';
13
+ /**
14
+ * Rules whose verdict depends on the on-disk path of the file being
15
+ * linted. When a caller passes inline `source`, the file lives at a
16
+ * randomized temp path that can never match the source's declared
17
+ * package, so these rules always fire as false positives. Auto-disabled
18
+ * for inline source unless the caller explicitly re-enables them.
19
+ */
20
+ export const INLINE_SOURCE_FALSE_POSITIVE_RULES = ['directory-package-mismatch'];
13
21
  /**
14
22
  * Wrapper around the local `regal` binary.
15
23
  *
@@ -43,6 +51,12 @@ export class RegalCli {
43
51
  * - 0 — no findings at or above `failLevel`
44
52
  * - 3 — findings present
45
53
  * - non-zero other — Regal-internal failure (config error, etc.)
54
+ *
55
+ * When called with inline `source`, location-bound rules whose
56
+ * verdict depends on the on-disk path (currently
57
+ * `directory-package-mismatch`) are auto-disabled because the
58
+ * randomized temp-file path makes those rules false positives.
59
+ * Callers that want them anyway can re-enable via `enable`.
46
60
  */
47
61
  async lint(input) {
48
62
  if (!input.source && !input.paths?.length) {
@@ -57,9 +71,18 @@ export class RegalCli {
57
71
  args.push('--disable-all');
58
72
  if (input.enableAll)
59
73
  args.push('--enable-all');
60
- for (const rule of input.disable ?? [])
74
+ const userEnable = new Set(input.enable ?? []);
75
+ const userDisable = new Set(input.disable ?? []);
76
+ const effectiveDisable = new Set(userDisable);
77
+ if (input.source !== undefined) {
78
+ for (const rule of INLINE_SOURCE_FALSE_POSITIVE_RULES) {
79
+ if (!userEnable.has(rule))
80
+ effectiveDisable.add(rule);
81
+ }
82
+ }
83
+ for (const rule of effectiveDisable)
61
84
  args.push('--disable', rule);
62
- for (const rule of input.enable ?? [])
85
+ for (const rule of userEnable)
63
86
  args.push('--enable', rule);
64
87
  for (const cat of input.disableCategory ?? [])
65
88
  args.push('--disable-category', cat);
@@ -1 +1 @@
1
- {"version":3,"file":"regal-cli.js","sourceRoot":"","sources":["../../src/lib/regal-cli.ts"],"names":[],"mappings":"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AC,IAAc;QACtB,MAAM,IAAI,GAAoC;YAC5C,IAAI;YACJ,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,mBAAmB;SAC3C,CAAC;QACF,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAED,wEAAwE;IAEhE,KAAK,CAAC,cAAc,CAAI,MAAc,EAAE,EAAgC;QAC9E,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,iBAAiB,UAAU,EAAE,OAAO,CAAC,CAAC;QAClE,MAAM,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;gBAAS,CAAC;YACT,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;CACF"}
package/dist/server.d.ts CHANGED
@@ -3,13 +3,25 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
3
  import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
4
4
  import { type Config } from './config.js';
5
5
  export declare const SERVER_NAME = "orygn-opa-mcp";
6
- export declare const SERVER_VERSION = "0.1.0";
6
+ export declare const SERVER_VERSION = "0.1.2";
7
7
  /**
8
8
  * Construct an `McpServer`, register every tool / prompt / resource
9
9
  * onto it, and return it. Exported for tests so they can drive a
10
10
  * fully-loaded server without standing up a stdio transport.
11
11
  */
12
12
  export declare function buildServer(config: Config): McpServer;
13
+ /**
14
+ * Probe the configured `opa` and `regal` binaries at startup and log
15
+ * warnings if either is unreachable. Runs in the background so it
16
+ * doesn't delay the MCP `initialize` handshake. Most users only see
17
+ * the failure when they call a tool; surfacing it early in the log
18
+ * file gives operators a place to look when diagnosing
19
+ * `OPA_BINARY_NOT_FOUND` (most often caused by Claude Desktop's
20
+ * reduced PATH on macOS and Windows).
21
+ *
22
+ * Exported for tests; production callers don't await it.
23
+ */
24
+ export declare function runStartupSelfCheck(config: Config): Promise<void>;
13
25
  /**
14
26
  * Entry-point flow: load config from env, build the server, connect
15
27
  * to the supplied transport (defaults to stdio for production).
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAYA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAE/E,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAMtD,eAAO,MAAM,WAAW,kBAAkB,CAAC;AAC3C,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAoBrD;AAED;;;;;;;GAOG;AACH,wBAAsB,IAAI,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CASpE"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAYA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAE/E,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAQtD,eAAO,MAAM,WAAW,kBAAkB,CAAC;AAC3C,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAoBrD;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BvE;AAED;;;;;;;GAOG;AACH,wBAAsB,IAAI,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAepE"}
package/dist/server.js CHANGED
@@ -13,11 +13,13 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
13
13
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
14
14
  import { loadConfig } from './config.js';
15
15
  import { initLogger, logger } from './lib/logger.js';
16
+ import { OpaCli } from './lib/opa-cli.js';
17
+ import { RegalCli } from './lib/regal-cli.js';
16
18
  import { registerPrompts } from './prompts/index.js';
17
19
  import { registerResources } from './resources/index.js';
18
20
  import { registerTools } from './tools/index.js';
19
21
  export const SERVER_NAME = 'orygn-opa-mcp';
20
- export const SERVER_VERSION = '0.1.0';
22
+ export const SERVER_VERSION = '0.1.2';
21
23
  /**
22
24
  * Construct an `McpServer`, register every tool / prompt / resource
23
25
  * onto it, and return it. Exported for tests so they can drive a
@@ -40,6 +42,43 @@ export function buildServer(config) {
40
42
  registerResources(server, config);
41
43
  return server;
42
44
  }
45
+ /**
46
+ * Probe the configured `opa` and `regal` binaries at startup and log
47
+ * warnings if either is unreachable. Runs in the background so it
48
+ * doesn't delay the MCP `initialize` handshake. Most users only see
49
+ * the failure when they call a tool; surfacing it early in the log
50
+ * file gives operators a place to look when diagnosing
51
+ * `OPA_BINARY_NOT_FOUND` (most often caused by Claude Desktop's
52
+ * reduced PATH on macOS and Windows).
53
+ *
54
+ * Exported for tests; production callers don't await it.
55
+ */
56
+ export async function runStartupSelfCheck(config) {
57
+ const opa = new OpaCli(config);
58
+ const regal = new RegalCli(config);
59
+ const [opaVersion, regalVersion] = await Promise.all([
60
+ opa.version().catch(() => null),
61
+ regal.version().catch(() => null),
62
+ ]);
63
+ if (opaVersion === null) {
64
+ logger.warn('startup self-check: opa binary not reachable; rego_* tools will fail', {
65
+ opaBinary: config.opaBinary,
66
+ hint: 'set OPA_BINARY to an absolute path, or ensure opa is on PATH for the launching process. Most often hit under Claude Desktop, which spawns servers with a reduced PATH on macOS and Windows.',
67
+ });
68
+ }
69
+ else {
70
+ logger.info('startup self-check: opa OK', { version: opaVersion });
71
+ }
72
+ if (regalVersion === null) {
73
+ logger.warn('startup self-check: regal binary not reachable; rego_lint will return REGAL_NOT_FOUND', {
74
+ regalBinary: config.regalBinary,
75
+ hint: 'set REGAL_BINARY to an absolute path, or ensure regal is on PATH. Regal is optional; only rego_lint requires it.',
76
+ });
77
+ }
78
+ else {
79
+ logger.info('startup self-check: regal OK', { version: regalVersion });
80
+ }
81
+ }
43
82
  /**
44
83
  * Entry-point flow: load config from env, build the server, connect
45
84
  * to the supplied transport (defaults to stdio for production).
@@ -54,6 +93,10 @@ export async function main(transport) {
54
93
  const connectTo = transport ?? new StdioServerTransport();
55
94
  await server.connect(connectTo);
56
95
  logger.info('connected to transport, ready for requests');
96
+ // Fire-and-forget; do not block initialize on subprocess probes.
97
+ void runStartupSelfCheck(config).catch((cause) => {
98
+ logger.error('startup self-check threw unexpectedly', { error: cause });
99
+ });
57
100
  return server;
58
101
  }
59
102
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAGjF,OAAO,EAAE,UAAU,EAAe,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC;AAC3C,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAEt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AAE,CAAC;IACnB,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QAC9B,MAAM,CAAC,KAAK,CAAC,6BAA6B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9D,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -2,6 +2,8 @@ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import type { Config } from '../../config.js';
3
3
  export interface RegoCapabilitiesOutput {
4
4
  builtins?: unknown[];
5
+ builtin_names?: string[];
6
+ builtin_count?: number;
5
7
  future_keywords?: unknown[];
6
8
  features?: unknown[];
7
9
  wasm_abi_versions?: unknown[];
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/tools/authoring/capabilities.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAoB9C,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAkDhF"}
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/tools/authoring/capabilities.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AA2B9C,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAmEhF"}
@@ -18,14 +18,19 @@ const RegoCapabilitiesInput = {
18
18
  .string()
19
19
  .optional()
20
20
  .describe('A specific OPA capabilities version (e.g. "v0.69.0"). When neither flag is set, lists available versions.'),
21
+ names_only: z
22
+ .boolean()
23
+ .optional()
24
+ .default(true)
25
+ .describe('When true (default), return only builtin names, count, future keywords, and features. The full spec payload routinely exceeds client response size limits. Set to false to retrieve complete type signatures, documentation, and metadata for every builtin.'),
21
26
  };
22
27
  export function registerRegoCapabilities(server, config) {
23
28
  const opa = new OpaCli(config);
24
29
  server.registerTool('rego_capabilities', {
25
30
  title: 'OPA capabilities',
26
- description: 'Return OPA capabilities the available builtins, future keywords, features, and WASM ABI versions. With `current: true`, returns the running OPA\'s capabilities. With `version: "v0.69.0"`, returns those of a specific version. With neither, lists available named versions.',
31
+ description: 'Return OPA capabilities -- the available builtins, future keywords, features, and WASM ABI versions. With `current: true`, returns the running OPA\'s capabilities. With `version: "v0.69.0"`, returns those of a specific version. With neither, lists available named versions. By default (`names_only: true`), returns only builtin names and count to stay within response size limits; pass `names_only: false` for full type signatures and documentation.',
27
32
  inputSchema: RegoCapabilitiesInput,
28
- }, async ({ current, version }) => {
33
+ }, async ({ current, version, names_only }) => {
29
34
  return withToolEnvelope(config, async () => {
30
35
  if (current && version) {
31
36
  return err('INVALID_INPUT', 'rego_capabilities accepts at most one of `current` or `version`.');
@@ -35,7 +40,7 @@ export function registerRegoCapabilities(server, config) {
35
40
  if (subprocessFailure)
36
41
  return subprocessFailure;
37
42
  if (result.exitCode !== 0) {
38
- return err('INVALID_INPUT', 'opa capabilities exited non-zero `version` is likely unrecognized.', { details: { stderr: result.stderr.trim(), version } });
43
+ return err('INVALID_INPUT', 'opa capabilities exited non-zero -- `version` is likely unrecognized.', { details: { stderr: result.stderr.trim(), version } });
39
44
  }
40
45
  // When listing versions (no flags), output is a newline-separated
41
46
  // list of names. Otherwise, output is JSON.
@@ -50,6 +55,21 @@ export function registerRegoCapabilities(server, config) {
50
55
  details: { stdout: trimmed },
51
56
  });
52
57
  }
58
+ // names_only defaults to true; treat undefined as true so the default
59
+ // applies even when the MCP SDK's schema validation is bypassed.
60
+ if (names_only !== false) {
61
+ const builtins = parsed.builtins ?? [];
62
+ const builtin_names = builtins
63
+ .map((b) => b.name)
64
+ .filter((n) => typeof n === 'string');
65
+ return ok({
66
+ builtin_names,
67
+ builtin_count: builtin_names.length,
68
+ future_keywords: parsed.future_keywords,
69
+ features: parsed.features,
70
+ wasm_abi_versions: parsed.wasm_abi_versions,
71
+ });
72
+ }
53
73
  return ok(parsed);
54
74
  });
55
75
  });
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../../src/tools/authoring/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAEjG,MAAM,qBAAqB,GAAG;IAC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,aAAa;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CA6DxE"}
1
+ {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../../src/tools/authoring/lint.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAoC9C,UAAU,aAAa;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AA2BD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAiExE"}
@@ -31,11 +31,36 @@ const RegoLintInput = {
31
31
  .describe('Severity at which Regal returns a non-zero exit. Default: `error`.'),
32
32
  ignoreFiles: z.array(z.string()).optional().describe('Glob patterns to skip.'),
33
33
  };
34
+ /**
35
+ * Matches the temp filenames RegalCli writes inline source to. The
36
+ * basename anchor (`$`) is intentional: any path ending in our
37
+ * temp-file pattern is ours, regardless of whether the OS reports it
38
+ * with forward or back slashes or what tmpdir() resolves to.
39
+ */
40
+ const INLINE_TEMP_PATH = /orygn-opa-mcp-[0-9a-f-]+\.rego$/i;
41
+ /**
42
+ * Replace the leaking temp-file path in violation locations with
43
+ * `<inline>` when the call used inline source, so users see "this came
44
+ * from your inline source" instead of `/tmp/...orygn-opa-mcp-<uuid>.rego`.
45
+ * Returns a new array; the input is not mutated.
46
+ */
47
+ function rewriteInlineLocations(violations) {
48
+ return violations.map((violation) => {
49
+ const loc = violation.location;
50
+ if (!loc || typeof loc !== 'object')
51
+ return violation;
52
+ const locObj = loc;
53
+ const file = locObj['file'];
54
+ if (typeof file !== 'string' || !INLINE_TEMP_PATH.test(file))
55
+ return violation;
56
+ return { ...violation, location: { ...locObj, file: '<inline>' } };
57
+ });
58
+ }
34
59
  export function registerRegoLint(server, config) {
35
60
  const regal = new RegalCli(config);
36
61
  server.registerTool('rego_lint', {
37
62
  title: 'Lint Rego',
38
- description: 'Lint Rego source with the Regal linter. Returns categorized violations (style, bugs, idiomatic, performance) with file/line locations. Requires `regal` on PATH or `REGAL_BINARY` set; returns REGAL_NOT_FOUND otherwise. When called with inline `source` rather than `paths`, expect location-bound rules such as `directory-package-mismatch` to fire as artifacts of the randomized temp-file path. Prefer `paths` for canonical signal; for inline workflows, ignore or `disable` those rules.',
63
+ description: 'Lint Rego source with the Regal linter. Returns categorized violations (style, bugs, idiomatic, performance) with file/line locations. Requires `regal` on PATH or `REGAL_BINARY` set; returns REGAL_NOT_FOUND otherwise. When called with inline `source`, location-bound rules whose verdict depends on the on-disk path (`directory-package-mismatch`) are auto-disabled to avoid temp-file false positives, and `location.file` is reported as `<inline>` instead of the randomized temp path. Re-enable those rules via `enable` if your workflow actually needs them.',
39
64
  inputSchema: RegoLintInput,
40
65
  }, async (input) => {
41
66
  return withToolEnvelope(config, async () => {
@@ -73,8 +98,10 @@ export function registerRegoLint(server, config) {
73
98
  details: { stderr: result.stderr.trim(), exitCode: result.exitCode },
74
99
  });
75
100
  }
101
+ const rawViolations = parsed.violations ?? [];
102
+ const violations = source !== undefined ? rewriteInlineLocations(rawViolations) : rawViolations;
76
103
  return ok({
77
- violations: parsed.violations ?? [],
104
+ violations,
78
105
  notices: parsed.notices,
79
106
  summary: parsed.summary,
80
107
  });
@@ -1 +1 @@
1
- {"version":3,"file":"lint.js","sourceRoot":"","sources":["../../../src/tools/authoring/lint.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,aAAa,EACb,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,aAAa,GAAG;IACpB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sDAAsD,CAAC;IAC9F,KAAK,EAAE,CAAC;SACL,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,EAAE;SACV,QAAQ,CACP,6FAA6F,CAC9F;IACH,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,sEAAsE,CAAC;IACnF,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IACjF,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ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,MAAM,EAAE,CAAC;gBACZ,OAAO,GAAG,CAAC,eAAe,EAAE,+CAA+C,EAAE;oBAC3E,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE;iBACrE,CAAC,CAAC;YACL,CAAC;YAED,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;YAC9C,MAAM,UAAU,GACd,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;YAE/E,OAAO,EAAE,CAAiB;gBACxB,UAAU;gBACV,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,OAAO,EAAE,MAAM,CAAC,OAAO;aACxB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@orygn/opa-mcp",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
+ "mcpName": "io.github.OrygnsCode/opa-mcp",
4
5
  "description": "Model Context Protocol server for Open Policy Agent (OPA). Author, validate, debug, and explain Rego policies through any MCP-compatible client.",
5
6
  "type": "module",
6
7
  "license": "MIT",
@@ -82,5 +83,8 @@
82
83
  "publishConfig": {
83
84
  "access": "public",
84
85
  "provenance": true
86
+ },
87
+ "overrides": {
88
+ "hono": ">=4.12.18"
85
89
  }
86
90
  }