@sdsrs/code-graph 0.2.1 → 0.2.2
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 +69 -8
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -13,6 +13,34 @@ A high-performance code knowledge graph server implementing the [Model Context P
|
|
|
13
13
|
- **Embedding model** — Optional local embedding via Candle (feature-gated `embed-model`)
|
|
14
14
|
- **MCP protocol** — JSON-RPC 2.0 over stdio, plug-and-play with Claude Code, Cursor, and other MCP clients
|
|
15
15
|
|
|
16
|
+
## Why code-graph-mcp?
|
|
17
|
+
|
|
18
|
+
Unlike naive full-text search or simple AST dumps, code-graph-mcp builds a **structured knowledge graph** that understands the relationships between symbols across your entire codebase.
|
|
19
|
+
|
|
20
|
+
### Incremental by Design
|
|
21
|
+
|
|
22
|
+
BLAKE3 Merkle tree tracks every file's content hash. On re-index, only changed files are re-parsed — unchanged directory subtrees are skipped entirely via mtime cache. When a function signature changes, **dirty propagation** automatically regenerates context for all downstream callers across files.
|
|
23
|
+
|
|
24
|
+
### Hybrid Search, Not Just Grep
|
|
25
|
+
|
|
26
|
+
Combines BM25 full-text ranking (FTS5) with vector semantic similarity (sqlite-vec) via **Reciprocal Rank Fusion (RRF)** — so searching "handle user login" finds the right function even if it's named `authenticate_session`. Results are auto-compressed to fit LLM context windows (L0→full code, L1→summaries, L2→file groups, L3→directory overview).
|
|
27
|
+
|
|
28
|
+
### Scope-Aware Relation Extraction
|
|
29
|
+
|
|
30
|
+
The parser doesn't just find function calls — it tracks them within their proper scope context. Extracts calls, imports, inheritance, interface implementations, exports, and HTTP route bindings. Same-file targets are preferred over cross-file matches to minimize false-positive edges.
|
|
31
|
+
|
|
32
|
+
### HTTP Request Flow Tracing
|
|
33
|
+
|
|
34
|
+
Unique to code-graph-mcp: trace from `GET /api/users` → route handler → service layer → database call in a single query. Supports Express, Flask/FastAPI, and Go HTTP frameworks.
|
|
35
|
+
|
|
36
|
+
### Zero External Dependencies at Runtime
|
|
37
|
+
|
|
38
|
+
Single binary, embedded SQLite, bundled sqlite-vec extension, optional local embedding model via Candle — no database server, no cloud API, no Docker required. Runs entirely on your machine.
|
|
39
|
+
|
|
40
|
+
### Built for AI Assistants
|
|
41
|
+
|
|
42
|
+
Every design decision — from token-aware compression to node_id-based snippet expansion — is optimized for LLM context windows. Works out of the box with Claude Code, Cursor, Windsurf, and any MCP-compatible client.
|
|
43
|
+
|
|
16
44
|
## Architecture
|
|
17
45
|
|
|
18
46
|
```
|
|
@@ -35,18 +63,33 @@ src/
|
|
|
35
63
|
One-command setup — registers as an MCP server directly in Claude Code:
|
|
36
64
|
|
|
37
65
|
```bash
|
|
38
|
-
claude mcp add code-graph-mcp npx @sdsrs/code-graph
|
|
66
|
+
claude mcp add code-graph-mcp -- npx -y @sdsrs/code-graph
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Option 2: Cursor / Windsurf / Other MCP Clients
|
|
70
|
+
|
|
71
|
+
Add to your MCP settings file (e.g. `~/.cursor/mcp.json`):
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"mcpServers": {
|
|
76
|
+
"code-graph": {
|
|
77
|
+
"command": "npx",
|
|
78
|
+
"args": ["-y", "@sdsrs/code-graph"]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
39
82
|
```
|
|
40
83
|
|
|
41
|
-
### Option
|
|
84
|
+
### Option 3: npx (No Install)
|
|
42
85
|
|
|
43
86
|
Run directly without installing:
|
|
44
87
|
|
|
45
88
|
```bash
|
|
46
|
-
npx @sdsrs/code-graph
|
|
89
|
+
npx -y @sdsrs/code-graph
|
|
47
90
|
```
|
|
48
91
|
|
|
49
|
-
### Option
|
|
92
|
+
### Option 4: npm (Global Install)
|
|
50
93
|
|
|
51
94
|
Install globally, then run anywhere:
|
|
52
95
|
|
|
@@ -55,6 +98,24 @@ npm install -g @sdsrs/code-graph
|
|
|
55
98
|
code-graph-mcp
|
|
56
99
|
```
|
|
57
100
|
|
|
101
|
+
## Uninstallation
|
|
102
|
+
|
|
103
|
+
### Claude Code
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
claude mcp remove code-graph-mcp
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Cursor / Windsurf / Other MCP Clients
|
|
110
|
+
|
|
111
|
+
Remove the `code-graph` entry from your MCP settings file (e.g. `~/.cursor/mcp.json`).
|
|
112
|
+
|
|
113
|
+
### npm (Global)
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npm uninstall -g @sdsrs/code-graph
|
|
117
|
+
```
|
|
118
|
+
|
|
58
119
|
## Build from Source
|
|
59
120
|
|
|
60
121
|
### Prerequisites
|
|
@@ -72,16 +133,15 @@ cargo build --release
|
|
|
72
133
|
cargo build --release --no-default-features
|
|
73
134
|
```
|
|
74
135
|
|
|
75
|
-
### Configure
|
|
136
|
+
### Configure (from source)
|
|
76
137
|
|
|
77
|
-
|
|
138
|
+
Add the compiled binary to your MCP settings:
|
|
78
139
|
|
|
79
140
|
```json
|
|
80
141
|
{
|
|
81
142
|
"mcpServers": {
|
|
82
143
|
"code-graph": {
|
|
83
|
-
"command": "/path/to/code-graph-mcp"
|
|
84
|
-
"cwd": "/path/to/your/project"
|
|
144
|
+
"command": "/path/to/target/release/code-graph-mcp"
|
|
85
145
|
}
|
|
86
146
|
}
|
|
87
147
|
}
|
|
@@ -94,6 +154,7 @@ If you built from source, add to your MCP settings:
|
|
|
94
154
|
| `semantic_code_search` | Hybrid BM25 + vector + graph search for AST nodes |
|
|
95
155
|
| `get_call_graph` | Trace upstream/downstream call chains for a function |
|
|
96
156
|
| `find_http_route` | Map route path to backend handler function |
|
|
157
|
+
| `trace_http_chain` | Full request flow: route → handler → downstream call chain |
|
|
97
158
|
| `get_ast_node` | Extract a specific code symbol from a file |
|
|
98
159
|
| `read_snippet` | Read original code snippet by node ID with context |
|
|
99
160
|
| `start_watch` / `stop_watch` | Start/stop file system watcher for incremental indexing |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdsrs/code-graph",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "MCP server that indexes codebases into an AST knowledge graph with semantic search, call graph traversal, and HTTP route tracing",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"node": ">=16"
|
|
33
33
|
},
|
|
34
34
|
"optionalDependencies": {
|
|
35
|
-
"@sdsrs/code-graph-linux-x64": "0.2.
|
|
36
|
-
"@sdsrs/code-graph-linux-arm64": "0.2.
|
|
37
|
-
"@sdsrs/code-graph-darwin-x64": "0.2.
|
|
38
|
-
"@sdsrs/code-graph-darwin-arm64": "0.2.
|
|
39
|
-
"@sdsrs/code-graph-win32-x64": "0.2.
|
|
35
|
+
"@sdsrs/code-graph-linux-x64": "0.2.2",
|
|
36
|
+
"@sdsrs/code-graph-linux-arm64": "0.2.2",
|
|
37
|
+
"@sdsrs/code-graph-darwin-x64": "0.2.2",
|
|
38
|
+
"@sdsrs/code-graph-darwin-arm64": "0.2.2",
|
|
39
|
+
"@sdsrs/code-graph-win32-x64": "0.2.2"
|
|
40
40
|
}
|
|
41
41
|
}
|