mcp-code-context 3.8.1 → 3.9.1

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 (98) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/INSTRUCTIONS.md +2 -2
  3. package/README.md +23 -11
  4. package/dist/src/core/engine.d.ts +1 -1
  5. package/dist/src/core/engine.js +1 -1
  6. package/dist/src/core/indexManager.d.ts +1 -1
  7. package/dist/src/core/indexManager.js +1 -1
  8. package/dist/src/core/sessionManager.d.ts +1 -1
  9. package/dist/src/core/sessionManager.js +1 -1
  10. package/dist/src/core/validator.d.ts +1 -1
  11. package/dist/src/core/validator.js +1 -1
  12. package/dist/src/index.d.ts +1 -1
  13. package/dist/src/index.js +2 -2
  14. package/dist/src/operations/astTransform.d.ts +1 -1
  15. package/dist/src/operations/astTransform.js +1 -1
  16. package/dist/src/operations/compress.d.ts +1 -1
  17. package/dist/src/operations/compress.js +53 -2
  18. package/dist/src/operations/compress.js.map +1 -1
  19. package/dist/src/operations/confirmationStore.d.ts +1 -1
  20. package/dist/src/operations/confirmationStore.js +1 -1
  21. package/dist/src/operations/impactAnalysis.js +11 -0
  22. package/dist/src/operations/impactAnalysis.js.map +1 -1
  23. package/dist/src/operations/write.d.ts +1 -1
  24. package/dist/src/operations/write.js +1 -1
  25. package/dist/src/parsers/base.d.ts +2 -2
  26. package/dist/src/parsers/base.js +2 -2
  27. package/dist/src/parsers/csharp.d.ts +1 -1
  28. package/dist/src/parsers/csharp.js +1 -1
  29. package/dist/src/parsers/dartTreeSitter.d.ts +1 -1
  30. package/dist/src/parsers/dartTreeSitter.js +1 -1
  31. package/dist/src/parsers/go.d.ts +1 -1
  32. package/dist/src/parsers/go.js +1 -1
  33. package/dist/src/parsers/java.d.ts +1 -1
  34. package/dist/src/parsers/java.js +1 -1
  35. package/dist/src/parsers/kotlin.d.ts +1 -1
  36. package/dist/src/parsers/kotlin.js +1 -1
  37. package/dist/src/parsers/php.d.ts +1 -1
  38. package/dist/src/parsers/php.js +1 -1
  39. package/dist/src/parsers/python.d.ts +2 -2
  40. package/dist/src/parsers/python.js +2 -2
  41. package/dist/src/parsers/registry.d.ts +1 -1
  42. package/dist/src/parsers/registry.js +1 -1
  43. package/dist/src/parsers/ruby.d.ts +2 -2
  44. package/dist/src/parsers/ruby.js +2 -2
  45. package/dist/src/parsers/rust.d.ts +1 -1
  46. package/dist/src/parsers/rust.js +1 -1
  47. package/dist/src/parsers/typescript.d.ts +1 -1
  48. package/dist/src/parsers/typescript.js +1 -1
  49. package/dist/src/tools/pipeline.js +4 -0
  50. package/dist/src/tools/pipeline.js.map +1 -1
  51. package/dist/src/tools/readHandlers.d.ts +18 -0
  52. package/dist/src/tools/readHandlers.js +52 -0
  53. package/dist/src/tools/readHandlers.js.map +1 -1
  54. package/dist/src/tools/toolDefinitions.d.ts +45 -0
  55. package/dist/src/tools/toolDefinitionsCore.d.ts +45 -0
  56. package/dist/src/tools/toolDefinitionsCore.js +39 -3
  57. package/dist/src/tools/toolDefinitionsCore.js.map +1 -1
  58. package/dist/src/utils/appDir.d.ts +1 -1
  59. package/dist/src/utils/appDir.js +1 -1
  60. package/dist/src/utils/auditLogger.d.ts +1 -1
  61. package/dist/src/utils/auditLogger.js +1 -1
  62. package/dist/src/utils/backupManager.d.ts +1 -1
  63. package/dist/src/utils/backupManager.js +1 -1
  64. package/dist/src/utils/constants.d.ts +1 -1
  65. package/dist/src/utils/constants.js +1 -1
  66. package/dist/src/utils/diff.d.ts +2 -2
  67. package/dist/src/utils/diff.js +2 -2
  68. package/dist/src/utils/fileLock.d.ts +1 -1
  69. package/dist/src/utils/fileLock.js +1 -1
  70. package/dist/src/utils/fileWalker.d.ts +1 -1
  71. package/dist/src/utils/fileWalker.js +1 -1
  72. package/dist/src/utils/fileWatcher.d.ts +1 -1
  73. package/dist/src/utils/fileWatcher.js +1 -1
  74. package/dist/src/utils/fuzzySearch.d.ts +1 -1
  75. package/dist/src/utils/fuzzySearch.js +1 -1
  76. package/dist/src/utils/gemDescriptions.json +22 -0
  77. package/dist/src/utils/gemfileParser.d.ts +17 -0
  78. package/dist/src/utils/gemfileParser.js +63 -0
  79. package/dist/src/utils/gemfileParser.js.map +1 -0
  80. package/dist/src/utils/logger.d.ts +1 -1
  81. package/dist/src/utils/logger.js +1 -1
  82. package/dist/src/utils/metaprogramming.d.ts +18 -0
  83. package/dist/src/utils/metaprogramming.js +139 -0
  84. package/dist/src/utils/metaprogramming.js.map +1 -0
  85. package/dist/src/utils/railsRoutes.d.ts +19 -0
  86. package/dist/src/utils/railsRoutes.js +143 -0
  87. package/dist/src/utils/railsRoutes.js.map +1 -0
  88. package/dist/src/utils/railsSchema.d.ts +1 -0
  89. package/dist/src/utils/railsSchema.js +23 -0
  90. package/dist/src/utils/railsSchema.js.map +1 -1
  91. package/dist/src/utils/rateLimiter.d.ts +1 -1
  92. package/dist/src/utils/rateLimiter.js +1 -1
  93. package/dist/src/utils/streaming.d.ts +1 -1
  94. package/dist/src/utils/streaming.js +1 -1
  95. package/dist/src/utils/telemetry.d.ts +1 -1
  96. package/dist/src/utils/telemetry.js +1 -1
  97. package/llms.txt +52 -21
  98. package/package.json +2 -2
