project-graph-mcp 1.0.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/AGENT_ROLE.md +126 -0
- package/AGENT_ROLE_MINIMAL.md +54 -0
- package/CONFIGURATION.md +188 -0
- package/LICENSE +21 -0
- package/README.md +279 -0
- package/package.json +46 -0
- package/references/symbiote-3x.md +834 -0
- package/rules/express-5.json +76 -0
- package/rules/fastify-5.json +75 -0
- package/rules/nestjs-10.json +88 -0
- package/rules/nextjs-15.json +87 -0
- package/rules/node-22.json +156 -0
- package/rules/react-18.json +87 -0
- package/rules/react-19.json +76 -0
- package/rules/symbiote-2x.json +158 -0
- package/rules/symbiote-3x.json +221 -0
- package/rules/typescript-5.json +69 -0
- package/rules/vue-3.json +79 -0
- package/src/cli-handlers.js +140 -0
- package/src/cli.js +83 -0
- package/src/complexity.js +223 -0
- package/src/custom-rules.js +583 -0
- package/src/dead-code.js +468 -0
- package/src/filters.js +226 -0
- package/src/framework-references.js +177 -0
- package/src/full-analysis.js +159 -0
- package/src/graph-builder.js +269 -0
- package/src/instructions.js +175 -0
- package/src/jsdoc-generator.js +214 -0
- package/src/large-files.js +162 -0
- package/src/mcp-server.js +375 -0
- package/src/outdated-patterns.js +295 -0
- package/src/parser.js +293 -0
- package/src/server.js +28 -0
- package/src/similar-functions.js +278 -0
- package/src/test-annotations.js +301 -0
- package/src/tool-defs.js +444 -0
- package/src/tools.js +240 -0
- package/src/undocumented.js +260 -0
- package/src/workspace.js +70 -0
- package/vendor/acorn.mjs +6145 -0
- package/vendor/walk.mjs +437 -0
package/AGENT_ROLE.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Project Graph MCP - Agent Role
|
|
2
|
+
|
|
3
|
+
You have access to **Project Graph MCP** โ a suite of code analysis and project navigation tools.
|
|
4
|
+
|
|
5
|
+
## ๐งญ Navigation & Understanding
|
|
6
|
+
| Tool | Purpose |
|
|
7
|
+
|------|---------|
|
|
8
|
+
| `get_structure` | Get file/folder tree |
|
|
9
|
+
| `get_skeleton` | Get code structure (classes, functions, exports) |
|
|
10
|
+
| `expand` | Deep dive into a class or function |
|
|
11
|
+
| `get_agent_instructions` | Get project coding guidelines |
|
|
12
|
+
| `get_framework_reference` | Get framework AI reference (auto-detects or explicit) |
|
|
13
|
+
|
|
14
|
+
## ๐งช Testing System
|
|
15
|
+
|
|
16
|
+
| Tool | Purpose |
|
|
17
|
+
|------|---------|
|
|
18
|
+
| `get_pending_tests` | List @test/@expect annotations needing verification |
|
|
19
|
+
| `mark_test_passed` / `mark_test_failed` | Track test results |
|
|
20
|
+
| `get_test_summary` | Progress report |
|
|
21
|
+
|
|
22
|
+
### When to Write @test/@expect
|
|
23
|
+
Add annotations to JSDoc when creating or modifying **interactive methods**:
|
|
24
|
+
- `onclick` / `onchange` / `oninput` event handlers
|
|
25
|
+
- Methods that change DOM state (show/hide, toggle classes/attributes)
|
|
26
|
+
- Navigation and routing methods
|
|
27
|
+
- Form submission and validation handlers
|
|
28
|
+
- Any method with user-visible side effects
|
|
29
|
+
|
|
30
|
+
### Browser Testing Workflow (VERIFICATION mode)
|
|
31
|
+
After code changes, you MUST verify UI with this flow:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
1. get_pending_tests(path) โ see what needs verification
|
|
35
|
+
2. Open browser via browser_subagent โ execute each test step
|
|
36
|
+
3. mark_test_passed(testId) โ or mark_test_failed(testId, reason)
|
|
37
|
+
4. get_test_summary(path) โ final report before completing task
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Rule**: If `get_pending_tests()` returns items, they MUST be executed in the browser before the task is marked complete. Never skip browser verification when @test annotations exist.
|
|
41
|
+
|
|
42
|
+
### Example
|
|
43
|
+
```javascript
|
|
44
|
+
/**
|
|
45
|
+
* Delete selected persona
|
|
46
|
+
*
|
|
47
|
+
* @test click: Click delete button on persona card
|
|
48
|
+
* @test click: Confirm in dialog
|
|
49
|
+
* @expect element: Persona removed from list
|
|
50
|
+
* @expect visual: Toast notification appears
|
|
51
|
+
*/
|
|
52
|
+
async onDeletePersona() { ... }
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## ๐ Code Quality Analysis
|
|
56
|
+
| Tool | Purpose |
|
|
57
|
+
|------|---------|
|
|
58
|
+
| `get_full_analysis` | Run ALL checks + Health Score (0-100) |
|
|
59
|
+
| `get_dead_code` | Find unused functions/classes |
|
|
60
|
+
| `get_undocumented` | Find missing JSDoc |
|
|
61
|
+
| `get_similar_functions` | Detect code duplicates |
|
|
62
|
+
| `get_complexity` | Cyclomatic complexity metrics |
|
|
63
|
+
| `get_large_files` | Files needing split |
|
|
64
|
+
| `get_outdated_patterns` | Legacy patterns + redundant npm deps |
|
|
65
|
+
| `generate_jsdoc` | Auto-generate JSDoc templates |
|
|
66
|
+
|
|
67
|
+
## ๐ง Custom Rules (Configurable)
|
|
68
|
+
| Tool | Purpose |
|
|
69
|
+
|------|---------|
|
|
70
|
+
| `get_custom_rules` | List all rulesets |
|
|
71
|
+
| `set_custom_rule` | Add/update framework-specific rules |
|
|
72
|
+
| `check_custom_rules` | Run analysis (auto-detects applicable rules) |
|
|
73
|
+
|
|
74
|
+
### Auto-Detection
|
|
75
|
+
Rules are applied automatically based on:
|
|
76
|
+
- `package.json` dependencies (e.g., `@symbiotejs/symbiote`)
|
|
77
|
+
- Import patterns in source code
|
|
78
|
+
- Code patterns (e.g., `extends Symbiote`)
|
|
79
|
+
|
|
80
|
+
### Pre-built Rulesets (85 rules)
|
|
81
|
+
| Ruleset | Rules | Framework |
|
|
82
|
+
|---------|-------|-----------|
|
|
83
|
+
| `symbiote-2x` | 12 | Symbiote.js 2.x |
|
|
84
|
+
| `symbiote-3x` | 17 | Symbiote.js 3.x |
|
|
85
|
+
| `react-18` | 6 | React 18 |
|
|
86
|
+
| `react-19` | 5 | React 19 (Server Components) |
|
|
87
|
+
| `vue-3` | 5 | Vue 3 Composition API |
|
|
88
|
+
| `nextjs-15` | 6 | Next.js 15 App Router |
|
|
89
|
+
| `express-5` | 5 | Express.js 5.x |
|
|
90
|
+
| `fastify-5` | 5 | Fastify 5.x |
|
|
91
|
+
| `nestjs-10` | 6 | NestJS 10.x |
|
|
92
|
+
| `typescript-5` | 5 | TypeScript 5.x |
|
|
93
|
+
| `node-22` | 7 | Node.js 22+ |
|
|
94
|
+
|
|
95
|
+
### Creating New Rules
|
|
96
|
+
Read project workflow docs (e.g., `.agent/workflows/symbiote-audit.md`) and use `set_custom_rule`:
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"ruleSet": "framework-2x",
|
|
100
|
+
"rule": {
|
|
101
|
+
"id": "framework-no-antipattern",
|
|
102
|
+
"name": "Avoid antipattern",
|
|
103
|
+
"pattern": "badCode",
|
|
104
|
+
"patternType": "string",
|
|
105
|
+
"replacement": "Use goodCode",
|
|
106
|
+
"severity": "warning",
|
|
107
|
+
"filePattern": "*.js",
|
|
108
|
+
"docs": "https://docs.example.com"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## โ๏ธ Filters
|
|
114
|
+
| Tool | Purpose |
|
|
115
|
+
|------|---------|
|
|
116
|
+
| `get_filters` / `set_filters` | Configure excluded directories |
|
|
117
|
+
| `add_excludes` / `remove_excludes` | Modify exclude list |
|
|
118
|
+
|
|
119
|
+
## ๐ Recommended Workflow
|
|
120
|
+
|
|
121
|
+
1. **Start**: `get_structure` โ understand project layout
|
|
122
|
+
2. **Dive**: `get_skeleton` โ map code architecture
|
|
123
|
+
3. **Analyze**: `get_full_analysis` โ find issues (Health Score)
|
|
124
|
+
4. **Check Rules**: `check_custom_rules` โ framework-specific violations
|
|
125
|
+
5. **Fix**: Address issues by severity (error โ warning โ info)
|
|
126
|
+
6. **Verify**: `get_pending_tests` โ execute in browser โ `mark_test_passed/failed` โ `get_test_summary`
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Project Graph MCP
|
|
2
|
+
|
|
3
|
+
You have **Project Graph MCP** tools available โ code analysis, project navigation, and framework-specific linting.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
1. `get_skeleton(path)` โ Get code structure (classes, functions, exports)
|
|
8
|
+
2. `get_full_analysis(path)` โ Health Score (0-100) with all code quality checks
|
|
9
|
+
3. `get_agent_instructions` โ Project coding guidelines and JSDoc format
|
|
10
|
+
|
|
11
|
+
## Core Tools
|
|
12
|
+
|
|
13
|
+
### Navigation
|
|
14
|
+
- `get_skeleton` โ Compact project overview with symbol legend
|
|
15
|
+
- `expand(symbol)` โ Deep dive into class/function (use symbols from skeleton's `L` field)
|
|
16
|
+
- `deps(symbol)` โ Dependency tree (imports, usedBy, calls)
|
|
17
|
+
- `usages(symbol)` โ Find all usages across project
|
|
18
|
+
|
|
19
|
+
### Code Quality
|
|
20
|
+
- `get_full_analysis` โ Run ALL checks + Health Score
|
|
21
|
+
- `get_dead_code` โ Unused functions/classes
|
|
22
|
+
- `get_undocumented` โ Missing JSDoc
|
|
23
|
+
- `get_similar_functions` โ Code duplicates
|
|
24
|
+
- `get_complexity` โ Cyclomatic complexity (flags >10)
|
|
25
|
+
- `get_large_files` โ Files needing split
|
|
26
|
+
- `get_outdated_patterns` โ Legacy patterns
|
|
27
|
+
|
|
28
|
+
### Testing
|
|
29
|
+
- `get_pending_tests` โ List @test/@expect annotations
|
|
30
|
+
- `mark_test_passed(testId)` / `mark_test_failed(testId, reason)`
|
|
31
|
+
- `get_test_summary` โ Progress report
|
|
32
|
+
|
|
33
|
+
### Custom Rules
|
|
34
|
+
- `check_custom_rules(path)` โ Run framework-specific analysis (auto-detected)
|
|
35
|
+
- `get_custom_rules` โ List all rulesets (62 rules across 10 frameworks)
|
|
36
|
+
- `set_custom_rule` โ Add/update rules
|
|
37
|
+
|
|
38
|
+
**Pre-built rulesets:** React 18/19, Vue 3, Next.js 15, Express 5, Fastify 5, NestJS 10, TypeScript 5, Node.js 22, Symbiote 2.x
|
|
39
|
+
|
|
40
|
+
## Workflow
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
1. get_skeleton("src/") โ Understand structure
|
|
44
|
+
2. get_full_analysis("src/") โ Find issues (Health Score)
|
|
45
|
+
3. check_custom_rules("src/") โ Framework violations
|
|
46
|
+
4. Fix by severity: error โ warning โ info
|
|
47
|
+
5. get_pending_tests("src/") โ Verification checklist
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Tips
|
|
51
|
+
|
|
52
|
+
- Skeleton uses minified symbols (e.g., `SN` = `SymNode`). Check `_keys` and `L` fields for legend.
|
|
53
|
+
- File paths in results are relative to the scanned directory.
|
|
54
|
+
- Use `.graphignore` file to exclude files from custom rules checking.
|
package/CONFIGURATION.md
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# MCP Client Configuration
|
|
2
|
+
|
|
3
|
+
Configuration examples for popular MCP clients (2026).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Desktop & IDE Clients
|
|
8
|
+
|
|
9
|
+
### Antigravity / Gemini CLI
|
|
10
|
+
```json
|
|
11
|
+
// ~/.gemini/antigravity/mcp_config.json
|
|
12
|
+
{
|
|
13
|
+
"mcpServers": {
|
|
14
|
+
"project-graph": {
|
|
15
|
+
"command": "node",
|
|
16
|
+
"args": ["/path/to/project-graph-mcp/src/server.js"],
|
|
17
|
+
"env": {}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Cursor
|
|
24
|
+
```json
|
|
25
|
+
// .cursor/mcp.json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"project-graph": {
|
|
29
|
+
"command": "node",
|
|
30
|
+
"args": ["/path/to/project-graph-mcp/src/server.js"]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Zed
|
|
37
|
+
```json
|
|
38
|
+
// ~/.config/zed/settings.json
|
|
39
|
+
{
|
|
40
|
+
"context_servers": {
|
|
41
|
+
"project-graph": {
|
|
42
|
+
"command": "node",
|
|
43
|
+
"args": ["/path/to/project-graph-mcp/src/server.js"]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### VS Code + Copilot
|
|
50
|
+
```json
|
|
51
|
+
// .vscode/mcp.json
|
|
52
|
+
{
|
|
53
|
+
"servers": {
|
|
54
|
+
"project-graph": {
|
|
55
|
+
"command": "node",
|
|
56
|
+
"args": ["/path/to/project-graph-mcp/src/server.js"]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Continue
|
|
63
|
+
```yaml
|
|
64
|
+
# ~/.continue/mcpServers/project-graph.yaml
|
|
65
|
+
name: project-graph
|
|
66
|
+
command: node
|
|
67
|
+
args:
|
|
68
|
+
- /path/to/project-graph-mcp/src/server.js
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Or JSON format in `~/.continue/mcpServers/project-graph.json`:
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"name": "project-graph",
|
|
75
|
+
"command": "node",
|
|
76
|
+
"args": ["/path/to/project-graph-mcp/src/server.js"]
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Sourcegraph Cody
|
|
81
|
+
```json
|
|
82
|
+
// ~/.sourcegraph/cody.json
|
|
83
|
+
{
|
|
84
|
+
"mcp": {
|
|
85
|
+
"servers": {
|
|
86
|
+
"project-graph": {
|
|
87
|
+
"command": "node",
|
|
88
|
+
"args": ["/path/to/project-graph-mcp/src/server.js"]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## AI Assistants
|
|
98
|
+
|
|
99
|
+
### Claude Desktop
|
|
100
|
+
```json
|
|
101
|
+
// macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
|
|
102
|
+
// Windows: %APPDATA%\Claude\claude_desktop_config.json
|
|
103
|
+
{
|
|
104
|
+
"mcpServers": {
|
|
105
|
+
"project-graph": {
|
|
106
|
+
"command": "node",
|
|
107
|
+
"args": ["/path/to/project-graph-mcp/src/server.js"]
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### OpenCode / Crush
|
|
114
|
+
```json
|
|
115
|
+
// ~/.config/opencode/config.json
|
|
116
|
+
{
|
|
117
|
+
"mcp": {
|
|
118
|
+
"servers": {
|
|
119
|
+
"project-graph": {
|
|
120
|
+
"command": "node",
|
|
121
|
+
"args": ["/path/to/project-graph-mcp/src/server.js"]
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### CodeGPT (VS Code / JetBrains)
|
|
129
|
+
```json
|
|
130
|
+
// Extension settings
|
|
131
|
+
{
|
|
132
|
+
"codegpt.mcp.servers": {
|
|
133
|
+
"project-graph": {
|
|
134
|
+
"command": "node",
|
|
135
|
+
"args": ["/path/to/project-graph-mcp/src/server.js"]
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Mobile & Cross-Platform
|
|
144
|
+
|
|
145
|
+
### Jenova (iOS/Android)
|
|
146
|
+
Add via app settings โ MCP Servers โ Custom:
|
|
147
|
+
- **Name**: project-graph
|
|
148
|
+
- **Command**: node
|
|
149
|
+
- **Args**: /path/to/project-graph-mcp/src/server.js
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Enterprise & Frameworks
|
|
154
|
+
|
|
155
|
+
### Firebase Genkit
|
|
156
|
+
```javascript
|
|
157
|
+
import { mcpClient } from '@genkit-ai/mcp';
|
|
158
|
+
|
|
159
|
+
const projectGraph = mcpClient({
|
|
160
|
+
command: 'node',
|
|
161
|
+
args: ['/path/to/project-graph-mcp/src/server.js'],
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### NVIDIA AIQ Toolkit
|
|
166
|
+
```yaml
|
|
167
|
+
# aiq_config.yaml
|
|
168
|
+
mcp_servers:
|
|
169
|
+
project-graph:
|
|
170
|
+
command: node
|
|
171
|
+
args:
|
|
172
|
+
- /path/to/project-graph-mcp/src/server.js
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Any MCP Client
|
|
178
|
+
|
|
179
|
+
The server uses **stdio transport** โ JSON-RPC 2.0 over stdin/stdout.
|
|
180
|
+
|
|
181
|
+
### Protocol
|
|
182
|
+
- **Methods**: `initialize`, `tools/list`, `tools/call`
|
|
183
|
+
- **Transport**: stdio (no HTTP server)
|
|
184
|
+
|
|
185
|
+
### Manual Test
|
|
186
|
+
```bash
|
|
187
|
+
echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | node src/server.js
|
|
188
|
+
```
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RND-PRO
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
# project-graph-mcp
|
|
2
|
+
|
|
3
|
+
**MCP server for AI agents** โ project graph, code quality analysis, and framework-specific lint rules.
|
|
4
|
+
|
|
5
|
+
> Developed by [RND-PRO](https://rnd-pro.com)
|
|
6
|
+
|
|
7
|
+
## Why?
|
|
8
|
+
|
|
9
|
+
AI agents struggle with large codebases:
|
|
10
|
+
- **Context limits** โ can't read entire project at once
|
|
11
|
+
- **No architecture awareness** โ miss patterns and conventions
|
|
12
|
+
- **Framework blindness** โ don't know React vs Vue vs Symbiote best practices
|
|
13
|
+
- **Manual verification** โ no structured way to track what's tested
|
|
14
|
+
|
|
15
|
+
**Project Graph MCP solves this:**
|
|
16
|
+
- ๐ฆ **10-50x compression** โ skeleton view fits in context window
|
|
17
|
+
- ๐ **Code quality analysis** โ dead code, complexity, duplicates
|
|
18
|
+
- ๐ฏ **Framework-specific rules** โ auto-detect and apply (React, Vue, Express, Node.js, Symbiote)
|
|
19
|
+
- โ
**Test checklists** โ track @test/@expect annotations
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
### ๐บ๏ธ Project Graph (10-50x compression)
|
|
24
|
+
- `get_skeleton` โ Compact project overview with class/function counts
|
|
25
|
+
- `expand` โ Expand minified symbol to full code
|
|
26
|
+
- `deps` โ Dependency tree for any symbol
|
|
27
|
+
- `usages` โ Find all usages of a symbol
|
|
28
|
+
- `get_focus_zone` โ Auto-enriched context from git diff
|
|
29
|
+
|
|
30
|
+
### ๐งช Test Checklists (Universal)
|
|
31
|
+
- `get_pending_tests` โ List tests from `@test/@expect` JSDoc annotations
|
|
32
|
+
- `mark_test_passed` / `mark_test_failed` โ Track progress
|
|
33
|
+
- `get_test_summary` โ Progress report
|
|
34
|
+
|
|
35
|
+
Supports: Browser, API, CLI, and Integration tests.
|
|
36
|
+
|
|
37
|
+
### ๐ Code Quality Analysis
|
|
38
|
+
- `get_dead_code` โ Find unused functions/classes (never called, not exported)
|
|
39
|
+
- `generate_jsdoc` โ Auto-generate JSDoc templates with @test/@expect
|
|
40
|
+
- `get_similar_functions` โ Detect duplicates (signature + structure similarity)
|
|
41
|
+
- `get_complexity` โ Cyclomatic complexity metrics (flags >10)
|
|
42
|
+
- `get_large_files` โ Files needing split (lines, functions, exports)
|
|
43
|
+
- `get_outdated_patterns` โ Legacy code patterns + redundant npm deps (Node 18+ built-ins)
|
|
44
|
+
- `get_undocumented` โ Find missing JSDoc (@test, @param, @returns)
|
|
45
|
+
- `get_full_analysis` โ Run ALL checks + Health Score (0-100)
|
|
46
|
+
|
|
47
|
+
### ๐ง Custom Rules (Configurable)
|
|
48
|
+
- `get_custom_rules` โ List all rulesets and rules
|
|
49
|
+
- `set_custom_rule` โ Add/update a rule (agent can configure)
|
|
50
|
+
- `check_custom_rules` โ Run custom rules analysis
|
|
51
|
+
|
|
52
|
+
Includes 10 pre-built rulesets (62 rules): React 18/19, Vue 3, Next.js 15, Express 5, Fastify 5, NestJS 10, TypeScript 5, Node.js 22, Symbiote 2.x
|
|
53
|
+
|
|
54
|
+
### โ๏ธ Filter Configuration
|
|
55
|
+
- `get_filters` / `set_filters` โ Configure excluded directories and patterns
|
|
56
|
+
- `add_excludes` / `remove_excludes` โ Modify exclude list
|
|
57
|
+
- Automatic `.gitignore` parsing
|
|
58
|
+
- **`.graphignore`** โ Project-specific ignore file for custom rules (like .gitignore)
|
|
59
|
+
|
|
60
|
+
### ๐ Framework References
|
|
61
|
+
- `get_framework_reference` โ Auto-detect project framework and return AI-optimized docs
|
|
62
|
+
- Includes: React 18/19, Vue 3, Next.js, Express, Node.js, Symbiote.js
|
|
63
|
+
|
|
64
|
+
### ๐ Agent Instructions
|
|
65
|
+
- `get_agent_instructions` โ Get coding guidelines, JSDoc format, architecture standards
|
|
66
|
+
- [AGENT_ROLE.md](AGENT_ROLE.md) โ Full system prompt for agents
|
|
67
|
+
- [AGENT_ROLE_MINIMAL.md](AGENT_ROLE_MINIMAL.md) โ Minimal variant (agent self-discovers)
|
|
68
|
+
|
|
69
|
+
### ๐ก Response Hints
|
|
70
|
+
Every tool response includes contextual coaching hints:
|
|
71
|
+
- `get_skeleton` โ "Use expand() to see code, deps() for architecture"
|
|
72
|
+
- `invalidate_cache` โ "Cache cleared. Run get_skeleton() to rebuild"
|
|
73
|
+
- `get_dead_code` โ "Review before removing โ some may be used dynamically"
|
|
74
|
+
- `get_undocumented` โ "Use generate_jsdoc() for auto-generation"
|
|
75
|
+
- Large classes auto-detected โ "Run get_complexity() to find refactoring targets"
|
|
76
|
+
|
|
77
|
+
### ๐ก๏ธ Security
|
|
78
|
+
- **Path Traversal Protection** โ all tool paths validated to stay within workspace root
|
|
79
|
+
- **Workspace Isolation** โ MCP roots set workspace boundary, tools cannot escape it
|
|
80
|
+
|
|
81
|
+
### ๐ MCP Ecosystem
|
|
82
|
+
Works alongside [agent-pool-mcp](https://github.com/rnd-pro/agent-pool-mcp) for parallel agent orchestration:
|
|
83
|
+
|
|
84
|
+
| Layer | project-graph-mcp | agent-pool-mcp |
|
|
85
|
+
|-------|-------------------|----------------|
|
|
86
|
+
| **Primary IDE agent** | Navigates codebase, runs analysis | Delegates tasks, consults peer |
|
|
87
|
+
| **Gemini CLI workers** | Available as MCP tool inside Gemini CLI | Executes delegated tasks |
|
|
88
|
+
|
|
89
|
+
## Installation
|
|
90
|
+
|
|
91
|
+
Add to your IDE's MCP configuration:
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"mcpServers": {
|
|
96
|
+
"project-graph": {
|
|
97
|
+
"command": "npx",
|
|
98
|
+
"args": ["-y", "project-graph-mcp"]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Restart your IDE โ project-graph-mcp will be downloaded and started automatically.
|
|
105
|
+
**Zero dependencies** โ only Node.js >= 18 required.
|
|
106
|
+
|
|
107
|
+
<details>
|
|
108
|
+
<summary>๐ Where is my MCP config file?</summary>
|
|
109
|
+
|
|
110
|
+
| IDE | Config path |
|
|
111
|
+
|-----|------------|
|
|
112
|
+
| Antigravity | `~/.gemini/antigravity/mcp_config.json` |
|
|
113
|
+
| Gemini CLI | `~/.gemini/settings.json` |
|
|
114
|
+
| Cursor | `.cursor/mcp.json` |
|
|
115
|
+
| Windsurf | `.windsurf/mcp.json` |
|
|
116
|
+
| Claude Code | Run: `claude mcp add project-graph npx -y project-graph-mcp` |
|
|
117
|
+
|
|
118
|
+
See **[CONFIGURATION.md](CONFIGURATION.md)** for all supported IDEs.
|
|
119
|
+
|
|
120
|
+
</details>
|
|
121
|
+
|
|
122
|
+
<details>
|
|
123
|
+
<summary>๐ฆ Alternative: from source</summary>
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
git clone https://github.com/rnd-pro/project-graph-mcp
|
|
127
|
+
cd project-graph-mcp
|
|
128
|
+
# No npm install needed โ zero dependencies
|
|
129
|
+
# Use "node /path/to/project-graph-mcp/src/server.js" as the command in MCP config
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
</details>
|
|
133
|
+
|
|
134
|
+
## CLI Usage
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Get project skeleton (minified graph)
|
|
138
|
+
node src/server.js skeleton src/components
|
|
139
|
+
|
|
140
|
+
# Expand minified symbol
|
|
141
|
+
node src/server.js expand SN
|
|
142
|
+
|
|
143
|
+
# Get dependencies
|
|
144
|
+
node src/server.js deps SNG
|
|
145
|
+
|
|
146
|
+
# List pending tests
|
|
147
|
+
node src/server.js pending src/
|
|
148
|
+
|
|
149
|
+
# Get test progress summary
|
|
150
|
+
node src/server.js summary src/
|
|
151
|
+
|
|
152
|
+
# Show filter configuration
|
|
153
|
+
node src/server.js filters
|
|
154
|
+
|
|
155
|
+
# Show agent instructions
|
|
156
|
+
node src/server.js instructions
|
|
157
|
+
|
|
158
|
+
# Code Quality Analysis
|
|
159
|
+
node src/server.js deadcode src/ # Find unused code
|
|
160
|
+
node src/server.js jsdoc src/file.js # Generate JSDoc
|
|
161
|
+
node src/server.js similar src/ # Find duplicates
|
|
162
|
+
node src/server.js complexity src/ # Cyclomatic complexity
|
|
163
|
+
node src/server.js largefiles src/ # Large files
|
|
164
|
+
node src/server.js outdated . # Legacy patterns
|
|
165
|
+
|
|
166
|
+
# Show help
|
|
167
|
+
node src/server.js help
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## MCP Configuration
|
|
171
|
+
|
|
172
|
+
See **[CONFIGURATION.md](CONFIGURATION.md)** for client-specific setup:
|
|
173
|
+
- Antigravity / Gemini CLI
|
|
174
|
+
- Cursor / Zed / Continue
|
|
175
|
+
- VS Code + Copilot / CodeGPT
|
|
176
|
+
- Claude Desktop
|
|
177
|
+
- OpenCode / Crush
|
|
178
|
+
- Jenova (mobile)
|
|
179
|
+
- Firebase Genkit / NVIDIA AIQ
|
|
180
|
+
|
|
181
|
+
## Test Annotations
|
|
182
|
+
|
|
183
|
+
Add to your code:
|
|
184
|
+
```javascript
|
|
185
|
+
/**
|
|
186
|
+
* Create new user via API
|
|
187
|
+
*
|
|
188
|
+
* @test request: POST /api/users with valid data
|
|
189
|
+
* @expect status: 201 Created
|
|
190
|
+
* @expect db: User row created
|
|
191
|
+
*/
|
|
192
|
+
async createUser(data) { ... }
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Supported types:
|
|
196
|
+
- **Browser**: click, key, drag, type, scroll, hover
|
|
197
|
+
- **API**: request, call, invoke, mock
|
|
198
|
+
- **CLI**: run, exec, spawn, input
|
|
199
|
+
- **Integration**: setup, action, teardown, wait
|
|
200
|
+
|
|
201
|
+
Agent workflow:
|
|
202
|
+
```
|
|
203
|
+
1. get_pending_tests("src/")
|
|
204
|
+
โ [{ id: "createUser.0", type: "request", description: "POST /api/users" }]
|
|
205
|
+
|
|
206
|
+
2. Agent runs the test
|
|
207
|
+
|
|
208
|
+
3. mark_test_passed("createUser.0")
|
|
209
|
+
|
|
210
|
+
4. get_test_summary("src/")
|
|
211
|
+
โ { total: 9, passed: 1, pending: 8, progress: 11 }
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## .graphignore
|
|
215
|
+
|
|
216
|
+
Exclude files from custom rules checking (useful for files containing code examples):
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
# Comments start with #
|
|
220
|
+
instructions.js # Exact filename
|
|
221
|
+
outdated-patterns.js # Files with code examples
|
|
222
|
+
*.min.js # Glob suffix
|
|
223
|
+
dist/* # Glob prefix
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Searches parent directories automatically (like .gitignore).
|
|
227
|
+
|
|
228
|
+
## Architecture
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
project-graph-mcp/
|
|
232
|
+
โโโ src/
|
|
233
|
+
โ โโโ server.js # Entry point (CLI/MCP mode switch)
|
|
234
|
+
โ โโโ mcp-server.js # MCP server + response hints
|
|
235
|
+
โ โโโ cli.js / cli-handlers.js # CLI commands
|
|
236
|
+
โ โโโ tool-defs.js # MCP tool schemas
|
|
237
|
+
โ โโโ tools.js # Graph tools (skeleton, expand, deps)
|
|
238
|
+
โ โโโ workspace.js # Path resolution + traversal protection
|
|
239
|
+
โ โโโ parser.js # AST parser (Acorn)
|
|
240
|
+
โ โโโ graph-builder.js # Minified graph + legend
|
|
241
|
+
โ โโโ filters.js # Exclude patterns, .gitignore
|
|
242
|
+
โ โโโ dead-code.js # Unused code detection
|
|
243
|
+
โ โโโ complexity.js # Cyclomatic complexity
|
|
244
|
+
โ โโโ similar-functions.js # Duplicate detection
|
|
245
|
+
โ โโโ large-files.js # File size analysis
|
|
246
|
+
โ โโโ outdated-patterns.js # Legacy pattern detection
|
|
247
|
+
โ โโโ full-analysis.js # Health Score (0-100)
|
|
248
|
+
โ โโโ undocumented.js # Missing JSDoc finder
|
|
249
|
+
โ โโโ jsdoc-generator.js # JSDoc template generation
|
|
250
|
+
โ โโโ custom-rules.js # Configurable lint rules
|
|
251
|
+
โ โโโ framework-references.js # Framework-specific docs
|
|
252
|
+
โ โโโ test-annotations.js # @test/@expect parsing
|
|
253
|
+
โ โโโ instructions.js # Agent guidelines
|
|
254
|
+
โโโ rules/ # Pre-built rule sets (JSON)
|
|
255
|
+
โโโ references/ # Framework reference docs
|
|
256
|
+
โโโ vendor/
|
|
257
|
+
โ โโโ acorn.mjs # AST parser (MIT, vendored)
|
|
258
|
+
โ โโโ walk.mjs # AST walker (MIT, vendored)
|
|
259
|
+
โโโ tests/
|
|
260
|
+
โโโ parser.test.js
|
|
261
|
+
โโโ mcp.test.js
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Skeleton Example
|
|
265
|
+
|
|
266
|
+
```json
|
|
267
|
+
{
|
|
268
|
+
"L": { "SN": "SymNode", "SNG": "SymNodeGraph" },
|
|
269
|
+
"s": { "files": 23, "classes": 10, "functions": 65 },
|
|
270
|
+
"n": { "SN": { "m": 11, "$": 7 }, "SNG": { "m": 16, "$": 5 } },
|
|
271
|
+
"e": 35, "o": 7, "d": 5, "F": 63
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**L** = Legend, **s** = stats, **n** = nodes, **e** = edges, **o** = orphans, **d** = duplicates, **F** = functions
|
|
276
|
+
|
|
277
|
+
## License
|
|
278
|
+
|
|
279
|
+
MIT
|