mcp-code-context 3.6.1 → 3.6.3
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 +41 -31
- package/HIRE_ME.md +234 -234
- package/INSTRUCTIONS.md +279 -274
- package/LICENSE +21 -21
- package/README.md +482 -486
- package/SECURITY.md +14 -14
- package/SPONSORS.md +104 -104
- package/dist/src/core/cacheManager.d.ts +6 -1
- package/dist/src/core/cacheManager.js +25 -16
- package/dist/src/core/cacheManager.js.map +1 -1
- package/dist/src/core/engine.d.ts +1 -1
- package/dist/src/core/engine.js +1 -1
- package/dist/src/core/validator.d.ts +1 -1
- package/dist/src/core/validator.js +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +207 -24
- package/dist/src/index.js.map +1 -1
- package/dist/src/operations/compress.d.ts +1 -1
- package/dist/src/operations/compress.js +1 -1
- package/dist/src/operations/confirmationStore.d.ts +1 -1
- package/dist/src/operations/confirmationStore.js +1 -1
- package/dist/src/operations/read.d.ts +37 -1
- package/dist/src/operations/read.js +176 -9
- package/dist/src/operations/read.js.map +1 -1
- package/dist/src/operations/write.d.ts +2 -2
- package/dist/src/operations/write.js +2 -2
- package/dist/src/parsers/base.d.ts +3 -1
- package/dist/src/parsers/base.js +1 -1
- package/dist/src/parsers/base.js.map +1 -1
- package/dist/src/parsers/dartTreeSitter.d.ts +1 -1
- package/dist/src/parsers/dartTreeSitter.js +5 -1
- package/dist/src/parsers/dartTreeSitter.js.map +1 -1
- package/dist/src/parsers/php.d.ts +1 -1
- package/dist/src/parsers/php.js +5 -1
- package/dist/src/parsers/php.js.map +1 -1
- package/dist/src/parsers/python.d.ts +1 -1
- package/dist/src/parsers/python.js +5 -1
- package/dist/src/parsers/python.js.map +1 -1
- package/dist/src/parsers/registry.d.ts +1 -1
- package/dist/src/parsers/registry.js +1 -1
- package/dist/src/parsers/typescript.d.ts +1 -1
- package/dist/src/parsers/typescript.js +9 -5
- package/dist/src/parsers/typescript.js.map +1 -1
- package/dist/src/utils/auditLogger.d.ts +1 -1
- package/dist/src/utils/auditLogger.js +1 -1
- package/dist/src/utils/backupManager.d.ts +1 -1
- package/dist/src/utils/backupManager.js +1 -1
- package/dist/src/utils/constants.d.ts +1 -1
- package/dist/src/utils/constants.js +1 -1
- package/dist/src/utils/diff.d.ts +1 -1
- package/dist/src/utils/diff.js +4 -4
- package/dist/src/utils/fileLock.d.ts +1 -1
- package/dist/src/utils/fileLock.js +1 -1
- package/dist/src/utils/fileWalker.d.ts +1 -1
- package/dist/src/utils/fileWalker.js +1 -1
- package/dist/src/utils/fileWatcher.d.ts +2 -1
- package/dist/src/utils/fileWatcher.js +12 -2
- package/dist/src/utils/fileWatcher.js.map +1 -1
- package/dist/src/utils/fuzzySearch.d.ts +1 -1
- package/dist/src/utils/fuzzySearch.js +1 -1
- package/dist/src/utils/logger.d.ts +1 -1
- package/dist/src/utils/logger.js +1 -1
- package/dist/src/utils/rateLimiter.d.ts +5 -1
- package/dist/src/utils/rateLimiter.js +5 -1
- package/dist/src/utils/rateLimiter.js.map +1 -1
- package/dist/src/utils/safeRegex.d.ts +1 -1
- package/dist/src/utils/safeRegex.js +1 -1
- package/dist/src/utils/streaming.d.ts +1 -1
- package/dist/src/utils/streaming.js +1 -1
- package/dist/src/utils/telemetry.d.ts +1 -1
- package/dist/src/utils/telemetry.js +1 -1
- package/llms.txt +37 -21
- package/package.json +3 -3
- package/scripts/replace-version.js +59 -59
- package/vitest.config.ts +37 -37
package/INSTRUCTIONS.md
CHANGED
|
@@ -1,274 +1,279 @@
|
|
|
1
|
-
# Instructions for AI Agents Using mcp-code-context
|
|
2
|
-
|
|
3
|
-
## 🎯 Quick Start
|
|
4
|
-
|
|
5
|
-
This MCP server provides **surgical code editing** with Tree-sitter AST parsing. Use it to read and modify code with precision.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 📖 Essential Reading Workflow
|
|
10
|
-
|
|
11
|
-
### 1. Start with Repository Map
|
|
12
|
-
```
|
|
13
|
-
@mcp-code-context/get_semantic_repo_map
|
|
14
|
-
directoryPath: /absolute/path/to/project
|
|
15
|
-
projectRoot: /absolute/path/to/project
|
|
16
|
-
format: xml
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
**Why**: Get architectural overview before diving into files. Saves 80% tokens vs reading raw files.
|
|
20
|
-
|
|
21
|
-
### 2. Extract Specific Symbols
|
|
22
|
-
```
|
|
23
|
-
@mcp-code-context/read_file_surgical
|
|
24
|
-
filePath: /path/to/file.ts
|
|
25
|
-
projectRoot: /project/root
|
|
26
|
-
symbolName: functionName
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
**Why**: Read only what you need. If symbol not found, tool suggests available symbols.
|
|
30
|
-
|
|
31
|
-
### 3. Check Impact Before Editing
|
|
32
|
-
```
|
|
33
|
-
@mcp-code-context/analyze_impact
|
|
34
|
-
filePath: /path/to/file.ts
|
|
35
|
-
projectRoot: /project/root
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
**Why**: Know which files depend on what you're about to change.
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## ✏️ Essential Writing Workflow
|
|
43
|
-
|
|
44
|
-
### Two-Phase Pattern (ALWAYS FOLLOW)
|
|
45
|
-
|
|
46
|
-
**Phase 1: Preview**
|
|
47
|
-
```
|
|
48
|
-
@mcp-code-context/write_file_surgical
|
|
49
|
-
filePath: /path/to/file.ts
|
|
50
|
-
projectRoot: /project/root
|
|
51
|
-
symbolName: myFunction
|
|
52
|
-
newContent: "function myFunction() { return 42; }"
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
**Result**: Returns diff + confirmationToken
|
|
56
|
-
|
|
57
|
-
**Phase 2: Apply**
|
|
58
|
-
```
|
|
59
|
-
@mcp-code-context/write_file_surgical
|
|
60
|
-
filePath: /path/to/file.ts
|
|
61
|
-
projectRoot: /project/root
|
|
62
|
-
symbolName: myFunction
|
|
63
|
-
newContent: "function myFunction() { return 42; }"
|
|
64
|
-
confirm: true
|
|
65
|
-
confirmationToken: "TOKEN_FROM_PHASE_1"
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
**Result**: ✅ Success. Changes applied to 1 file(s).
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
## 🚨 Critical Rules
|
|
73
|
-
|
|
74
|
-
### 1. **ALWAYS Use projectRoot**
|
|
75
|
-
Every tool requires `projectRoot` for security. Use the project's root directory.
|
|
76
|
-
|
|
77
|
-
### 2. **NEVER Skip Phase 1**
|
|
78
|
-
Always preview diffs before applying. Tokens are stored in memory and expire on server restart.
|
|
79
|
-
|
|
80
|
-
### 3. **Use Surgical Tools, Not Full File Rewrites**
|
|
81
|
-
❌ **Bad**: Read entire file, modify, write entire file
|
|
82
|
-
✅ **Good**: Use `write_file_surgical` to replace only the target symbol
|
|
83
|
-
|
|
84
|
-
### 4. **Check Dependencies First**
|
|
85
|
-
Before removing or renaming symbols, use `analyze_impact` to avoid breaking imports.
|
|
86
|
-
|
|
87
|
-
### 5. **Provide Complete Symbol Code**
|
|
88
|
-
When using `write_file_surgical`, include the full function/method signature + body:
|
|
89
|
-
```typescript
|
|
90
|
-
// ✅ GOOD
|
|
91
|
-
newContent: "function hello(name: string): string {\n return `Hello, ${name}`;\n}"
|
|
92
|
-
|
|
93
|
-
// ❌ BAD (incomplete)
|
|
94
|
-
newContent: "return `Hello, ${name}`;"
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
## 🔍 Advanced Search
|
|
100
|
-
|
|
101
|
-
### Pattern Search
|
|
102
|
-
```
|
|
103
|
-
@mcp-code-context/search_code_pattern
|
|
104
|
-
rootDir: /project/root
|
|
105
|
-
projectRoot: /project/root
|
|
106
|
-
pattern: "myFunction"
|
|
107
|
-
fileExtensions: [".ts", ".js"]
|
|
108
|
-
maxResults: 10
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### Fuzzy Search (v3.6.
|
|
112
|
-
```
|
|
113
|
-
@mcp-code-context/search_code_pattern
|
|
114
|
-
rootDir: /project/root
|
|
115
|
-
projectRoot: /project/root
|
|
116
|
-
pattern: "authUser"
|
|
117
|
-
fuzzyMatch: true
|
|
118
|
-
fuzzyThreshold: 0.6
|
|
119
|
-
maxResults: 5
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
**Finds**: `authenticateUser`, `authorizeUser`, etc.
|
|
123
|
-
|
|
124
|
-
---
|
|
125
|
-
|
|
126
|
-
## 🛡️ Safety Features
|
|
127
|
-
|
|
128
|
-
### Automatic Backups
|
|
129
|
-
Every write creates a backup. Rollback if needed:
|
|
130
|
-
```
|
|
131
|
-
@mcp-code-context/rollback_file
|
|
132
|
-
filePath: /path/to/file.ts
|
|
133
|
-
projectRoot: /project/root
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### Cache Management
|
|
137
|
-
```
|
|
138
|
-
@mcp-code-context/get_cache_stats
|
|
139
|
-
projectRoot: /project/root
|
|
140
|
-
|
|
141
|
-
@mcp-code-context/clear_cache
|
|
142
|
-
projectRoot: /project/root
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
## 💡 Pro Tips
|
|
148
|
-
|
|
149
|
-
### 1. **Use className for Method Scoping**
|
|
150
|
-
When a file has multiple classes with same method name:
|
|
151
|
-
```
|
|
152
|
-
@mcp-code-context/read_file_surgical
|
|
153
|
-
filePath: /path/to/file.ts
|
|
154
|
-
symbolName: render
|
|
155
|
-
className: MyComponent
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
### 2. **Batch Operations with rename_symbol**
|
|
159
|
-
Rename across entire codebase in one operation:
|
|
160
|
-
```
|
|
161
|
-
@mcp-code-context/rename_symbol
|
|
162
|
-
filePath: /path/to/definition.ts
|
|
163
|
-
projectRoot: /project/root
|
|
164
|
-
oldName: oldFunction
|
|
165
|
-
newName: newFunction
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### 3. **Insert New Code Precisely**
|
|
169
|
-
```
|
|
170
|
-
@mcp-code-context/insert_symbol
|
|
171
|
-
filePath: /path/to/file.ts
|
|
172
|
-
projectRoot: /project/root
|
|
173
|
-
code: "private newMethod() { }"
|
|
174
|
-
anchorSymbol: existingMethod
|
|
175
|
-
position: after
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
### 4. **Read Specific Lines Only**
|
|
179
|
-
```
|
|
180
|
-
@mcp-code-context/read_file_lines
|
|
181
|
-
filePath: /path/to/file.ts
|
|
182
|
-
projectRoot: /project/root
|
|
183
|
-
startLine: 100
|
|
184
|
-
endLine: 120
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
---
|
|
188
|
-
|
|
189
|
-
## ⚠️ Common Mistakes
|
|
190
|
-
|
|
191
|
-
### ❌ Mistake 1: Forgetting projectRoot
|
|
192
|
-
```
|
|
193
|
-
// WRONG
|
|
194
|
-
@mcp-code-context/read_file_surgical
|
|
195
|
-
filePath: /path/to/file.ts
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
### ❌ Mistake 2: Skipping Phase 1
|
|
199
|
-
```
|
|
200
|
-
// WRONG - No preview
|
|
201
|
-
@mcp-code-context/write_file_surgical
|
|
202
|
-
confirm: true
|
|
203
|
-
confirmationToken: "FAKE_TOKEN"
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
### ❌ Mistake 3: Incomplete Symbol Code
|
|
207
|
-
```
|
|
208
|
-
// WRONG - Missing function signature
|
|
209
|
-
newContent: "{ return 42; }"
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
### ❌ Mistake 4: Not Checking Impact
|
|
213
|
-
```
|
|
214
|
-
// WRONG - Removing without checking dependencies
|
|
215
|
-
@mcp-code-context/remove_symbol
|
|
216
|
-
symbolName: importantFunction
|
|
217
|
-
force: true
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
---
|
|
221
|
-
|
|
222
|
-
## 📊 Performance Tips
|
|
223
|
-
|
|
224
|
-
1. **Use get_semantic_repo_map first** - 80% token savings
|
|
225
|
-
2. **Extract symbols, not full files** - 90% token savings
|
|
226
|
-
3. **Use fuzzy search for discovery** - Finds similar patterns
|
|
227
|
-
4. **Enable caching** - 10x faster repeated operations
|
|
228
|
-
5. **Paginate search results** - Default 10 results, use `startIndex` for more
|
|
229
|
-
|
|
230
|
-
---
|
|
231
|
-
|
|
232
|
-
## 🎓 Example Workflow
|
|
233
|
-
|
|
234
|
-
```
|
|
235
|
-
1. Get repo map
|
|
236
|
-
→ @mcp-code-context/get_semantic_repo_map
|
|
237
|
-
|
|
238
|
-
2. Find target symbol
|
|
239
|
-
→ @mcp-code-context/read_file_surgical
|
|
240
|
-
|
|
241
|
-
3. Check dependencies
|
|
242
|
-
→ @mcp-code-context/analyze_impact
|
|
243
|
-
|
|
244
|
-
4. Preview changes (Phase 1)
|
|
245
|
-
→ @mcp-code-context/write_file_surgical
|
|
246
|
-
|
|
247
|
-
5. Review diff, then apply (Phase 2)
|
|
248
|
-
→ @mcp-code-context/write_file_surgical (with token)
|
|
249
|
-
|
|
250
|
-
6. Verify or rollback if needed
|
|
251
|
-
→ @mcp-code-context/rollback_file
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
---
|
|
255
|
-
|
|
256
|
-
## 🚀 v3.6.
|
|
257
|
-
|
|
258
|
-
- ✅ **
|
|
259
|
-
- ✅
|
|
260
|
-
- ✅ **
|
|
261
|
-
- ✅
|
|
262
|
-
- ✅ **
|
|
263
|
-
- ✅ **
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
1
|
+
# Instructions for AI Agents Using mcp-code-context
|
|
2
|
+
|
|
3
|
+
## 🎯 Quick Start
|
|
4
|
+
|
|
5
|
+
This MCP server provides **surgical code editing** with Tree-sitter AST parsing. Use it to read and modify code with precision.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 📖 Essential Reading Workflow
|
|
10
|
+
|
|
11
|
+
### 1. Start with Repository Map
|
|
12
|
+
```
|
|
13
|
+
@mcp-code-context/get_semantic_repo_map
|
|
14
|
+
directoryPath: /absolute/path/to/project
|
|
15
|
+
projectRoot: /absolute/path/to/project
|
|
16
|
+
format: xml
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Why**: Get architectural overview before diving into files. Saves 80% tokens vs reading raw files.
|
|
20
|
+
|
|
21
|
+
### 2. Extract Specific Symbols
|
|
22
|
+
```
|
|
23
|
+
@mcp-code-context/read_file_surgical
|
|
24
|
+
filePath: /path/to/file.ts
|
|
25
|
+
projectRoot: /project/root
|
|
26
|
+
symbolName: functionName
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Why**: Read only what you need. If symbol not found, tool suggests available symbols.
|
|
30
|
+
|
|
31
|
+
### 3. Check Impact Before Editing
|
|
32
|
+
```
|
|
33
|
+
@mcp-code-context/analyze_impact
|
|
34
|
+
filePath: /path/to/file.ts
|
|
35
|
+
projectRoot: /project/root
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Why**: Know which files depend on what you're about to change.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## ✏️ Essential Writing Workflow
|
|
43
|
+
|
|
44
|
+
### Two-Phase Pattern (ALWAYS FOLLOW)
|
|
45
|
+
|
|
46
|
+
**Phase 1: Preview**
|
|
47
|
+
```
|
|
48
|
+
@mcp-code-context/write_file_surgical
|
|
49
|
+
filePath: /path/to/file.ts
|
|
50
|
+
projectRoot: /project/root
|
|
51
|
+
symbolName: myFunction
|
|
52
|
+
newContent: "function myFunction() { return 42; }"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Result**: Returns diff + confirmationToken
|
|
56
|
+
|
|
57
|
+
**Phase 2: Apply**
|
|
58
|
+
```
|
|
59
|
+
@mcp-code-context/write_file_surgical
|
|
60
|
+
filePath: /path/to/file.ts
|
|
61
|
+
projectRoot: /project/root
|
|
62
|
+
symbolName: myFunction
|
|
63
|
+
newContent: "function myFunction() { return 42; }"
|
|
64
|
+
confirm: true
|
|
65
|
+
confirmationToken: "TOKEN_FROM_PHASE_1"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Result**: ✅ Success. Changes applied to 1 file(s).
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 🚨 Critical Rules
|
|
73
|
+
|
|
74
|
+
### 1. **ALWAYS Use projectRoot**
|
|
75
|
+
Every tool requires `projectRoot` for security. Use the project's root directory.
|
|
76
|
+
|
|
77
|
+
### 2. **NEVER Skip Phase 1**
|
|
78
|
+
Always preview diffs before applying. Tokens are stored in memory and expire on server restart.
|
|
79
|
+
|
|
80
|
+
### 3. **Use Surgical Tools, Not Full File Rewrites**
|
|
81
|
+
❌ **Bad**: Read entire file, modify, write entire file
|
|
82
|
+
✅ **Good**: Use `write_file_surgical` to replace only the target symbol
|
|
83
|
+
|
|
84
|
+
### 4. **Check Dependencies First**
|
|
85
|
+
Before removing or renaming symbols, use `analyze_impact` to avoid breaking imports.
|
|
86
|
+
|
|
87
|
+
### 5. **Provide Complete Symbol Code**
|
|
88
|
+
When using `write_file_surgical`, include the full function/method signature + body:
|
|
89
|
+
```typescript
|
|
90
|
+
// ✅ GOOD
|
|
91
|
+
newContent: "function hello(name: string): string {\n return `Hello, ${name}`;\n}"
|
|
92
|
+
|
|
93
|
+
// ❌ BAD (incomplete)
|
|
94
|
+
newContent: "return `Hello, ${name}`;"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 🔍 Advanced Search
|
|
100
|
+
|
|
101
|
+
### Pattern Search
|
|
102
|
+
```
|
|
103
|
+
@mcp-code-context/search_code_pattern
|
|
104
|
+
rootDir: /project/root
|
|
105
|
+
projectRoot: /project/root
|
|
106
|
+
pattern: "myFunction"
|
|
107
|
+
fileExtensions: [".ts", ".js"]
|
|
108
|
+
maxResults: 10
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Fuzzy Search (v3.6.2+)
|
|
112
|
+
```
|
|
113
|
+
@mcp-code-context/search_code_pattern
|
|
114
|
+
rootDir: /project/root
|
|
115
|
+
projectRoot: /project/root
|
|
116
|
+
pattern: "authUser"
|
|
117
|
+
fuzzyMatch: true
|
|
118
|
+
fuzzyThreshold: 0.6
|
|
119
|
+
maxResults: 5
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Finds**: `authenticateUser`, `authorizeUser`, etc.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## 🛡️ Safety Features
|
|
127
|
+
|
|
128
|
+
### Automatic Backups
|
|
129
|
+
Every write creates a backup. Rollback if needed:
|
|
130
|
+
```
|
|
131
|
+
@mcp-code-context/rollback_file
|
|
132
|
+
filePath: /path/to/file.ts
|
|
133
|
+
projectRoot: /project/root
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Cache Management
|
|
137
|
+
```
|
|
138
|
+
@mcp-code-context/get_cache_stats
|
|
139
|
+
projectRoot: /project/root
|
|
140
|
+
|
|
141
|
+
@mcp-code-context/clear_cache
|
|
142
|
+
projectRoot: /project/root
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## 💡 Pro Tips
|
|
148
|
+
|
|
149
|
+
### 1. **Use className for Method Scoping**
|
|
150
|
+
When a file has multiple classes with same method name:
|
|
151
|
+
```
|
|
152
|
+
@mcp-code-context/read_file_surgical
|
|
153
|
+
filePath: /path/to/file.ts
|
|
154
|
+
symbolName: render
|
|
155
|
+
className: MyComponent
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### 2. **Batch Operations with rename_symbol**
|
|
159
|
+
Rename across entire codebase in one operation:
|
|
160
|
+
```
|
|
161
|
+
@mcp-code-context/rename_symbol
|
|
162
|
+
filePath: /path/to/definition.ts
|
|
163
|
+
projectRoot: /project/root
|
|
164
|
+
oldName: oldFunction
|
|
165
|
+
newName: newFunction
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### 3. **Insert New Code Precisely**
|
|
169
|
+
```
|
|
170
|
+
@mcp-code-context/insert_symbol
|
|
171
|
+
filePath: /path/to/file.ts
|
|
172
|
+
projectRoot: /project/root
|
|
173
|
+
code: "private newMethod() { }"
|
|
174
|
+
anchorSymbol: existingMethod
|
|
175
|
+
position: after
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### 4. **Read Specific Lines Only**
|
|
179
|
+
```
|
|
180
|
+
@mcp-code-context/read_file_lines
|
|
181
|
+
filePath: /path/to/file.ts
|
|
182
|
+
projectRoot: /project/root
|
|
183
|
+
startLine: 100
|
|
184
|
+
endLine: 120
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## ⚠️ Common Mistakes
|
|
190
|
+
|
|
191
|
+
### ❌ Mistake 1: Forgetting projectRoot
|
|
192
|
+
```
|
|
193
|
+
// WRONG
|
|
194
|
+
@mcp-code-context/read_file_surgical
|
|
195
|
+
filePath: /path/to/file.ts
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### ❌ Mistake 2: Skipping Phase 1
|
|
199
|
+
```
|
|
200
|
+
// WRONG - No preview
|
|
201
|
+
@mcp-code-context/write_file_surgical
|
|
202
|
+
confirm: true
|
|
203
|
+
confirmationToken: "FAKE_TOKEN"
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### ❌ Mistake 3: Incomplete Symbol Code
|
|
207
|
+
```
|
|
208
|
+
// WRONG - Missing function signature
|
|
209
|
+
newContent: "{ return 42; }"
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### ❌ Mistake 4: Not Checking Impact
|
|
213
|
+
```
|
|
214
|
+
// WRONG - Removing without checking dependencies
|
|
215
|
+
@mcp-code-context/remove_symbol
|
|
216
|
+
symbolName: importantFunction
|
|
217
|
+
force: true
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## 📊 Performance Tips
|
|
223
|
+
|
|
224
|
+
1. **Use get_semantic_repo_map first** - 80% token savings
|
|
225
|
+
2. **Extract symbols, not full files** - 90% token savings
|
|
226
|
+
3. **Use fuzzy search for discovery** - Finds similar patterns
|
|
227
|
+
4. **Enable caching** - 10x faster repeated operations
|
|
228
|
+
5. **Paginate search results** - Default 10 results, use `startIndex` for more
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## 🎓 Example Workflow
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
1. Get repo map
|
|
236
|
+
→ @mcp-code-context/get_semantic_repo_map
|
|
237
|
+
|
|
238
|
+
2. Find target symbol
|
|
239
|
+
→ @mcp-code-context/read_file_surgical
|
|
240
|
+
|
|
241
|
+
3. Check dependencies
|
|
242
|
+
→ @mcp-code-context/analyze_impact
|
|
243
|
+
|
|
244
|
+
4. Preview changes (Phase 1)
|
|
245
|
+
→ @mcp-code-context/write_file_surgical
|
|
246
|
+
|
|
247
|
+
5. Review diff, then apply (Phase 2)
|
|
248
|
+
→ @mcp-code-context/write_file_surgical (with token)
|
|
249
|
+
|
|
250
|
+
6. Verify or rollback if needed
|
|
251
|
+
→ @mcp-code-context/rollback_file
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## 🚀 v3.6.3 Features
|
|
257
|
+
|
|
258
|
+
- ✅ **4 New Tools**: `search_symbols`, `explain_symbol`, `batch_read`, `get_rate_limit_status`
|
|
259
|
+
- ✅ **`diffFormat`**: Control diff verbosity on all write tools (`unified`, `compact`, `summary`, `none`)
|
|
260
|
+
- ✅ **Phase 2 optimized**: No need to resend `newContent`/`code` — server stores it from Phase 1
|
|
261
|
+
- ✅ **`aroundPattern` line number**: Output now shows `Match found at line N`
|
|
262
|
+
- ✅ **Rate limiter in stats**: `get_server_stats` includes token balance and operation costs
|
|
263
|
+
- ✅ **Cache hit rate**: `get_cache_stats` includes `hits`, `misses`, `hitRate`
|
|
264
|
+
- ✅ **Watcher paths**: `get_file_watcher_status` includes list of watched files
|
|
265
|
+
- ✅ **Fuzzy Search**: Find similar patterns with typo tolerance
|
|
266
|
+
- ✅ **Pagination**: Default 10 results, use `startIndex` for more
|
|
267
|
+
- ✅ **Persistent Cache**: 10x faster with sql.js WASM SQLite
|
|
268
|
+
- ✅ **File Watcher**: Auto-invalidate cache on file changes
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## 📚 Full Documentation
|
|
273
|
+
|
|
274
|
+
See `llms.txt` for complete API reference and technical details.
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
**Version**: 3.6.3
|
|
279
|
+
**Last Updated**: May 1, 2026
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026
|
|
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.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
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.
|