package/llms.txt CHANGED
@@ -1,21 +1,31 @@
1
- # mcp-code-context v3.8.1
1
+ # mcp-code-context v3.9.1
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, session-scoped state, and crash recovery.
4
4
 
5
- ## What's New in v3.8.1
5
+ ## What's New in v3.9.1
6
+
7
+ 🐛 **Bug Fix Release**:
8
+ - ✅ **`get_rails_routes` namespace fix**: Routes inside `namespace :admin do` now produce `/admin/users` (was `/users`). Controllers correctly namespaced as `admin/users`. Fixed regex that captured `admin do` instead of `admin` with symbol syntax.
9
+ - ✅ **`get_rails_routes` indentation parser**: Replaced fragile `do/end` depth counter with indentation-based stack. Handles nested namespaces (`api/v1`), `member do` blocks, and `scope` correctly.
10
+ - ✅ **Repo map Gems + Concerns**: `get_semantic_repo_map` appends `<gem>` behavior blocks and `<concern>` entries when Gemfile and concerns directories are present.
11
+
12
+ ## Previously Added in v3.9.0
13
+
14
+ - ✅ **`get_gemfile_context`**: Parse Gemfile, return implicit behaviors for known gems (devise, sidekiq, pundit, kaminari, paper_trail, geocoder, etc.)
15
+ - ✅ **`find_metaprogramming`**: Scan Ruby for `define_method`, `method_missing`, `class_eval`, `ActiveSupport::Concern`, `delegate`, `has_many :through` etc.
16
+ - ✅ **`get_rails_routes`**: Parse `config/routes.rb` into structured route map
17
+ - ✅ **Concern resolution in `analyze_impact`**: Checks `app/models/concerns` and `app/controllers/concerns` before file scan
18
+
19
+ ## Previously Added in v3.8.x
6
20
 
