@esankhan3/code-search-mcp 0.4.7 → 0.4.9

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.
@@ -1,6 +1,6 @@
1
1
  import { existsSync, readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
- import { getKnowledgeBasePath } from "@esankhan3/anvil-knowledge-core";
3
+ import { getKnowledgeBasePath, openSystemGraphStore } from "@esankhan3/anvil-knowledge-core";
4
4
  import { loadAllProfiles } from "@esankhan3/anvil-knowledge-core";
5
5
  import { loadProfile } from "@esankhan3/anvil-knowledge-core";
6
6
  function registerResources(ctx) {
@@ -33,17 +33,26 @@ async function handleResource(uri, ctx) {
33
33
  };
34
34
  }
35
35
  if (uri === "code-search://system-graph") {
36
- const graphPath = join(kbPath, "system_graph_v2.json");
37
- if (!existsSync(graphPath)) {
38
- return { contents: [{ uri, mimeType: "application/json", text: '{"nodes":[],"edges":[]}' }] };
36
+ const store = await openSystemGraphStore(kbPath);
37
+ if (!store) {
38
+ return { contents: [{ uri, mimeType: "application/json", text: '{"nodes":[],"crossRepoEdges":[],"totals":{"nodes":0,"crossRepoEdges":0}}' }] };
39
+ }
40
+ try {
41
+ const NODE_LIMIT = 200;
42
+ const EDGE_LIMIT = 200;
43
+ const { rows: nodes, total: nodeTotal } = store.searchNodes({ minDegree: 0 }, NODE_LIMIT);
44
+ const { edges: crossRepoEdges, total: edgeTotal } = store.crossRepoEdges(void 0, EDGE_LIMIT);
45
+ const payload = {
46
+ nodes,
47
+ crossRepoEdges,
48
+ totals: { nodes: nodeTotal, crossRepoEdges: edgeTotal },
49
+ truncated: nodeTotal > nodes.length || edgeTotal > crossRepoEdges.length,
50
+ note: "Bounded overview (top nodes by degree + cross-repo edges). Use the graph tools for full traversal."
51
+ };
52
+ return { contents: [{ uri, mimeType: "application/json", text: JSON.stringify(payload, null, 2) }] };
53
+ } finally {
54
+ store.close();
39
55
  }
40
- return {
41
- contents: [{
42
- uri,
43
- mimeType: "application/json",
44
- text: readFileSync(graphPath, "utf-8")
45
- }]
46
- };
47
56
  }
48
57
  const profileMatch = uri.match(/^code-search:\/\/repo\/([^/]+)\/profile$/);
49
58
  if (profileMatch) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esankhan3/code-search-mcp",
3
- "version": "0.4.7",
3
+ "version": "0.4.9",
4
4
  "description": "MCP server for multi-repo code search — GitHub org or local path, zero config",
5
5
  "type": "module",
6
6
  "license": "MIT",