mcp-code-context 3.5.1 โ†’ 3.5.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/HIRE_ME.md +234 -0
  3. package/README.md +433 -304
  4. package/SECURITY.md +14 -14
  5. package/SPONSORS.md +104 -0
  6. package/dist/src/core/engine.d.ts +1 -1
  7. package/dist/src/core/engine.js +1 -1
  8. package/dist/src/core/validator.d.ts +1 -1
  9. package/dist/src/core/validator.js +3 -3
  10. package/dist/src/core/validator.js.map +1 -1
  11. package/dist/src/index.d.ts +1 -1
  12. package/dist/src/index.js +8 -3
  13. package/dist/src/index.js.map +1 -1
  14. package/dist/src/operations/compress.d.ts +1 -1
  15. package/dist/src/operations/compress.js +1 -1
  16. package/dist/src/operations/confirmationStore.d.ts +10 -2
  17. package/dist/src/operations/confirmationStore.js +40 -2
  18. package/dist/src/operations/confirmationStore.js.map +1 -1
  19. package/dist/src/operations/read.d.ts +1 -1
  20. package/dist/src/operations/read.js +9 -1
  21. package/dist/src/operations/read.js.map +1 -1
  22. package/dist/src/operations/write.d.ts +2 -2
  23. package/dist/src/operations/write.js +2 -2
  24. package/dist/src/parsers/base.d.ts +1 -1
  25. package/dist/src/parsers/base.js +1 -1
  26. package/dist/src/parsers/dartTreeSitter.d.ts +1 -1
  27. package/dist/src/parsers/dartTreeSitter.js +1 -1
  28. package/dist/src/parsers/php.d.ts +1 -1
  29. package/dist/src/parsers/php.js +1 -1
  30. package/dist/src/parsers/python.d.ts +1 -1
  31. package/dist/src/parsers/python.js +1 -1
  32. package/dist/src/parsers/registry.d.ts +1 -1
  33. package/dist/src/parsers/registry.js +1 -1
  34. package/dist/src/parsers/typescript.d.ts +1 -1
  35. package/dist/src/parsers/typescript.js +1 -1
  36. package/dist/src/utils/auditLogger.d.ts +1 -1
  37. package/dist/src/utils/auditLogger.js +1 -1
  38. package/dist/src/utils/backupManager.d.ts +1 -1
  39. package/dist/src/utils/backupManager.js +1 -1
  40. package/dist/src/utils/constants.d.ts +1 -1
  41. package/dist/src/utils/constants.js +1 -1
  42. package/dist/src/utils/diff.d.ts +1 -1
  43. package/dist/src/utils/diff.js +1 -1
  44. package/dist/src/utils/fileLock.d.ts +1 -1
  45. package/dist/src/utils/fileLock.js +1 -1
  46. package/dist/src/utils/rateLimiter.d.ts +1 -1
  47. package/dist/src/utils/rateLimiter.js +1 -1
  48. package/dist/src/utils/safeRegex.d.ts +1 -1
  49. package/dist/src/utils/safeRegex.js +1 -1
  50. package/dist/src/utils/streaming.d.ts +1 -1
  51. package/dist/src/utils/streaming.js +1 -1
  52. package/dist/src/utils/telemetry.d.ts +1 -1
  53. package/dist/src/utils/telemetry.js +1 -1
  54. package/llms.txt +5 -5
  55. package/package.json +17 -2
  56. package/CHANGELOG_v3.2.0.md +0 -196
  57. package/CHANGELOG_v3.3.0.md +0 -266
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Write Operations - v3.5.1
2
+ * Write Operations - v3.5.3
3
3
  * FIXES: SecurityValidator in renameSymbol, atomic writes, AST-based positioning
4
4
  * CRITICAL: renameSymbol Phase 1 is now pure-functional (no disk writes)
5
5
  */
@@ -173,7 +173,7 @@ export async function removeSymbol(options) {
173
173
  }
174
174
  /**
175
175
  * Rename symbol using AST-aware replacement
176
- * v3.5.1 - CRITICAL FIX: Pure-functional Phase 1 (no writes to disk)
176
+ * v3.5.3 - CRITICAL FIX: Pure-functional Phase 1 (no writes to disk)
177
177
  * All changes are accumulated in pendingWrites for Phase 2 confirmation.
178
178
  */
179
179
  export async function renameSymbol(params) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Base Parser - v3.5.1
2
+ * Base Parser - v3.5.3
3
3
  * Abstract base for all language parsers