7
- 🚀 **CRITICAL FIXES - Production Readiness Release**:
8
21
  - ✅ **Session-scoped state**: Each MCP client gets isolated locks, confirmation store, rate limiter (no state leakage)
9
22
  - ✅ **Crash recovery**: SQLite-backed pending operations store - survive restarts
10
23
  - ✅ **Expanded ReDoS protection**: 15+ patterns (was 6) - better security
11
24
  - ✅ **Auto-persist before eviction**: CacheManager now persists before LRU eviction
12
25
  - ✅ **Higher file limits**: MAX_FILES_REPO_MAP = 2000 (was 500)
13
- - ✅ **Multi-client tests**: New integration tests for concurrent MCP clients
14
26
  - ✅ **Ruby full support**: Complete `RubyParser` with `search()` for `search_code_pattern` compatibility
15
27
  - ✅ **ActiveRecord Virtual Schema**: Parses `db/schema.rb` and injects column annotations on AR model reads
16
28
 
17
- ## Previously Added in v3.7.x
18
-
19
29
  - ✅ 4 new tools: `search_symbols`, `explain_symbol`, `batch_read`, `get_rate_limit_status`
20
30
  - ✅ `diffFormat` parameter on all write tools (`unified`, `compact`, `summary`, `none`)
21
31
  - ✅ Phase 2 no longer requires `newContent`/`code` — server stores content from Phase 1
@@ -149,13 +159,13 @@ This MCP server solves two problems:
149
159
  - `steps` (optional): Number of versions to go back (1-5, default: 1).
150
160
  **What it does:** Reverts the file to the state it was in before the last 1-5 modifications.
151
161
 
152
- ### Write Tools (v3.8.1 Two-Phase Workflow)
162
+ ### Write Tools (v3.9.1 Two-Phase Workflow)
153
163
 
154
164
  All write tools follow a **Two-Phase Workflow**:
155
165
  1. **Phase 1 (Preview)**: Call without a token to get a unified `diff` and a `confirmationToken`.
156
166
  2. **Phase 2 (Apply)**: Call with `confirmationToken` and `confirm: true` to apply the changes.
157
167
 
158
- **Important Notes (v3.8.1):**
168
+ **Important Notes (v3.9.1):**
159
169
  - ✅ **Windows CRLF Support**: Fully resolved. All operations work correctly on Windows files with CRLF line endings.
160
170
  - ✅ **Parameter Brace Handling**: Methods with braces in parameters (e.g., `{int? cart}`) are now handled correctly.
161
171
  - ✅ **Session-scoped state**: Each MCP client gets isolated state (locks, confirmation store, rate limiter).
@@ -236,9 +246,36 @@ All write tools follow a **Two-Phase Workflow**:
236
246
 
237
247
  **Best used when:** Cleaning up deprecated functions or unused code.
238
248
 
239
- ## New Tools (v3.8.1)
249
+ ## New Tools (v3.9.x)
250
+
251
+ #### 11. `get_gemfile_context`
252
+ **Purpose:** Parse the Gemfile and return known gem behaviors with their implicit Rails conventions.
253
+
254
+ **Input:** `projectRoot` (required).
255
+
256
+ **Returns:** List of all gems, known gems with their implicit behavior descriptions, and an XML annotation block.
257
+
258
+ **Best used when:** Starting work on a Rails project to understand what auth/authorization/pagination/etc. gems are active without reading docs.
259
+
260
+ #### 12. `find_metaprogramming`
261
+ **Purpose:** Scan Ruby files for dynamic method generation entry points.
240
262
 
