@cognium/mcp-server 0.4.0 → 0.6.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 CHANGED
@@ -4,6 +4,128 @@ All notable changes to `@cognium/mcp-server` are documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.6.0] - 2026-10-03
8
+
9
+ Tested against `circle-ir` **4.10.0**. **No tool was added, removed or renamed;
10
+ no input or output schema changed; no answer changed.** A minor because the
11
+ repository ships a new Claude Code plugin feature beside the server, not because
12
+ the server's surface moved — the publish gate's `tools/list` comparison against
13
+ the previous release passes unchanged.
14
+
15
+ **Added — the `find_callers` suggestion, in the Claude Code plugin.** After a
16
+ `Read` or `Grep` whose output names a Java method declaration, the plugin adds
17
+ one line of context suggesting `find_callers` for that method, with the symbol
18
+ filled in, **once per method per session**. It only suggests: it calls no tool,
19
+ runs no analysis, reads no file, changes nothing and blocks nothing. It can be
20
+ turned off from `/config` (**Suggest find_callers after reading Java**) or with
21
+ `COGNIUM_SUGGEST_FIND_CALLERS=off`.
22
+
23
+ **Why, measured.** A paired bench found the navigation tools reached for in **1
24
+ of 12** runs where they were available and the question was exactly theirs.
25
+ Rewording the tool descriptions (0.5.1) moved that **0 of 5** runs; this
26
+ suggestion moved it **6 of 6** (Fisher exact two-tailed p = 0.0022). The reading
27
+ of why: the tools are listed in the session but their descriptions are fetched on
28
+ demand, so wording cannot influence a choice the agent never looks up — naming
29
+ the tool is what prompts it. From a bench: one repository, one prompt, six runs a
30
+ cell, and no accuracy claim is made in either direction.
31
+
32
+ **Fixed, before it shipped.** The method pattern captured a **constructor** as a
33
+ method name — `public AttackResult(` has a modifier and a name and no return
34
+ type — so on a real file it offered to find the callers of the class. Requiring a
35
+ return type keeps constructors out. Found end to end, against the file whose
36
+ constructor is declared above its first method.
37
+
38
+ ## [0.5.1] - 2026-10-03
39
+
40
+ Tested against `circle-ir` **4.10.0**. **Tool descriptions only.** No tool was
41
+ added, removed or renamed; no input or output schema changed; no behaviour
42
+ changed. The two navigation tools now open with the question each answers and
43
+ say to call them before grepping for callers, because a paired bench found the
44
+ tools reached for on 1 of 12 runs where they were available and the question
45
+ was exactly theirs.
46
+
47
+ **What the wording is worth, measured:** on its own, not much. A second paired
48
+ trial put this text against 0.5.0's on the same questions and found the tools
49
+ reached for on 1 of 6 Claude Code runs against 0 of 6, and 0 of 6 Codex runs
50
+ against 0 of 6 — no effect this bench can distinguish from none (n = 6 a cell).
51
+ The change is kept because it costs nothing and describes the tools more
52
+ accurately, not because it was shown to work.
53
+
54
+ ## [0.5.0] - 2026-10-02
55
+
56
+ Tested against `circle-ir` **4.10.0** (range `4.10`) and MCP SDK v2
57
+ (`@modelcontextprotocol/server` **^2.2.0**), with the optional module
58
+ `circle-ir-ai` **4.19.0**. Two tools are added. No tool was removed or
59
+ renamed, and what every existing tool accepts and returns is unchanged.
60
+
61
+ **`circle-ir` moves to a new minor, so an optional module must move with it.**
62
+ A module built against `4.9` is refused at load on `4.10` by design, which
63
+ would leave states 1 and 2 with none of their tools. Release order therefore
64
+ matters: `circle-ir` 4.10.0, then `circle-ir-ai` on 4.10, then this package.
65
+
66
+ ### Added
67
+ - **`find_callers` and `find_callees`** — who calls a method, and what a
68
+ method calls, over `circle-ir`'s navigation index. Java today; the tools
69
+ report `unsupported-language` for a file in a language the index does not
70
+ resolve rather than guessing.
71
+
72
+ Every answer carries a **tier**: `exact` (the receiver's static type was
73
+ known and the target was unique in it), `polymorphic` (dispatch is open,
74
+ with every candidate body listed and the declaring member as the target),
75
+ or `inferred` (bound by the method name alone). `inferred` is a floor and is
76
+ never promoted; it is also never produced when a receiver's type *is* known
77
+ and lacks the method, which on a 405-file Java repository was 78 of 147
78
+ name-only "callers" of a single method.
79
+
80
+ Every call site that could not be resolved carries a **reason** from a
81
+ closed vocabulary — `external`, `dynamic`, `generated`, `parse-error`,
82
+ `unsupported-language`, `unknown` — so an unresolved count can be read
83
+ rather than guessed at. Every answer states its **denominator**: files
84
+ searched, languages, and the directories deliberately skipped. A list cut to
85
+ `limit` reports `truncated` with the real total.
86
+
87
+ Both tools accept either a `symbol` or a `site`. A site is
88
+ `{file, line, method_name}` and not a column, because a chained expression
89
+ reports several calls at one line and column — `b.of().step("a").done()` is
90
+ three calls at one position — so the method name is what completes the key.
91
+
92
+ Both are `readOnlyHint: true`, `openWorldHint: false`, and every successful
93
+ response says `provenance: deterministic`. No model is consulted.
94
+
95
+ When no answer is `exact`, the response carries a `nextStep` line saying
96
+ what to do instead — inspect the candidates, check a receiver, or reach for
97
+ a language server. It sits in the server's envelope, not inside the answer,
98
+ because it is advice rather than a fact about the code.
99
+
100
+ ### Measured
101
+
102
+ The navigation tools were evaluated against compiler-backed ground truth: a
103
+ sample of call sites in WebGoat, each site's callee resolved by the Eclipse
104
+ JDT compiler, with a pinned `ripgrep` answering the same queries as a
105
+ baseline. Java only. Every figure below carries its denominator.
106
+
107
+ - **`exact` precision: 100 %** — of the 142 `exact` answers that landed on a
108
+ site the compiler had resolved, 142 named the compiler's callee and none
109
+ contradicted it.
110
+ - **An `inferred` hit is not evidence of a call.** It is a name that matched
111
+ with no receiver type to confirm it, and the baseline is the measure of
112
+ what that is worth: a plain name match was right **60.6 %** of the time on
113
+ this sample. An `inferred` hit is a lead to check, and the tool will not
114
+ promote it.
115
+ - **Recall over sites whose target is declared in the repository: 79.6 %.**
116
+ - **Recall over all sampled sites: 34.1 %**, against the baseline's
117
+ **92.3 %** — and capped at **39.8 %** for any tool answering from an index,
118
+ because only 186 of the 467 sampled sites have a target declared inside the
119
+ repository. That row's two columns answer different questions and should
120
+ not be read as one comparison.
121
+
122
+ ### Changed
123
+ - The server's own cache keeps a navigation index per project, separately
124
+ from the scan analyses. It asks the engine for more (the extra type
125
+ information that makes a Java `record` visible) and for less (no cross-file
126
+ taint phase, which navigation does not read), so a caller asking "who calls
127
+ this" does not pay for taint analysis it will not use.
128
+
7
129
  ## [0.4.0] - 2026-10-02