4
4
  * IMPROVEMENT: replaceSymbol moved here using AST indices (eliminates indexOf fragility)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Base Parser - v3.5.1
2
+ * Base Parser - v3.5.3
3
3
  * Abstract base for all language parsers
4
4
  * IMPROVEMENT: replaceSymbol moved here using AST indices (eliminates indexOf fragility)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Dart Tree-sitter Parser - v3.5.1
2
+ * Dart Tree-sitter Parser - v3.5.3
3
3
  * 100% AST accuracy via WASM
4
4
  * CLEANUP: replaceSymbol removed (inherited from BaseParser)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Dart Tree-sitter Parser - v3.5.1
2
+ * Dart Tree-sitter Parser - v3.5.3
3
3
  * 100% AST accuracy via WASM
4
4
  * CLEANUP: replaceSymbol removed (inherited from BaseParser)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * PHP Parser - v3.5.1
2
+ * PHP Parser - v3.5.3
3
3
  * CLEANUP: replaceSymbol removed (inherited from BaseParser)
4
4
  */
5
5
  import { Tree } from "web-tree-sitter";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * PHP Parser - v3.5.1
2
+ * PHP Parser - v3.5.3
3
3
  * CLEANUP: replaceSymbol removed (inherited from BaseParser)
4
4
  */
5
5
  import { BaseParser } from "./base.js";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Python Parser - v3.5.1
2
+ * Python Parser - v3.5.3
3
3
  * CLEANUP: replaceSymbol removed (inherited from BaseParser)
4
4
  */
5
5
  import { Tree } from "web-tree-sitter";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Python Parser - v3.5.1
2
+ * Python Parser - v3.5.3
3
3
  * CLEANUP: replaceSymbol removed (inherited from BaseParser)
4
4
  */
5
5
  import { BaseParser } from "./base.js";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Parser Registry - v3.5.1
2
+ * Parser Registry - v3.5.3
3
3
  * Manages all language parsers
4
4
  */
5
5
  import { BaseParser } from "./base.js";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Parser Registry - v3.5.1
2
+ * Parser Registry - v3.5.3
3
3
  * Manages all language parsers
4
4
  */
5
5
  import { TypeScriptParser } from "./typescript.js";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * TypeScript Parser - v3.5.1
2
+ * TypeScript Parser - v3.5.3
3
3
  * Tree-sitter based TS/JS parser
4
4
  * CLEANUP: replaceSymbol removed (inherited from BaseParser)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * TypeScript Parser - v3.5.1
2
+ * TypeScript Parser - v3.5.3
3
3
  * Tree-sitter based TS/JS parser
4
4
  * CLEANUP: replaceSymbol removed (inherited from BaseParser)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Audit Logger - v3.5.1
2
+ * Audit Logger - v3.5.3
3
3
  * Comprehensive audit trail for all operations
4
4
  */
