context-mcp-server 1.0.2 → 1.0.4
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 +12 -16
- package/codegraph/__pycache__/config.cpython-313.pyc +0 -0
- package/codegraph/__pycache__/scanner.cpython-313.pyc +0 -0
- package/codegraph/__pycache__/server.cpython-313.pyc +0 -0
- package/codegraph/config.py +139 -22
- package/codegraph/extractors/__pycache__/ast_extractor.cpython-313.pyc +0 -0
- package/codegraph/extractors/__pycache__/build_extractor.cpython-313.pyc +0 -0
- package/codegraph/extractors/ast_extractor.py +392 -176
- package/codegraph/extractors/build_extractor.py +68 -0
- package/codegraph/scanner.py +5 -21
- package/codegraph/server.py +32 -229
- package/package.json +3 -1
- package/pyproject.toml +69 -0
- package/src/cli.js +2 -2
- package/src/templates/AGENTS.md +8 -15
- package/src/templates/CLAUDE.md +15 -27
- package/src/templates/GEMINI.md +7 -14
- package/uv.lock +1295 -0
package/src/templates/CLAUDE.md
CHANGED
|
@@ -9,7 +9,7 @@ description: >
|
|
|
9
9
|
# Context-MCP — Claude Usage Guide
|
|
10
10
|
|
|
11
11
|
Persistent memory + codebase knowledge graph for Claude.
|
|
12
|
-
Every conversation starts with `context.resume`. Every
|
|
12
|
+
Every conversation starts with `context.resume`. Every codebase question uses `codegraph_query`. Files only read for bugs/logic.
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
@@ -45,42 +45,31 @@ Always pass `project`. Auto-compact fires at >50 entries — oldest summarized a
|
|
|
45
45
|
|
|
46
46
|
## 3. CodeGraph Pipeline
|
|
47
47
|
|
|
48
|
-
### Step 1 — Build (once per project,
|
|
48
|
+
### Step 1 — Build (once per project, fast, local)
|
|
49
49
|
```
|
|
50
50
|
codegraph_build(path)
|
|
51
|
-
→ AST: code files → functions, classes, imports, edges
|
|
52
|
-
→ Config: .yaml .toml .sql → schema nodes
|
|
53
|
-
→ Docs: .md .txt .pdf → pending (no content yet)
|
|
54
51
|
```
|
|
55
|
-
|
|
52
|
+
- Parses codebase into AST graph using tree-sitter (regex fallback for unsupported languages)
|
|
53
|
+
- Extracts functions, classes, imports, call edges for all code files
|
|
54
|
+
- Build files (package.json, pyproject.toml, go.mod, Dockerfile, etc.) get a single metadata node
|
|
55
|
+
- Saves graph to `~/.context-mcp/graphs.json`. Visible on `context.resume`.
|
|
56
56
|
|
|
57
|
-
### Step 2 —
|
|
57
|
+
### Step 2 — Query (free, instant, forever)
|
|
58
58
|
```
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
codegraph_add_nodes(path, nodes)
|
|
66
|
-
→ stores descriptions in semantic cache (never overwritten by rebuild)
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### Step 3 — Query (free, instant forever)
|
|
70
|
-
```
|
|
71
|
-
codegraph_query(path, question) → NODE/EDGE subgraph, token_budget param (default 2000)
|
|
72
|
-
codegraph_explain(path, node) → one node: description + depends_on + used_by
|
|
73
|
-
codegraph_path(path, from, to) → shortest path between two concepts
|
|
74
|
-
codegraph_nodes(path, type) → list all nodes of a type
|
|
75
|
-
codegraph_report(path) → god nodes, clusters, surprises
|
|
59
|
+
codegraph_query(path, question) → fetch any details about the codebase
|
|
60
|
+
codegraph_explain(path, node) → one node: type, file, depends_on, used_by
|
|
61
|
+
codegraph_path(path, from, to) → shortest path between two concepts
|
|
62
|
+
codegraph_nodes(path, type) → list all nodes of a type
|
|
63
|
+
codegraph_report(path) → god nodes, clusters, surprises
|
|
76
64
|
```
|
|
77
65
|
|
|
78
66
|
---
|
|
79
67
|
|
|
80
68
|
## 4. Graph vs File
|
|
81
69
|
|
|
82
|
-
**Graph** —
|
|
83
|
-
|
|
70
|
+
**Graph** — use for any question about what exists in the codebase: finding functions, classes, files, understanding what a module contains, dependencies, callers, imports, paths between concepts.
|
|
71
|
+
|
|
72
|
+
**File** — use for bugs, logic inside a specific function, tracing unexpected behavior.
|
|
84
73
|
|
|
85
74
|
---
|
|
86
75
|
|
|
@@ -91,4 +80,3 @@ codegraph_report(path) → god nodes, clusters, surprises
|
|
|
91
80
|
3. **`search` before asking** — if user references past work, find it first
|
|
92
81
|
4. **`codegraph_query` before reading files** — graph is faster and cheaper
|
|
93
82
|
5. **Read files for bugs/logic** — graph is structure only, not behavior
|
|
94
|
-
6. **Enrich once** — run extract → add_nodes once per project; descriptions persist forever
|
package/src/templates/GEMINI.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Context-MCP — Gemini CLI Usage Guide
|
|
2
2
|
|
|
3
3
|
Persistent memory + codebase knowledge graph.
|
|
4
|
-
Every conversation starts with `context.resume`. Every
|
|
4
|
+
Every conversation starts with `context.resume`. Every codebase question uses `codegraph_query`. Files only read for bugs/logic.
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -37,21 +37,15 @@ Always pass `project`. Auto-compact fires at >50 entries.
|
|
|
37
37
|
|
|
38
38
|
## 3. CodeGraph Pipeline
|
|
39
39
|
|
|
40
|
-
### Step 1 — Build (once,
|
|
40
|
+
### Step 1 — Build (once, fast, local)
|
|
41
41
|
```
|
|
42
42
|
codegraph_build(path) → AST graph: functions, classes, imports, edges
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
### Step 2 —
|
|
45
|
+
### Step 2 — Query (free, instant)
|
|
46
46
|
```
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### Step 3 — Query (free, instant)
|
|
52
|
-
```
|
|
53
|
-
codegraph_query(path, question) → NODE/EDGE subgraph (token_budget default 2000)
|
|
54
|
-
codegraph_explain(path, node) → single node + neighbors
|
|
47
|
+
codegraph_query(path, question) → fetch any details about the codebase
|
|
48
|
+
codegraph_explain(path, node) → single node: type, file, connections
|
|
55
49
|
codegraph_path(path, from, to) → shortest path
|
|
56
50
|
codegraph_nodes(path, type) → list nodes by type
|
|
57
51
|
codegraph_report(path) → full graph analysis
|
|
@@ -61,8 +55,8 @@ codegraph_report(path) → full graph analysis
|
|
|
61
55
|
|
|
62
56
|
## 4. Graph vs File
|
|
63
57
|
|
|
64
|
-
**Graph** —
|
|
65
|
-
**File** — bugs, logic, tracing behavior.
|
|
58
|
+
**Graph** — use for any question about what exists: finding functions, classes, files, dependencies, callers, imports, paths between concepts.
|
|
59
|
+
**File** — bugs, logic, tracing unexpected behavior.
|
|
66
60
|
|
|
67
61
|
---
|
|
68
62
|
|
|
@@ -73,4 +67,3 @@ codegraph_report(path) → full graph analysis
|
|
|
73
67
|
3. **`search` before asking** — if user references past work, find it first
|
|
74
68
|
4. **`codegraph_query` before reading files** — graph is faster and cheaper
|
|
75
69
|
5. **Read files for bugs/logic** — graph is structure only, not behavior
|
|
76
|
-
6. **Enrich once** — descriptions persist forever
|