@cognium-ai/mcp-server 4.16.5 → 4.17.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 (67) hide show
  1. package/CHANGELOG.md +1834 -0
  2. package/README.md +27 -257
  3. package/dist/deprecation.d.ts +5 -0
  4. package/dist/deprecation.d.ts.map +1 -0
  5. package/dist/deprecation.js +7 -0
  6. package/dist/deprecation.js.map +1 -0
  7. package/dist/index.d.ts +18 -12
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +27 -19
  10. package/dist/index.js.map +1 -1
  11. package/dist/server.d.ts +15 -3
  12. package/dist/server.d.ts.map +1 -1
  13. package/dist/server.js +26 -31
  14. package/dist/server.js.map +1 -1
  15. package/package.json +6 -7
  16. package/dist/analysis.d.ts +0 -25
  17. package/dist/analysis.d.ts.map +0 -1
  18. package/dist/analysis.js +0 -45
  19. package/dist/analysis.js.map +0 -1
  20. package/dist/mappers.d.ts +0 -41
  21. package/dist/mappers.d.ts.map +0 -1
  22. package/dist/mappers.js +0 -69
  23. package/dist/mappers.js.map +0 -1
  24. package/dist/tools/check-license-compliance.d.ts +0 -11
  25. package/dist/tools/check-license-compliance.d.ts.map +0 -1
  26. package/dist/tools/check-license-compliance.js +0 -125
  27. package/dist/tools/check-license-compliance.js.map +0 -1
  28. package/dist/tools/find-credential-exposure.d.ts +0 -17
  29. package/dist/tools/find-credential-exposure.d.ts.map +0 -1
  30. package/dist/tools/find-credential-exposure.js +0 -185
  31. package/dist/tools/find-credential-exposure.js.map +0 -1
  32. package/dist/tools/find-excessive-permissions.d.ts +0 -16
  33. package/dist/tools/find-excessive-permissions.d.ts.map +0 -1
  34. package/dist/tools/find-excessive-permissions.js +0 -144
  35. package/dist/tools/find-excessive-permissions.js.map +0 -1
  36. package/dist/tools/find-install-script-risk.d.ts +0 -11
  37. package/dist/tools/find-install-script-risk.d.ts.map +0 -1
  38. package/dist/tools/find-install-script-risk.js +0 -115
  39. package/dist/tools/find-install-script-risk.js.map +0 -1
  40. package/dist/tools/find-pattern.d.ts +0 -13
  41. package/dist/tools/find-pattern.d.ts.map +0 -1
  42. package/dist/tools/find-pattern.js +0 -114
  43. package/dist/tools/find-pattern.js.map +0 -1
  44. package/dist/tools/find-spec-drift.d.ts +0 -10
  45. package/dist/tools/find-spec-drift.d.ts.map +0 -1
  46. package/dist/tools/find-spec-drift.js +0 -41
  47. package/dist/tools/find-spec-drift.js.map +0 -1
  48. package/dist/tools/find-stale-dependencies.d.ts +0 -14
  49. package/dist/tools/find-stale-dependencies.d.ts.map +0 -1
  50. package/dist/tools/find-stale-dependencies.js +0 -177
  51. package/dist/tools/find-stale-dependencies.js.map +0 -1
  52. package/dist/tools/find-typosquats.d.ts +0 -11
  53. package/dist/tools/find-typosquats.d.ts.map +0 -1
  54. package/dist/tools/find-typosquats.js +0 -141
  55. package/dist/tools/find-typosquats.js.map +0 -1
  56. package/dist/tools/layer-bom.d.ts +0 -15
  57. package/dist/tools/layer-bom.d.ts.map +0 -1
  58. package/dist/tools/layer-bom.js +0 -98
  59. package/dist/tools/layer-bom.js.map +0 -1
  60. package/dist/tools/verify-spec-conformance.d.ts +0 -9
  61. package/dist/tools/verify-spec-conformance.d.ts.map +0 -1
  62. package/dist/tools/verify-spec-conformance.js +0 -49
  63. package/dist/tools/verify-spec-conformance.js.map +0 -1
  64. package/dist/walk.d.ts +0 -33
  65. package/dist/walk.d.ts.map +0 -1
  66. package/dist/walk.js +0 -83
  67. package/dist/walk.js.map +0 -1