8
130
 
9
131
  Tested against `circle-ir` **4.9.29** (range `4.9`) and MCP SDK v2
package/README.md CHANGED
@@ -76,6 +76,8 @@ The same stdio config is bundled in the [Cognium SAST plugin](../../plugins/cogn
76
76
  | `describe_sink` | CWE, remediation, CVSS-like severity, and sanitizer list for a sink category. |
77
77
  | `describe_source` | Every framework API pattern circle-ir treats as a source of a given category. |
78
78
  | `find_similar` | Given a finding id, return other findings sharing the same `rule_id` and/or `sink_type`. |
79
+ | `find_callers` | Who calls a method, with a resolution tier on every answer and a reason on every site it could not resolve. Java. |
80
+ | `find_callees` | What a method calls, with the same tiers and reasons. Java. |
79
81
  | `refresh` | Manually invalidate the cache for one project or every project. |
80
82
 
81
83
  ## Resources
@@ -95,6 +97,89 @@ The same stdio config is bundled in the [Cognium SAST plugin](../../plugins/cogn
95
97
  3. Iterate over the highest-severity findings with `explain_finding` for CWE context.
96
98
  4. `find_similar` to catch the same pattern elsewhere.
97
99
  5. Before proposing a fix, `check_sanitizer` any proposed wrapper against the target sink type.
100
+ 6. Before changing a method, `find_callers` on it to see what depends on it.
101
+
102
+ ## The Claude Code plugin's `find_callers` suggestion
103
+
104
+ This repository also ships a Claude Code plugin (`plugins/cognium-dev`). With it
105
+ enabled, a `Read` or `Grep` whose output names a Java **method** declaration adds
106
+ one line of context **suggesting** `find_callers` for that method, with the
107
+ symbol filled in — once per method per session.
108
+
109
+ **It only suggests.** It calls no tool, runs no analysis, reads no file and
110
+ changes nothing; calling the tool stays the agent's decision. Turn it off with
111
+ the plugin's **Suggest find_callers after reading Java** option in `/config`, or
112
+ `COGNIUM_SUGGEST_FIND_CALLERS=off` outside the plugin. It is a plugin feature and
113
+ changes nothing about the server: the tools, their schemas and their answers are
114
+ the same with it and without it.
115
+
116
+ ## Reading a navigation answer
117
+
118
+ `find_callers` and `find_callees` report a **tier** on every answer and a
119
+ **reason** on every call site they could not resolve, because a caller list is
120
+ only useful if you know whether it is complete.
121
+
122
+ | Tier | What it means |
123
+ | ---- | ------------- |
124
+ | `exact` | The receiver's static type was known and the target was unique in it. Act on these. |
125
+ | `polymorphic` | Dispatch is open. `candidates` lists every implementation that could run, and `target` is the declaring member. |
126
+ | `inferred` | Bound by the method name alone, with no receiver type to confirm it. **A lead to check, never a caller.** |
127
+
128
+ `inferred` is a floor and is never promoted. It is also never produced when a
129
+ receiver's type *is* known and lacks the method: on a 405-file Java
130
+ repository, 78 of 147 name-only "callers" of one method had a receiver whose
131
+ own declared type could not have had it, so that case is now no answer plus a
132
+ reason rather than a weak answer.
133
+
134
+ Every non-answer carries one of `external` (the target is outside the searched
135
+ tree — the JDK, a framework), `dynamic` (reflection), `generated` (the member
136
+ only exists after annotation processing, such as a Lombok accessor),
137
+ `parse-error`, `unsupported-language`, or `unknown` (in the tree, and the call
138
+ graph could not bind it). A large `external` count usually means the name is a
139
+ common one, not that the answer is poor.
140
+
141
+ `scope` states what was searched and what was skipped, so a count can be read
142
+ against its denominator, and `truncated` appears whenever a list was cut.
143
+
144
+ ### What the tiers measure
145
+
146
+ The navigation tools resolve **Java**. A file in another language is reported
147
+ as `unsupported-language` and is not counted in `scope.searched`, so an answer
148
+ never implies a language was searched when it was not.
149
+
150
+ These numbers come from an independent evaluation against compiler-backed
151
+ ground truth — a sample of call sites in [WebGoat](https://github.com/WebGoat/WebGoat),
152
+ each site's callee resolved by the Eclipse JDT compiler, with a pinned
153
+ [ripgrep](https://github.com/BurntSushi/ripgrep) answering the same queries as
154
+ a baseline. Every figure carries its denominator, and the baseline is on the
155
+ same line so the comparison is visible rather than asserted.
156
+
157
+ | | this server | ripgrep baseline |
158
+ | --- | --- | --- |
159
+ | `exact` precision | **100 %** — 142 of 142 answers that landed on a resolved site | — (it claims no `exact`) |
160
+ | recall, all sampled sites | 34.1 % | 92.3 % |
161
+ | recall, targets declared in the repository | 79.6 % | — |
162
+ | precision of a plain name match | — | 60.6 % |
163
+
164
+ Two of those rows need reading together rather than separately. **Recall over
165
+ all sampled sites is capped at 39.8 % for any tool that answers from an
166
+ index**, because only 186 of the 467 sampled sites have a target declared
167
+ inside the repository at all; the rest are in the JDK or a library. A text
168
+ search answers about a name wherever it is declared, so the two columns of
169
+ that row are answering different questions. The row below it — targets
170
+ declared in the repository — is the one where both columns answer the same
171
+ question.
172
+
173
+ **An `inferred` hit is not evidence of a call.** It is a method name that
174
+ matched, with no receiver type to confirm it — and the baseline row above is
175
+ the measure of what a bare name match is worth: right 60.6 % of the time on
176
+ this sample. Treat an `inferred` hit as a lead to check by opening the site,
177
+ never as a caller. That is why it is a separate tier rather than a weaker
178
+ `exact`: the label is the warning, and the tool will not promote it.
179
+
180
+ What `exact` is worth is the other half of the same point: of the 142 `exact`
181
+ answers that landed on a site the compiler had resolved, **142 named the
182
+ compiler's callee and none contradicted it.**
98
183
 
99
184
  ## Using it as a library
100
185
 
package/dist/cache.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  * mtimes and re-run `analyzeProject` only if any file changed. LRU
7
7
  * eviction keeps memory bounded when the LLM hops between projects.
8
8
  */
9
- import { type ProjectAnalysis } from 'circle-ir';
9
+ import { type NavigationIndex, type ProjectAnalysis } from 'circle-ir';
10
10
  /**
11
11
  * Per-project analysis options that participate in the cache key. Two
12
12
  * scans with different profiles / disabled passes must not share a cache
@@ -22,6 +22,7 @@ export interface ProjectScanOptions {
22
22
  }
23
23
  export declare class ProjectCache {
24
24
  private entries;
25
+ private navEntries;
25
26
  private readonly capacity;
26
27
  constructor(capacity?: number);
27
28
  private cacheKey;
@@ -36,6 +37,34 @@ export declare class ProjectCache {
36
37
  analysisMs: number;
37
38
  fileCount: number;
38
39
  }>;
40
+ /**
41
+ * Return a cached navigation index if fresh, else build one.
42
+ *
43
+ * Kept apart from `getOrCompute` on purpose, in both directions:
44
+ *
45
+ * - **It asks the engine for more.** The index needs `navigationTypes`,
46
+ * which makes a Java `record` visible and keeps a nested type's nesting.
47
+ * Sharing an entry with the scan tools would hand them type information
48
+ * they do not expect, so the two never share one.
49
+ * - **It asks the engine to do less.** Navigation needs per-file IR and
50
+ * nothing else, so this runs `analyze` per file rather than
51
+ * `analyzeProject`, skipping the cross-file taint phase entirely. On a
52
+ * large repository that phase is the expensive part, and a caller
53
+ * asking "who calls this method" should not pay for taint analysis it
54
+ * will not read.
55
+ *
56
+ * `parseMs` is the measured wall time of that loop, which is parsing **and**
57
+ * IR extraction — the two are one call and the server cannot separate them.
58
+ * It is handed to the index so `timing.parseMs` carries a real reading
59
+ * rather than a zero, and it over-reports pure parse time rather than
60
+ * guessing at it.
61
+ */
62
+ getOrComputeNavigation(projectRoot: string, opts?: ProjectScanOptions): Promise<{
63
+ index: NavigationIndex;
64
+ cacheHit: boolean;
65
+ parseMs: number;
66
+ fileCount: number;
67
+ }>;
39
68
  /** Invalidate one specific project (all option-keys) or one specific key. */
40
69
  invalidate(projectRoot: string, opts?: ProjectScanOptions): number;
41
70
  /** Invalidate every cached project. */
@@ -1 +1 @@
1
- {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAIjE;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAmBD,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAAiC;IAChD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAElC,YAAY,QAAQ,SAAI,EAEvB;IAED,OAAO,CAAC,QAAQ;IAIhB;;;;OAIG;IACG,YAAY,CAChB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,kBAAkB,GACvB,OAAO,C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IAAI,GAAE,kBAAuB,GAC5B,OAAO,CAAC;QACT,KAAK,EAAE,eAAe,CAAC;QACvB,QAAQ,EAAE,OAAO,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAwDD;IAED,6EAA6E;IAC7E,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,kBAAkB,GAAG,MAAM,CAoBjE;IAED,uCAAuC;IACvC,KAAK,IAAI,MAAM,CAKd;IAED,IAAI,IAAI,MAAM,CAEb;IAED,OAAO,CAAC,QAAQ;CAejB"}
package/dist/cache.js CHANGED
@@ -6,9 +6,9 @@
6
6
  * mtimes and re-run `analyzeProject` only if any file changed. LRU
7
7
  * eviction keeps memory bounded when the LLM hops between projects.
8
8
  */
9
- import { resolve } from 'path';
10
- import { analyzeProject } from 'circle-ir';
11
- import { collectFiles, indexMtimes, mtimesEqual } from './util/files.js';
9
+ import { relative, resolve } from 'path';
10
+ import { analyze, analyzeProject, buildNavigationIndex, } from 'circle-ir';
11
+ import { collectFiles, indexMtimes, mtimesEqual, SKIPPED_DIRECTORIES } from './util/files.js';
12
12
  import { ensureAnalyzer } from './util/wasm.js';
13
13
  function optionsKey(opts) {
14
14
  const parts = [
@@ -20,6 +20,7 @@ function optionsKey(opts) {
20
20
  }
21
21
  export class ProjectCache {
22
22
  entries = new Map();
23
+ navEntries = new Map();
23
24
  capacity;
24
25
  constructor(capacity = 3) {
25
26
  this.capacity = capacity;
@@ -68,6 +69,80 @@ export class ProjectCache {
68
69
  this.evictLRU();
69
70
  return { analysis, cacheHit: false, analysisMs, fileCount: files.length };
70
71
  }
72
+ /**
73
+ * Return a cached navigation index if fresh, else build one.
74
+ *
75
+ * Kept apart from `getOrCompute` on purpose, in both directions:
76
+ *
77
+ * - **It asks the engine for more.** The index needs `navigationTypes`,
78
+ * which makes a Java `record` visible and keeps a nested type's nesting.
79
+ * Sharing an entry with the scan tools would hand them type information
80
+ * they do not expect, so the two never share one.
81
+ * - **It asks the engine to do less.** Navigation needs per-file IR and
82
+ * nothing else, so this runs `analyze` per file rather than
83
+ * `analyzeProject`, skipping the cross-file taint phase entirely. On a
84
+ * large repository that phase is the expensive part, and a caller
85
+ * asking "who calls this method" should not pay for taint analysis it
86
+ * will not read.
87
+ *
88
+ * `parseMs` is the measured wall time of that loop, which is parsing **and**
89
+ * IR extraction — the two are one call and the server cannot separate them.
90
+ * It is handed to the index so `timing.parseMs` carries a real reading
91
+ * rather than a zero, and it over-reports pure parse time rather than
92
+ * guessing at it.
93
+ */
94
+ async getOrComputeNavigation(projectRoot, opts = {}) {
95
+ await ensureAnalyzer();
96
+ const absRoot = resolve(projectRoot);
97
+ const key = `${absRoot}::nav::${optionsKey(opts)}`;
98
+ const langOpt = opts.language;
99
+ const collectOpts = langOpt ? { language: langOpt } : {};
100
+ const currentMtimes = indexMtimes(absRoot, collectOpts);
101
+ const existing = this.navEntries.get(key);
102
+ if (existing && mtimesEqual(existing.mtimes, currentMtimes)) {
103
+ this.navEntries.delete(key);
104
+ this.navEntries.set(key, existing);
105
+ return {
106
+ index: existing.index,
107
+ cacheHit: true,
108
+ parseMs: existing.parseMs,
109
+ fileCount: existing.fileCount,
110
+ };
111
+ }
112
+ const files = collectFiles(absRoot, collectOpts);
113
+ const t0 = Date.now();
114
+ const navFiles = [];
115
+ for (const f of files) {
116
+ navFiles.push({
117
+ // Paths are reported relative to the project root, so an answer does
118
+ // not leak the absolute layout of the machine it was produced on and
119
+ // two runs from different checkouts of the same commit agree.
120
+ path: relative(absRoot, f.filePath) || f.filePath,
121
+ language: f.language,
122
+ source: f.code,
123
+ ir: await analyze(f.code, f.filePath, f.language, { navigationTypes: true }),
124
+ });
125
+ }
126
+ const parseMs = Date.now() - t0;
127
+ const index = buildNavigationIndex(navFiles, {
128
+ parseMs,
129
+ cache: true,
130
+ excluded: SKIPPED_DIRECTORIES.map((d) => ({
131
+ pattern: `**/${d}/**`,
132
+ reason: 'not project source',
133
+ })),
134
+ });
135
+ this.navEntries.set(key, {
136
+ key,
137
+ index,
138
+ mtimes: currentMtimes,
139
+ computedAt: Date.now(),
140
+ parseMs,
141
+ fileCount: files.length,
142
+ });
143
+ this.evictLRU();
144
+ return { index, cacheHit: false, parseMs, fileCount: files.length };
145
+ }
71
146
  /** Invalidate one specific project (all option-keys) or one specific key. */
72
147
  invalidate(projectRoot, opts) {
73
148
  const abs = resolve(projectRoot);
@@ -83,16 +158,23 @@ export class ProjectCache {
83
158
  removed++;
84
159
  }
85
160
  }
161
+ for (const key of [...this.navEntries.keys()]) {
162
+ if (key.startsWith(abs + '::')) {
163
+ this.navEntries.delete(key);
164
+ removed++;
165
+ }
166
+ }
86
167
  return removed;
87
168
  }
88
169
  /** Invalidate every cached project. */
89
170
  clear() {
90
- const n = this.entries.size;
171
+ const n = this.entries.size + this.navEntries.size;
91
172
  this.entries.clear();
173
+ this.navEntries.clear();
92
174
  return n;
93
175
  }
94
176
  size() {
95
- return this.entries.size;
177
+ return this.entries.size + this.navEntries.size;
96
178
  }
97
179
  evictLRU() {
98
180
  while (this.entries.size > this.capacity) {
@@ -101,6 +183,15 @@ export class ProjectCache {
101
183
  break;
102
184
  this.entries.delete(oldestKey);
103
185
  }
186
+ // Navigation indexes are evicted on their own budget: a project can hold
187
+ // one of each, and evicting a scan entry must not drop a navigation index
188
+ // the caller is still querying.
189
+ while (this.navEntries.size > this.capacity) {
190
+ const oldestKey = this.navEntries.keys().next().value;
191
+ if (oldestKey === undefined)
192
+ break;
193
+ this.navEntries.delete(oldestKey);
194
+ }
104
195
  }
105
196
  }
106
197
  //# sourceMappingURL=cache.js.map
package/dist/cache.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAwB,MAAM,WAAW,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SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAID;;;;;;GAMG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAAC,SAAS,CAAC,CAUpD;AAED,4EAA4E;AAC5E,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,IAAI,GAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,GAAG,YAAY,CAAM,GAC5D,OAAO,CAAC;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,CAAC,CAQtD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAC3B,IAAI,GAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,GAAG,YAAY,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,uBAAuB,CAAA;CAAO,GACpG,cAAc,CAGhB"}
package/dist/server.js CHANGED
@@ -23,6 +23,7 @@ import { attackSurfaceSummaryConfig, makeAttackSurfaceSummaryHandler } from './t
23
23
  import { listReachableSinksConfig, makeListReachableSinksHandler } from './tools/list-reachable-sinks.js';
24
24
  import { findSimilarConfig, makeFindSimilarHandler } from './tools/find-similar.js';
25
25
  import { refreshConfig, makeRefreshHandler } from './tools/refresh.js';
26
+ import { findCallersConfig, makeFindCallersHandler, findCalleesConfig, makeFindCalleesHandler, } from './tools/navigation.js';
26
27
  const require_ = createRequire(import.meta.url);
27
28
  /**
28
29
  * Server name and version, from the manifest, in one place.
@@ -61,6 +62,8 @@ export function buildServer(opts = {}) {
61
62
  server.registerTool('attack_surface_summary', attackSurfaceSummaryConfig, makeAttackSurfaceSummaryHandler(ctx));
62
63
  server.registerTool('list_reachable_sinks', listReachableSinksConfig, makeListReachableSinksHandler(ctx));
63
64
  server.registerTool('find_similar', findSimilarConfig, makeFindSimilarHandler(ctx));
65
+ server.registerTool('find_callers', findCallersConfig, makeFindCallersHandler(ctx));
66
+ server.registerTool('find_callees', findCalleesConfig, makeFindCalleesHandler(ctx));
64
67
  server.registerTool('refresh', refreshConfig, makeRefreshHandler(ctx));
65
68
  registerResources(server);
66
69
  // A module that throws while registering is refused like any other bad
@@ -1 +1 @@
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,gBAAgB,EAAqD,MAAM,8BAA8B,CAAC;AAC9H,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAmB,MAAM,iBAAiB,CAAC;AACzF,OAAO,EACL,WAAW,EACX,eAAe,GAGhB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CA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,EAAE,CAAC;QACnC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,WAAW,CAAC,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC,CAAC;QACjF,yEAAyE;QACzE,qEAAqE;QACrE,MAAM,UAAU,GAAG,oBAAoB,CAAC,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;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAI,GAA+F,EAAE;IAErG,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC;IACnC,OAAO,gBAAgB,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACnF,CAAC"}
@@ -0,0 +1,177 @@
1
+ /**
2
+ * `find_callers` and `find_callees` — who calls a method, and what a method
3
+ * calls, with every answer saying how it was reached.
4
+ *
5
+ * These two differ from the other nine read-only tools in what they promise.
6
+ * A scan reports what it found; these report what they found **and what they
7
+ * could not reach**, because a caller list is only useful if you know whether
8
+ * it is complete. So every response carries three things the engine computes
9
+ * and this tool passes through untouched:
10
+ *
11
+ * - a **tier** per answer. `exact` means the receiver's static type was
12
+ * known and the target was unique in it. `polymorphic` means dispatch is
13
+ * open, with every candidate body listed. `inferred` means bound by name
14
+ * alone — a floor, never a promise, and never produced when a receiver
15
+ * type *is* known and disagrees.
16
+ * - a **reason** per non-answer, from a closed vocabulary, so "7,000 sites
17
+ * unresolved" can be read as "6,900 of them are in the JDK".
18
+ * - a **scope**: how many files were searched, in which languages, and what
19
+ * was deliberately left out. A count without its denominator is not an
20
+ * answer.
21
+ *
22
+ * The envelope this tool adds around that — `projectRoot`, `cacheHit`,
23
+ * `nextStep`, `provenance` — is the server's. The answer-shape fields inside
24
+ * are the engine's and are not rewritten here, because they are compared
25
+ * field for field against a compiler-backed oracle.
26
+ */
27
+ import { z } from 'zod';
28
+ import type { NavigationAnswer, Tier } from 'circle-ir';
29
+ import type { ToolContext, ToolResult } from './types.js';
30
+ /** Cap on `answers[]`. A truncated list always says so. */
31
+ export declare const MAX_NAVIGATION_ANSWERS = 200;
32
+ declare const LANGUAGES: readonly ['java', 'javascript', 'typescript', 'python', 'go', 'rust', 'bash', 'html'];
33
+ export declare const findCallersInputShape: {
34
+ readonly project_root: z.ZodString;
35
+ readonly symbol: z.ZodOptional<z.ZodString>;
36
+ readonly site: z.ZodOptional<z.ZodObject<{
37
+ file: z.ZodString;
38
+ line: z.ZodNumber;
39
+ method_name: z.ZodString;
40
+ }, z.core.$strip>>;
41
+ readonly language: z.ZodOptional<z.ZodEnum<{
42
+ bash: "bash";
43
+ go: "go";
44
+ html: "html";
45
+ java: "java";
46
+ javascript: "javascript";
47
+ python: "python";
48
+ rust: "rust";
49
+ typescript: "typescript";
50
+ }>>;
51
+ readonly limit: z.ZodOptional<z.ZodNumber>;
52
+ readonly tiers: z.ZodOptional<z.ZodArray<z.ZodEnum<{
53
+ exact: "exact";
54
+ inferred: "inferred";
55
+ polymorphic: "polymorphic";
56
+ }>>>;
57
+ };
58
+ export declare const findCalleesInputShape: {
59
+ readonly project_root: z.ZodString;
60
+ readonly symbol: z.ZodOptional<z.ZodString>;
61
+ readonly site: z.ZodOptional<z.ZodObject<{
62
+ file: z.ZodString;
63
+ line: z.ZodNumber;
64
+ method_name: z.ZodString;
65
+ }, z.core.$strip>>;
66
+ readonly language: z.ZodOptional<z.ZodEnum<{
67
+ bash: "bash";
68
+ go: "go";
69
+ html: "html";
70
+ java: "java";
71
+ javascript: "javascript";
72
+ python: "python";
73
+ rust: "rust";
74
+ typescript: "typescript";
75
+ }>>;
76
+ readonly limit: z.ZodOptional<z.ZodNumber>;
77
+ readonly tiers: z.ZodOptional<z.ZodArray<z.ZodEnum<{
78
+ exact: "exact";
79
+ inferred: "inferred";
80
+ polymorphic: "polymorphic";
81
+ }>>>;
82
+ };
83
+ export declare const findCallersConfig: {
84
+ readonly title: 'Find the callers of a symbol';
85
+ readonly description: string;
86
+ readonly inputSchema: {
87
+ readonly project_root: z.ZodString;
88
+ readonly symbol: z.ZodOptional<z.ZodString>;
89
+ readonly site: z.ZodOptional<z.ZodObject<{
90
+ file: z.ZodString;
91
+ line: z.ZodNumber;
92
+ method_name: z.ZodString;
93
+ }, z.core.$strip>>;
94
+ readonly language: z.ZodOptional<z.ZodEnum<{
95
+ bash: "bash";
96
+ go: "go";
97
+ html: "html";
98
+ java: "java";
99
+ javascript: "javascript";
100
+ python: "python";
101
+ rust: "rust";
102
+ typescript: "typescript";
103
+ }>>;
104
+ readonly limit: z.ZodOptional<z.ZodNumber>;
105
+ readonly tiers: z.ZodOptional<z.ZodArray<z.ZodEnum<{
106
+ exact: "exact";
107
+ inferred: "inferred";
108
+ polymorphic: "polymorphic";
109
+ }>>>;
110
+ };
111
+ readonly annotations: {
112
+ readonly readOnlyHint: true;
113
+ readonly destructiveHint: false;
114
+ readonly idempotentHint: true;
115
+ readonly openWorldHint: false;
116
+ };
117
+ };
118
+ export declare const findCalleesConfig: {
119
+ readonly title: 'Find what a symbol calls';
120
+ readonly description: string;
121
+ readonly inputSchema: {
122
+ readonly project_root: z.ZodString;
123
+ readonly symbol: z.ZodOptional<z.ZodString>;
124
+ readonly site: z.ZodOptional<z.ZodObject<{
125
+ file: z.ZodString;
126
+ line: z.ZodNumber;
127
+ method_name: z.ZodString;
128
+ }, z.core.$strip>>;
129
+ readonly language: z.ZodOptional<z.ZodEnum<{
130
+ bash: "bash";
131
+ go: "go";
132
+ html: "html";
133
+ java: "java";
134
+ javascript: "javascript";
135
+ python: "python";
136
+ rust: "rust";
137
+ typescript: "typescript";
138
+ }>>;
139
+ readonly limit: z.ZodOptional<z.ZodNumber>;
140
+ readonly tiers: z.ZodOptional<z.ZodArray<z.ZodEnum<{
141
+ exact: "exact";
142
+ inferred: "inferred";
143
+ polymorphic: "polymorphic";
144
+ }>>>;
145
+ };
146
+ readonly annotations: {
147
+ readonly readOnlyHint: true;
148
+ readonly destructiveHint: false;
149
+ readonly idempotentHint: true;
150
+ readonly openWorldHint: false;
151
+ };
152
+ };
153
+ interface NavigationArgs {
154
+ project_root: string;
155
+ symbol?: string;
156
+ site?: {
157
+ file: string;
158
+ line: number;
159
+ method_name: string;
160
+ };
161
+ language?: (typeof LANGUAGES)[number];
162
+ limit?: number;
163
+ tiers?: Tier[];
164
+ }
165
+ /**
166
+ * What to do when nothing is `exact`.
167
+ *
168
+ * The engine deliberately has no field for this: the answer shape is compared
169
+ * field for field against an oracle, and a hint is advice rather than a fact
170
+ * about the code. So it is computed here, from the answer the engine gave,
171
+ * and lives in the server's envelope.
172
+ */
173
+ export declare function nextStepFor(answer: NavigationAnswer, kind: 'callers' | 'callees'): string | undefined;
174
+ export declare const makeFindCallersHandler: (ctx: ToolContext) => (args: NavigationArgs) => Promise<ToolResult>;
175
+ export declare const makeFindCalleesHandler: (ctx: ToolContext) => (args: NavigationArgs) => Promise<ToolResult>;
176
+ export {};
177
+ //# sourceMapp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EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CA+CrG;AAqED,eAAO,MAAM,sBAAsB,QAxDpB,WAAW,YACT,cAAc,KAAG,OAAO,CAAC,UAAU,CAuDQ,CAAC;AAC7D,eAAO,MAAM,sBAAsB,QAzDpB,WAAW,YACT,cAAc,KAAG,OAAO,CAAC,UAAU,CAwDQ,CAAC"}
@@ -0,0 +1,227 @@
1
+ /**
2
+ * `find_callers` and `find_callees` — who calls a method, and what a method
3
+ * calls, with every answer saying how it was reached.
4
+ *
5
+ * These two differ from the other nine read-only tools in what they promise.
6
+ * A scan reports what it found; these report what they found **and what they
7
+ * could not reach**, because a caller list is only useful if you know whether
8
+ * it is complete. So every response carries three things the engine computes
9
+ * and this tool passes through untouched:
10
+ *
11
+ * - a **tier** per answer. `exact` means the receiver's static type was
12
+ * known and the target was unique in it. `polymorphic` means dispatch is
13
+ * open, with every candidate body listed. `inferred` means bound by name
14
+ * alone — a floor, never a promise, and never produced when a receiver
15
+ * type *is* known and disagrees.
16
+ * - a **reason** per non-answer, from a closed vocabulary, so "7,000 sites
17
+ * unresolved" can be read as "6,900 of them are in the JDK".
18
+ * - a **scope**: how many files were searched, in which languages, and what
19
+ * was deliberately left out. A count without its denominator is not an
20
+ * answer.
21
+ *
22
+ * The envelope this tool adds around that — `projectRoot`, `cacheHit`,
23
+ * `nextStep`, `provenance` — is the server's. The answer-shape fields inside
24
+ * are the engine's and are not rewritten here, because they are compared
25
+ * field for field against a compiler-backed oracle.
26
+ */
27
+ import { z } from 'zod';
28
+ import { resolve } from 'path';
29
+ import { textResult, errorResult, READ_ONLY_ANNOTATIONS } from './types.js';
30
+ /** Cap on `answers[]`. A truncated list always says so. */
31
+ export const MAX_NAVIGATION_ANSWERS = 200;
32
+ const TIERS = ['exact', 'polymorphic', 'inferred'];
33
+ const LANGUAGES = [
34
+ 'java', 'javascript', 'typescript', 'python', 'go', 'rust', 'bash', 'html',
35
+ ];
36
+ /**
37
+ * Either a symbol or a site, never both.
38
+ *
39
+ * The site form is keyed on `(file, line, method_name)` and not on a column,
40
+ * because a chained expression reports several calls at one line and column —
41
+ * `b.of().step("a").done()` is three calls at one position — so a
42
+ * `(file, line, col)` triple cannot address one of them. The method name is
43
+ * what completes the key.
44
+ */
45
+ const commonShape = {
46
+ project_root: z.string().describe('Absolute path to the project root.'),
47
+ symbol: z
48
+ .string()
49
+ .optional()
50
+ .describe('Fully-qualified name, e.g. `com.acme.users.User.equals`. A constructor is ' +
51
+ '`com.acme.users.User.<init>`. Give this or `site`, not both.'),
52
+ site: z
53
+ .object({
54
+ file: z.string().describe('Path relative to the project root.'),
55
+ line: z.number().int().positive().describe('1-indexed line.'),
56
+ method_name: z
57
+ .string()
58
+ .describe('The method name as written on that line. Required because one line and ' +
59
+ 'column can hold several calls in a chained expression.'),
60
+ })
61
+ .optional()
62
+ .describe('A call site, when you have a line of code rather than a name.'),
63
+ language: z.enum(LANGUAGES).optional().describe('Restrict the search to one language.'),
64
+ limit: z
65
+ .number()
66
+ .int()
67
+ .positive()
68
+ .max(1000)
69
+ .optional()
70
+ .describe(`Cap on returned answers (default ${MAX_NAVIGATION_ANSWERS}). Truncation is reported.`),
71
+ tiers: z
72
+ .array(z.enum(TIERS))
73
+ .optional()
74
+ .describe('Return only these tiers. Omit for all three. `["exact"]` for answers you can act on.'),
75
+ };
76
+ export const findCallersInputShape = commonShape;
77
+ export const findCalleesInputShape = commonShape;
78
+ export const findCallersConfig = {
79
+ title: 'Find the callers of a symbol',
80
+ description:
81
+ // The first line answers "which question is this tool for?", because an
82
+ // agent choosing between grep and a call graph is choosing between two
83
+ // tools that both look applicable. Measured on a paired bench, the tool
84
+ // was reached for on 1 of 12 runs where it was available and the question
85
+ // was exactly this one; this text is the cheapest thing to change.
86
+ 'THE QUESTION THIS ANSWERS: "who calls this method?" — call this FIRST for that question, ' +
87
+ 'before grepping. A text search for a method name finds the name; this finds the calls, and ' +
88
+ 'says which ones it is sure of.\n\n' +
89
+ 'Who calls this method, with a resolution tier on every answer and a reason on every site it ' +
90
+ 'could not resolve. Use it before changing or deleting a method, to see what depends on it, and ' +
91
+ 'to judge the blast radius of a rename.\n\n' +
92
+ 'Read the tiers before acting: `exact` means the receiver\'s static type was known and the target ' +
93
+ 'was unique in it — act on these. `polymorphic` means dispatch is open; `candidates` lists every ' +
94
+ 'implementation that could run, and all of them are reachable. `inferred` means bound by the ' +
95
+ 'method name alone with no receiver type to confirm it — treat it as a lead to check, never as a ' +
96
+ 'caller. An inferred hit is NOT evidence that the method is called from there.\n\n' +
97
+ '`unresolved` is the honest half of the answer: each entry is a site that calls something of this ' +
98
+ 'name which could not be bound, with a reason — `external` (the target is outside the searched ' +
99
+ 'tree, e.g. in the JDK or a framework), `dynamic` (reflection), `generated` (the member only ' +
100
+ 'exists after annotation processing, e.g. a Lombok accessor), `parse-error`, ' +
101
+ '`unsupported-language`, or `unknown` (in the tree, and we failed to bind it). ' +
102
+ 'A large `external` count usually means the name is a common one, not that the answer is poor.\n\n' +
103
+ '`scope` states what was searched and what was skipped, so a count can be read against its ' +
104
+ 'denominator. Deterministic: no model is consulted.',
105
+ inputSchema: findCallersInputShape,
106
+ annotations: READ_ONLY_ANNOTATIONS,
107
+ };
108
+ export const findCalleesConfig = {
109
+ title: 'Find what a symbol calls',
110
+ description: 'THE QUESTION THIS ANSWERS: "what does this method call?" — call this FIRST for that question, ' +
111
+ 'before reading the body and following names by hand.\n\n' +
112
+ 'What this method calls, with a resolution tier on every answer and a reason on every call it ' +
113
+ 'could not resolve. Use it to understand a method before editing it, to trace what a change will ' +
114
+ 'touch, and to find the project-internal calls inside a body full of framework noise.\n\n' +
115
+ 'Tiers and `unresolved` mean exactly what they do for `find_callers` — `exact` is actionable, ' +
116
+ '`polymorphic` lists every candidate body, `inferred` is a lead and not a fact. In a typical ' +
117
+ 'method body most unresolved entries are `external`: calls into the standard library and ' +
118
+ 'frameworks, which are correctly not answered rather than missing.\n\n' +
119
+ 'A constructor appears as a target ending `.<init>`, while `methodName` is the name as written ' +
120
+ 'at the call site, so the two differ for a `new` expression. Deterministic: no model is consulted.',
121
+ inputSchema: findCalleesInputShape,
122
+ annotations: READ_ONLY_ANNOTATIONS,
123
+ };
124
+ /**
125
+ * What to do when nothing is `exact`.
126
+ *
127
+ * The engine deliberately has no field for this: the answer shape is compared
128
+ * field for field against an oracle, and a hint is advice rather than a fact
129
+ * about the code. So it is computed here, from the answer the engine gave,
130
+ * and lives in the server's envelope.
131
+ */
132
+ export function nextStepFor(answer, kind) {
133
+ const exact = answer.answers.filter((a) => a.tier === 'exact').length;
134
+ if (exact > 0)
135
+ return undefined;
136
+ const polymorphic = answer.answers.filter((a) => a.tier === 'polymorphic').length;
137
+ if (polymorphic > 0) {
138
+ return (`No answer is exact. ${polymorphic} ${plural(polymorphic, 'site', 'sites')} dispatch openly — ` +
139
+ 'read `candidates` on each and decide which implementations matter, rather than assuming one.');
140
+ }
141
+ const inferred = answer.answers.filter((a) => a.tier === 'inferred').length;
142
+ const reasons = tally(answer.unresolved.map((u) => u.reason));
143
+ const unknown = reasons.unknown ?? 0;
144
+ const external = reasons.external ?? 0;
145
+ if (inferred > 0) {
146
+ return (`No answer is exact: ${inferred} ${plural(inferred, 'hit is', 'hits are')} bound by method name ` +
147
+ 'alone. Open each site and check the receiver before relying on it, or narrow the query to the ' +
148
+ 'declaring type. A language server with full type information will do better here than this ' +
149
+ 'call graph can.');
150
+ }
151
+ if (unknown > 0) {
152
+ return (`Nothing resolved, and ${unknown} ${plural(unknown, 'site is', 'sites are')} in the searched tree ` +
153
+ 'but could not be bound — this call graph is insufficient for them. Try a language server, or ' +
154
+ 'grep for the name and read the receivers.');
155
+ }
156
+ if (external > 0 && answer.answers.length === 0) {
157
+ return (`Nothing resolved inside the searched tree: ${external} of the ` +
158
+ `${answer.unresolved.length} ${plural(answer.unresolved.length, 'site', 'sites')} target code ` +
159
+ 'outside it. If you expected a project target, check `scope` — the file may be in an excluded ' +
160
+ 'directory, or the symbol may be spelled differently.');
161
+ }
162
+ if (answer.answers.length === 0 && answer.unresolved.length === 0) {
163
+ return (`No ${kind} found at all. Check the symbol is fully qualified and spelled as the project ` +
164
+ 'declares it, and that `scope.searched.files` is the number of files you expected.');
165
+ }
166
+ return undefined;
167
+ }
168
+ function plural(n, one, many) {
169
+ return n === 1 ? one : many;
170
+ }
171
+ function tally(values) {
172
+ const out = {};
173
+ for (const v of values)
174
+ out[v] = (out[v] ?? 0) + 1;
175
+ return out;
176
+ }
177
+ function makeHandler(kind) {
178
+ return (ctx) => async (args) => {
179
+ if (!args.symbol && !args.site) {
180
+ return errorResult('give either `symbol` or `site`.');
181
+ }
182
+ if (args.symbol && args.site) {
183
+ return errorResult('give `symbol` or `site`, not both.');
184
+ }
185
+ const root = resolve(args.project_root);
186
+ const { index, cacheHit, fileCount } = await ctx.cache.getOrComputeNavigation(root, {
187
+ ...(args.language ? { language: args.language } : {}),
188
+ });
189
+ let symbol = args.symbol;
190
+ if (args.site) {
191
+ symbol = index.symbolAt(args.site.file, args.site.line, args.site.method_name, kind);
192
+ if (!symbol) {
193
+ return textResult({
194
+ projectRoot: root,
195
+ cacheHit,
196
+ query: { kind, site: args.site },
197
+ resolvedSymbol: null,
198
+ answers: [],
199
+ unresolved: [],
200
+ nextStep: `No call to \`${args.site.method_name}\` was found at ${args.site.file}:${args.site.line}, ` +
201
+ 'or the call could not be bound to a symbol to search for. Check the file path is relative ' +
202
+ `to the project root (${fileCount} files were indexed) and that the name is as written.`,
203
+ });
204
+ }
205
+ }
206
+ const opts = {
207
+ limit: args.limit ?? MAX_NAVIGATION_ANSWERS,
208
+ ...(args.tiers ? { tiers: args.tiers } : {}),
209
+ };
210
+ const answer = kind === 'callers'
211
+ ? index.resolveCallers({ symbol: symbol }, opts)
212
+ : index.resolveCallees({ symbol: symbol }, opts);
213
+ const nextStep = nextStepFor(answer, kind);
214
+ // The answer-shape fields are spread through unchanged. Only the
215
+ // envelope is this tool's.
216
+ return textResult({
217
+ projectRoot: root,
218
+ cacheHit,
219
+ ...(args.site ? { resolvedSymbol: symbol } : {}),
220
+ ...answer,
221
+ ...(nextStep ? { nextStep } : {}),
222
+ });
223
+ };
224
+ }
225
+ export const makeFindCallersHandler = makeHandler('callers');
226
+ export const makeFindCalleesHandler = makeHandler('callees');
227
+ //# sourceMappingURL=navigation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/tools/navigation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG/B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE5E,2DAA2D;AAC3D,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAE1C,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,UAAU,CAAU,CAAC;AAE5D,MAAM,SAAS,GAAG;IAChB,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAClE,CAAC;AAEX;;;;;;;;GAQG;AACH,MAAM,WAAW,GAAG;IAClB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;IACvE,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,4EAA4E;QAC1E,8DAA8D,CACjE;IACH,IAAI,EAAE,CAAC;SACJ,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,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C,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAClC,CAAC,CAAC;IACL,CAAC,CAAC;AACN,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC"}
@@ -6,6 +6,15 @@
6
6
  * `packages/cli/src/cli.ts`.
7
7
  */
8
8
  import type { SupportedLanguage } from 'circle-ir';
9
+ /**
10
+ * Directories skipped during recursive collection.
11
+ *
12
+ * Exported because a navigation answer has to state its own denominator: a
13
+ * caller told "3 callers" is entitled to know that `node_modules` and `dist`
14
+ * were never looked in. The list is the single source for both the walk and
15
+ * the `scope.excluded` the answer carries.
16
+ */
17
+ export declare const SKIPPED_DIRECTORIES: readonly string[];
9
18
  export declare function detectLanguage(filePath: string): SupportedLanguage | null;
10
19
  export interface CollectedFile {
11
20
  filePath: string;
@@ -1 +1 @@
1
- {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/util/files.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAoCnD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAGzE;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,kDAAkD;IAClD,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,cAAmB,GAAG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G,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAMnF"}
@@ -23,8 +23,15 @@ const LANG_MAP = {
23
23
  '.html': 'html',
24
24
  '.htm': 'html',
25
25
  };
26
- /** Directories skipped during recursive collection. */
27
- const SKIP_DIRS = new Set([
26
+ /**
27
+ * Directories skipped during recursive collection.
28
+ *
29
+ * Exported because a navigation answer has to state its own denominator: a
30
+ * caller told "3 callers" is entitled to know that `node_modules` and `dist`
31
+ * were never looked in. The list is the single source for both the walk and
32
+ * the `scope.excluded` the answer carries.
33
+ */
34
+ export const SKIPPED_DIRECTORIES = [
28
35
  'node_modules',
29
36
  '.git',
30
37
  'dist',
@@ -38,7 +45,8 @@ const SKIP_DIRS = new Set([
38
45
  'venv',
39
46
  '.tox',
40
47
  '.pytest_cache',
41
- ]);
48
+ ];
49
+ const SKIP_DIRS = new Set(SKIPPED_DIRECTORIES);
42
50
  export function detectLanguage(filePath) {
43
51
  const ext = extname(filePath).toLowerCase();
44
52
  return LANG_MAP[ext] ?? null;
@@ -1 +1 @@
1
- {"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/util/files.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG9C,MAAM,QAAQ,GAAsC;IAClD,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,M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AAC,QAAQ,IAAI,IAAI,KAAK,IAAI,CAAC,QAAQ;oBAAE,SAAS;gBACtD,IAAI,CAAC;oBACH,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;gBAClC,CAAC;gBAAC,MAAM,CAAC;oBACP,SAAS;gBACX,CAAC;gBACD,IAAI,GAAG,CAAC,IAAI,IAAI,QAAQ;oBAAE,MAAM;YAClC,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,CAAsB,EAAE,CAAsB;IACxE,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACpC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QACvB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;IACnC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognium/mcp-server",
3
- "version": "0.4.0",
3
+ "version": "0.6.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",
@@ -66,7 +66,7 @@
66
66
  "dependencies": {
67
67
  "@modelcontextprotocol/core": "^2.2.0",
68
68
  "@modelcontextprotocol/server": "^2.2.0",
69
- "circle-ir": "4.9.29",
69
+ "circle-ir": "4.10.0",
70
70
  "yaml": "^2.9.1",
71
71
  "zod": "^4.6.5"
72
72
  },