241
- #### 11. `get_session_stats`
263
+ **Input:** `projectRoot` (required), `filePath` (optional — scan single file), `rootDir` (optional — scan subdirectory).
264
+
265
+ **Returns:** All matches grouped by file, with line number, pattern name, description, and code snippet.
266
+
267
+ **Best used when:** Investigating where "magic methods" are defined in a Rails project (before using `analyze_impact`).
268
+
269
+ #### 13. `get_rails_routes`
270
+ **Purpose:** Parse `config/routes.rb` and return a structured route map.
271
+
272
+ **Input:** `projectRoot` (required).
273
+
274
+ **Returns:** Array of routes with `method`, `path`, `controller`, `action`. Includes warnings for `only:/except:` and nested resources.
275
+
276
+ **Best used when:** Understanding API surface of a Rails app, finding what controller handles a given route.
277
+
278
+ #### 14. `get_session_stats`
242
279
  **Purpose:** Get statistics for the current MCP client session.
243
280
 
244
281
  **Input:** None.
@@ -248,27 +285,21 @@ All write tools follow a **Two-Phase Workflow**:
248
285
  - `locksHeld`: Number of file locks currently held
249
286
  - `rateLimiterTokens`: Current token balance for this session
250
287
 
251
- **Best used when:** Diagnosing session-specific issues or understanding your client's resource usage.
252
-
253
- #### 12. `clear_session_cache`
288
+ #### 15. `clear_session_cache`
254
289
  **Purpose:** Clear the cache for the current MCP client session only.
255
290
 
256
291
  **Input:** None.
257
292
 
258
293
  **Returns:** `cacheEntriesCleared` - Number of cache entries removed.
259
294
 
260
- **Best used when:** You want to reset your client's cache without affecting other MCP clients.
261
-
262
- #### 13. `list_pending_operations`
295
+ #### 16. `list_pending_operations`
263
296
  **Purpose:** List all pending operations (for recovery after crash).
264
297
 
265
298
  **Input:** None.
266
299
 
267
300
  **Returns:** Array of pending operations with tokens, file paths, and timestamps.
268
301
 
269
- **Best used when:** Recovering work after a server crash.
270
-
271
- ## Previously Added Tools (v3.8.1)
302
+ ## Previously Added Tools (v3.9.x)
272
303
 
273
304
  #### 14. `parse_file`
274
305
  **Purpose:** Parse a file using Tree-sitter and extract all symbols.
@@ -313,7 +344,7 @@ All write tools follow a **Two-Phase Workflow**:
313
344
  5. **Phase 2: Apply Edit** → Verify the diff, then call with the token and `confirm: true`.
314
345
  6. **Recovery** → Use `rollback_file` if needed.
315
346
 
316
- ## Session State Configuration (v3.8.1+)
347
+ ## Session State Configuration (v3.9.1+)
317
348
 
318
349
  ### Critical: Session-Scoped State
319
350
 
@@ -429,6 +460,6 @@ No additional configuration is needed beyond adding the MCP server definition. S
429
460
 
430
461
  ---
431
462
 
432
- **Version**: 3.8.1
463
+ **Version**: 3.9.1
433
464
  **Last Updated**: June 8, 2026
434
465
  **Status**: Production-ready with session-scoped state and crash recovery
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-code-context",
3
- "version": "3.8.1",
3
+ "version": "3.9.1",
4
4
  "description": "Powerful MCP server with Tree-sitter WASM parsers for 100% AST accuracy. Zero native dependencies. Production-ready with persistent caching, structured logging, file watching, fuzzy search, rate limiting, file locking, and ReDoS protection. Supports TypeScript, JavaScript, PHP, Dart, Python, and Ruby (with ActiveRecord Virtual Schema extraction).",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -8,7 +8,7 @@
8
8
  "mcp-code-context": "dist/src/index.js"
9
9
  },
10
10
  "scripts": {
11
- "build": "tsc",
11
+ "build": "tsc && node -e \"require('fs').copyFileSync('src/utils/gemDescriptions.json', 'dist/src/utils/gemDescriptions.json')\"",
12
12
  "test": "npm run build && npm run build:tests && node dist-tests/tests/test-security.js && node dist-tests/tests/test-file-lock.js && node dist-tests/tests/test-rate-limiter.js && node dist-tests/tests/test-v3.4.js && node dist-tests/tests/test-backup-manager.js && node dist-tests/tests/test-index-manager.js && node dist-tests/tests/test-wasm-parsers.js",
13
13
  "test:ui": "vitest --ui",
14
14
  "test:run": "vitest run",