mcp-codebase-intelligence 0.2.0 → 0.3.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/README.md +97 -16
- package/dist/graph/code-graph.d.ts +16 -0
- package/dist/graph/code-graph.js +30 -4
- package/dist/graph/code-graph.js.map +1 -1
- package/dist/graph/schema.js +1 -0
- package/dist/graph/schema.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +61 -60
- package/dist/index.js.map +1 -1
- package/dist/indexer/docstring-extractor.d.ts +7 -0
- package/dist/indexer/docstring-extractor.js +118 -0
- package/dist/indexer/docstring-extractor.js.map +1 -0
- package/dist/indexer/file-watcher.d.ts +2 -2
- package/dist/indexer/file-watcher.js +24 -15
- package/dist/indexer/file-watcher.js.map +1 -1
- package/dist/indexer/lang-cpp.d.ts +3 -0
- package/dist/indexer/lang-cpp.js +469 -0
- package/dist/indexer/lang-cpp.js.map +1 -0
- package/dist/indexer/lang-go.js +4 -0
- package/dist/indexer/lang-go.js.map +1 -1
- package/dist/indexer/lang-java.js +4 -0
- package/dist/indexer/lang-java.js.map +1 -1
- package/dist/indexer/lang-python.js +3 -0
- package/dist/indexer/lang-python.js.map +1 -1
- package/dist/indexer/lang-rust.js +5 -0
- package/dist/indexer/lang-rust.js.map +1 -1
- package/dist/indexer/tree-sitter-indexer.js +5 -0
- package/dist/indexer/tree-sitter-indexer.js.map +1 -1
- package/dist/project-manager.d.ts +63 -0
- package/dist/project-manager.js +479 -0
- package/dist/project-manager.js.map +1 -0
- package/dist/tools/find-symbol.js +2 -1
- package/dist/tools/find-symbol.js.map +1 -1
- package/dist/tools/project-tools.d.ts +38 -0
- package/dist/tools/project-tools.js +72 -0
- package/dist/tools/project-tools.js.map +1 -0
- package/dist/tools/search-codebase.d.ts +39 -0
- package/dist/tools/search-codebase.js +59 -0
- package/dist/tools/search-codebase.js.map +1 -0
- package/package.json +3 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CodeGraph } from "../graph/code-graph.js";
|
|
2
|
+
export declare const searchCodebaseTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {
|
|
8
|
+
query: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
kind: {
|
|
13
|
+
type: string;
|
|
14
|
+
enum: string[];
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
scope: {
|
|
18
|
+
type: string;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
limit: {
|
|
22
|
+
type: string;
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
required: string[];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export declare function handleSearchCodebase(graph: CodeGraph, args: {
|
|
30
|
+
query: string;
|
|
31
|
+
kind?: string;
|
|
32
|
+
scope?: string;
|
|
33
|
+
limit?: number;
|
|
34
|
+
}): {
|
|
35
|
+
content: {
|
|
36
|
+
type: "text";
|
|
37
|
+
text: string;
|
|
38
|
+
}[];
|
|
39
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export const searchCodebaseTool = {
|
|
2
|
+
name: "search_codebase",
|
|
3
|
+
description: "Search symbols by their docstring/comment content. Find functions, classes, and methods by what they do, not just their name. Useful for discovering APIs, finding implementations by description, or locating code by its documentation.",
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: {
|
|
7
|
+
query: {
|
|
8
|
+
type: "string",
|
|
9
|
+
description: "Text to search for in docstrings/comments (supports partial matching)",
|
|
10
|
+
},
|
|
11
|
+
kind: {
|
|
12
|
+
type: "string",
|
|
13
|
+
enum: ["function", "class", "interface", "type", "variable", "method", "enum", "property"],
|
|
14
|
+
description: "Optional: filter by symbol kind",
|
|
15
|
+
},
|
|
16
|
+
scope: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "Optional: limit search to files under this path prefix",
|
|
19
|
+
},
|
|
20
|
+
limit: {
|
|
21
|
+
type: "number",
|
|
22
|
+
description: "Maximum results to return (default: 20)",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
required: ["query"],
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export function handleSearchCodebase(graph, args) {
|
|
29
|
+
const results = graph.searchByDocstring(args.query, {
|
|
30
|
+
kind: args.kind,
|
|
31
|
+
scope: args.scope,
|
|
32
|
+
limit: args.limit ?? 20,
|
|
33
|
+
});
|
|
34
|
+
if (results.length === 0) {
|
|
35
|
+
return {
|
|
36
|
+
content: [
|
|
37
|
+
{
|
|
38
|
+
type: "text",
|
|
39
|
+
text: `No symbols found with docstrings matching "${args.query}"`,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const formatted = results.map((s) => {
|
|
45
|
+
const exported = s.isExported ? " [exported]" : "";
|
|
46
|
+
const sig = s.signature ? `\n Signature: ${s.signature}` : "";
|
|
47
|
+
const doc = s.docstring ? `\n Docstring: ${s.docstring}` : "";
|
|
48
|
+
return `${s.kind} ${s.name}${exported}\n Location: ${s.filePath}:${s.lineStart}-${s.lineEnd}${sig}${doc}`;
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
content: [
|
|
52
|
+
{
|
|
53
|
+
type: "text",
|
|
54
|
+
text: `Found ${results.length} symbol(s) with docstrings matching "${args.query}":\n\n${formatted.join("\n\n")}`,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=search-codebase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-codebase.js","sourceRoot":"","sources":["../../src/tools/search-codebase.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,iBAAiB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C,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,MAAM,GAAG,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,OAAO,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,GAAG,QAAQ,iBAAiB,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,OAAO,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;IAC7G,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,SAAS,OAAO,CAAC,MAAM,wCAAwC,IAAI,CAAC,KAAK,SAAS,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;aACjH;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-codebase-intelligence",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "MCP server providing semantic code intelligence — symbol search, references, call graphs, impact analysis, and architecture diagrams via tree-sitter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -50,6 +50,8 @@
|
|
|
50
50
|
"chokidar": "^5.0.0",
|
|
51
51
|
"glob": "^13.0.6",
|
|
52
52
|
"tree-sitter": "^0.22.4",
|
|
53
|
+
"tree-sitter-c": "^0.23.6",
|
|
54
|
+
"tree-sitter-cpp": "^0.23.4",
|
|
53
55
|
"tree-sitter-go": "^0.23.4",
|
|
54
56
|
"tree-sitter-java": "^0.23.5",
|
|
55
57
|
"tree-sitter-python": "^0.23.6",
|