@cognium/mcp-server 0.1.21 → 0.2.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 +94 -0
- package/README.md +68 -2
- package/dist/bin.d.ts +18 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +34 -0
- package/dist/bin.js.map +1 -0
- package/dist/enablement.d.ts +67 -0
- package/dist/enablement.d.ts.map +1 -0
- package/dist/enablement.js +97 -0
- package/dist/enablement.js.map +1 -0
- package/dist/index.d.ts +13 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -20
- package/dist/index.js.map +1 -1
- package/dist/jcs.d.ts +28 -0
- package/dist/jcs.d.ts.map +1 -0
- package/dist/jcs.js +60 -0
- package/dist/jcs.js.map +1 -0
- package/dist/licence.d.ts +119 -0
- package/dist/licence.d.ts.map +1 -0
- package/dist/licence.js +234 -0
- package/dist/licence.js.map +1 -0
- package/dist/modules.d.ts +83 -0
- package/dist/modules.d.ts.map +1 -0
- package/dist/modules.js +136 -0
- package/dist/modules.js.map +1 -0
- package/dist/server.d.ts +44 -3
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +82 -8
- package/dist/server.js.map +1 -1
- package/dist/startup.d.ts +14 -0
- package/dist/startup.d.ts.map +1 -0
- package/dist/startup.js +42 -0
- package/dist/startup.js.map +1 -0
- package/dist/tools/types.d.ts +9 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js.map +1 -1
- package/dist/util/wasm.d.ts.map +1 -1
- package/dist/util/wasm.js +3 -1
- package/dist/util/wasm.js.map +1 -1
- package/package.json +3 -3
package/dist/server.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MCP server assembly — register every tool + resource on a fresh
|
|
3
|
-
* `McpServer` instance
|
|
4
|
-
* module stays transport-agnostic
|
|
2
|
+
* MCP server assembly — register every floor tool + resource on a fresh
|
|
3
|
+
* `McpServer` instance, then let each optional module register its own.
|
|
4
|
+
* Transport wiring lives in `bin.ts` so this module stays transport-agnostic
|
|
5
|
+
* and testable, and `index.ts` exports it so a host can mount it over HTTP
|
|
6
|
+
* without spawning a subprocess.
|
|
5
7
|
*/
|
|
8
|
+
import { createRequire } from 'node:module';
|
|
6
9
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
10
|
import { ProjectCache } from './cache.js';
|
|
8
11
|
import { registerResources } from './resources/index.js';
|
|
12
|
+
import { floorEnablement, enablementForProcess } from './enablement.js';
|
|
13
|
+
import { loadModules, circleIrVersion, } from './modules.js';
|
|
9
14
|
import { scanConfig, makeScanHandler } from './tools/scan.js';
|
|
10
15
|
import { explainFindingConfig, makeExplainFindingHandler } from './tools/explain-finding.js';
|
|
11
16
|
import { taintPathsConfig, makeTaintPathsHandler } from './tools/taint-paths.js';
|
|
@@ -17,13 +22,34 @@ import { attackSurfaceSummaryConfig, makeAttackSurfaceSummaryHandler } from './t
|
|
|
17
22
|
import { listReachableSinksConfig, makeListReachableSinksHandler } from './tools/list-reachable-sinks.js';
|
|
18
23
|
import { findSimilarConfig, makeFindSimilarHandler } from './tools/find-similar.js';
|
|
19
24
|
import { refreshConfig, makeRefreshHandler } from './tools/refresh.js';
|
|
25
|
+
const require_ = createRequire(import.meta.url);
|
|
26
|
+
/**
|
|
27
|
+
* Server name and version, from the manifest, in one place.
|
|
28
|
+
*
|
|
29
|
+
* They used to be string literals here, and had drifted to `0.1.0` while the
|
|
30
|
+
* package was at `0.1.21`. The `initialize` result carries both, so every
|
|
31
|
+
* transport has to report the same pair — otherwise two clients talking to
|
|
32
|
+
* the same install disagree about what they are talking to.
|
|
33
|
+
*/
|
|
34
|
+
function identity() {
|
|
35
|
+
try {
|
|
36
|
+
const pkg = require_('../package.json');
|
|
37
|
+
return { name: pkg.name, version: pkg.version };
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return { name: '@cognium/mcp-server', version: '0.0.0' };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const IDENTITY = identity();
|
|
44
|
+
export const SERVER_NAME = IDENTITY.name;
|
|
45
|
+
export const SERVER_VERSION = IDENTITY.version;
|
|
20
46
|
export function buildServer(opts = {}) {
|
|
21
47
|
const cache = new ProjectCache(opts.cacheCapacity ?? 3);
|
|
22
|
-
const ctx = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
48
|
+
const ctx = {
|
|
49
|
+
cache,
|
|
50
|
+
enablement: opts.enablement ?? floorEnablement(),
|
|
51
|
+
};
|
|
52
|
+
const server = new McpServer(IDENTITY);
|
|
27
53
|
server.registerTool('scan', scanConfig, makeScanHandler(ctx));
|
|
28
54
|
server.registerTool('explain_finding', explainFindingConfig, makeExplainFindingHandler(ctx));
|
|
29
55
|
server.registerTool('taint_paths', taintPathsConfig, makeTaintPathsHandler(ctx));
|
|
@@ -36,6 +62,54 @@ export function buildServer(opts = {}) {
|
|
|
36
62
|
server.registerTool('find_similar', findSimilarConfig, makeFindSimilarHandler(ctx));
|
|
37
63
|
server.registerTool('refresh', refreshConfig, makeRefreshHandler(ctx));
|
|
38
64
|
registerResources(server);
|
|
65
|
+
// A module that throws while registering is refused like any other bad
|
|
66
|
+
// module: the tools it managed to register stay, the rest do not arrive,
|
|
67
|
+
// and the server keeps serving. Losing the floor because an optional
|
|
68
|
+
// extra misbehaved would be the worse outcome.
|
|
69
|
+
for (const mod of opts.modules ?? []) {
|
|
70
|
+
try {
|
|
71
|
+
mod.register(server, ctx);
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
process.stderr.write(`[${SERVER_NAME}] module ${mod.id}@${mod.version} failed to register: ${err.message}\n`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
39
77
|
return server;
|
|
40
78
|
}
|
|
79
|
+
let discovery;
|
|
80
|
+
/**
|
|
81
|
+
* Resolve the optional modules and compute enablement, once per process.
|
|
82
|
+
*
|
|
83
|
+
* Memoized on the promise, not the result, so concurrent callers — the HTTP
|
|
84
|
+
* host builds a server per request — share one resolution instead of racing
|
|
85
|
+
* to import the same module several times.
|
|
86
|
+
*/
|
|
87
|
+
export function discoverModules() {
|
|
88
|
+
discovery ??= (async () => {
|
|
89
|
+
const circleIr = circleIrVersion();
|
|
90
|
+
const { modules, refusals } = await loadModules({ installedCircleIr: circleIr });
|
|
91
|
+
// The import happens first, so `installed` is a fact about what actually
|
|
92
|
+
// loaded rather than a guess from whether a specifier might resolve.
|
|
93
|
+
const enablement = enablementForProcess({ installed: modules.length > 0 });
|
|
94
|
+
return { modules, refusals, enablement, circleIr };
|
|
95
|
+
})();
|
|
96
|
+
return discovery;
|
|
97
|
+
}
|
|
98
|
+
/** Drop the discovery memo. For tests; nothing in the server calls this. */
|
|
99
|
+
export function resetDiscoveryForTests() {
|
|
100
|
+
discovery = undefined;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The server a host should build: floor plus whatever optional modules this
|
|
104
|
+
* install has, with enablement computed once.
|
|
105
|
+
*/
|
|
106
|
+
export async function createServer(opts = {}) {
|
|
107
|
+
const found = await discoverModules();
|
|
108
|
+
const server = buildServer({
|
|
109
|
+
...opts,
|
|
110
|
+
modules: found.modules,
|
|
111
|
+
enablement: found.enablement,
|
|
112
|
+
});
|
|
113
|
+
return { server, discovery: found };
|
|
114
|
+
}
|
|
41
115
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY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,EAAE,SAAS,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC;QAC3E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;IACrD,CAAC,CAAC,EAAE,CAAC;IACL,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,sBAAsB;IACpC,SAAS,GAAG,SAAS,CAAC;AACxB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,IAAI,GAAuD,EAAE;IAE7D,MAAM,KAAK,GAAG,MAAM,eAAe,EAAE,CAAC;IACtC,MAAM,MAAM,GAAG,WAAW,CAAC;QACzB,GAAG,IAAI;QACP,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,UAAU,EAAE,KAAK,CAAC,UAAU;KAC7B,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The startup lines.
|
|
3
|
+
*
|
|
4
|
+
* Pure: it turns a `Discovery` into the lines to print, so the wording is
|
|
5
|
+
* testable without starting a server. `bin.ts` writes them to stderr —
|
|
6
|
+
* stdout belongs to the JSON-RPC stream and must stay clean.
|
|
7
|
+
*
|
|
8
|
+
* What gets said, and what does not: the loaded modules, the licence state,
|
|
9
|
+
* whether an endpoint is configured, and any refusal. Never the token, never
|
|
10
|
+
* the endpoint's value, never anything about a key.
|
|
11
|
+
*/
|
|
12
|
+
import type { Discovery } from './server.js';
|
|
13
|
+
export declare function startupLines(found: Discovery): string[];
|
|
14
|
+
//# sourceMappingURL=startup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup.d.ts","sourceRoot":"","sources":["../src/startup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,EAAE,CAuCvD"}
|
package/dist/startup.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The startup lines.
|
|
3
|
+
*
|
|
4
|
+
* Pure: it turns a `Discovery` into the lines to print, so the wording is
|
|
5
|
+
* testable without starting a server. `bin.ts` writes them to stderr —
|
|
6
|
+
* stdout belongs to the JSON-RPC stream and must stay clean.
|
|
7
|
+
*
|
|
8
|
+
* What gets said, and what does not: the loaded modules, the licence state,
|
|
9
|
+
* whether an endpoint is configured, and any refusal. Never the token, never
|
|
10
|
+
* the endpoint's value, never anything about a key.
|
|
11
|
+
*/
|
|
12
|
+
import { SERVER_NAME, SERVER_VERSION } from './server.js';
|
|
13
|
+
export function startupLines(found) {
|
|
14
|
+
const tag = `[${SERVER_NAME}]`;
|
|
15
|
+
const lines = [];
|
|
16
|
+
const modules = found.modules.length === 0
|
|
17
|
+
? 'none'
|
|
18
|
+
: found.modules.map((m) => `${m.id}@${m.version} (${m.licence})`).join(', ');
|
|
19
|
+
lines.push(`${tag} ${SERVER_VERSION} · circle-ir ${found.circleIr} · licence ${found.enablement.state} · modules ${modules}` +
|
|
20
|
+
(found.enablement.endpoint ? ' · endpoint configured' : ''));
|
|
21
|
+
// One notice in the extended state, once per process, as the terms require.
|
|
22
|
+
if (found.enablement.state === 'extended') {
|
|
23
|
+
const polyform = found.modules.filter((m) => /polyform/i.test(m.licence));
|
|
24
|
+
if (polyform.length > 0) {
|
|
25
|
+
lines.push(`${tag} ${polyform.map((m) => m.id).join(', ')} is licensed for non-commercial use. ` +
|
|
26
|
+
`Run \`cognium license set <token>\` for commercial terms.`);
|
|
27
|
+
}
|
|
28
|
+
if (found.enablement.licence.status === 'expired') {
|
|
29
|
+
lines.push(`${tag} ${found.enablement.licence.detail}; serving with non-commercial terms.`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// A refusal costs only the module that was refused: say what is left, which
|
|
33
|
+
// is the floor alone unless another module did load.
|
|
34
|
+
const stillServing = found.modules.length === 0
|
|
35
|
+
? 'Serving the deterministic floor only.'
|
|
36
|
+
: `Still serving the deterministic floor and ${found.modules.map((m) => m.id).join(', ')}.`;
|
|
37
|
+
for (const refusal of found.refusals) {
|
|
38
|
+
lines.push(`${tag} refused ${refusal.specifier}: ${refusal.reason}. ${stillServing}`);
|
|
39
|
+
}
|
|
40
|
+
return lines;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=startup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup.js","sourceRoot":"","sources":["../src/startup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,UAAU,YAAY,CAAC,KAAgB;IAC3C,MAAM,GAAG,GAAG,IAAI,WAAW,GAAG,CAAC;IAC/B,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,MAAM,OAAO,GACX,KAAK,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;QACxB,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEjF,KAAK,CAAC,IAAI,CACR,GAAG,GAAG,IAAI,cAAc,gBAAgB,KAAK,CAAC,QAAQ,cAAc,KAAK,CAAC,UAAU,CAAC,KAAK,cAAc,OAAO,EAAE;QAC/G,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,CAAC,CAC9D,CAAC;IAEF,4E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HANGED
|
@@ -2,8 +2,17 @@
|
|
|
2
2
|
* Shared types for tool handlers.
|
|
3
3
|
*/
|
|
4
4
|
import type { ProjectCache } from '../cache.js';
|
|
5
|
+
import type { Enablement } from '../enablement.js';
|
|
5
6
|
export interface ToolContext {
|
|
7
|
+
/** One analysis cache for the whole server, shared by every tool. */
|
|
6
8
|
cache: ProjectCache;
|
|
9
|
+
/**
|
|
10
|
+
* What this install may offer. Present so an optional module can decide,
|
|
11
|
+
* at registration time, which of its own tools to register, and check
|
|
12
|
+
* again at call time before doing anything an endpoint or a licence is
|
|
13
|
+
* needed for. The floor tools never consult it.
|
|
14
|
+
*/
|
|
15
|
+
enablement: Enablement;
|
|
7
16
|
}
|
|
8
17
|
/**
|
|
9
18
|
* MCP `CallToolResult`-compatible shape. We construct the JSON payload
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,WAAW,WAAW;IAC1B,qEAAqE;IACrE,KAAK,EAAE,YAAY,CAAC;IACpB;;;;;OAKG;IACH,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,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,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAK7F;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAKvD"}
|
package/dist/tools/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AA2BH,MAAM,UAAU,UAAU,CAAC,OAAgB,EAAE,UAAoC;IAC/E,MAAM,IAAI,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACtF,MAAM,MAAM,GAAe,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IACjE,IAAI,UAAU;QAAE,MAAM,CAAC,iBAAiB,GAAG,UAAU,CAAC;IACtD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,OAAO,EAAE,EAAE,CAAC;QACtD,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
|
package/dist/util/wasm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../../src/util/wasm.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../../src/util/wasm.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CA0BpD"}
|
package/dist/util/wasm.js
CHANGED
|
@@ -25,7 +25,9 @@ export async function ensureAnalyzer() {
|
|
|
25
25
|
go: wasmBase + 'tree-sitter-go.wasm',
|
|
26
26
|
java: wasmBase + 'tree-sitter-java.wasm',
|
|
27
27
|
javascript: wasmBase + 'tree-sitter-javascript.wasm',
|
|
28
|
-
|
|
28
|
+
// TypeScript grammar, not JavaScript: TS-only syntax (interfaces,
|
|
29
|
+
// type annotations) otherwise parses as error-recovered calls (#409).
|
|
30
|
+
typescript: wasmBase + 'tree-sitter-typescript.wasm',
|
|
29
31
|
python: wasmBase + 'tree-sitter-python.wasm',
|
|
30
32
|
rust: wasmBase + 'tree-sitter-rust.wasm',
|
|
31
33
|
html: wasmBase + 'tree-sitter-html.wasm',
|
package/dist/util/wasm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasm.js","sourceRoot":"","sources":["../../src/util/wasm.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEhE,IAAI,WAAW,GAAyB,IAAI,CAAC;AAE7C,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,IAAI,qBAAqB,EAAE;QAAE,OAAO;IACpC,IAAI,WAAW;QAAE,OAAO,WAAW,CAAC;IAEpC,WAAW,GAAG,CAAC,KAAK,IAAI,EAAE;QACxB,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/C,MAAM,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,OAAO,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;QAC9D,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC;QAClE,MAAM,YAAY,CAAC;YACjB,QAAQ,EAAE,QAAQ,GAAG,sBAAsB;YAC3C,aAAa,EAAE;gBACb,IAAI,EAAE,QAAQ,GAAG,uBAAuB;gBACxC,EAAE,EAAE,QAAQ,GAAG,qBAAqB;gBACpC,IAAI,EAAE,QAAQ,GAAG,uBAAuB;gBACxC,UAAU,EAAE,QAAQ,GAAG,6BAA6B;gBACpD,kEAAkE;gBAClE,sEAAsE;gBACtE,UAAU,EAAE,QAAQ,GAAG,6BAA6B;gBACpD,MAAM,EAAE,QAAQ,GAAG,yBAAyB;gBAC5C,IAAI,EAAE,QAAQ,GAAG,uBAAuB;gBACxC,IAAI,EAAE,QAAQ,GAAG,uBAAuB;aACzC;SACF,CAAC,CAAC;IACL,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cognium/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Model Context Protocol server exposing the circle-ir SAST engine as structured tools for LLM agents (Claude Desktop, Claude Code, Cursor, cognium-ai).",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"bin": {
|
|
9
|
-
"mcp-server-cognium-dev": "dist/
|
|
9
|
+
"mcp-server-cognium-dev": "dist/bin.js"
|
|
10
10
|
},
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"LICENSE"
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
|
-
"build": "tsc && chmod +x dist/
|
|
24
|
+
"build": "tsc && chmod +x dist/bin.js",
|
|
25
25
|
"clean": "rm -rf dist *.tsbuildinfo",
|
|
26
26
|
"typecheck": "tsc --noEmit",
|
|
27
27
|
"test": "vitest run",
|