circle-ir-ai 4.16.5 → 4.18.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 +71 -8
- package/README.md +24 -0
- package/dist/mcp/analysis.d.ts +25 -0
- package/dist/mcp/analysis.d.ts.map +1 -0
- package/dist/mcp/analysis.js +45 -0
- package/dist/mcp/analysis.js.map +1 -0
- package/dist/mcp/index.d.ts +24 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +67 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/mappers.d.ts +41 -0
- package/dist/mcp/mappers.d.ts.map +1 -0
- package/dist/mcp/mappers.js +69 -0
- package/dist/mcp/mappers.js.map +1 -0
- package/dist/mcp/result.d.ts +59 -0
- package/dist/mcp/result.d.ts.map +1 -0
- package/dist/mcp/result.js +60 -0
- package/dist/mcp/result.js.map +1 -0
- package/dist/mcp/tools/check-license-compliance.d.ts +11 -0
- package/dist/mcp/tools/check-license-compliance.d.ts.map +1 -0
- package/dist/mcp/tools/check-license-compliance.js +126 -0
- package/dist/mcp/tools/check-license-compliance.js.map +1 -0
- package/dist/mcp/tools/find-credential-exposure.d.ts +20 -0
- package/dist/mcp/tools/find-credential-exposure.d.ts.map +1 -0
- package/dist/mcp/tools/find-credential-exposure.js +207 -0
- package/dist/mcp/tools/find-credential-exposure.js.map +1 -0
- package/dist/mcp/tools/find-excessive-permissions.d.ts +16 -0
- package/dist/mcp/tools/find-excessive-permissions.d.ts.map +1 -0
- package/dist/mcp/tools/find-excessive-permissions.js +145 -0
- package/dist/mcp/tools/find-excessive-permissions.js.map +1 -0
- package/dist/mcp/tools/find-install-script-risk.d.ts +11 -0
- package/dist/mcp/tools/find-install-script-risk.d.ts.map +1 -0
- package/dist/mcp/tools/find-install-script-risk.js +116 -0
- package/dist/mcp/tools/find-install-script-risk.js.map +1 -0
- package/dist/mcp/tools/find-pattern.d.ts +13 -0
- package/dist/mcp/tools/find-pattern.d.ts.map +1 -0
- package/dist/mcp/tools/find-pattern.js +115 -0
- package/dist/mcp/tools/find-pattern.js.map +1 -0
- package/dist/mcp/tools/find-spec-drift.d.ts +10 -0
- package/dist/mcp/tools/find-spec-drift.d.ts.map +1 -0
- package/dist/mcp/tools/find-spec-drift.js +42 -0
- package/dist/mcp/tools/find-spec-drift.js.map +1 -0
- package/dist/mcp/tools/find-stale-dependencies.d.ts +14 -0
- package/dist/mcp/tools/find-stale-dependencies.d.ts.map +1 -0
- package/dist/mcp/tools/find-stale-dependencies.js +178 -0
- package/dist/mcp/tools/find-stale-dependencies.js.map +1 -0
- package/dist/mcp/tools/find-typosquats.d.ts +11 -0
- package/dist/mcp/tools/find-typosquats.d.ts.map +1 -0
- package/dist/mcp/tools/find-typosquats.js +142 -0
- package/dist/mcp/tools/find-typosquats.js.map +1 -0
- package/dist/mcp/tools/layer-bom.d.ts +15 -0
- package/dist/mcp/tools/layer-bom.d.ts.map +1 -0
- package/dist/mcp/tools/layer-bom.js +99 -0
- package/dist/mcp/tools/layer-bom.js.map +1 -0
- package/dist/mcp/tools/verify-spec-conformance.d.ts +9 -0
- package/dist/mcp/tools/verify-spec-conformance.d.ts.map +1 -0
- package/dist/mcp/tools/verify-spec-conformance.js +48 -0
- package/dist/mcp/tools/verify-spec-conformance.js.map +1 -0
- package/dist/mcp/types.d.ts +36 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +17 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/mcp/walk.d.ts +33 -0
- package/dist/mcp/walk.d.ts.map +1 -0
- package/dist/mcp/walk.js +83 -0
- package/dist/mcp/walk.js.map +1 -0
- package/dist/secret-scan/scanner.d.ts +7 -0
- package/dist/secret-scan/scanner.d.ts.map +1 -1
- package/dist/secret-scan/scanner.js +1 -1
- package/dist/secret-scan/scanner.js.map +1 -1
- package/package.json +18 -2
- package/dist/coverage/index.d.ts +0 -50
- package/dist/coverage/index.d.ts.map +0 -1
- package/dist/coverage/index.js +0 -73
- package/dist/coverage/index.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,64 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Added
|
|
11
|
+
- **The ten MCP tools declare annotations** (4.18.0), each measured before it was written down.
|
|
12
|
+
All ten are `readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`: none writes,
|
|
13
|
+
changes or deletes a file in the project, the working directory, the home directory or the temp
|
|
14
|
+
directory. Seven are `openWorldHint: false` and open no connection at all. Three are
|
|
15
|
+
`openWorldHint: true`, because they can leave the machine: `find_stale_dependencies` (the npm
|
|
16
|
+
registry, and the OSV database unless `check_vulnerabilities` is off), `find_typosquats` (npm
|
|
17
|
+
download counts, only with `check_popularity`) and `find_credential_exposure` (a model endpoint,
|
|
18
|
+
only with `llm_verify`). The hint is per tool, so it is declared even where one argument causes
|
|
19
|
+
it. `tests/mcp/annotations.test.ts` fails if a tool starts writing a file or a local tool opens
|
|
20
|
+
a connection. Additive in `tools/list`; no name, argument or response changes.
|
|
21
|
+
- **`circle-ir-ai/mcp` is built on the v2 MCP SDK** (4.18.0), the line that speaks protocol
|
|
22
|
+
revision 2026-07-28. The optional peer is now `@modelcontextprotocol/server` ^2.2.0, in place of
|
|
23
|
+
`@modelcontextprotocol/sdk` ^1.30.1, and each tool hands the SDK schema objects rather than
|
|
24
|
+
bare shapes. The tools, their arguments and their output schemas are unchanged: under one
|
|
25
|
+
server the ten schemas are identical to 4.17.0's. Loads into `@cognium/mcp-server` 0.2.x (1.x
|
|
26
|
+
SDK) and 0.4.x (v2 SDK) alike; checked in all four pairings of old and new.
|
|
27
|
+
|
|
28
|
+
**Type-level only:** a host that type-checks this module against `@cognium/mcp-server`'s
|
|
29
|
+
`ToolModule` needs the server on 0.4.0 or later, where that type is on the v2 SDK too.
|
|
30
|
+
- **`circle-ir-ai/mcp` — this library's ten MCP tools as a module for `@cognium/mcp-server`**
|
|
31
|
+
(4.17.0). The server looks for this entry at startup and, when the package is installed and
|
|
32
|
+
built against the same `circle-ir` minor, registers the tools after its own eleven. Built
|
|
33
|
+
against `circle-ir` 4.9.29 and tested with `@cognium/mcp-server` 0.2.0 and MCP SDK ^1.30.1.
|
|
34
|
+
The tools are the ones `@cognium-ai/mcp-server` served, with the same names and arguments:
|
|
35
|
+
`verify_spec_conformance`, `find_spec_drift`, `find_pattern`, `find_credential_exposure`,
|
|
36
|
+
`check_license_compliance`, `find_stale_dependencies`, `find_install_script_risk`,
|
|
37
|
+
`find_typosquats`, `find_excessive_permissions`, `layer_bom`.
|
|
38
|
+
|
|
39
|
+
The server is not a dependency. `@modelcontextprotocol/sdk` is an optional peer, needed only
|
|
40
|
+
by a host that loads this entry; `zod` (^4) is now a direct dependency, where it was already
|
|
41
|
+
present transitively.
|
|
42
|
+
|
|
43
|
+
- **Every response carries `provenance`**: `deterministic`, or `llm: <model>` when a model
|
|
44
|
+
judged something in that call. It is in each tool's output schema, as a required field.
|
|
45
|
+
- **Nine of the ten tools are deterministic.** The only model path is `llm_verify` on
|
|
46
|
+
`find_credential_exposure`, which is off by default, marked `LLM-backed` in the tool and
|
|
47
|
+
argument descriptions, and runs only when the call asks for it.
|
|
48
|
+
- **`llm_verify` is refused on an install that is not enabled for it** — no configured
|
|
49
|
+
endpoint (`COGNIUM_ENDPOINT`) and no licence token. The call returns one line as an error
|
|
50
|
+
result. Before, the engine skipped verification and returned the unverified findings with
|
|
51
|
+
nothing to say so.
|
|
52
|
+
- **The configured endpoint is where the model is.** With an endpoint, verification goes to
|
|
53
|
+
it; with a licence token and no endpoint, the `LLM_*` environment applies as before.
|
|
54
|
+
- `SecretScanOptions.llmConfig` — overrides merged over the environment-derived LLM
|
|
55
|
+
configuration for the verifier, so a caller that was handed an endpoint can use it without
|
|
56
|
+
writing to `process.env`. Unset, behaviour is unchanged.
|
|
57
|
+
|
|
58
|
+
#### Consumer Impact
|
|
59
|
+
- **`find_credential_exposure` with `llm_verify: true` and no enablement now returns an error
|
|
60
|
+
result (`isError: true`) instead of findings.** A client that does not check `isError` and
|
|
61
|
+
reads `structuredContent` will find it absent. Call without `llm_verify`, or configure
|
|
62
|
+
`COGNIUM_ENDPOINT` or a licence token. Applies only through this module; the
|
|
63
|
+
`scanForSecrets` API itself is unchanged.
|
|
64
|
+
- **Tool input schemas are now generated by zod 4.** Names, types and required arguments are
|
|
65
|
+
the same; incidental JSON Schema details (`$schema`, how defaults are expressed) can differ
|
|
66
|
+
from what `@cognium-ai/mcp-server` published.
|
|
67
|
+
|
|
10
68
|
### Changed
|
|
11
69
|
- **`circle-ir` 4.9.27 → 4.9.29.** All four packages re-pinned; suites pass unchanged
|
|
12
70
|
(circle-ir-ai 2340, cognium-ai 363, mcp-server 11, circle-pack 182) and each resolves exactly
|
|
@@ -36,15 +94,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
36
94
|
**cognium-dev#503 landed:** CWE-81 went 0.0% → 88.9% and CWE-94 0.0% → 100%, the two families
|
|
37
95
|
that were at exactly zero and that ticket's two missing sinks.
|
|
38
96
|
|
|
39
|
-
**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
97
|
+
**cognium-dev#508 and #509 are fixed in 4.9.29.** Verified on the published build: the probes
|
|
98
|
+
where a tainted parameter never reaches the query (`D2_NoSibling`, `D4_TaintUnused`) are now
|
|
99
|
+
clean, and one SQLi emits one finding rather than two. They still reproduced on 4.9.28.
|
|
100
|
+
|
|
101
|
+
**Precision regressed sharply anyway, via a different mechanism.** CWE-89 sqli and CWE-643
|
|
102
|
+
xpath now fire on **100% of their files including every `Good*()` safe control** (27/27 and
|
|
103
|
+
10/10), and CWE-94 on 90%, while the other six families hold **0.0% FPR** at 88.9–90% recall.
|
|
104
|
+
All 27 CWE-89 false-positive files are **cross-method leaks** (`xLeak` 27 of 27) — taint
|
|
105
|
+
associated across a `Bad()`→`Good*()` boundary by variable name, the cognium-dev#316 family,
|
|
106
|
+
not #508's source×sink pairing. Leaks went 3 → 12 → 27 as more sources bound, so the recall
|
|
107
|
+
work and that leak multiply.
|
|
45
108
|
|
|
46
|
-
**Not fixed
|
|
47
|
-
|
|
109
|
+
**Not fixed:** cognium-dev#520 (`HtmlEncoder` still uncredited, so `xss_htmlencode_safe`
|
|
110
|
+
remains the sole FP on both C# synthetic gates).
|
|
48
111
|
|
|
49
112
|
**Carried-over regression:** `rmp_serde::from_slice` is still not a deserialization sink, so
|
|
50
113
|
MessagePack over a `TcpStream` is undetected — Rust synthetic 97.3% TPR, down from 100%.
|
package/README.md
CHANGED
|
@@ -213,9 +213,33 @@ Top findings: Jenkins (9), HuggingFace (4), Tauri (6-7), TiKV (3), Deno (3), Car
|
|
|
213
213
|
| Bash | Shell script command-injection / code-injection detection |
|
|
214
214
|
| HTML | XSS detection in templates |
|
|
215
215
|
|
|
216
|
+
## MCP tools
|
|
217
|
+
|
|
218
|
+
`circle-ir-ai/mcp` exports this library's ten MCP tools as a module for
|
|
219
|
+
[`@cognium/mcp-server`](https://www.npmjs.com/package/@cognium/mcp-server). Install both and the
|
|
220
|
+
server finds the module at startup and lists the tools after its own:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
npm install @cognium/mcp-server circle-ir-ai
|
|
224
|
+
npx mcp-server-cognium-dev
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
The module is refused, on one line of stderr, if it was built against a different `circle-ir`
|
|
228
|
+
minor than the server has; the server's own tools keep serving.
|
|
229
|
+
|
|
230
|
+
Each tool declares annotations in `tools/list`. All ten are read-only. Seven never leave the
|
|
231
|
+
machine; `find_stale_dependencies`, `find_typosquats` and `find_credential_exposure` can, and say
|
|
232
|
+
so (`openWorldHint: true`).
|
|
233
|
+
|
|
234
|
+
Every response carries `provenance`: `deterministic`, or `llm: <model>` when a model judged
|
|
235
|
+
something in that call. Nine of the ten tools are deterministic. The one model path is
|
|
236
|
+
`llm_verify` on `find_credential_exposure`: off by default, and refused with one line unless
|
|
237
|
+
the install has a configured endpoint (`COGNIUM_ENDPOINT`) or a licence token.
|
|
238
|
+
|
|
216
239
|
## Related Packages
|
|
217
240
|
|
|
218
241
|
- **[circle-ir](https://github.com/cogniumhq/circle-ir)**: Core SAST library (open source, MIT)
|
|
242
|
+
- **[@cognium/mcp-server](https://www.npmjs.com/package/@cognium/mcp-server)**: The MCP server that loads `circle-ir-ai/mcp` (MIT)
|
|
219
243
|
|
|
220
244
|
## License
|
|
221
245
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Circle-IR loading for the MCP tools.
|
|
3
|
+
*
|
|
4
|
+
* Wraps circle-ir-ai's analyzer lifecycle: initialize the WASM-backed
|
|
5
|
+
* analyzer once, walk the code root for supported source files, and run
|
|
6
|
+
* circle-ir's `analyze` per file. The resulting `CircleIR[]` is the input to
|
|
7
|
+
* `analyzeSpecGap` (used by the verify/drift tools).
|
|
8
|
+
*
|
|
9
|
+
* Mirrors the wiring recipe in cognium-ai's `spec-diff` command, but depends
|
|
10
|
+
* only on `circle-ir` + `circle-ir-ai` (not the cognium-ai CLI).
|
|
11
|
+
*/
|
|
12
|
+
import { type CircleIR } from 'circle-ir';
|
|
13
|
+
import { type WalkOptions } from './walk.js';
|
|
14
|
+
export interface LoadedCircleIR {
|
|
15
|
+
/** Absolute path to the analyzed code root. */
|
|
16
|
+
codePath: string;
|
|
17
|
+
/** Per-file circle-ir analysis results. */
|
|
18
|
+
results: CircleIR[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Walk `codeRoot`, analyze each supported source file, and return the
|
|
22
|
+
* collected `CircleIR[]` alongside the resolved code path.
|
|
23
|
+
*/
|
|
24
|
+
export declare function loadCircleIR(codeRoot: string, options?: WalkOptions): Promise<LoadedCircleIR>;
|
|
25
|
+
//# sourceMappingURL=analysis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analysis.d.ts","sourceRoot":"","sources":["../../src/mcp/analysis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAW,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAEjE,MAAM,WAAW,cAAc;IAC7B,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,OAAO,EAAE,QAAQ,EAAE,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,cAAc,CAAC,CAwBzB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Circle-IR loading for the MCP tools.
|
|
3
|
+
*
|
|
4
|
+
* Wraps circle-ir-ai's analyzer lifecycle: initialize the WASM-backed
|
|
5
|
+
* analyzer once, walk the code root for supported source files, and run
|
|
6
|
+
* circle-ir's `analyze` per file. The resulting `CircleIR[]` is the input to
|
|
7
|
+
* `analyzeSpecGap` (used by the verify/drift tools).
|
|
8
|
+
*
|
|
9
|
+
* Mirrors the wiring recipe in cognium-ai's `spec-diff` command, but depends
|
|
10
|
+
* only on `circle-ir` + `circle-ir-ai` (not the cognium-ai CLI).
|
|
11
|
+
*/
|
|
12
|
+
import * as fs from 'fs';
|
|
13
|
+
import * as path from 'path';
|
|
14
|
+
import { analyze } from 'circle-ir';
|
|
15
|
+
import { ensureAnalyzerInitialized } from '../utils/analyzer-init.js';
|
|
16
|
+
import { collectSourceFiles } from './walk.js';
|
|
17
|
+
/**
|
|
18
|
+
* Walk `codeRoot`, analyze each supported source file, and return the
|
|
19
|
+
* collected `CircleIR[]` alongside the resolved code path.
|
|
20
|
+
*/
|
|
21
|
+
export async function loadCircleIR(codeRoot, options = {}) {
|
|
22
|
+
await ensureAnalyzerInitialized();
|
|
23
|
+
const codePath = path.resolve(codeRoot);
|
|
24
|
+
const files = collectSourceFiles(codePath, options);
|
|
25
|
+
const results = [];
|
|
26
|
+
for (const file of files) {
|
|
27
|
+
let content;
|
|
28
|
+
try {
|
|
29
|
+
content = fs.readFileSync(file.absolutePath, 'utf-8');
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
const ir = await analyze(content, path.basename(file.absolutePath), file.language);
|
|
36
|
+
results.push(ir);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// Skip files circle-ir can't parse; spec-gap tolerates a partial corpus.
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return { codePath, results };
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=analysis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analysis.js","sourceRoot":"","sources":["../../src/mcp/analysis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAiB,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAoB,MAAM,WAAW,CAAC;AASjE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,QAAgB,EAChB,UAAuB,EAAE;IAEzB,MAAM,yBAAyB,EAAE,CAAC;IAElC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,kBAAkB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAEpD,MAAM,OAAO,GAAe,EAAE,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,OAAe,CAAC;QACpB,IAAI,CAAC;YACH,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QACD,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YACnF,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACnB,CAAC;QAAC,MAAM,CAAC;YACP,yEAAyE;YACzE,SAAS;QACX,CAAC;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `circle-ir-ai/mcp` — this library's tools as a module for the one MCP
|
|
3
|
+
* server.
|
|
4
|
+
*
|
|
5
|
+
* `@cognium/mcp-server` looks for this entry when it starts and, if the
|
|
6
|
+
* package is installed and built against the same `circle-ir` minor,
|
|
7
|
+
* registers these tools after its own. The server is not a dependency of
|
|
8
|
+
* this package and is never bundled with it: the module only describes
|
|
9
|
+
* itself and registers handlers over this library's own functions.
|
|
10
|
+
*
|
|
11
|
+
* Nine of the ten tools are deterministic. `find_credential_exposure` is
|
|
12
|
+
* deterministic unless it is called with `llm_verify`, which asks a model to
|
|
13
|
+
* re-check the candidates; that path runs only when asked for by name, only
|
|
14
|
+
* on an install that is enabled for it, and refuses otherwise.
|
|
15
|
+
*/
|
|
16
|
+
import type { CircleIrAiToolModule } from './types.js';
|
|
17
|
+
/** The tools this module registers, in registration order. */
|
|
18
|
+
export declare const TOOL_NAMES: readonly ["verify_spec_conformance", "find_spec_drift", "find_pattern", "find_credential_exposure", "check_license_compliance", "find_stale_dependencies", "find_install_script_risk", "find_typosquats", "find_excessive_permissions", "layer_bom"];
|
|
19
|
+
export declare const toolModule: CircleIrAiToolModule;
|
|
20
|
+
export default toolModule;
|
|
21
|
+
export { DETERMINISTIC, llmProvenance } from './result.js';
|
|
22
|
+
export { llmEnabled } from './types.js';
|
|
23
|
+
export type { CircleIrAiToolModule, ModuleContext, ModuleEnablement } from './types.js';
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EAAE,oBAAoB,EAAiB,MAAM,YAAY,CAAC;AAsBtE,8DAA8D;AAC9D,eAAO,MAAM,UAAU,sPAWb,CAAC;AAEX,eAAO,MAAM,UAAU,EAAE,oBAuBxB,CAAC;AAEF,eAAe,UAAU,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,oBAAoB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `circle-ir-ai/mcp` — this library's tools as a module for the one MCP
|
|
3
|
+
* server.
|
|
4
|
+
*
|
|
5
|
+
* `@cognium/mcp-server` looks for this entry when it starts and, if the
|
|
6
|
+
* package is installed and built against the same `circle-ir` minor,
|
|
7
|
+
* registers these tools after its own. The server is not a dependency of
|
|
8
|
+
* this package and is never bundled with it: the module only describes
|
|
9
|
+
* itself and registers handlers over this library's own functions.
|
|
10
|
+
*
|
|
11
|
+
* Nine of the ten tools are deterministic. `find_credential_exposure` is
|
|
12
|
+
* deterministic unless it is called with `llm_verify`, which asks a model to
|
|
13
|
+
* re-check the candidates; that path runs only when asked for by name, only
|
|
14
|
+
* on an install that is enabled for it, and refuses otherwise.
|
|
15
|
+
*/
|
|
16
|
+
import { createRequire } from 'node:module';
|
|
17
|
+
import { registerVerifySpecConformance } from './tools/verify-spec-conformance.js';
|
|
18
|
+
import { registerFindSpecDrift } from './tools/find-spec-drift.js';
|
|
19
|
+
import { registerFindPattern } from './tools/find-pattern.js';
|
|
20
|
+
import { registerFindCredentialExposure } from './tools/find-credential-exposure.js';
|
|
21
|
+
import { registerCheckLicenseCompliance } from './tools/check-license-compliance.js';
|
|
22
|
+
import { registerFindStaleDependencies } from './tools/find-stale-dependencies.js';
|
|
23
|
+
import { registerFindInstallScriptRisk } from './tools/find-install-script-risk.js';
|
|
24
|
+
import { registerFindTyposquats } from './tools/find-typosquats.js';
|
|
25
|
+
import { registerFindExcessivePermissions } from './tools/find-excessive-permissions.js';
|
|
26
|
+
import { registerLayerBom } from './tools/layer-bom.js';
|
|
27
|
+
// From the manifest, so the module can never announce a version or a
|
|
28
|
+
// `circle-ir` pin other than the one it was published with.
|
|
29
|
+
const manifest = createRequire(import.meta.url)('../../package.json');
|
|
30
|
+
/** The tools this module registers, in registration order. */
|
|
31
|
+
export const TOOL_NAMES = [
|
|
32
|
+
'verify_spec_conformance',
|
|
33
|
+
'find_spec_drift',
|
|
34
|
+
'find_pattern',
|
|
35
|
+
'find_credential_exposure',
|
|
36
|
+
'check_license_compliance',
|
|
37
|
+
'find_stale_dependencies',
|
|
38
|
+
'find_install_script_risk',
|
|
39
|
+
'find_typosquats',
|
|
40
|
+
'find_excessive_permissions',
|
|
41
|
+
'layer_bom',
|
|
42
|
+
];
|
|
43
|
+
export const toolModule = {
|
|
44
|
+
id: 'circle-ir-ai/mcp',
|
|
45
|
+
version: manifest.version,
|
|
46
|
+
licence: manifest.license,
|
|
47
|
+
circleIrRange: manifest.dependencies['circle-ir'],
|
|
48
|
+
register(server, ctx) {
|
|
49
|
+
// Spec tools
|
|
50
|
+
registerVerifySpecConformance(server);
|
|
51
|
+
registerFindSpecDrift(server);
|
|
52
|
+
registerFindPattern(server);
|
|
53
|
+
// Supply chain and credentials
|
|
54
|
+
registerFindCredentialExposure(server, ctx);
|
|
55
|
+
registerCheckLicenseCompliance(server);
|
|
56
|
+
registerFindStaleDependencies(server);
|
|
57
|
+
registerFindInstallScriptRisk(server);
|
|
58
|
+
registerFindTyposquats(server);
|
|
59
|
+
registerFindExcessivePermissions(server);
|
|
60
|
+
// Inventory
|
|
61
|
+
registerLayerBom(server);
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
export default toolModule;
|
|
65
|
+
export { DETERMINISTIC, llmProvenance } from './result.js';
|
|
66
|
+
export { llmEnabled } from './types.js';
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAQxD,qEAAqE;AACrE,4DAA4D;AAC5D,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAAa,CAAC;AAElF,8DAA8D;AAC9D,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,yBAAyB;IACzB,iBAAiB;IACjB,cAAc;IACd,0BAA0B;IAC1B,0BAA0B;IAC1B,yBAAyB;IACzB,0BAA0B;IAC1B,iBAAiB;IACjB,4BAA4B;IAC5B,WAAW;CACH,CAAC;AAEX,MAAM,CAAC,MAAM,UAAU,GAAyB;IAC9C,EAAE,EAAE,kBAAkB;IACtB,OAAO,EAAE,QAAQ,CAAC,OAAO;IACzB,OAAO,EAAE,QAAQ,CAAC,OAAO;IACzB,aAAa,EAAE,QAAQ,CAAC,YAAY,CAAC,WAAW,CAAC;IAEjD,QAAQ,CAAC,MAAiB,EAAE,GAAkB;QAC5C,aAAa;QACb,6BAA6B,CAAC,MAAM,CAAC,CAAC;QACtC,qBAAqB,CAAC,MAAM,CAAC,CAAC;QAC9B,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAE5B,+BAA+B;QAC/B,8BAA8B,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC5C,8BAA8B,CAAC,MAAM,CAAC,CAAC;QACvC,6BAA6B,CAAC,MAAM,CAAC,CAAC;QACtC,6BAA6B,CAAC,MAAM,CAAC,CAAC;QACtC,sBAAsB,CAAC,MAAM,CAAC,CAAC;QAC/B,gCAAgC,CAAC,MAAM,CAAC,CAAC;QAEzC,YAAY;QACZ,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;CACF,CAAC;AAEF,eAAe,UAAU,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure mappers from the engine's `SpecGapResult` (camelCase) to the MCP
|
|
3
|
+
* boundary shapes (snake_case). Kept side-effect-free so they can be unit
|
|
4
|
+
* tested without spinning up the analyzer.
|
|
5
|
+
*
|
|
6
|
+
* Schema stability: field names here are draft-stable through 2026-08-31.
|
|
7
|
+
* Additive changes are safe; renames/removals are breaking (bump major).
|
|
8
|
+
*/
|
|
9
|
+
import type { SpecGapResult } from '../spec-gap/index.js';
|
|
10
|
+
/** Confidence at/above which a covered match is "covered" vs "partial". */
|
|
11
|
+
export declare const PARTIAL_CONFIDENCE_THRESHOLD = 0.7;
|
|
12
|
+
export type RequirementStatus = 'covered' | 'partial' | 'uncovered';
|
|
13
|
+
export interface RequirementEvidence {
|
|
14
|
+
function?: string;
|
|
15
|
+
file?: string;
|
|
16
|
+
span?: [number, number];
|
|
17
|
+
}
|
|
18
|
+
export interface VerifyRequirement {
|
|
19
|
+
id: string;
|
|
20
|
+
status: RequirementStatus;
|
|
21
|
+
evidence: RequirementEvidence;
|
|
22
|
+
}
|
|
23
|
+
export interface VerifyConformanceResult {
|
|
24
|
+
alignment_score: number;
|
|
25
|
+
requirements: VerifyRequirement[];
|
|
26
|
+
summary: string;
|
|
27
|
+
}
|
|
28
|
+
export type DriftKind = 'code_without_spec' | 'spec_without_code';
|
|
29
|
+
export interface Drift {
|
|
30
|
+
kind: DriftKind;
|
|
31
|
+
location: string;
|
|
32
|
+
suggested_action: string;
|
|
33
|
+
}
|
|
34
|
+
export interface FindSpecDriftResult {
|
|
35
|
+
drifts: Drift[];
|
|
36
|
+
}
|
|
37
|
+
/** Map a `SpecGapResult` to the `verify_spec_conformance` output shape. */
|
|
38
|
+
export declare function toVerifyConformance(result: SpecGapResult): VerifyConformanceResult;
|
|
39
|
+
/** Map a `SpecGapResult` to the `find_spec_drift` output shape. */
|
|
40
|
+
export declare function toSpecDrift(result: SpecGapResult): FindSpecDriftResult;
|
|
41
|
+
//# sourceMappingURL=mappers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../../src/mcp/mappers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,2EAA2E;AAC3E,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAEhD,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;AAEpE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,mBAAmB,CAAC;CAC/B;AAED,MAAM,WAAW,uBAAuB;IACtC,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,SAAS,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AAElE,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB;AAED,2EAA2E;AAC3E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,uBAAuB,CA2ClF;AAED,mEAAmE;AACnE,wBAAgB,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,mBAAmB,CAqBtE"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure mappers from the engine's `SpecGapResult` (camelCase) to the MCP
|
|
3
|
+
* boundary shapes (snake_case). Kept side-effect-free so they can be unit
|
|
4
|
+
* tested without spinning up the analyzer.
|
|
5
|
+
*
|
|
6
|
+
* Schema stability: field names here are draft-stable through 2026-08-31.
|
|
7
|
+
* Additive changes are safe; renames/removals are breaking (bump major).
|
|
8
|
+
*/
|
|
9
|
+
/** Confidence at/above which a covered match is "covered" vs "partial". */
|
|
10
|
+
export const PARTIAL_CONFIDENCE_THRESHOLD = 0.7;
|
|
11
|
+
/** Map a `SpecGapResult` to the `verify_spec_conformance` output shape. */
|
|
12
|
+
export function toVerifyConformance(result) {
|
|
13
|
+
// Empty-spec guard: the engine returns specAlignmentScore=100 when zero
|
|
14
|
+
// requirements parse from spec_dir (a missing/empty/malformed spec). A
|
|
15
|
+
// consumer gating on `alignment_score >= N` would treat that as a pass.
|
|
16
|
+
// Surface it as a non-passing 0 with an explicit summary instead.
|
|
17
|
+
if (result.summary.totalRequirements === 0) {
|
|
18
|
+
return {
|
|
19
|
+
alignment_score: 0,
|
|
20
|
+
requirements: [],
|
|
21
|
+
summary: 'No requirements parsed from spec_dir — check the path and that ' +
|
|
22
|
+
'spec.md uses "- REQ-NNN: ..." bullets.',
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const requirements = [];
|
|
26
|
+
for (const match of result.coveredRequirements) {
|
|
27
|
+
requirements.push({
|
|
28
|
+
id: match.requirement.id,
|
|
29
|
+
status: match.confidence >= PARTIAL_CONFIDENCE_THRESHOLD ? 'covered' : 'partial',
|
|
30
|
+
evidence: { function: match.matchedFunction },
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
for (const uncovered of result.uncoveredRequirements) {
|
|
34
|
+
requirements.push({
|
|
35
|
+
id: uncovered.requirement.id,
|
|
36
|
+
status: 'uncovered',
|
|
37
|
+
evidence: {},
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const { covered, totalRequirements, coveragePercent, undocumented } = result.summary;
|
|
41
|
+
const summary = `${covered}/${totalRequirements} requirements covered (${coveragePercent}%); ` +
|
|
42
|
+
`${undocumented} undocumented behaviors`;
|
|
43
|
+
return {
|
|
44
|
+
alignment_score: result.specAlignmentScore,
|
|
45
|
+
requirements,
|
|
46
|
+
summary,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** Map a `SpecGapResult` to the `find_spec_drift` output shape. */
|
|
50
|
+
export function toSpecDrift(result) {
|
|
51
|
+
const drifts = [];
|
|
52
|
+
for (const behavior of result.undocumentedBehaviors) {
|
|
53
|
+
drifts.push({
|
|
54
|
+
kind: 'code_without_spec',
|
|
55
|
+
location: behavior.functionName,
|
|
56
|
+
suggested_action: behavior.suggestion,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
for (const uncovered of result.uncoveredRequirements) {
|
|
60
|
+
const { id, description } = uncovered.requirement;
|
|
61
|
+
drifts.push({
|
|
62
|
+
kind: 'spec_without_code',
|
|
63
|
+
location: id,
|
|
64
|
+
suggested_action: uncovered.reason || `Implement ${id}: ${description}`,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return { drifts };
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=mappers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mappers.js","sourceRoot":"","sources":["../../src/mcp/mappers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAC;AAkChD,2EAA2E;AAC3E,MAAM,UAAU,mBAAmB,CAAC,MAAqB;IACvD,wEAAwE;IACxE,uEAAuE;IACvE,wEAAwE;IACxE,kEAAkE;IAClE,IAAI,MAAM,CAAC,OAAO,CAAC,iBAAiB,KAAK,CAAC,EAAE,CAAC;QAC3C,OAAO;YACL,eAAe,EAAE,CAAC;YAClB,YAAY,EAAE,EAAE;YAChB,OAAO,EACL,iEAAiE;gBACjE,wCAAwC;SAC3C,CAAC;IACJ,CAAC;IAED,MAAM,YAAY,GAAwB,EAAE,CAAC;IAE7C,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAC/C,YAAY,CAAC,IAAI,CAAC;YAChB,EAAE,EAAE,KAAK,CAAC,WAAW,CAAC,EAAE;YACxB,MAAM,EAAE,KAAK,CAAC,UAAU,IAAI,4BAA4B,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;YAChF,QAAQ,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,eAAe,EAAE;SAC9C,CAAC,CAAC;IACL,CAAC;IAED,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,qBAAqB,EAAE,CAAC;QACrD,YAAY,CAAC,IAAI,CAAC;YAChB,EAAE,EAAE,SAAS,CAAC,WAAW,CAAC,EAAE;YAC5B,MAAM,EAAE,WAAW;YACnB,QAAQ,EAAE,EAAE;SACb,CAAC,CAAC;IACL,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC;IACrF,MAAM,OAAO,GACX,GAAG,OAAO,IAAI,iBAAiB,0BAA0B,eAAe,MAAM;QAC9E,GAAG,YAAY,yBAAyB,CAAC;IAE3C,OAAO;QACL,eAAe,EAAE,MAAM,CAAC,kBAAkB;QAC1C,YAAY;QACZ,OAAO;KACR,CAAC;AACJ,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,WAAW,CAAC,MAAqB;IAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;IAE3B,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,qBAAqB,EAAE,CAAC;QACpD,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,mBAAmB;YACzB,QAAQ,EAAE,QAAQ,CAAC,YAAY;YAC/B,gBAAgB,EAAE,QAAQ,CAAC,UAAU;SACtC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,qBAAqB,EAAE,CAAC;QACrD,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC,WAAW,CAAC;QAClD,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,mBAAmB;YACzB,QAAQ,EAAE,EAAE;YACZ,gBAAgB,EAAE,SAAS,CAAC,MAAM,IAAI,aAAa,EAAE,KAAK,WAAW,EAAE;SACxE,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one result shape every tool in this module returns.
|
|
3
|
+
*
|
|
4
|
+
* Each response says how it was produced: `deterministic`, or
|
|
5
|
+
* `llm: <model>` when a model contributed to it. The field is in the output
|
|
6
|
+
* schema of every tool, so a client can rely on it rather than infer it from
|
|
7
|
+
* which tool it called.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
/** No model was involved in producing the response. */
|
|
11
|
+
export declare const DETERMINISTIC = "deterministic";
|
|
12
|
+
/** The provenance of a response a model contributed to. */
|
|
13
|
+
export declare function llmProvenance(model: string): string;
|
|
14
|
+
export declare const provenanceSchema: z.ZodString;
|
|
15
|
+
export interface ToolResult {
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
content: Array<{
|
|
18
|
+
type: 'text';
|
|
19
|
+
text: string;
|
|
20
|
+
}>;
|
|
21
|
+
structuredContent?: Record<string, unknown>;
|
|
22
|
+
isError?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** A successful result: the payload plus its provenance, as text and as structured content. */
|
|
25
|
+
export declare function toolResult(payload: object, provenance: string): ToolResult;
|
|
26
|
+
/**
|
|
27
|
+
* A refusal: the tool was asked for something this install is not enabled
|
|
28
|
+
* for. One line, as an error result, so the caller sees why — never a quiet
|
|
29
|
+
* fall back to a different behaviour than the one requested.
|
|
30
|
+
*/
|
|
31
|
+
export declare function refusal(message: string): ToolResult;
|
|
32
|
+
/**
|
|
33
|
+
* What a tool declares about itself in `tools/list`. A client may use these
|
|
34
|
+
* to decide whether a call needs confirmation, so they are claims to keep
|
|
35
|
+
* true: measured, per tool, before they were written down.
|
|
36
|
+
*
|
|
37
|
+
* No tool in this module writes, changes or deletes a file — in the project
|
|
38
|
+
* it is pointed at, the working directory, the home directory or the temp
|
|
39
|
+
* directory.
|
|
40
|
+
*/
|
|
41
|
+
export declare const READ_ONLY_LOCAL: {
|
|
42
|
+
readonly readOnlyHint: true;
|
|
43
|
+
readonly destructiveHint: false;
|
|
44
|
+
readonly idempotentHint: true;
|
|
45
|
+
/** Reads the local project and nothing else; no connection leaves the machine. */
|
|
46
|
+
readonly openWorldHint: false;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Read-only, but it can reach beyond the machine: a package registry, a
|
|
50
|
+
* vulnerability database, or — when asked for by name — a model endpoint.
|
|
51
|
+
* Declared for the tool as a whole even where only one argument causes it.
|
|
52
|
+
*/
|
|
53
|
+
export declare const READ_ONLY_NETWORK: {
|
|
54
|
+
readonly openWorldHint: true;
|
|
55
|
+
readonly readOnlyHint: true;
|
|
56
|
+
readonly destructiveHint: false;
|
|
57
|
+
readonly idempotentHint: true;
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/mcp/result.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,uDAAuD;AACvD,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAE7C,2DAA2D;AAC3D,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,eAAO,MAAM,gBAAgB,aAE6E,CAAC;AAE3G,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,+FAA+F;AAC/F,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,CAM1E;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAEnD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe;;;;IAI1B,kFAAkF;;CAE1E,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;CAGpB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one result shape every tool in this module returns.
|
|
3
|
+
*
|
|
4
|
+
* Each response says how it was produced: `deterministic`, or
|
|
5
|
+
* `llm: <model>` when a model contributed to it. The field is in the output
|
|
6
|
+
* schema of every tool, so a client can rely on it rather than infer it from
|
|
7
|
+
* which tool it called.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
/** No model was involved in producing the response. */
|
|
11
|
+
export const DETERMINISTIC = 'deterministic';
|
|
12
|
+
/** The provenance of a response a model contributed to. */
|
|
13
|
+
export function llmProvenance(model) {
|
|
14
|
+
return `llm: ${model}`;
|
|
15
|
+
}
|
|
16
|
+
export const provenanceSchema = z
|
|
17
|
+
.string()
|
|
18
|
+
.describe('How this response was produced: "deterministic", or "llm: <model>" when a model contributed');
|
|
19
|
+
/** A successful result: the payload plus its provenance, as text and as structured content. */
|
|
20
|
+
export function toolResult(payload, provenance) {
|
|
21
|
+
const body = { ...payload, provenance };
|
|
22
|
+
return {
|
|
23
|
+
content: [{ type: 'text', text: JSON.stringify(body) }],
|
|
24
|
+
structuredContent: body,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A refusal: the tool was asked for something this install is not enabled
|
|
29
|
+
* for. One line, as an error result, so the caller sees why — never a quiet
|
|
30
|
+
* fall back to a different behaviour than the one requested.
|
|
31
|
+
*/
|
|
32
|
+
export function refusal(message) {
|
|
33
|
+
return { content: [{ type: 'text', text: message }], isError: true };
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* What a tool declares about itself in `tools/list`. A client may use these
|
|
37
|
+
* to decide whether a call needs confirmation, so they are claims to keep
|
|
38
|
+
* true: measured, per tool, before they were written down.
|
|
39
|
+
*
|
|
40
|
+
* No tool in this module writes, changes or deletes a file — in the project
|
|
41
|
+
* it is pointed at, the working directory, the home directory or the temp
|
|
42
|
+
* directory.
|
|
43
|
+
*/
|
|
44
|
+
export const READ_ONLY_LOCAL = {
|
|
45
|
+
readOnlyHint: true,
|
|
46
|
+
destructiveHint: false,
|
|
47
|
+
idempotentHint: true,
|
|
48
|
+
/** Reads the local project and nothing else; no connection leaves the machine. */
|
|
49
|
+
openWorldHint: false,
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Read-only, but it can reach beyond the machine: a package registry, a
|
|
53
|
+
* vulnerability database, or — when asked for by name — a model endpoint.
|
|
54
|
+
* Declared for the tool as a whole even where only one argument causes it.
|
|
55
|
+
*/
|
|
56
|
+
export const READ_ONLY_NETWORK = {
|
|
57
|
+
...READ_ONLY_LOCAL,
|
|
58
|
+
openWorldHint: true,
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/mcp/result.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,uDAAuD;AACvD,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC;AAE7C,2DAA2D;AAC3D,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,QAAQ,KAAK,EAAE,CAAC;AACzB,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,EAAE;KACR,QAAQ,CAAC,6FAA6F,CAAC,CAAC;AAS3G,+FAA+F;AAC/F,MAAM,UAAU,UAAU,CAAC,OAAe,EAAE,UAAkB;IAC5D,MAAM,IAAI,GAAG,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,CAAC;IACxC,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACvD,iBAAiB,EAAE,IAAI;KACxB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,OAAe;IACrC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACvE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,KAAK;IACtB,cAAc,EAAE,IAAI;IACpB,kFAAkF;IAClF,aAAa,EAAE,KAAK;CACZ,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,GAAG,eAAe;IAClB,aAAa,EAAE,IAAI;CACX,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* check_license_compliance MCP tool (Pillar I, Workflow #2).
|
|
3
|
+
*
|
|
4
|
+
* Scans a code root for copyleft/restrictive license issues in dependencies.
|
|
5
|
+
* Supports Node.js (package.json) and Rust (Cargo.toml) ecosystems.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/cogniumhq/cognium-ai/issues/79
|
|
8
|
+
*/
|
|
9
|
+
import type { McpServer } from "@modelcontextprotocol/server";
|
|
10
|
+
export declare function registerCheckLicenseCompliance(server: McpServer): void;
|
|
11
|
+
//# sourceMappingURL=check-license-compliance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-license-compliance.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/check-license-compliance.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AA4H9D,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAqDtE"}
|