5
5
  export interface AuditEntry {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Audit Logger - v3.5.1
2
+ * Audit Logger - v3.5.3
3
3
  * Comprehensive audit trail for all operations
4
4
  */
5
5
  import * as fs from "node:fs/promises";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Backup Manager - v3.5.1
2
+ * Backup Manager - v3.5.3
3
3
  * Handles rolling backups for file modifications
4
4
  */
5
5
  export declare class BackupManager {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Backup Manager - v3.5.1
2
+ * Backup Manager - v3.5.3
3
3
  * Handles rolling backups for file modifications
4
4
  */
5
5
  import * as fs from "node:fs/promises";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Constants - Centralized configuration
3
- * v3.5.1
3
+ * v3.5.3
4
4
  */
5
5
  export declare const EXCLUDE_DIRS: string[];
6
6
  export declare const SUPPORTED_EXTENSIONS: string[];
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Constants - Centralized configuration
3
- * v3.5.1
3
+ * v3.5.3
4
4
  */
5
5
  export const EXCLUDE_DIRS = [
6
6
  "node_modules",
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Diff Engine - v3.5.1
2
+ * Diff Engine - v3.5.3
3
3
  * LCS-based unified diff with memory safety cap
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Diff Engine - v3.5.1
2
+ * Diff Engine - v3.5.3
3
3
  * LCS-based unified diff with memory safety cap
4
4
  */
5
5
  const MAX_DIFF_LINES = 5000;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * File Lock Manager - v3.5.1
2
+ * File Lock Manager - v3.5.3
3
3
  * Prevents concurrent writes to same file
4
4
  */
5
5
  interface LockInfo {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * File Lock Manager - v3.5.1
2
+ * File Lock Manager - v3.5.3
3
3
  * Prevents concurrent writes to same file
4
4
  */
5
5
  export class FileLockManager {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Rate Limiter - v3.5.1
2
+ * Rate Limiter - v3.5.3
3
3
  * Token bucket algorithm for DoS protection
4
4
  */
5
5
  interface RateLimitConfig {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Rate Limiter - v3.5.1
2
+ * Rate Limiter - v3.5.3
3
3
  * Token bucket algorithm for DoS protection
4
4
  */
5
5
  export class RateLimiter {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Safe Regex - v3.5.1
2
+ * Safe Regex - v3.5.3
3
3
  * CRITICAL FIX: Real ReDoS protection via worker_threads
4
4
  *
5
5
  * Problem: setTimeout cannot interrupt regex.test() in Node.js single-threaded event loop.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Safe Regex - v3.5.1
2
+ * Safe Regex - v3.5.3
3
3
  * CRITICAL FIX: Real ReDoS protection via worker_threads
4
4
  *
5
5
  * Problem: setTimeout cannot interrupt regex.test() in Node.js single-threaded event loop.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * File Streaming - v3.5.1
2
+ * File Streaming - v3.5.3
3
3
  * Stream large files in chunks to avoid memory exhaustion
4
4
  */
5
5
  export interface StreamOptions {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * File Streaming - v3.5.1
2
+ * File Streaming - v3.5.3
3
3
  * Stream large files in chunks to avoid memory exhaustion
4
4
  */
5
5
  import * as fs from "node:fs";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Telemetry - v3.5.1
2
+ * Telemetry - v3.5.3
3
3
  * Metrics collection and monitoring
4
4
  */
5
5
  export interface Metric {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Telemetry - v3.5.1
2
+ * Telemetry - v3.5.3
3
3
  * Metrics collection and monitoring
4
4
  */
5
5
  export class TelemetryCollector {
package/llms.txt CHANGED
@@ -1,8 +1,8 @@
1
- # mcp-code-context v3.5.1
1
+ # mcp-code-context v3.5.3
2
2
 
3
3
  > A Model Context Protocol (MCP) server with **Tree-sitter WASM parsers** for 100% AST accuracy. Zero native dependencies. Production-ready with middleware pipeline.
4
4
 
5
- ## What's New in v3.5.1
5
+ ## What's New in v3.5.3
6
6
 
7
7
  ๐Ÿ”’ **Production Hardening**:
8
8
  - โœ… Two-phase write workflow (dry-run + confirmation token)
@@ -142,13 +142,13 @@ This MCP server solves two problems:
142
142
  - `steps` (optional): Number of versions to go back (1-5, default: 1).
143
143
  **What it does:** Reverts the file to the state it was in before the last 1-5 modifications.
144
144
 
145
- ### Write Tools (v3.5.1 Two-Phase Workflow)
145
+ ### Write Tools (v3.5.3 Two-Phase Workflow)
146
146
 
147
147
  All write tools follow a **Two-Phase Workflow**:
148
148
  1. **Phase 1 (Preview)**: Call without a token to get a unified `diff` and a `confirmationToken`.
149
149
  2. **Phase 2 (Apply)**: Call with `confirmationToken` and `confirm: true` to apply the changes.
150
150
 
151
- **Important Notes (v3.5.1):**
151
+ **Important Notes (v3.5.3):**
152
152
  - โœ… **Windows CRLF Support**: Fully resolved. All operations work correctly on Windows files with CRLF line endings.
153
153
  - โœ… **Parameter Brace Handling**: Methods with braces in parameters (e.g., `{int? cart}`) are now handled correctly.
154
154
 
@@ -236,7 +236,7 @@ All write tools follow a **Two-Phase Workflow**:
236
236
  5. **Phase 2: Apply Edit** โ†’ Verify the diff, then call with the token and `confirm: true`.
237
237
  6. **Recovery** โ†’ Use `rollback_file` if needed.
238
238
 
239
- ### Additional Tools (v3.5.1)
239
+ ### Additional Tools (v3.5.3)
240
240
 
241
241
  #### 11. `parse_file`
242
242
  **Purpose:** Parse a file using Tree-sitter and extract all symbols.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-code-context",
3
- "version": "3.5.1",
3
+ "version": "3.5.3",
4
4
  "description": "Powerful MCP server with Tree-sitter WASM parsers for 100% AST accuracy. Zero native dependencies. Production-ready with streaming, telemetry, audit logging, rate limiting, file locking, and ReDoS protection. Supports TypeScript, JavaScript, PHP, Dart, and Python.",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -36,12 +36,27 @@
36
36
  "dart",
37
37
  "python"
38
38
  ],
39
- "author": "",
39
+ "author": "Alejandro Chataing <a.chataing.a@gmail.com>",
40
40
  "license": "MIT",
41
41
  "repository": {
42
42
  "type": "git",
43
43
  "url": "git+https://github.com/achatainga/mcp-code-context.git"
44
44
  },
45
+ "funding": [
46
+ {
47
+ "type": "ko-fi",
48
+ "url": "https://ko-fi.com/achatainga"
49
+ },
50
+ {
51
+ "type": "paypal",
52
+ "url": "https://paypal.me/achatainga"
53
+ }
54
+ ],
55
+ "homepage": "https://github.com/achatainga/mcp-code-context#readme",
56
+ "bugs": {
57
+ "url": "https://github.com/achatainga/mcp-code-context/issues",
58
+ "email": "a.chataing.a@gmail.com"
59
+ },
45
60
  "dependencies": {
46
61
  "@modelcontextprotocol/sdk": "^1.12.0",
47
62
  "ignore": "^6.0.2",
@@ -1,196 +0,0 @@
1
- # Changelog v3.2.0 - Security & Validation Hardening
2
-
3
- ## ๐Ÿ”’ CRITICAL Security Fixes
4
-
5
- ### Path Traversal Protection (CVE-LEVEL)
6
- **Impact**: HIGH - Could allow access to files outside project boundary
7
- **Fix**: Moved path traversal check AFTER `path.resolve()` normalization
8
- ```typescript
9
- // BEFORE (vulnerable):
10
- if (filePath.includes("..")) return { valid: false };
11
- const resolved = path.resolve(filePath);
12
-
13
- // AFTER (secure):
14
- const resolved = path.resolve(filePath);
15
- if (!resolved.startsWith(this.projectRoot)) return { valid: false };
16
- ```
17
-
18
- ### Regex Injection in renameSymbol (CVE-LEVEL)
19
- **Impact**: HIGH - Could corrupt entire codebase with malicious symbol names
20
- **Fix**: Sanitize all regex inputs before use
21
- ```typescript
22
- // BEFORE (vulnerable):
23
- const regex = new RegExp(`\\b${oldName}\\b`, "g");
24
-
25
- // AFTER (secure):
26
- const sanitized = oldName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
27
- const regex = new RegExp(`\\b${sanitized}\\b`, "g");
28
- ```
29
-
30
- ### Syntax Validation Post-Write
31
- **Impact**: CRITICAL - Prevented silent code corruption
32
- **Fix**: All write operations now validate syntax before returning
33
- ```typescript
34
- const syntaxCheck = validateSyntax(result, parser);
35
- if (!syntaxCheck.valid) {
36
- return { success: false, error: syntaxCheck.error };
37
- }
38
- ```
39
-
40
- ---
41
-
42
- ## โœจ Major Improvements
43
-
44
- ### 1. AST-Aware insertCode
45
- **Before**: Used `indexOf()` to find anchor (could match strings/comments)
46
- **After**: Uses AST `node.startIndex/endIndex` for precise positioning
47
- ```typescript
48
- // Find anchor using AST
49
- const symbols = parser.findSymbols(tree);
50
- const anchorNode = symbols.find(s => s.name === anchorSymbol);
51
- insertIndex = anchorNode.startIndex; // Exact AST position
52
- ```
53
-
54
- ### 2. Improved renameSymbol
55
- - AST-based symbol location (not blind regex)
56
- - Only renames in import statements (not strings/comments)
57
- - Sanitized regex patterns
58
- - Better error messages
59
-
60
- ### 3. Async I/O Migration
61
- **Before**: `fs.readFileSync()` blocked event loop
62
- **After**: `await fs.readFile()` non-blocking
63
- ```typescript
64
- // engine.ts:60
65
- const wasmBuffer = await fs.readFile(wasmPath); // Was: fs.readFileSync
66
- ```
67
-
68
- ### 4. Centralized Constants
69
- **Before**: Hardcoded in 5+ files
70
- ```typescript
71
- const excludeDirs = ["node_modules", "dist", "build", ".git"];
72
- ```
73
- **After**: Single source of truth
74
- ```typescript
75
- import { EXCLUDE_DIRS, SUPPORTED_EXTENSIONS } from "../utils/constants.js";
76
- ```
77
-
78
- ### 5. LCS-Based Diff Generation
79
- **Before**: Simple line-by-line (O(n))
80
- **After**: Longest Common Subsequence algorithm (O(n*m))
81
- - Cleaner diffs with proper context
82
- - Better readability
83
- - Configurable context lines
84
-
85
- ### 6. Size Limits in compress
86
- **Before**: Only file count limit (500)
87
- **After**: Total size limit (50MB) + per-file check
88
- ```typescript
89
- if (totalSize + stat.size > MAX_TOTAL_SIZE_BYTES) break;
90
- ```
91
-
92
- ---
93
-
94
- ## ๐Ÿงช Testing
95
-
96
- ### New Security Test Suite
97
- - โœ… Path traversal protection (4 tests)
98
- - โœ… ReDoS detection (4 patterns)
99
- - โœ… Regex injection protection (4 tests)
100
- - โœ… File size validation (2 tests)
101
-
102
- **Coverage**: 100% on security-critical paths
103
-
104
- ### Existing Tests
105
- - โœ… 47/47 parser tests passing
106
- - โœ… TypeScript, Python, PHP, Dart parsers validated
107
- - โœ… Symbol extraction, replacement, insertion tested
108
-
109
- ---
110
-
111
- ## ๐Ÿ“Š Metrics Improvement
112
-
113
- | Metric | v3.1.0 | v3.2.0 | Change |
114
- |--------|--------|--------|--------|
115
- | Security | 5.0/10 | 9.5/10 | +4.5 โœ… |
116
- | Code Quality | 6.5/10 | 8.5/10 | +2.0 โœ… |
117
- | Maintainability | 7.0/10 | 8.5/10 | +1.5 โœ… |
118
- | **Overall** | **6.2/10** | **8.8/10** | **+2.6** |
119
-
120
- ---
121
-
122
- ## ๐Ÿšจ Breaking Changes
123
-
124
- ### Syntax Validation
125
- All write operations now validate syntax before returning. Invalid code will be rejected:
126
- ```typescript
127
- // This will now fail if newContent has syntax errors:
128
- const result = await replaceSymbol({ symbolName, newContent, ... });
129
- ```
130
-
131
- **Migration**: Ensure all generated code is syntactically valid before calling write operations.
132
-
133
- ---
134
-
135
- ## ๐Ÿ“ Files Changed
136
-
137
- ### Core
138
- - `src/core/validator.ts` - Path traversal fix
139
- - `src/core/engine.ts` - Async I/O migration
140
-
141
- ### Operations
142
- - `src/operations/write.ts` - Syntax validation, AST positioning, sanitization
143
- - `src/operations/compress.ts` - Size limits
144
- - `src/operations/read.ts` - Centralized constants
145
-
146
- ### Utils
147
- - `src/utils/constants.ts` - NEW: Centralized configuration
148
- - `src/utils/diff.ts` - NEW: LCS-based diff
149
-
150
- ### Tests
151
- - `tests/test-security.ts` - NEW: Security test suite
152
-
153
- ---
154
-
155
- ## ๐Ÿ”„ Upgrade Guide
156
-
157
- ### From v3.1.0 to v3.2.0
158
-
159
- 1. **No API changes** - Fully backward compatible
160
- 2. **Stricter validation** - Some previously accepted (but invalid) code will now be rejected
161
- 3. **Better error messages** - Syntax errors now caught before file write
162
-
163
- ### Recommended Actions
164
- 1. Run existing tests to ensure compatibility
165
- 2. Review any custom write operations for syntax validity
166
- 3. Update error handling to catch new validation errors
167
-
168
- ---
169
-
170
- ## ๐ŸŽฏ Next Steps (v3.3.0)
171
-
172
- - [ ] Rate limiting for DoS protection
173
- - [ ] File locking for concurrent writes
174
- - [ ] Streaming for files >10MB
175
- - [ ] LSP integration for advanced refactoring
176
- - [ ] Telemetry and observability
177
-
178
- ---
179
-
180
- ## ๐Ÿ‘ฅ Contributors
181
-
182
- - Security audit and fixes
183
- - Performance optimizations
184
- - Test coverage improvements
185
-
186
- ---
187
-
188
- ## ๐Ÿ“„ License
189
-
190
- MIT
191
-
192
- ---
193
-
194
- **Full Diff**: v3.1.0...v3.2.0
195
- **Release Date**: 2026-04-24
196
- **Stability**: Production-ready