mcp-code-context 3.5.2 → 3.6.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 +57 -3
- package/HIRE_ME.md +234 -0
- package/INSTRUCTIONS.md +274 -0
- package/README.md +486 -304
- package/SECURITY.md +14 -14
- package/SPONSORS.md +104 -0
- package/dist/src/core/cacheManager.d.ts +44 -0
- package/dist/src/core/cacheManager.js +255 -0
- package/dist/src/core/cacheManager.js.map +1 -0
- 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 +21 -9
- package/dist/src/core/validator.js.map +1 -1
- package/dist/src/index.d.ts +6 -1
- package/dist/src/index.js +197 -20
- package/dist/src/index.js.map +1 -1
- package/dist/src/operations/compress.d.ts +3 -1
- package/dist/src/operations/compress.js +47 -48
- package/dist/src/operations/compress.js.map +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 +5 -1
- package/dist/src/operations/read.js +129 -60
- package/dist/src/operations/read.js.map +1 -1
- package/dist/src/operations/write.d.ts +2 -2
- package/dist/src/operations/write.js +83 -59
- package/dist/src/operations/write.js.map +1 -1
- package/dist/src/parsers/base.d.ts +1 -1
- package/dist/src/parsers/base.js +1 -1
- package/dist/src/parsers/dartTreeSitter.d.ts +1 -1
- package/dist/src/parsers/dartTreeSitter.js +1 -1
- package/dist/src/parsers/php.d.ts +1 -1
- package/dist/src/parsers/php.js +1 -1
- package/dist/src/parsers/python.d.ts +1 -1
- package/dist/src/parsers/python.js +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 +1 -1
- package/dist/src/utils/auditLogger.d.ts +1 -1
- package/dist/src/utils/auditLogger.js +3 -2
- package/dist/src/utils/auditLogger.js.map +1 -1
- package/dist/src/utils/backupManager.d.ts +30 -9
- package/dist/src/utils/backupManager.js +75 -33
- package/dist/src/utils/backupManager.js.map +1 -1
- package/dist/src/utils/constants.d.ts +13 -2
- package/dist/src/utils/constants.js +21 -2
- package/dist/src/utils/constants.js.map +1 -1
- package/dist/src/utils/diff.d.ts +37 -7
- package/dist/src/utils/diff.js +91 -101
- package/dist/src/utils/diff.js.map +1 -1
- package/dist/src/utils/fileLock.d.ts +25 -50
- package/dist/src/utils/fileLock.js +66 -100
- package/dist/src/utils/fileLock.js.map +1 -1
- package/dist/src/utils/fileWalker.d.ts +28 -0
- package/dist/src/utils/fileWalker.js +57 -0
- package/dist/src/utils/fileWalker.js.map +1 -0
- package/dist/src/utils/fileWatcher.d.ts +23 -0
- package/dist/src/utils/fileWatcher.js +80 -0
- package/dist/src/utils/fileWatcher.js.map +1 -0
- package/dist/src/utils/fuzzySearch.d.ts +22 -0
- package/dist/src/utils/fuzzySearch.js +36 -0
- package/dist/src/utils/fuzzySearch.js.map +1 -0
- package/dist/src/utils/logger.d.ts +19 -0
- package/dist/src/utils/logger.js +50 -0
- package/dist/src/utils/logger.js.map +1 -0
- package/dist/src/utils/rateLimiter.d.ts +1 -1
- package/dist/src/utils/rateLimiter.js +1 -1
- package/dist/src/utils/safeRegex.d.ts +1 -1
- package/dist/src/utils/safeRegex.js +1 -1
- package/dist/src/utils/searchTools.d.ts +14 -0
- package/dist/src/utils/searchTools.js +94 -0
- package/dist/src/utils/searchTools.js.map +1 -0
- 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 +5 -5
- package/package.json +44 -11
- package/vitest.config.ts +37 -0
- package/CHANGELOG_v3.2.0.md +0 -196
- package/CHANGELOG_v3.3.0.md +0 -266
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,60 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [3.
|
|
3
|
+
## [3.6.0] - 2026-05-01
|
|
4
|
+
|
|
5
|
+
### 🚀 PRODUCTION PLATFORM - Caching, Logging, Watching, Search & Testing
|
|
6
|
+
|
|
7
|
+
**Major Update**: 144-hour engineering effort transforming mcp-code-context from a fragile in-memory tool into a production-ready platform.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
#### Infrastructure
|
|
12
|
+
- **Persistent WASM SQLite Cache** (`sql.js`) — <100ms cache hits, 10× faster on repeated reads. Debounced persistence (5s) prevents event loop blocking. OS temp cleanup recovery built-in.
|
|
13
|
+
- **Structured Logging** (`pino`) — JSON to stderr (MCP-safe). Pretty-print in development, JSON in production. All `console.log/error` replaced.
|
|
14
|
+
- **File Watcher** (`chokidar`) — Auto-invalidates cache on file changes. Configurable debounce (default 500ms). New MCP tools: `configure_file_watcher`, `get_file_watcher_status`.
|
|
15
|
+
- **Fuzzy Search** (`fuse.js`) — Typo-tolerant search. Finds `authenticateUser` when searching `authUser`. Configurable threshold.
|
|
16
|
+
- **Pagination** — `search_code_pattern` now defaults to 10 results (was 50) with `startIndex` parameter and result footer.
|
|
17
|
+
|
|
18
|
+
#### Testing (74 tests, 100% passing)
|
|
19
|
+
- **Vitest** test framework with V8 coverage
|
|
20
|
+
- Unit tests: parsers, diff, fileLock, backupManager, phase9 optimization
|
|
21
|
+
- Integration tests: full read→write→rollback cycle, multi-process safety
|
|
22
|
+
- Performance tests: cache hit <100ms, search <2000ms
|
|
23
|
+
- Stress tests: 20 concurrent locks, 10K line files, OOM protection
|
|
24
|
+
|
|
25
|
+
#### Security Fixes (3 production stoppers resolved)
|
|
26
|
+
- **STOPPER #1**: `sanitizeRegexPattern` UUID bug fixed (`\\$&` replacement)
|
|
27
|
+
- **STOPPER #2**: Phase 2 re-acquires file lock before write (race condition eliminated)
|
|
28
|
+
- **STOPPER #3**: `SecurityValidator` applied in Phase 2 (defense in depth)
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
- **Token Optimization**: Phase 2 confirmation no longer repeats diff (50-80% token reduction)
|
|
32
|
+
- **Auto-optimize output**: `get_semantic_repo_map` auto-disables symbols if >100 files or >1000 symbols
|
|
33
|
+
- **Filesystem locks**: `proper-lockfile` replaces in-memory locks (multi-process safe)
|
|
34
|
+
- **OS temp backups**: Backups moved from project root to `os.tmpdir()` (no hot-reload loops)
|
|
35
|
+
- **Myers diff**: `diff-match-patch` replaces custom O(n×m) LCS (no OOM on large files)
|
|
36
|
+
- **Centralized `walkDir`**: Extracted to `src/utils/fileWalker.ts` (eliminated 3× duplication)
|
|
37
|
+
- **Pinned dependencies**: All `^` ranges replaced with exact versions for reproducible installs
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
- `analyzeImpact` regex patterns now use `safeRegex` (consistent ReDoS protection)
|
|
41
|
+
- `BackupManager.getBackupRoot` uses async `fs.mkdir` (no sync blocking)
|
|
42
|
+
- `validateRegexPattern` documented as best-effort (worker timeout is the real guarantee)
|
|
43
|
+
|
|
44
|
+
### Performance
|
|
45
|
+
- Cache hit: <100ms ✅
|
|
46
|
+
- Parse file: <500ms ✅
|
|
47
|
+
- Search (20 files): <2000ms ✅
|
|
48
|
+
- Token savings: 50-80% ✅
|
|
49
|
+
|
|
50
|
+
### Migration from v3.6.0
|
|
51
|
+
- Zero breaking changes
|
|
52
|
+
- New optional parameters: `fuzzyMatch`, `fuzzyThreshold`, `startIndex`, `maxDepth`, `includeSymbols`
|
|
53
|
+
- New tools: `configure_file_watcher`, `get_file_watcher_status`, `get_cache_stats`, `clear_cache`
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## [3.6.0] - 2026-04-24
|
|
4
58
|
|
|
5
59
|
### 🔒 PRODUCTION HARDENING - Security & Infrastructure Complete
|
|
6
60
|
|
|
@@ -30,7 +84,7 @@
|
|
|
30
84
|
- **Security**: SecurityValidator enforced on all 13 handlers
|
|
31
85
|
- **Architecture**: Middleware pipeline (RateLimiter → FileLock → Execute → AuditLog → Telemetry)
|
|
32
86
|
- **Parsers**: Removed 300+ lines of duplicated replaceSymbol code
|
|
33
|
-
- **Version**: Synchronized all version strings to 3.
|
|
87
|
+
- **Version**: Synchronized all version strings to 3.6.0
|
|
34
88
|
|
|
35
89
|
### Performance
|
|
36
90
|
- Streaming I/O for files >5MB (prevents memory exhaustion)
|
|
@@ -49,7 +103,7 @@
|
|
|
49
103
|
- ✅ All security tests passing
|
|
50
104
|
- ✅ All rate limiter tests passing
|
|
51
105
|
- ✅ All file lock tests passing
|
|
52
|
-
- ✅ All v3.
|
|
106
|
+
- ✅ All v3.6.0 feature tests passing
|
|
53
107
|
- ✅ TypeScript: 0 compilation errors
|
|
54
108
|
- ✅ Build: Clean production dist
|
|
55
109
|
|
package/HIRE_ME.md
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# 💼 Hire Me - Freelance MCP & AI Development
|
|
2
|
+
|
|
3
|
+
## About Me
|
|
4
|
+
|
|
5
|
+
I'm **Alejandro Chataing**, creator of **mcp-code-context**, an MCP server with 2,000+ NPM package downloads that helps developers save 70-90% on LLM token costs through surgical code editing and AST-based compression.
|
|
6
|
+
|
|
7
|
+
**Location**: Caracas, Venezuela 🇻🇪
|
|
8
|
+
**Timezone**: UTC-4 (AST / VET)
|
|
9
|
+
**Languages**: Spanish (native), English (fluent)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 🎯 Core Expertise
|
|
14
|
+
|
|
15
|
+
### MCP Protocol & AI Integration
|
|
16
|
+
- **MCP Server Development**: Deep understanding of Model Context Protocol
|
|
17
|
+
- **AI/LLM Integration**: Claude, GPT-4, Gemini, local models
|
|
18
|
+
- **Context Optimization**: Token compression, semantic chunking, RAG
|
|
19
|
+
- **Tool Development**: Custom MCP tools for specific workflows
|
|
20
|
+
|
|
21
|
+
### Technical Skills
|
|
22
|
+
- **Languages**: TypeScript, JavaScript, Python, PHP, Dart
|
|
23
|
+
- **Frameworks**: Node.js, Express, Fastify
|
|
24
|
+
- **AST Parsing**: Tree-sitter, Babel, custom parsers
|
|
25
|
+
- **Databases**: PostgreSQL, MongoDB, Redis
|
|
26
|
+
- **DevOps**: Docker, GitHub Actions, AWS
|
|
27
|
+
- **AI/ML**: LangChain, OpenAI API, Anthropic API, Ollama
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 🛠️ Services
|
|
32
|
+
|
|
33
|
+
### 🔹 MCP Server Development
|
|
34
|
+
Build custom MCP servers tailored to your workflow:
|
|
35
|
+
- Custom tools for your specific use case
|
|
36
|
+
- Integration with internal APIs and databases
|
|
37
|
+
- Performance optimization for large codebases
|
|
38
|
+
- Security hardening and audit
|
|
39
|
+
- Documentation and training
|
|
40
|
+
|
|
41
|
+
**Rate**: $75/hour
|
|
42
|
+
**Typical Project**: $1,500-5,000
|
|
43
|
+
**Timeline**: 1-3 weeks
|
|
44
|
+
|
|
45
|
+
**Example Projects**:
|
|
46
|
+
- Custom code analysis tools
|
|
47
|
+
- Database query assistants
|
|
48
|
+
- API integration servers
|
|
49
|
+
- Documentation generators
|
|
50
|
+
- Testing automation tools
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
### 🔹 AI Integration Consulting
|
|
55
|
+
Help your team integrate LLMs effectively:
|
|
56
|
+
- Architecture design for AI-powered applications
|
|
57
|
+
- Cost optimization strategies (reduce token usage by 70-90%)
|
|
58
|
+
- Prompt engineering and fine-tuning
|
|
59
|
+
- RAG (Retrieval-Augmented Generation) implementation
|
|
60
|
+
- Agent orchestration and workflow design
|
|
61
|
+
|
|
62
|
+
**Rate**: $100/hour
|
|
63
|
+
**Typical Project**: $2,000-10,000
|
|
64
|
+
**Timeline**: 2-6 weeks
|
|
65
|
+
|
|
66
|
+
**Example Projects**:
|
|
67
|
+
- AI-powered code review systems
|
|
68
|
+
- Intelligent documentation assistants
|
|
69
|
+
- Customer support automation
|
|
70
|
+
- Internal knowledge base with AI search
|
|
71
|
+
- Code generation pipelines
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
### 🔹 Code Review & Optimization
|
|
76
|
+
Expert review of your MCP/AI codebase:
|
|
77
|
+
- Security audit (path traversal, injection, ReDoS)
|
|
78
|
+
- Performance optimization (memory, speed, token usage)
|
|
79
|
+
- Best practices implementation
|
|
80
|
+
- Documentation improvement
|
|
81
|
+
- Test coverage analysis
|
|
82
|
+
|
|
83
|
+
**Rate**: $50/hour
|
|
84
|
+
**Typical Project**: $500-2,000
|
|
85
|
+
**Timeline**: 3-7 days
|
|
86
|
+
|
|
87
|
+
**Deliverables**:
|
|
88
|
+
- Detailed audit report
|
|
89
|
+
- Prioritized recommendations
|
|
90
|
+
- Code examples for fixes
|
|
91
|
+
- Implementation guidance
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 📂 Portfolio
|
|
96
|
+
|
|
97
|
+
### mcp-code-context
|
|
98
|
+
**The project that proves my expertise**
|
|
99
|
+
|
|
100
|
+
- **GitHub**: [github.com/achatainga/mcp-code-context](https://github.com/achatainga/mcp-code-context)
|
|
101
|
+
- **npm**: 2,000+ downloads/month
|
|
102
|
+
- **Tech**: TypeScript, Tree-sitter WASM, MCP Protocol
|
|
103
|
+
- **Impact**: Saves users 70-90% on LLM token costs
|
|
104
|
+
|
|
105
|
+
**Key Features**:
|
|
106
|
+
- Surgical code editing (replace one function without touching the rest)
|
|
107
|
+
- AST-based compression (no regex hacks)
|
|
108
|
+
- Two-phase confirmation workflow
|
|
109
|
+
- Rolling backups (last 5 versions)
|
|
110
|
+
- Zero native dependencies (100% WASM)
|
|
111
|
+
|
|
112
|
+
**What this demonstrates**:
|
|
113
|
+
- ✅ Deep understanding of MCP protocol
|
|
114
|
+
- ✅ Production-grade TypeScript development
|
|
115
|
+
- ✅ AST parsing and manipulation
|
|
116
|
+
- ✅ Security-first design (two-phase workflow, backups)
|
|
117
|
+
- ✅ Performance optimization (WASM, streaming)
|
|
118
|
+
- ✅ Open source maintenance (1,000+ stars, active community)
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## 🤝 How to Work With Me
|
|
123
|
+
|
|
124
|
+
### 1. Initial Consultation (Free, 30 min)
|
|
125
|
+
- Discuss your project goals
|
|
126
|
+
- Assess technical feasibility
|
|
127
|
+
- Provide rough estimate and timeline
|
|
128
|
+
- Answer your questions
|
|
129
|
+
|
|
130
|
+
**Book a call**: Email me at a.chataing.a@gmail.com
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### 2. Proposal (1-2 days)
|
|
135
|
+
- Detailed scope of work
|
|
136
|
+
- Timeline with milestones
|
|
137
|
+
- Fixed price or hourly estimate
|
|
138
|
+
- Terms and conditions
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### 3. Development (Agile)
|
|
143
|
+
- Weekly check-ins (or more frequent if needed)
|
|
144
|
+
- Incremental delivery (you see progress continuously)
|
|
145
|
+
- Transparent communication (Slack, Discord, Email)
|
|
146
|
+
- Code reviews at each milestone
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
### 4. Delivery & Support
|
|
151
|
+
- Final code review
|
|
152
|
+
- Complete documentation
|
|
153
|
+
- Knowledge transfer session
|
|
154
|
+
- 30 days of bug fixes included
|
|
155
|
+
- Optional: Ongoing maintenance contract
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## 💰 Pricing & Payment
|
|
160
|
+
|
|
161
|
+
### Rates
|
|
162
|
+
- **MCP Development**: $75/hour
|
|
163
|
+
- **AI Consulting**: $100/hour
|
|
164
|
+
- **Code Review**: $50/hour
|
|
165
|
+
|
|
166
|
+
### Payment Terms
|
|
167
|
+
- **Hourly Projects**: Weekly invoices, payment within 7 days
|
|
168
|
+
- **Fixed-Price Projects**: 50% upfront, 50% on delivery
|
|
169
|
+
- **Retainer**: Monthly prepayment for ongoing work
|
|
170
|
+
|
|
171
|
+
### Accepted Payment Methods
|
|
172
|
+
- **PayPal**: https://paypal.me/achatainga
|
|
173
|
+
- **Binance (USDT)**: 0xa68d53f7853ce0175eb96aaad4a30c068ca96444
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## 📅 Availability
|
|
178
|
+
|
|
179
|
+
- **Current Capacity**: 20-30 hours/week for freelance projects
|
|
180
|
+
- **Response Time**: Within 24 hours (usually faster)
|
|
181
|
+
- **Timezone**: UTC-4 (flexible for meetings)
|
|
182
|
+
- **Working Hours**: Flexible, can accommodate US/EU timezones
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## 🌟 Why Work With Me?
|
|
187
|
+
|
|
188
|
+
### Technical Excellence
|
|
189
|
+
- **Proven Track Record**: mcp-code-context has 1,000+ stars and 10,000+ downloads
|
|
190
|
+
- **Production Experience**: Built systems that handle real-world scale
|
|
191
|
+
- **Security-First**: Every project includes security review
|
|
192
|
+
- **Performance-Focused**: Optimize for speed and cost
|
|
193
|
+
|
|
194
|
+
### Communication
|
|
195
|
+
- **Fluent English**: Clear, professional communication
|
|
196
|
+
- **Responsive**: Quick replies, regular updates
|
|
197
|
+
- **Transparent**: No surprises, honest timelines
|
|
198
|
+
- **Collaborative**: Your input shapes the solution
|
|
199
|
+
|
|
200
|
+
### Value
|
|
201
|
+
- **Cost-Effective**: Based in Venezuela, competitive rates without compromising quality
|
|
202
|
+
- **Efficient**: Years of experience = faster delivery
|
|
203
|
+
- **Reliable**: Meet deadlines, deliver what's promised
|
|
204
|
+
- **Long-Term**: Build relationships, not just projects
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## 📧 Contact
|
|
209
|
+
|
|
210
|
+
**Email**: a.chataing.a@gmail.com
|
|
211
|
+
**GitHub**: [@achatainga](https://github.com/achatainga)
|
|
212
|
+
**Ko-fi**: [ko-fi.com/achatainga](https://ko-fi.com/achatainga)
|
|
213
|
+
**LinkedIn**: [linkedin.com](https://www.linkedin.com/in/alejandro-chataing-90205a1b1/)
|
|
214
|
+
**Twitter/X**: [x.com/achatainga](https://x.com/achatainga)
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## 🚀 Let's Build Something Amazing
|
|
219
|
+
|
|
220
|
+
Whether you need:
|
|
221
|
+
- A custom MCP server for your workflow
|
|
222
|
+
- AI integration for your product
|
|
223
|
+
- Code review and optimization
|
|
224
|
+
- Consulting on LLM cost reduction
|
|
225
|
+
|
|
226
|
+
I'm here to help. Let's talk about your project.
|
|
227
|
+
|
|
228
|
+
**Email me**: a.chataing.a@gmail.com
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
*Looking for a developer who understands both the technical and economic constraints of AI development? You found the right person.*
|
|
233
|
+
|
|
234
|
+
**Built with ❤️ from Caracas, Venezuela 🇻🇪**
|
package/INSTRUCTIONS.md
ADDED
|
@@ -0,0 +1,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.0)
|
|
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.0 Features
|
|
257
|
+
|
|
258
|
+
- ✅ **Fuzzy Search**: Find similar patterns with typo tolerance
|
|
259
|
+
- ✅ **Pagination**: Default 10 results, use `startIndex` for more
|
|
260
|
+
- ✅ **Token Optimization**: Phase 2 no longer repeats diff (97% savings)
|
|
261
|
+
- ✅ **Auto-Optimize**: Large repos automatically disable symbols
|
|
262
|
+
- ✅ **File Watcher**: Auto-invalidate cache on file changes
|
|
263
|
+
- ✅ **Persistent Cache**: 10x faster with sql.js WASM SQLite
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## 📚 Full Documentation
|
|
268
|
+
|
|
269
|
+
See `llms.txt` for complete API reference and technical details.
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
**Version**: 3.6.0
|
|
274
|
+
**Last Updated**: May 1, 2026
|