@simpletoolsindiaorg/engi-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/CHANGELOG.md +34 -0
- package/LICENSE +21 -0
- package/README.md +592 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +6 -0
- package/dist/bin.js.map +1 -0
- package/dist/capabilities/analysis/analysis.d.ts +223 -0
- package/dist/capabilities/analysis/analysis.d.ts.map +1 -0
- package/dist/capabilities/analysis/analysis.js +202 -0
- package/dist/capabilities/analysis/analysis.js.map +1 -0
- package/dist/capabilities/analysis/index.d.ts +2 -0
- package/dist/capabilities/analysis/index.d.ts.map +1 -0
- package/dist/capabilities/analysis/index.js +19 -0
- package/dist/capabilities/analysis/index.js.map +1 -0
- package/dist/capabilities/documentation/documentation.d.ts +107 -0
- package/dist/capabilities/documentation/documentation.d.ts.map +1 -0
- package/dist/capabilities/documentation/documentation.js +112 -0
- package/dist/capabilities/documentation/documentation.js.map +1 -0
- package/dist/capabilities/documentation/index.d.ts +2 -0
- package/dist/capabilities/documentation/index.d.ts.map +1 -0
- package/dist/capabilities/documentation/index.js +19 -0
- package/dist/capabilities/documentation/index.js.map +1 -0
- package/dist/capabilities/execution/execution.d.ts +96 -0
- package/dist/capabilities/execution/execution.d.ts.map +1 -0
- package/dist/capabilities/execution/execution.js +175 -0
- package/dist/capabilities/execution/execution.js.map +1 -0
- package/dist/capabilities/execution/index.d.ts +2 -0
- package/dist/capabilities/execution/index.d.ts.map +1 -0
- package/dist/capabilities/execution/index.js +19 -0
- package/dist/capabilities/execution/index.js.map +1 -0
- package/dist/capabilities/memory/index.d.ts +2 -0
- package/dist/capabilities/memory/index.d.ts.map +1 -0
- package/dist/capabilities/memory/index.js +19 -0
- package/dist/capabilities/memory/index.js.map +1 -0
- package/dist/capabilities/memory/memory.d.ts +227 -0
- package/dist/capabilities/memory/memory.d.ts.map +1 -0
- package/dist/capabilities/memory/memory.js +106 -0
- package/dist/capabilities/memory/memory.js.map +1 -0
- package/dist/capabilities/planning/index.d.ts +2 -0
- package/dist/capabilities/planning/index.d.ts.map +1 -0
- package/dist/capabilities/planning/index.js +19 -0
- package/dist/capabilities/planning/index.js.map +1 -0
- package/dist/capabilities/planning/planning.d.ts +131 -0
- package/dist/capabilities/planning/planning.d.ts.map +1 -0
- package/dist/capabilities/planning/planning.js +179 -0
- package/dist/capabilities/planning/planning.js.map +1 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +19 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/indexer/index.d.ts +2 -0
- package/dist/core/indexer/index.d.ts.map +1 -0
- package/dist/core/indexer/index.js +9 -0
- package/dist/core/indexer/index.js.map +1 -0
- package/dist/core/indexer/indexer.d.ts +35 -0
- package/dist/core/indexer/indexer.d.ts.map +1 -0
- package/dist/core/indexer/indexer.js +377 -0
- package/dist/core/indexer/indexer.js.map +1 -0
- package/dist/core/retrieval/index.d.ts +2 -0
- package/dist/core/retrieval/index.d.ts.map +1 -0
- package/dist/core/retrieval/index.js +8 -0
- package/dist/core/retrieval/index.js.map +1 -0
- package/dist/core/retrieval/retriever.d.ts +28 -0
- package/dist/core/retrieval/retriever.d.ts.map +1 -0
- package/dist/core/retrieval/retriever.js +258 -0
- package/dist/core/retrieval/retriever.js.map +1 -0
- package/dist/core/summarizer/index.d.ts +2 -0
- package/dist/core/summarizer/index.d.ts.map +1 -0
- package/dist/core/summarizer/index.js +8 -0
- package/dist/core/summarizer/index.js.map +1 -0
- package/dist/core/summarizer/summarizer.d.ts +33 -0
- package/dist/core/summarizer/summarizer.d.ts.map +1 -0
- package/dist/core/summarizer/summarizer.js +341 -0
- package/dist/core/summarizer/summarizer.js.map +1 -0
- package/dist/core/types.d.ts +224 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +4 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +127 -0
- package/dist/index.js.map +1 -0
- package/dist/memory/index.d.ts +2 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +9 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/memory.d.ts +59 -0
- package/dist/memory/memory.d.ts.map +1 -0
- package/dist/memory/memory.js +212 -0
- package/dist/memory/memory.js.map +1 -0
- package/dist/resources/index.d.ts +3 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +16 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/resources.d.ts +86 -0
- package/dist/resources/resources.d.ts.map +1 -0
- package/dist/resources/resources.js +285 -0
- package/dist/resources/resources.js.map +1 -0
- package/dist/utils/formatter.d.ts +26 -0
- package/dist/utils/formatter.d.ts.map +1 -0
- package/dist/utils/formatter.js +56 -0
- package/dist/utils/formatter.js.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +17 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +21 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +44 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/token-counter.d.ts +24 -0
- package/dist/utils/token-counter.d.ts.map +1 -0
- package/dist/utils/token-counter.js +49 -0
- package/dist/utils/token-counter.js.map +1 -0
- package/package.json +70 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.0] - 2024-03-16
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- 12 MCP tools across 5 capability modules (analysis, planning, execution, documentation, memory)
|
|
12
|
+
- 7 MCP resources via `repo://` URIs (architecture-map, module-index, symbol-index, test-map, doc-map, patterns, glossary)
|
|
13
|
+
- Repository indexer supporting 16 programming languages
|
|
14
|
+
- Keyword-based file scoring and retrieval engine (confidence 0–1)
|
|
15
|
+
- Three-level verbosity system: minimal / standard / detailed
|
|
16
|
+
- In-memory and file-based task memory checkpoint system
|
|
17
|
+
- 55 tests across all capability modules and utilities
|
|
18
|
+
- Token reduction benchmark: 97.3% average savings over direct file reading
|
|
19
|
+
- CLI entry point (`engineering-mcp`) for global install and npx usage
|
|
20
|
+
- Full TypeScript source with strict mode, declaration maps, and source maps
|
|
21
|
+
|
|
22
|
+
### Tools
|
|
23
|
+
- `task_classify` — detect task type and suggest next tools
|
|
24
|
+
- `repo_scope_find` — find minimum relevant files for a task (indexes repo on first call)
|
|
25
|
+
- `flow_summarize` — compact execution flow summary
|
|
26
|
+
- `bug_trace_compact` — symptom-based bug cause analysis
|
|
27
|
+
- `implementation_plan` — step-by-step feature/fix plan with edit targets
|
|
28
|
+
- `poc_plan` — minimum viable POC scaffolding
|
|
29
|
+
- `impact_analyze` — blast radius estimation before edits
|
|
30
|
+
- `test_select` — minimum test set for changed files
|
|
31
|
+
- `doc_context_build` — audience-targeted documentation context
|
|
32
|
+
- `doc_update_plan` — identify which docs need updating
|
|
33
|
+
- `memory_checkpoint` — save multi-session task state
|
|
34
|
+
- `memory_restore` — restore previously saved task state
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 simpletoolsindia (support@simpletools.in)
|
|
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,592 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
███████╗███╗ ██╗ ██████╗ ██╗ ███╗ ███╗ ██████╗██████╗
|
|
5
|
+
██╔════╝████╗ ██║██╔════╝ ██║ ████╗ ████║██╔════╝██╔══██╗
|
|
6
|
+
█████╗ ██╔██╗ ██║██║ ███╗██║ ██╔████╔██║██║ ██████╔╝
|
|
7
|
+
██╔══╝ ██║╚██╗██║██║ ██║██║ ██║╚██╔╝██║██║ ██╔═══╝
|
|
8
|
+
███████╗██║ ╚████║╚██████╔╝██║ ██║ ╚═╝ ██║╚██████╗██║
|
|
9
|
+
╚══════╝╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Software Engineering Intelligence — MCP Server**
|
|
13
|
+
|
|
14
|
+
*Stop feeding Claude your entire codebase. Give it a brain instead.*
|
|
15
|
+
|
|
16
|
+
[](https://www.npmjs.com/package/@software-engineering/mcp-server)
|
|
17
|
+
[](https://nodejs.org)
|
|
18
|
+
[](https://modelcontextprotocol.io)
|
|
19
|
+
[](LICENSE)
|
|
20
|
+
[](src/)
|
|
21
|
+
[](#-proven-token-savings)
|
|
22
|
+
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Why?
|
|
28
|
+
|
|
29
|
+
Every time Claude Code helps you with a task, it reads files. Lots of them. For a 50,000-line repo, that is **hundreds of thousands of tokens per session** — slow, expensive, and wasteful.
|
|
30
|
+
|
|
31
|
+
**engi-mcp** gives Claude a compact intelligence layer: indexed summaries, scoped file discovery, and compact planning tools. Instead of reading 27 files (18,000 tokens), Claude reads a 350-token summary and gets the same job done.
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
WITHOUT engi-mcp: Claude reads 27 files → 18,298 tokens
|
|
35
|
+
WITH engi-mcp: 3 tool calls → 405 tokens
|
|
36
|
+
─────────────────────────
|
|
37
|
+
SAVED: 17,893 tokens (97.8% reduction)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Table of Contents
|
|
43
|
+
|
|
44
|
+
- [Quick Start](#-quick-start)
|
|
45
|
+
- [How It Works](#-how-it-works)
|
|
46
|
+
- [All 12 Tools](#-all-12-tools)
|
|
47
|
+
- [All 7 Resources](#-all-7-resources)
|
|
48
|
+
- [Proven Token Savings](#-proven-token-savings)
|
|
49
|
+
- [Recommended Workflow](#-recommended-workflow)
|
|
50
|
+
- [Integration with Claude Code](#-integration-with-claude-code)
|
|
51
|
+
- [Architecture Deep Dive](#-architecture-deep-dive)
|
|
52
|
+
- [Configuration](#-configuration)
|
|
53
|
+
- [Project Structure](#-project-structure)
|
|
54
|
+
- [Development](#-development)
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Quick Start
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Install globally
|
|
62
|
+
npm install -g @software-engineering/mcp-server
|
|
63
|
+
|
|
64
|
+
# Or use directly with npx (no install needed)
|
|
65
|
+
npx @software-engineering/mcp-server
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Add to your Claude Code config (~/.claude.json):
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"engi": {
|
|
74
|
+
"command": "npx",
|
|
75
|
+
"args": ["-y", "@software-engineering/mcp-server"],
|
|
76
|
+
"env": { "LOG_LEVEL": "warn" }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
That is it. Claude now has a 97%-more-efficient brain for your repo.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## How It Works
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
Your Repo engi-mcp Claude
|
|
90
|
+
│ │ │
|
|
91
|
+
│ ← index on first call ────┤ │
|
|
92
|
+
│ │ task_classify(task) ───────┤
|
|
93
|
+
│ detects type, suggests tools │
|
|
94
|
+
│ │ repo_scope_find(task) ─────┤
|
|
95
|
+
│ ranks and returns top 5 files │
|
|
96
|
+
│ │ flow_summarize(files) ─────┤
|
|
97
|
+
│ compact summary, not raw code │
|
|
98
|
+
│ │ implementation_plan() ─────┤
|
|
99
|
+
│ step-by-step with edit targets │
|
|
100
|
+
│ │ impact_analyze() ──────────┤
|
|
101
|
+
│ blast radius before any edit │
|
|
102
|
+
│ │ │
|
|
103
|
+
│ │ ← edit the right files only ┤
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Core Pipeline
|
|
107
|
+
|
|
108
|
+
| Stage | What Happens |
|
|
109
|
+
|-------|-------------|
|
|
110
|
+
| **Index** | Scan repo once → build lightweight file/symbol/import/test/doc index |
|
|
111
|
+
| **Retrieve** | Score and rank files by keyword match, export match, file type preference |
|
|
112
|
+
| **Summarize** | Generate compact flow descriptions, not raw source code |
|
|
113
|
+
| **Plan** | Return edit targets, risk notes, required tests — no reading needed |
|
|
114
|
+
| **Memory** | Checkpoint task state so multi-session work never restarts from scratch |
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## All 12 Tools
|
|
119
|
+
|
|
120
|
+
### Analysis Tools
|
|
121
|
+
|
|
122
|
+
#### task_classify
|
|
123
|
+
Identifies what kind of task you are working on before doing any file reading.
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{ "task": "Fix the null pointer when user logs out" }
|
|
127
|
+
```
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"types": ["bug"],
|
|
131
|
+
"confidence": 0.8,
|
|
132
|
+
"suggestedMode": "planning",
|
|
133
|
+
"nextTools": ["repo_scope_find", "implementation_plan"]
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
#### repo_scope_find
|
|
140
|
+
Finds the minimum relevant files for your task. Pass repoPath the first time to build the index.
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"task": "Fix the null pointer when user logs out",
|
|
145
|
+
"taskType": "bug",
|
|
146
|
+
"repoPath": "/abs/path/to/your/repo",
|
|
147
|
+
"limit": 10
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"files": [
|
|
153
|
+
{ "path": "src/auth/logout.ts", "exports": ["logout", "clearSession"] },
|
|
154
|
+
{ "path": "src/auth/session.ts", "exports": ["SessionManager"] }
|
|
155
|
+
],
|
|
156
|
+
"modules": ["auth"],
|
|
157
|
+
"symbols": ["logout", "clearSession"],
|
|
158
|
+
"confidence": 0.87
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Note: Only pass repoPath once per session. The index persists in memory.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
#### flow_summarize
|
|
167
|
+
Returns a compact execution flow — no raw source code.
|
|
168
|
+
|
|
169
|
+
```json
|
|
170
|
+
{
|
|
171
|
+
"scope": ["src/auth/logout.ts", "src/auth/session.ts"],
|
|
172
|
+
"verbosity": "standard"
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"summary": "2 files in flow",
|
|
178
|
+
"steps": [
|
|
179
|
+
{ "order": 1, "description": "logout.ts calls clearSession() and emits event" },
|
|
180
|
+
{ "order": 2, "description": "session.ts SessionManager.destroy() removes token" }
|
|
181
|
+
],
|
|
182
|
+
"keySymbols": ["logout", "clearSession", "SessionManager"],
|
|
183
|
+
"entryPoint": "src/auth/logout.ts"
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
#### bug_trace_compact
|
|
190
|
+
Analyzes a symptom description to pinpoint likely causes without reading files.
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"symptom": "null pointer exception when calling session.user.id after logout",
|
|
195
|
+
"scope": ["src/auth/logout.ts", "src/auth/session.ts"]
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"likelyCauses": [
|
|
201
|
+
{ "type": "null_undefined", "description": "session.user not cleared before event fires", "likelihood": 0.85 },
|
|
202
|
+
{ "type": "race_condition", "description": "async clearSession called without await", "likelihood": 0.6 }
|
|
203
|
+
],
|
|
204
|
+
"suspectFiles": ["src/auth/session.ts"],
|
|
205
|
+
"confidence": 0.72
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
### Planning Tools
|
|
212
|
+
|
|
213
|
+
#### implementation_plan
|
|
214
|
+
Generates a complete step-by-step plan with exact edit targets and risk notes.
|
|
215
|
+
|
|
216
|
+
```json
|
|
217
|
+
{
|
|
218
|
+
"task": "Add rate limiting to the auth endpoint",
|
|
219
|
+
"taskType": "feature",
|
|
220
|
+
"scope": ["src/auth/router.ts", "src/middleware/index.ts"]
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
```json
|
|
224
|
+
{
|
|
225
|
+
"steps": [
|
|
226
|
+
{ "order": 1, "description": "Add rate-limit middleware", "file": "src/middleware/rateLimit.ts", "action": "create" },
|
|
227
|
+
{ "order": 2, "description": "Register middleware in router", "file": "src/auth/router.ts", "action": "modify" }
|
|
228
|
+
],
|
|
229
|
+
"editTargets": [{ "file": "src/auth/router.ts", "description": "Add rateLimit middleware before /login handler" }],
|
|
230
|
+
"requiredTests": ["src/auth/router.test.ts"],
|
|
231
|
+
"riskNotes": ["Verify rate limit headers do not break existing auth tests"]
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
#### poc_plan
|
|
238
|
+
Scaffolds a minimum viable proof-of-concept — skips production concerns deliberately.
|
|
239
|
+
|
|
240
|
+
```json
|
|
241
|
+
{
|
|
242
|
+
"goal": "Streaming token counter API endpoint",
|
|
243
|
+
"constraints": ["no auth", "simple"]
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
```json
|
|
247
|
+
{
|
|
248
|
+
"minimalArchitecture": "Simple Express HTTP handler with minimal routing",
|
|
249
|
+
"filesToCreate": ["src/poc/handler.ts"],
|
|
250
|
+
"shortcutsAllowed": ["Use in-memory storage", "Skip authentication"],
|
|
251
|
+
"excludedScope": ["Database integration", "Complex validation"],
|
|
252
|
+
"mockStrategy": "Use hardcoded test data and in-memory implementations"
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
### Execution Tools
|
|
259
|
+
|
|
260
|
+
#### impact_analyze
|
|
261
|
+
Estimates blast radius before you make any edit.
|
|
262
|
+
|
|
263
|
+
```json
|
|
264
|
+
{
|
|
265
|
+
"scope": ["src/core/indexer/indexer.ts"],
|
|
266
|
+
"changeType": "modify"
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
```json
|
|
270
|
+
{
|
|
271
|
+
"affectedFiles": ["src/core/retrieval/retriever.ts", "src/resources/resources.ts"],
|
|
272
|
+
"affectedModules": ["core", "resources"],
|
|
273
|
+
"regressionNotes": ["retriever depends on FileIndexEntry shape"],
|
|
274
|
+
"riskyPoints": ["RepositoryIndex interface change would cascade to all 5 consumers"],
|
|
275
|
+
"relatedTests": ["src/capabilities/analysis/analysis.test.ts"]
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
#### test_select
|
|
282
|
+
Returns the minimum test set — stop running npm test when you only changed 2 files.
|
|
283
|
+
|
|
284
|
+
```json
|
|
285
|
+
{
|
|
286
|
+
"scope": ["src/utils/token-counter.ts"],
|
|
287
|
+
"changeType": "modify"
|
|
288
|
+
}
|
|
289
|
+
```
|
|
290
|
+
```json
|
|
291
|
+
{
|
|
292
|
+
"requiredTests": [{ "path": "src/utils/utils.test.ts", "type": "unit" }],
|
|
293
|
+
"optionalTests": [],
|
|
294
|
+
"reason": "Found 1 required and 0 optional tests for changed files"
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
### Documentation Tools
|
|
301
|
+
|
|
302
|
+
#### doc_context_build
|
|
303
|
+
Builds compact context for writing documentation, targeted at a specific audience.
|
|
304
|
+
|
|
305
|
+
```json
|
|
306
|
+
{
|
|
307
|
+
"feature": "New impact_analyze tool added to execution module",
|
|
308
|
+
"changedFiles": ["src/capabilities/execution/execution.ts"],
|
|
309
|
+
"audience": "api"
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
#### doc_update_plan
|
|
314
|
+
Identifies exactly which docs need updating after code changes.
|
|
315
|
+
|
|
316
|
+
```json
|
|
317
|
+
{
|
|
318
|
+
"changedFiles": ["src/capabilities/execution/execution.ts", "src/core/types.ts"]
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
```json
|
|
322
|
+
{
|
|
323
|
+
"docsToUpdate": [{ "path": "README.md", "reason": "References changed module: capabilities" }],
|
|
324
|
+
"sectionsToUpdate": ["README.md - capabilities section"],
|
|
325
|
+
"examplesNeeded": ["Example usage of execution"]
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
### Memory Tools
|
|
332
|
+
|
|
333
|
+
#### memory_checkpoint
|
|
334
|
+
Saves task state at the end of a session so the next session resumes — not restarts.
|
|
335
|
+
|
|
336
|
+
```json
|
|
337
|
+
{
|
|
338
|
+
"taskId": "auth-refactor-2024",
|
|
339
|
+
"taskType": "feature",
|
|
340
|
+
"files": ["src/auth/router.ts", "src/middleware/rateLimit.ts"],
|
|
341
|
+
"decisions": [{ "description": "Use token bucket algorithm", "rationale": "Simpler than sliding window for our load" }],
|
|
342
|
+
"risks": ["rate limit headers must match nginx proxy config"],
|
|
343
|
+
"notes": "Step 2/4 done. Next: add Redis backend."
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
#### memory_restore
|
|
348
|
+
Restores a previously saved checkpoint by taskId.
|
|
349
|
+
|
|
350
|
+
```json
|
|
351
|
+
{ "taskId": "auth-refactor-2024" }
|
|
352
|
+
```
|
|
353
|
+
```json
|
|
354
|
+
{
|
|
355
|
+
"progressSummary": "1 decision recorded. 1 risk noted.",
|
|
356
|
+
"unresolvedItems": ["rate limit headers must match nginx proxy config"]
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## All 7 Resources
|
|
363
|
+
|
|
364
|
+
Resources are read via repo:// URIs — lighter than tools, no arguments needed.
|
|
365
|
+
|
|
366
|
+
| Resource URI | What It Returns | Typical Use |
|
|
367
|
+
|---|---|---|
|
|
368
|
+
| repo://architecture-map | Module dependency graph with edge counts | Before a large refactor |
|
|
369
|
+
| repo://module-index | All modules: file counts, languages, top exports | Understanding repo shape |
|
|
370
|
+
| repo://symbol-index | All exported symbols (capped 200) with file + line | Finding where something lives |
|
|
371
|
+
| repo://test-map | Test files to source targets mapping | Knowing test coverage at a glance |
|
|
372
|
+
| repo://doc-map | Docs with sections | Finding which doc to update |
|
|
373
|
+
| repo://patterns | Detected singletons, factories, handlers, schemas | Matching existing patterns |
|
|
374
|
+
| repo://glossary | All module/file/symbol names | Disambiguation before searching |
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
## Proven Token Savings
|
|
379
|
+
|
|
380
|
+
Real measurements on this repo (27 files, ~18k tokens):
|
|
381
|
+
|
|
382
|
+
| Scenario | Tools Used | Without MCP | With MCP | Saved |
|
|
383
|
+
|----------|-----------|------------|---------|-------|
|
|
384
|
+
| Analysis | 3 | 18,298 | 405 | **97.8%** |
|
|
385
|
+
| Bug Fix | 3 | 18,298 | 734 | **96.0%** |
|
|
386
|
+
| Feature | 5 | 18,298 | 1,117 | **93.9%** |
|
|
387
|
+
| POC | 2 | 18,298 | 128 | **99.3%** |
|
|
388
|
+
| Documentation | 3 | 18,298 | 226 | **98.8%** |
|
|
389
|
+
| Multi-session Memory | 2 | 36,596 | 434 | **98.8%** |
|
|
390
|
+
| All 7 Resources | 7 | 18,298 | 836 | **95.4%** |
|
|
391
|
+
| **TOTAL** | **19/19** | **146,384** | **3,880** | **97.3%** |
|
|
392
|
+
|
|
393
|
+
Run the benchmark yourself:
|
|
394
|
+
```bash
|
|
395
|
+
npx tsx test-token-report.ts
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
## Recommended Workflow
|
|
401
|
+
|
|
402
|
+
Add this to your project CLAUDE.md:
|
|
403
|
+
|
|
404
|
+
```
|
|
405
|
+
Step 1: task_classify(task) → detect type, get next tools
|
|
406
|
+
Step 2: repo_scope_find(task, repoPath) → find minimum relevant files
|
|
407
|
+
Step 3a: flow_summarize(files) → analysis / feature
|
|
408
|
+
Step 3b: bug_trace_compact(symptom, files) → bug fix
|
|
409
|
+
Step 3c: doc_context_build(feature, files) → documentation
|
|
410
|
+
Step 4a: implementation_plan(task, files) → feature or bug
|
|
411
|
+
Step 4b: poc_plan(goal) → proof of concept
|
|
412
|
+
Step 4c: doc_update_plan(changedFiles) → documentation
|
|
413
|
+
Step 5: impact_analyze(files, changeType) → blast radius check
|
|
414
|
+
Step 6: test_select(files) → minimum test set
|
|
415
|
+
Step 7: memory_checkpoint(taskId, ...) → save for next session
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## Integration with Claude Code
|
|
421
|
+
|
|
422
|
+
### Option A — Global install
|
|
423
|
+
|
|
424
|
+
```bash
|
|
425
|
+
npm install -g @software-engineering/mcp-server
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
Add to ~/.claude.json:
|
|
429
|
+
|
|
430
|
+
```json
|
|
431
|
+
{
|
|
432
|
+
"mcpServers": {
|
|
433
|
+
"engi": {
|
|
434
|
+
"command": "engineering-mcp",
|
|
435
|
+
"env": { "LOG_LEVEL": "warn" }
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### Option B — npx (zero install)
|
|
442
|
+
|
|
443
|
+
```json
|
|
444
|
+
{
|
|
445
|
+
"mcpServers": {
|
|
446
|
+
"engi": {
|
|
447
|
+
"command": "npx",
|
|
448
|
+
"args": ["-y", "@software-engineering/mcp-server"],
|
|
449
|
+
"env": { "LOG_LEVEL": "warn" }
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
### Option C — Local path
|
|
456
|
+
|
|
457
|
+
```json
|
|
458
|
+
{
|
|
459
|
+
"mcpServers": {
|
|
460
|
+
"engi": {
|
|
461
|
+
"command": "node",
|
|
462
|
+
"args": ["/absolute/path/to/mcp-token/dist/index.js"],
|
|
463
|
+
"env": { "LOG_LEVEL": "warn" }
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
### Claude Desktop
|
|
470
|
+
|
|
471
|
+
Config path: ~/Library/Application Support/Claude/claude_desktop_config.json
|
|
472
|
+
|
|
473
|
+
```json
|
|
474
|
+
{
|
|
475
|
+
"mcpServers": {
|
|
476
|
+
"engi": {
|
|
477
|
+
"command": "npx",
|
|
478
|
+
"args": ["-y", "@software-engineering/mcp-server"]
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
---
|
|
485
|
+
|
|
486
|
+
## Architecture Deep Dive
|
|
487
|
+
|
|
488
|
+
```
|
|
489
|
+
MCP Protocol (stdio)
|
|
490
|
+
ListTools / CallTool / ReadResource
|
|
491
|
+
│
|
|
492
|
+
Server (src/index.ts)
|
|
493
|
+
Tool Registry · Request Routing
|
|
494
|
+
│ │ │ │ │
|
|
495
|
+
Analysis Planning Execution Docs Memory
|
|
496
|
+
4 tools 2 tools 2 tools 2 tools 2 tools
|
|
497
|
+
│
|
|
498
|
+
Core Layers
|
|
499
|
+
Indexer → Retrieval Engine → Summarizer
|
|
500
|
+
│
|
|
501
|
+
Resources (repo:// URIs, 7 total)
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
### Indexer — What Gets Indexed
|
|
505
|
+
|
|
506
|
+
| What | How |
|
|
507
|
+
|------|-----|
|
|
508
|
+
| Files | Recursive scan, skips node_modules, dist, .git, build |
|
|
509
|
+
| File type | source / test / config / doc / other |
|
|
510
|
+
| Language | 16 languages detected by extension |
|
|
511
|
+
| Exports | Language-aware regex (TypeScript, JavaScript, Python, Go) |
|
|
512
|
+
| Imports | import from, require(), from ... import |
|
|
513
|
+
| Symbols | Functions, classes, interfaces, types with line numbers |
|
|
514
|
+
| Tests | Files matching *.test.*, *.spec.*, __tests__/ |
|
|
515
|
+
| Docs | Files matching readme, changelog, guide, api |
|
|
516
|
+
|
|
517
|
+
### Retrieval — Scoring Algorithm
|
|
518
|
+
|
|
519
|
+
```
|
|
520
|
+
For each file in index:
|
|
521
|
+
score += 10 if keyword in file path or name
|
|
522
|
+
score += 15 if keyword in file exports
|
|
523
|
+
score += 8 if file type matches task type
|
|
524
|
+
score += 20 if doc file for documentation task
|
|
525
|
+
|
|
526
|
+
confidence = avg(topN scores) / max_possible_score → 0.0 to 1.0
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
### Verbosity Levels
|
|
530
|
+
|
|
531
|
+
| Level | Tokens | Use When |
|
|
532
|
+
|-------|--------|---------|
|
|
533
|
+
| minimal | ~50 | Default — just key facts |
|
|
534
|
+
| standard | ~150 | Exploring unfamiliar code |
|
|
535
|
+
| detailed | ~400 | Debugging complex flows |
|
|
536
|
+
|
|
537
|
+
---
|
|
538
|
+
|
|
539
|
+
## Configuration
|
|
540
|
+
|
|
541
|
+
| Variable | Default | Description |
|
|
542
|
+
|----------|---------|-------------|
|
|
543
|
+
| LOG_LEVEL | info | debug / info / warn / error |
|
|
544
|
+
|
|
545
|
+
---
|
|
546
|
+
|
|
547
|
+
## Project Structure
|
|
548
|
+
|
|
549
|
+
```
|
|
550
|
+
src/
|
|
551
|
+
├── index.ts MCP server · tool registry · request routing
|
|
552
|
+
├── bin.ts CLI entry (npx / global install)
|
|
553
|
+
├── core/
|
|
554
|
+
│ ├── types.ts All shared TypeScript interfaces
|
|
555
|
+
│ ├── indexer/indexer.ts Repo scanner · export parser · singleton
|
|
556
|
+
│ ├── retrieval/retriever.ts Keyword scorer · scope finder
|
|
557
|
+
│ └── summarizer/summarizer.ts Flow builder · bug tracer · doc builder
|
|
558
|
+
├── capabilities/
|
|
559
|
+
│ ├── analysis/ task_classify · repo_scope_find · flow_summarize · bug_trace_compact
|
|
560
|
+
│ ├── planning/ implementation_plan · poc_plan
|
|
561
|
+
│ ├── execution/ impact_analyze · test_select
|
|
562
|
+
│ ├── documentation/ doc_context_build · doc_update_plan
|
|
563
|
+
│ └── memory/ memory_checkpoint · memory_restore
|
|
564
|
+
├── resources/resources.ts 7 repo:// resource builders
|
|
565
|
+
├── memory/memory.ts Checkpoint store (in-memory + file)
|
|
566
|
+
└── utils/
|
|
567
|
+
├── token-counter.ts estimateTokens · checkTokenBudget
|
|
568
|
+
├── logger.ts stderr logger
|
|
569
|
+
└── formatter.ts Response formatting
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
---
|
|
573
|
+
|
|
574
|
+
## Development
|
|
575
|
+
|
|
576
|
+
```bash
|
|
577
|
+
npm install # install deps
|
|
578
|
+
npm run build # compile TypeScript
|
|
579
|
+
npm run dev # watch mode
|
|
580
|
+
npm test # run 55 tests
|
|
581
|
+
npx tsx test-token-report.ts # token reduction benchmark
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
---
|
|
585
|
+
|
|
586
|
+
## License
|
|
587
|
+
|
|
588
|
+
MIT — see LICENSE
|
|
589
|
+
|
|
590
|
+
---
|
|
591
|
+
|
|
592
|
+
Made for engineers who want Claude to work smarter, not harder.
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA,OAAO,YAAY,CAAC"}
|
package/dist/bin.js
ADDED
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";;;AACA,2FAA2F;AAC3F,sBAAoB"}
|