package/README.md CHANGED
@@ -1,282 +1,52 @@
1
1
  # @cognium-ai/mcp-server
2
2
 
3
- An [MCP](https://modelcontextprotocol.io) server exposing Cognium's security
4
- scanning and spec-conformance tools over **stdio**. Backed by the
5
- [`circle-ir-ai`](https://www.npmjs.com/package/circle-ir-ai) engine.
3
+ > **Deprecated — this is the last release.** This package is now a shim over
4
+ > [`@cognium/mcp-server`](https://www.npmjs.com/package/@cognium/mcp-server), the one Cognium MCP
5
+ > server. Move to it when you can; this shim keeps an existing install working meanwhile.
6
6
 
7
- ## Tools Overview
8
-
9
- | Tool | Category | Description |
10
- |------|----------|-------------|
11
- | `find_credential_exposure` | Pillar I | Detect hardcoded secrets (AWS, GitHub, OpenAI, etc.) |
12
- | `check_license_compliance` | Pillar I | Flag copyleft licenses in dependencies |
13
- | `find_stale_dependencies` | Pillar I | Check npm registry for outdated packages |
14
- | `find_install_script_risk` | Pillar I | Detect malicious install script patterns |
15
- | `find_typosquats` | Pillar I | Detect typosquat package names |
16
- | `find_excessive_permissions` | Pillar I | Audit MCP config permissions |
17
- | `verify_spec_conformance` | Spec | Analyze code-to-spec alignment |
18
- | `find_spec_drift` | Spec | Report spec/code drift |
19
- | `find_pattern` | Utility | Regex search over code |
20
-
21
- ## Install & run
7
+ ## Moving off the shim
22
8
 
23
9
  ```bash
24
- npm install -g @cognium-ai/mcp-server
25
- cognium-mcp # speaks MCP JSON-RPC over stdin/stdout
10
+ npm install -g @cognium/mcp-server circle-ir-ai
11
+ mcp-server-cognium-dev # speaks MCP JSON-RPC over stdin/stdout
26
12
  ```
27
13
 
28
- Or wire it into an MCP client config:
14
+ Or in an MCP client config:
29
15
 
30
16
  ```json
31
17
  {
32
18
  "mcpServers": {
33
19
  "cognium": {
34
20
  "command": "npx",
35
- "args": ["-y", "@cognium-ai/mcp-server"]
21
+ "args": ["-y", "-p", "@cognium/mcp-server", "-p", "circle-ir-ai", "mcp-server-cognium-dev"]
36
22
  }
37
23
  }
38
24
  }
39
25
  ```
40
26
 
41
- Inspect it interactively:
42
-
43
- ```bash
44
- npx @modelcontextprotocol/inspector cognium-mcp
45
- ```
46
-
47
- ## Pillar I Security Tools
48
-
49
- All Pillar I tools return a common envelope:
50
-
51
- ```jsonc
52
- {
53
- "findings": [{ "kind": "...", "severity": "...", "location": {...}, "evidence": {...}, "suggested_action": "..." }],
54
- "summary": { "total": N, "by_severity": {...}, "truncated": false }
55
- }
56
- ```
57
-
58
- - `location.span` is **1-indexed line numbers** `[start_line, end_line]`
59
- - All tools accept `severity_floor` to filter results
60
-
61
- ### `find_credential_exposure`
62
-
63
- Detect hardcoded secrets using SAST pattern matching.
64
-
65
- | Input | Type | Description |
66
- |-------|------|-------------|
67
- | `code_root` | string | Absolute path to scan |
68
- | `include_git_history` | boolean | Scan git history (default: false) |
69
- | `severity_floor` | enum | Minimum severity: info/low/medium/high/critical |
70
-
71
- **Evidence:** `rule_id`, `match_snippet` (redacted), `confidence`
72
-
73
- ### `check_license_compliance`
74
-
75
- Flag copyleft licenses in npm/Cargo dependencies.
76
-
77
- | Input | Type | Description |
78
- |-------|------|-------------|
79
- | `code_root` | string | Absolute path to scan |
80
- | `include_dev_deps` | boolean | Include devDependencies (default: false) |
81
- | `severity_floor` | enum | Minimum severity |
82
-
83
- **Severity:** AGPL/SSPL=critical, GPL=high, LGPL/MPL=medium, EUPL/CPAL=low
84
-
85
- ### `find_stale_dependencies`
86
-
87
- Check npm dependencies for staleness and known vulnerabilities.
88
-
89
- | Input | Type | Description |
90
- |-------|------|-------------|
91
- | `code_root` | string | Absolute path to scan |
92
- | `include_dev_deps` | boolean | Include devDependencies (default: false) |
93
- | `severity_floor` | enum | Minimum severity |
94
- | `check_vulnerabilities` | boolean | Query OSV for CVEs (default: true) |
95
-
96
- **Staleness severity:** >3 years=high, >2 years=medium, >1 year=low
97
-
98
- **Vulnerability severity:** CVSS ≥9.0=critical, ≥7.0=high, ≥4.0=medium, <4.0=low
99
-
100
- **Evidence:**
101
- - Staleness: `dependency`, `current_version`, `latest_version`, `days_since_publish`, `last_publish_date`
102
- - Vulnerability: `dependency`, `current_version`, `vuln_id`, `cve`, `cvss`, `summary`
103
-
104
- ### `find_install_script_risk`
105
-
106
- Detect malicious patterns in npm lifecycle scripts (preinstall, postinstall, etc.).
107
-
108
- | Input | Type | Description |
109
- |-------|------|-------------|
110
- | `code_root` | string | Absolute path to scan |
111
- | `severity_floor` | enum | Minimum severity |
112
-
113
- **Rules:** piped downloads (critical), eval/exec (critical), base64 decode (high), env exfiltration (high), network downloads (medium), hidden file writes (medium)
114
-
115
- ### `find_typosquats`
116
-
117
- Detect typosquat package names using Levenshtein distance and homoglyph detection.
118
-
119
- | Input | Type | Description |
120
- |-------|------|-------------|
121
- | `code_root` | string | Absolute path to scan |
122
- | `include_dev_deps` | boolean | Include devDependencies (default: false) |
123
- | `severity_floor` | enum | Minimum severity |
124
- | `check_homoglyphs` | boolean | Detect visual deception attacks (default: true) |
125
- | `check_popularity` | boolean | Query npm for download counts (default: false) |
126
-
127
- **Detection methods:**
128
- - **Levenshtein:** distance=1 is high, distance=2 is medium
129
- - **Homoglyph:** detects visual deception (`rn`→`m`, `1`→`l`, `0`→`o`, etc.) - always high severity
130
-
131
- **Evidence:** `dependency`, `similar_to`, `detection_method`, `distance`, `homoglyph`, `target_downloads`
132
-
133
- ### `find_excessive_permissions`
134
-
135
- Audit MCP server configurations for overly broad permissions.
136
-
137
- | Input | Type | Description |
138
- |-------|------|-------------|
139
- | `code_root` | string | Absolute path to scan |
140
- | `severity_floor` | enum | Minimum severity |
141
- | `deep_analysis` | boolean | Run CircleIR to detect undisclosed capabilities (default: true) |
142
-
143
- **Config formats:** skill bundle (mcp.json), Claude Desktop, Cursor
144
-
145
- **Static rules:** broad filesystem paths, secret env vars, unrestricted network, dangerous commands
146
-
147
- **Deep analysis:** Cross-references declared permissions against actual code behavior. Detects undisclosed network, filesystem, or process execution capabilities.
27
+ `@cognium/mcp-server` serves eleven deterministic tools on its own. With `circle-ir-ai`
28
+ installed next to it, it also serves the ten tools this package used to: `verify_spec_conformance`,
29
+ `find_spec_drift`, `find_pattern`, `find_credential_exposure`, `check_license_compliance`,
30
+ `find_stale_dependencies`, `find_install_script_risk`, `find_typosquats`,
31
+ `find_excessive_permissions` and `layer_bom`. They keep their names and arguments. Their
32
+ documentation now lives with `circle-ir-ai`.
148
33
 
149
- ---
34
+ ## What the shim still does
150
35
 
151
- ## Spec Tools
36
+ - **`cognium-mcp`** prints a deprecation notice on stderr and then runs the one server over
37
+ stdio. `tools/list` is the 21 tools above.
38
+ - **`buildServer()`** keeps its name and stays synchronous, and returns a server with the same
39
+ 21 tools, so a host that mounted this package over its own transport needs no change.
40
+ `createServer()` from `@cognium/mcp-server` is re-exported for hosts that can await.
152
41
 
153
- ### `verify_spec_conformance`
42
+ ## What changed for a caller
154
43
 
155
- Analyze how well code conforms to its [Specifica](https://www.npmjs.com/package/circle-ir-ai)
156
- spec.
157
-
158
- **Input**
159
-
160
- | field | type | description |
161
- |-------------|--------|-----------------------------------------------|
162
- | `spec_dir` | string | Path to the `.specifica/` directory (spec.md) |
163
- | `code_root` | string | Path to the code root to analyze |
164
-
165
- **Output**
166
-
167
- ```jsonc
168
- {
169
- "alignment_score": 100, // 0–100
170
- "requirements": [
171
- { "id": "REQ-001", "status": "covered", "evidence": { "function": "calculateTotal" } },
172
- { "id": "REQ-002", "status": "partial", "evidence": { "function": "applyDiscount" } },
173
- { "id": "REQ-003", "status": "uncovered", "evidence": {} }
174
- ],
175
- "summary": "2/3 requirements covered (67%); 0 undocumented behaviors"
176
- }
177
- ```
178
-
179
- `status` is derived from the engine's match confidence:
180
-
181
- - `covered` — confidence **≥ 0.7**
182
- - `partial` — matched but confidence **< 0.7**
183
- - `uncovered` — no matching code behavior
184
-
185
- > The engine has no native "partial" state; it is a boundary heuristic at
186
- > confidence 0.7 over the engine's already-filtered match set
187
- > (min confidence 0.3).
188
- >
189
- > **Empty spec:** if no requirements parse from `spec_dir` (missing, empty, or
190
- > malformed `spec.md`), `alignment_score` is reported as **0** with an
191
- > explanatory `summary` — never a misleading 100 — so a `>= N` gate fails
192
- > safely instead of passing on a spec that was never read.
193
-
194
- ### `find_spec_drift`
195
-
196
- Report drift in both directions.
197
-
198
- **Input:** same as above (`spec_dir`, `code_root`).
199
-
200
- **Output**
201
-
202
- ```jsonc
203
- {
204
- "drifts": [
205
- { "kind": "code_without_spec", "location": "deleteUser", "suggested_action": "Document deleteUser: ..." },
206
- { "kind": "spec_without_code", "location": "REQ-004", "suggested_action": "Implement REQ-004: ..." }
207
- ]
208
- }
209
- ```
210
-
211
- - `code_without_spec` — an undocumented public behavior (engine
212
- `undocumentedBehaviors`).
213
- - `spec_without_code` — a requirement with no matching code (engine
214
- `uncoveredRequirements`).
215
-
216
- ### `find_pattern`
217
-
218
- Search file contents under a code root with a JavaScript regular expression.
219
-
220
- **Input**
221
-
222
- | field | type | description |
223
- |-------------|--------|---------------------------------------------------|
224
- | `pattern` | string | JS `RegExp` source (applied with the global flag) |
225
- | `code_root` | string | Path to the code root to search |
226
-
227
- **Output**
228
-
229
- ```jsonc
230
- {
231
- "matches": [
232
- { "file": "src/cart.ts", "span": [7, 7], "snippet": "return unitPrice * quantity;" }
233
- ]
234
- }
235
- ```
236
-
237
- > `span` is **line-based** `[startLine, endLine]` (1-based), **not** character
238
- > offsets. Files larger than 1 MiB, files detected as binary (NUL byte in the
239
- > leading window), and common build/vendor directories are skipped; results are
240
- > capped at 1000 matches.
241
- >
242
- > The pattern is validated once up front (an invalid regex errors even over an
243
- > empty tree). A 2 s wall-clock budget bounds total scanning between matches;
244
- > it does not interrupt a single `exec`, so the 1 MiB per-file cap is the real
245
- > bound against a catastrophic-backtracking pattern.
246
-
247
- ## Field mapping (engine → MCP boundary)
248
-
249
- The engine emits camelCase; this server renames to snake_case at the boundary.
250
-
251
- | MCP field | engine source (`SpecGapResult`) |
252
- |----------------------------|---------------------------------------------------------|
253
- | `alignment_score` | `specAlignmentScore` |
254
- | `requirements[].id` | `coveredRequirements[].requirement.id` / `uncoveredRequirements[].requirement.id` |
255
- | `requirements[].status` | derived from `coveredRequirements[].confidence` (≥0.7) |
256
- | `requirements[].evidence.function` | `coveredRequirements[].matchedFunction` |
257
- | `drifts` (code_without_spec) | `undocumentedBehaviors[]` → `{functionName, suggestion}` |
258
- | `drifts` (spec_without_code) | `uncoveredRequirements[]` → `{requirement.id, reason}` |
259
-
260
- ## Schema stability
261
-
262
- Tool input/output field names are **draft-stable through 2026-08-31**. Additive
263
- fields are non-breaking; renames or removals are breaking changes (major bump).
264
-
265
- ## Runtime support
266
-
267
- Works under **Node** (≥18) and **Bun**. circle-ir's WASM is resolved via
268
- `createRequire(import.meta.url)` from `node_modules/circle-ir`, so no symlink is
269
- required under either runtime. Both are exercised by the CI stdio smoke matrix.
270
-
271
- ## Development
272
-
273
- ```bash
274
- npm install # installs deps and builds (prepare → tsc)
275
- npm run typecheck
276
- npm test # vitest: mapper unit tests
277
- npm run smoke # spawn dist/index.js over stdio against the demo fixture
278
- ```
44
+ - `serverInfo` in the `initialize` result is `@cognium/mcp-server` and its version.
45
+ - Every response from the ten tools carries `provenance`: `deterministic`, or `llm: <model>`.
46
+ - `find_credential_exposure` with `llm_verify: true` is refused, with one line, unless the
47
+ install has a configured endpoint (`COGNIUM_ENDPOINT`) or a licence token.
279
48
 
280
49
  ## License
281
50
 
282
- PolyForm Noncommercial License 1.0.0 — see [LICENSE](./LICENSE).
51
+ PolyForm Noncommercial License 1.0.0. `@cognium/mcp-server` itself is MIT; the ten tools come
52
+ from `circle-ir-ai`, which is PolyForm Noncommercial. See [LICENSE](./LICENSE).
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The deprecation notice, in one place so the binary and the tests agree.
3
+ */
4
+ export declare const DEPRECATION_NOTICE: string;
5
+ //# sourceMappingURL=deprecation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../src/deprecation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,kBAAkB,QAGqB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The deprecation notice, in one place so the binary and the tests agree.
3
+ */
4
+ export const DEPRECATION_NOTICE = '[@cognium-ai/mcp-server] deprecated (2026-10-01): this package is now a shim over @cognium/mcp-server ' +
5
+ 'and this is its last release. Install @cognium/mcp-server and circle-ir-ai, and run ' +
6
+ '`mcp-server-cognium-dev`, to get the same tools.';
7
+ //# sourceMappingURL=deprecation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecation.js","sourceRoot":"","sources":["../src/deprecation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAC7B,wGAAwG;IACxG,sFAAsF;IACtF,kDAAkD,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,18 +1,24 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Entry point for the Cognium MCP server.
3
+ * `@cognium-ai/mcp-server` — a shim.
4
4
  *
5
- * - As a bin (`cognium-mcp`): connects the server to stdio so MCP clients
6
- * (e.g. cognium-code) can spawn it as a subprocess and communicate over
7
- * stdin/stdout.
8
- * - As a library import (`import { buildServer } from '@cognium-ai/mcp-server'`):
9
- * re-exports `buildServer` so HTTP transport hosts (e.g. circle-pack's
10
- * `/api/mcp`) can build and connect to a configured `McpServer` without
11
- * spawning a subprocess. The stdio bootstrap is guarded by an
12
- * `import.meta.url === file://${process.argv[1]}` check so library
13
- * consumers never accidentally start a stdio server on the host process's
14
- * stdin/stdout.
5
+ * The server that used to live here is retired. Its ten tools moved into
6
+ * `circle-ir-ai/mcp`, and `@cognium/mcp-server` — the one MCP server —
7
+ * loads them next to its own eleven. This package now only forwards to it,
8
+ * for one release, so an existing install keeps working while it is moved.
9
+ *
10
+ * The entry keeps the two roles it always had, so nothing that used it has
11
+ * to change first:
12
+ *
13
+ * - As a bin (`cognium-mcp`, or this file run directly): prints the
14
+ * deprecation notice on stderr, then serves the one server over stdio.
15
+ * - As a library import: re-exports `buildServer` and the one server's
16
+ * `createServer`. The stdio bootstrap is guarded, so importing never
17
+ * attaches a transport to the host process's stdin and stdout.
15
18
  */
16
19
  import { buildServer } from './server.js';
17
- export { buildServer };
20
+ import { DEPRECATION_NOTICE } from './deprecation.js';
21
+ export { buildServer, DEPRECATION_NOTICE };
22
+ export { createServer, discoverModules, startupLines, SERVER_NAME, SERVER_VERSION } from '@cognium/mcp-server';
23
+ export type { BuildServerOptions, Discovery, ToolModule } from '@cognium/mcp-server';
18
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;GAaG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC/G,YAAY,EAAE,kBAAkB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -1,27 +1,37 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Entry point for the Cognium MCP server.
3
+ * `@cognium-ai/mcp-server` — a shim.
4
4
  *
5
- * - As a bin (`cognium-mcp`): connects the server to stdio so MCP clients
6
- * (e.g. cognium-code) can spawn it as a subprocess and communicate over
7
- * stdin/stdout.
8
- * - As a library import (`import { buildServer } from '@cognium-ai/mcp-server'`):
9
- * re-exports `buildServer` so HTTP transport hosts (e.g. circle-pack's
10
- * `/api/mcp`) can build and connect to a configured `McpServer` without
11
- * spawning a subprocess. The stdio bootstrap is guarded by an
12
- * `import.meta.url === file://${process.argv[1]}` check so library
13
- * consumers never accidentally start a stdio server on the host process's
14
- * stdin/stdout.
5
+ * The server that used to live here is retired. Its ten tools moved into
6
+ * `circle-ir-ai/mcp`, and `@cognium/mcp-server` — the one MCP server —
7
+ * loads them next to its own eleven. This package now only forwards to it,
8
+ * for one release, so an existing install keeps working while it is moved.
9
+ *
10
+ * The entry keeps the two roles it always had, so nothing that used it has
11
+ * to change first:
12
+ *
13
+ * - As a bin (`cognium-mcp`, or this file run directly): prints the
14
+ * deprecation notice on stderr, then serves the one server over stdio.
15
+ * - As a library import: re-exports `buildServer` and the one server's
16
+ * `createServer`. The stdio bootstrap is guarded, so importing never
17
+ * attaches a transport to the host process's stdin and stdout.
15
18
  */
16
19
  import { realpathSync } from 'node:fs';
17
20
  import { pathToFileURL } from 'node:url';
18
21
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
22
+ import { createServer, startupLines } from '@cognium/mcp-server';
19
23
  import { buildServer } from './server.js';
20
- export { buildServer };
24
+ import { DEPRECATION_NOTICE } from './deprecation.js';
25
+ export { buildServer, DEPRECATION_NOTICE };
26
+ export { createServer, discoverModules, startupLines, SERVER_NAME, SERVER_VERSION } from '@cognium/mcp-server';
21
27
  async function main() {
22
- const server = buildServer();
23
- const transport = new StdioServerTransport();
24
- await server.connect(transport);
28
+ // stderr: stdout belongs to the JSON-RPC stream.
29
+ process.stderr.write(`${DEPRECATION_NOTICE}\n`);
30
+ const { server, discovery } = await createServer();
31
+ for (const line of startupLines(discovery)) {
32
+ process.stderr.write(`${line}\n`);
33
+ }
34
+ await server.connect(new StdioServerTransport());
25
35
  }
26
36
  // Only run the stdio bootstrap when invoked as an executable, not when
27
37
  // imported as a library.
@@ -45,11 +55,9 @@ function computeIsMain() {
45
55
  return false;
46
56
  }
47
57
  }
48
- const isMain = computeIsMain();
49
- if (isMain) {
58
+ if (computeIsMain()) {
50
59
  main().catch((err) => {
51
- // Logging to stderr keeps stdout clean for the JSON-RPC stream.
52
- console.error('Fatal error in cognium-mcp:', err);
60
+ process.stderr.write(`[@cognium-ai/mcp-server] fatal: ${err.stack ?? err}\n`);
53
61
  process.exit(1);
54
62
  });
55
63
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @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KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9B,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC;IAC1D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,IAAI,aAAa,EAAE,EAAE,CAAC;IACpB,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACnB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAoC,GAAa,CAAC,KAAK,IAAI,GAAG,IAAI,CAAC,CAAC;QACzF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
package/dist/server.d.ts CHANGED
@@ -1,6 +1,18 @@
1
1
  /**
2
- * Builds the Cognium MCP server and registers all tools.
2
+ * `buildServer()` under its old name and its old signature.
3
+ *
4
+ * This package used to build its own server with ten tools. Those tools now
5
+ * live in `circle-ir-ai/mcp` and are served by `@cognium/mcp-server`, which
6
+ * adds eleven of its own. A caller of `buildServer()` therefore still gets a
7
+ * server with the ten tools it had — plus the eleven — without changing a
8
+ * line.
9
+ *
10
+ * The one server's own `buildServer()` is synchronous and loads no modules;
11
+ * finding them is `createServer()`'s job, and that is asynchronous. To keep
12
+ * this entry synchronous the module is imported here directly, and put
13
+ * through the same `circle-ir` check the loader applies.
3
14
  */
4
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
- export declare function buildServer(): McpServer;
15
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
16
+ import { type BuildServerOptions } from '@cognium/mcp-server';
17
+ export declare function buildServer(opts?: Omit<BuildServerOptions, 'modules' | 'enablement'>): McpServer;
6
18
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYpE,wBAAgB,WAAW,IAAI,SAAS,CAyBvC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAML,KAAK,kBAAkB,EAExB,MAAM,qBAAqB,CAAC;AAG7B,wBAAgB,WAAW,CAAC,IAAI,GAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,GAAG,YAAY,CAAM,GAAG,SAAS,CAepG"}
package/dist/server.js CHANGED
@@ -1,36 +1,31 @@
1
1
  /**
2
- * Builds the Cognium MCP server and registers all tools.
2
+ * `buildServer()` under its old name and its old signature.
3
+ *
4
+ * This package used to build its own server with ten tools. Those tools now
5
+ * live in `circle-ir-ai/mcp` and are served by `@cognium/mcp-server`, which
6
+ * adds eleven of its own. A caller of `buildServer()` therefore still gets a
7
+ * server with the ten tools it had — plus the eleven — without changing a
8
+ * line.
9
+ *
10
+ * The one server's own `buildServer()` is synchronous and loads no modules;
11
+ * finding them is `createServer()`'s job, and that is asynchronous. To keep
12
+ * this entry synchronous the module is imported here directly, and put
13
+ * through the same `circle-ir` check the loader applies.
3
14
  */
4
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
- import { registerVerifySpecConformance } from './tools/verify-spec-conformance.js';
6
- import { registerFindSpecDrift } from './tools/find-spec-drift.js';
7
- import { registerFindPattern } from './tools/find-pattern.js';
8
- import { registerFindCredentialExposure } from './tools/find-credential-exposure.js';
9
- import { registerCheckLicenseCompliance } from './tools/check-license-compliance.js';
10
- import { registerFindStaleDependencies } from './tools/find-stale-dependencies.js';
11
- import { registerFindInstallScriptRisk } from './tools/find-install-script-risk.js';
12
- import { registerFindTyposquats } from './tools/find-typosquats.js';
13
- import { registerFindExcessivePermissions } from './tools/find-excessive-permissions.js';
14
- import { registerLayerBom } from './tools/layer-bom.js';
15
- export function buildServer() {
16
- const server = new McpServer({
17
- name: 'cognium-mcp',
18
- version: '0.4.0',
15
+ import { buildServer as buildOneServer, checkCircleIrRange, circleIrVersion, enablementForProcess, SERVER_NAME, } from '@cognium/mcp-server';
16
+ import toolModule from 'circle-ir-ai/mcp';
17
+ export function buildServer(opts = {}) {
18
+ const aiModule = toolModule;
19
+ const range = checkCircleIrRange(aiModule.circleIrRange, circleIrVersion());
20
+ if (!range.ok) {
21
+ process.stderr.write(`[${SERVER_NAME}] refused ${aiModule.id}: ${aiModule.id}@${aiModule.version} ${range.reason}. ` +
22
+ 'Serving the deterministic floor only.\n');
23
+ }
24
+ const modules = range.ok ? [aiModule] : [];
25
+ return buildOneServer({
26
+ ...opts,
27
+ modules,
28
+ enablement: enablementForProcess({ installed: modules.length > 0 }),
19
29
  });
20
- // Spec tools (legacy)
21
- registerVerifySpecConformance(server);
22
- registerFindSpecDrift(server);
23
- registerFindPattern(server);
24
- // Pillar I Batch 1
25
- registerFindCredentialExposure(server);
26
- registerCheckLicenseCompliance(server);
27
- // Pillar I Batch 2
28
- registerFindStaleDependencies(server);
29
- registerFindInstallScriptRisk(server);
30
- registerFindTyposquats(server);
31
- registerFindExcessivePermissions(server);
32
- // Conformis inventory primitive
33
- registerLayerBom(server);
34
- return server;
35
30
  }
36
31
  //# sourceMappingURL=server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MA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B,WAAW,GAGZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAE1C,MAAM,UAAU,WAAW,CAAC,OAA2D,EAAE;IACvF,MAAM,QAAQ,GAAe,UAAU,CAAC;IACxC,MAAM,KAAK,GAAG,kBAAkB,CAAC,QAAQ,CAAC,aAAa,EAAE,eAAe,EAAE,CAAC,CAAC;IAC5E,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;QACd,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,IAAI,WAAW,aAAa,QAAQ,CAAC,EAAE,KAAK,QAAQ,CAAC,EAAE,IAAI,QAAQ,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,IAAI;YAC7F,yCAAyC,CAC5C,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3C,OAAO,cAAc,CAAC;QACpB,GAAG,IAAI;QACP,OAAO;QACP,UAAU,EAAE,oBAAoB,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;KACpE,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cognium-ai/mcp-server",
3
- "version": "4.16.5",
4
- "description": "MCP server exposing Cognium spec-conformance, spec-drift, and pattern-search tools over stdio",
3
+ "version": "4.17.1",
4
+ "description": "Deprecated shim: forwards to @cognium/mcp-server, which now serves these tools via circle-ir-ai/mcp",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "bin": {
@@ -41,14 +41,13 @@
41
41
  "files": [
42
42
  "dist",
43
43
  "README.md",
44
+ "CHANGELOG.md",
44
45
  "LICENSE"
45
46
  ],
46
47
  "dependencies": {
47
- "@modelcontextprotocol/sdk": "^1.29.0",
48
- "circle-ir": "4.9.29",
49
- "circle-ir-ai": "^4.16.5",
50
- "minimatch": "^10.2.5",
51
- "zod": "^3.25.0"
48
+ "@cognium/mcp-server": "^0.2.0",
49
+ "@modelcontextprotocol/sdk": "^1.30.1",
50
+ "circle-ir-ai": "^4.19.0"
52
51
  },
53
52
  "devDependencies": {
54
53
  "@types/node": "^25.5.0",
@@ -1,25 +0,0 @@
1
- /**
2
- * Circle-IR loading for the MCP server.
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"analysis.d.ts","sourceRoot":"","sources":["../src/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"}