mcp-code-context 3.0.6 → 3.4.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 +84 -1
- package/CHANGELOG_v3.2.0.md +196 -0
- package/CHANGELOG_v3.3.0.md +266 -0
- package/README.md +1 -1
- package/SECURITY.md +177 -0
- package/dist/src/core/engine.d.ts +2 -2
- package/dist/src/core/engine.js +14 -8
- package/dist/src/core/engine.js.map +1 -1
- package/dist/src/core/validator.d.ts +2 -2
- package/dist/src/core/validator.js +8 -7
- package/dist/src/core/validator.js.map +1 -1
- package/dist/src/index.d.ts +6 -6
- package/dist/src/index.js +499 -158
- package/dist/src/index.js.map +1 -1
- package/dist/src/operations/compress.d.ts +18 -0
- package/dist/src/operations/compress.js +89 -0
- package/dist/src/operations/compress.js.map +1 -0
- package/dist/src/operations/confirmationStore.d.ts +53 -0
- package/dist/src/operations/confirmationStore.js +91 -0
- package/dist/src/operations/confirmationStore.js.map +1 -0
- package/dist/src/operations/read.d.ts +50 -0
- package/dist/src/operations/read.js +228 -0
- package/dist/src/operations/read.js.map +1 -0
- package/dist/src/operations/write.d.ts +16 -4
- package/dist/src/operations/write.js +142 -48
- package/dist/src/operations/write.js.map +1 -1
- package/dist/src/parsers/base.d.ts +7 -2
- package/dist/src/parsers/base.js +18 -1
- package/dist/src/parsers/base.js.map +1 -1
- package/dist/src/parsers/dartTreeSitter.d.ts +3 -3
- package/dist/src/parsers/dartTreeSitter.js +6 -11
- package/dist/src/parsers/dartTreeSitter.js.map +1 -1
- package/dist/src/parsers/php.d.ts +2 -2
- package/dist/src/parsers/php.js +5 -10
- package/dist/src/parsers/php.js.map +1 -1
- package/dist/src/parsers/python.d.ts +2 -2
- package/dist/src/parsers/python.js +5 -10
- package/dist/src/parsers/python.js.map +1 -1
- package/dist/src/parsers/registry.d.ts +1 -1
- package/dist/src/parsers/registry.js +2 -2
- package/dist/src/parsers/registry.js.map +1 -1
- package/dist/src/parsers/typescript.d.ts +2 -2
- package/dist/src/parsers/typescript.js +8 -13
- package/dist/src/parsers/typescript.js.map +1 -1
- package/dist/src/utils/auditLogger.d.ts +90 -0
- package/dist/src/utils/auditLogger.js +271 -0
- package/dist/src/utils/auditLogger.js.map +1 -0
- package/dist/src/utils/backupManager.d.ts +33 -0
- package/dist/src/utils/backupManager.js +130 -0
- package/dist/src/utils/backupManager.js.map +1 -0
- package/dist/src/utils/constants.d.ts +12 -0
- package/dist/src/utils/constants.js +33 -0
- package/dist/src/utils/constants.js.map +1 -0
- package/dist/src/utils/diff.d.ts +13 -0
- package/dist/src/utils/diff.js +124 -0
- package/dist/src/utils/diff.js.map +1 -0
- package/dist/src/utils/fileLock.d.ts +63 -0
- package/dist/src/utils/fileLock.js +123 -0
- package/dist/src/utils/fileLock.js.map +1 -0
- package/dist/src/utils/rateLimiter.d.ts +61 -0
- package/dist/src/utils/rateLimiter.js +114 -0
- package/dist/src/utils/rateLimiter.js.map +1 -0
- package/dist/src/utils/safeRegex.d.ts +41 -0
- package/dist/src/utils/safeRegex.js +137 -0
- package/dist/src/utils/safeRegex.js.map +1 -0
- package/dist/src/utils/streaming.d.ts +43 -0
- package/dist/src/utils/streaming.js +175 -0
- package/dist/src/utils/streaming.js.map +1 -0
- package/dist/src/utils/telemetry.d.ts +91 -0
- package/dist/src/utils/telemetry.js +185 -0
- package/dist/src/utils/telemetry.js.map +1 -0
- package/llms.txt +46 -28
- package/package.json +5 -5
- package/mcp-code-context-3.0.2.tgz +0 -0
- package/tsconfig.tests.json +0 -27
package/SECURITY.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# Security Policy - mcp-code-context v3.4.0
|
|
2
|
+
|
|
3
|
+
## 🔒 Security Improvements in v3.4.0
|
|
4
|
+
|
|
5
|
+
This release addresses **all critical security vulnerabilities** from comprehensive adversarial audit, implements full middleware pipeline, and hardens all 13 tool handlers.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Fixed Vulnerabilities
|
|
10
|
+
|
|
11
|
+
### 1. Path Traversal (HIGH)
|
|
12
|
+
**CVSS Score**: 8.1 (High)
|
|
13
|
+
**Status**: ✅ FIXED in v3.2.0, **hardened in v3.4.0**
|
|
14
|
+
|
|
15
|
+
**Description**: Path traversal check occurred BEFORE path normalization, allowing bypass with absolute paths.
|
|
16
|
+
|
|
17
|
+
**Fix**: Check boundary AFTER `path.resolve()` normalization. In v3.4.0, **all 13 handlers** now require `projectRoot` and validate via `SecurityValidator`.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
### 2. Regex Injection in renameSymbol (HIGH)
|
|
22
|
+
**CVSS Score**: 7.5 (High)
|
|
23
|
+
**Status**: ✅ FIXED in v3.2.0
|
|
24
|
+
|
|
25
|
+
**Description**: User-provided symbol names used directly in regex without sanitization.
|
|
26
|
+
|
|
27
|
+
**Fix**: Sanitize all regex metacharacters via `sanitizeRegexPattern()` before use.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
### 3. Code Corruption via Invalid Syntax (CRITICAL)
|
|
32
|
+
**CVSS Score**: 9.1 (Critical)
|
|
33
|
+
**Status**: ✅ FIXED in v3.2.0
|
|
34
|
+
|
|
35
|
+
**Description**: Write operations did not validate syntax of generated code.
|
|
36
|
+
|
|
37
|
+
**Fix**: Mandatory AST syntax validation before all writes.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
### 4. ReDoS in searchPattern and readLines (MEDIUM)
|
|
42
|
+
**CVSS Score**: 5.3 (Medium)
|
|
43
|
+
**Status**: ✅ FIXED in v3.4.0
|
|
44
|
+
|
|
45
|
+
**Description**: User-provided regex patterns could cause catastrophic backtracking.
|
|
46
|
+
|
|
47
|
+
**Fix**: All regex operations now use `safeRegexTest()` with pattern validation and timeout enforcement (1s limit).
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
### 5. Unbounded Memory in compress (MEDIUM)
|
|
52
|
+
**CVSS Score**: 5.9 (Medium)
|
|
53
|
+
**Status**: ✅ FIXED in v3.2.0
|
|
54
|
+
|
|
55
|
+
**Fix**: `MAX_TOTAL_SIZE_BYTES` (50MB) + `MAX_FILES_REPO_MAP` (500) limits.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
### 6. extractSymbol API Mismatch (CRITICAL)
|
|
60
|
+
**CVSS Score**: 9.0 (Critical)
|
|
61
|
+
**Status**: ✅ FIXED in v3.4.0
|
|
62
|
+
|
|
63
|
+
**Description**: `read.ts` passed `content` as `symbolName` and real `symbolName` as `className`. Symbol extraction was 100% broken.
|
|
64
|
+
|
|
65
|
+
**Fix**: Corrected argument order to match `BaseParser.extractSymbol(tree, symbolName, className?)`.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
### 7. Handlers Without Path Validation (HIGH)
|
|
70
|
+
**CVSS Score**: 8.5 (High)
|
|
71
|
+
**Status**: ✅ FIXED in v3.4.0
|
|
72
|
+
|
|
73
|
+
**Description**: `readLines`, `searchPattern`, `analyzeImpact`, `getSemanticRepoMap` had no path boundary check.
|
|
74
|
+
|
|
75
|
+
**Fix**: All 13 handlers now require `projectRoot` and validate all paths via `SecurityValidator`.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### 8. renameSymbol Arbitrary Write (HIGH)
|
|
80
|
+
**CVSS Score**: 8.0 (High)
|
|
81
|
+
**Status**: ✅ FIXED in v3.4.0
|
|
82
|
+
|
|
83
|
+
**Description**: `renameSymbol` wrote dependent files without SecurityValidator check, using non-atomic writes.
|
|
84
|
+
|
|
85
|
+
**Fix**: Each dependent file path validated via SecurityValidator + atomic write (write-to-tmp + rename).
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
### 9. LCS Diff OOM (MEDIUM)
|
|
90
|
+
**CVSS Score**: 5.0 (Medium)
|
|
91
|
+
**Status**: ✅ FIXED in v3.4.0
|
|
92
|
+
|
|
93
|
+
**Description**: LCS diff algorithm is O(n²) memory — 10K-line files cause OOM.
|
|
94
|
+
|
|
95
|
+
**Fix**: `MAX_DIFF_LINES = 5000` guard — falls back to O(n) `generateSimpleDiff` for large files.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Security Features
|
|
100
|
+
|
|
101
|
+
### Defense in Depth
|
|
102
|
+
|
|
103
|
+
1. **Input Validation**
|
|
104
|
+
- Path boundary enforcement on ALL handlers (v3.4.0)
|
|
105
|
+
- File size limits (10MB per file, 50MB total)
|
|
106
|
+
- Regex sanitization + timeout (1s limit)
|
|
107
|
+
|
|
108
|
+
2. **Two-Phase Write Workflow** (v3.4.0)
|
|
109
|
+
- Phase 1: Dry-run returns diff + confirmation token
|
|
110
|
+
- Phase 2: Apply with token (5-minute expiry)
|
|
111
|
+
- Max 50 pending operations
|
|
112
|
+
|
|
113
|
+
3. **Middleware Pipeline** (v3.4.0)
|
|
114
|
+
- Rate limiting (token bucket per operation)
|
|
115
|
+
- File locking (prevents concurrent writes)
|
|
116
|
+
- Audit logging (persistent `.mcp-audit-logs/`)
|
|
117
|
+
- Telemetry (operation metrics, percentiles)
|
|
118
|
+
|
|
119
|
+
4. **Syntax Validation**
|
|
120
|
+
- AST parsing of generated code post-write
|
|
121
|
+
- Rejection of invalid syntax before any file modification
|
|
122
|
+
|
|
123
|
+
5. **Atomic Writes**
|
|
124
|
+
- Write to `.tmp` file, then rename
|
|
125
|
+
- Prevents corruption on crash/timeout
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Reporting Vulnerabilities
|
|
130
|
+
|
|
131
|
+
1. **DO NOT** open public GitHub issues for security vulnerabilities
|
|
132
|
+
2. Include: Description, Steps to reproduce, Impact, Suggested fix
|
|
133
|
+
3. Response: Critical 24h, High 72h, Medium 1 week
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Security Testing
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
npm run build:tests
|
|
141
|
+
node dist-tests/tests/test-security.js
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Coverage**:
|
|
145
|
+
- ✅ Path traversal (all handlers)
|
|
146
|
+
- ✅ Regex injection (sanitization + timeout)
|
|
147
|
+
- ✅ File size validation
|
|
148
|
+
- ✅ ReDoS detection
|
|
149
|
+
- ✅ Two-phase write confirmation
|
|
150
|
+
- ✅ Rate limiting
|
|
151
|
+
- ✅ File locking
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Completed Security Roadmap
|
|
156
|
+
|
|
157
|
+
### v3.2.0 ✅
|
|
158
|
+
- [x] Path traversal fix (normalize before check)
|
|
159
|
+
- [x] Regex sanitization
|
|
160
|
+
- [x] Syntax validation
|
|
161
|
+
- [x] Bounded memory in compress
|
|
162
|
+
|
|
163
|
+
### v3.4.0 ✅
|
|
164
|
+
- [x] Regex timeout enforcement (safeRegexTest)
|
|
165
|
+
- [x] Rate limiting (token bucket)
|
|
166
|
+
- [x] File locking (concurrent write prevention)
|
|
167
|
+
- [x] Audit logging (persistent, rotated)
|
|
168
|
+
- [x] Telemetry (operation metrics)
|
|
169
|
+
- [x] Two-phase write workflow
|
|
170
|
+
- [x] All handlers validated with projectRoot
|
|
171
|
+
- [x] extractSymbol bug fix
|
|
172
|
+
- [x] Diff OOM guard
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
**Last Updated**: 2026-04-24
|
|
177
|
+
**Version**: 3.4.0
|
package/dist/src/core/engine.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Core Engine - v3.
|
|
3
|
-
*
|
|
2
|
+
* Core Engine - v3.4.0
|
|
3
|
+
* ASYNC I/O: Migrated to fs.promises
|
|
4
4
|
*/
|
|
5
5
|
import { Parser, Language } from "web-tree-sitter";
|
|
6
6
|
import * as path from "node:path";
|
|
7
|
-
import * as fs from "node:fs";
|
|
7
|
+
import * as fs from "node:fs/promises";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
9
|
import { dirname } from "path";
|
|
10
10
|
export class CodeContextEngine {
|
|
@@ -31,24 +31,30 @@ export class CodeContextEngine {
|
|
|
31
31
|
throw new Error("Engine not initialized");
|
|
32
32
|
}
|
|
33
33
|
const wasmFile = `tree-sitter-${name}.wasm`;
|
|
34
|
-
// Try multiple paths: installed module, local dev, CWD fallback
|
|
35
34
|
const possiblePaths = [
|
|
36
|
-
//
|
|
35
|
+
// 1. If running from src/core/engine.ts (ts-node)
|
|
37
36
|
path.join(dirname(fileURLToPath(import.meta.url)), "..", "..", "node_modules", "tree-sitter-wasms", "out", wasmFile),
|
|
38
|
-
//
|
|
37
|
+
// 2. If running from dist/src/core/engine.js (compiled)
|
|
38
|
+
path.join(dirname(fileURLToPath(import.meta.url)), "..", "..", "..", "node_modules", "tree-sitter-wasms", "out", wasmFile),
|
|
39
|
+
// 3. Fallback to process.cwd()
|
|
39
40
|
path.join(process.cwd(), "node_modules", "tree-sitter-wasms", "out", wasmFile),
|
|
40
41
|
];
|
|
41
42
|
let wasmPath = null;
|
|
42
43
|
for (const p of possiblePaths) {
|
|
43
|
-
|
|
44
|
+
try {
|
|
45
|
+
await fs.access(p);
|
|
44
46
|
wasmPath = p;
|
|
45
47
|
break;
|
|
46
48
|
}
|
|
49
|
+
catch {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
47
52
|
}
|
|
48
53
|
if (!wasmPath) {
|
|
49
54
|
throw new Error(`WASM file not found: ${wasmFile}. Tried paths: ${possiblePaths.join(", ")}`);
|
|
50
55
|
}
|
|
51
|
-
|
|
56
|
+
// CRITICAL FIX: Async I/O
|
|
57
|
+
const wasmBuffer = await fs.readFile(wasmPath);
|
|
52
58
|
const language = await Language.load(wasmBuffer);
|
|
53
59
|
this.languages.set(name, language);
|
|
54
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../../src/core/engine.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../../src/core/engine.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAO/B,MAAM,OAAO,iBAAiB;IACpB,MAAM,CAAe;IACrB,WAAW,GAAY,KAAK,CAAC;IAC7B,MAAM,GAAkB,IAAI,CAAC;IAC7B,SAAS,GAA0B,IAAI,GAAG,EAAE,CAAC;IAErD,YAAY,SAAuB,EAAE;QACnC,IAAI,CAAC,MAAM,GAAG;YACZ,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC;YAC1C,YAAY,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;YAC/B,GAAG,MAAM;SACV,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,IAAI,CAAC,WAAW;YAAE,OAAO;QAE7B,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QAEpB,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,IAAY;QAC7B,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IA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Q,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACjD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,WAAW,CAAC,IAAY;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,YAAY;QACV,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,IAAI,MAAM,EAAE,CAAC;IACtB,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Security Validator - v3.
|
|
3
|
-
*
|
|
2
|
+
* Security Validator - v3.4.0
|
|
3
|
+
* CRITICAL FIX: Path traversal check AFTER normalization
|
|
4
4
|
*/
|
|
5
5
|
import * as path from "node:path";
|
|
6
6
|
import * as fs from "node:fs/promises";
|
|
@@ -10,15 +10,16 @@ export class SecurityValidator {
|
|
|
10
10
|
this.projectRoot = path.resolve(projectRoot);
|
|
11
11
|
}
|
|
12
12
|
async validateFilePath(filePath) {
|
|
13
|
+
// Resolve FIRST, then check
|
|
13
14
|
const resolved = path.resolve(filePath);
|
|
14
|
-
//
|
|
15
|
-
if (filePath.includes("..")) {
|
|
16
|
-
return { valid: false, error: "Invalid path: contains dangerous patterns" };
|
|
17
|
-
}
|
|
18
|
-
// Project boundary check (MANDATORY)
|
|
15
|
+
// CRITICAL: Check boundary AFTER normalization
|
|
19
16
|
if (!resolved.startsWith(this.projectRoot)) {
|
|
20
17
|
return { valid: false, error: "Path outside project boundary" };
|
|
21
18
|
}
|
|
19
|
+
// Additional dangerous pattern check
|
|
20
|
+
if (filePath.includes("..") && !resolved.startsWith(this.projectRoot)) {
|
|
21
|
+
return { valid: false, error: "Invalid path: contains dangerous patterns" };
|
|
22
|
+
}
|
|
22
23
|
// Existence check
|
|
23
24
|
try {
|
|
24
25
|
await fs.access(resolved);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../../src/core/validator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAQvC,MAAM,OAAO,iBAAiB;IACpB,WAAW,CAAS;IAE5B,YAAY,WAAmB;QAC7B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,QAAgB;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAExC
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../../src/core/validator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAQvC,MAAM,OAAO,iBAAiB;IACpB,WAAW,CAAS;IAE5B,YAAY,WAAmB;QAC7B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,QAAgB;QACrC,4BAA4B;QAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAExC,+CAA+C;QAC/C,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YAC3C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,+BAA+B,EAAE,CAAC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3
|
-
* mcp-code-context v3.0
|
|
3
|
+
* mcp-code-context v3.4.0 - Tree-sitter WASM Edition
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Production-ready with:
|
|
6
6
|
* - Tree-sitter WASM for 100% AST accuracy (TypeScript, Python, PHP, Dart)
|
|
7
|
-
* - Zero native dependencies
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
10
|
-
* - Mandatory security boundaries
|
|
7
|
+
* - Zero native dependencies — 100% portable across Windows/Mac/Linux
|
|
8
|
+
* - Two-phase write workflow (dry-run + confirmation token)
|
|
9
|
+
* - Middleware pipeline: rate limiting, file locking, audit logging, telemetry
|
|
10
|
+
* - Mandatory security boundaries on ALL handlers
|
|
11
11
|
*/
|
|
12
12
|
export {};
|