mcp-code-context 3.9.0 → 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.
- package/CHANGELOG.md +10 -0
- package/INSTRUCTIONS.md +2 -2
- package/README.md +23 -11
- package/dist/src/core/engine.d.ts +1 -1
- package/dist/src/core/engine.js +1 -1
- package/dist/src/core/indexManager.d.ts +1 -1
- package/dist/src/core/indexManager.js +1 -1
- package/dist/src/core/sessionManager.d.ts +1 -1
- package/dist/src/core/sessionManager.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 +2 -2
- package/dist/src/operations/astTransform.d.ts +1 -1
- package/dist/src/operations/astTransform.js +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/write.d.ts +1 -1
- package/dist/src/operations/write.js +1 -1
- package/dist/src/parsers/base.d.ts +2 -2
- package/dist/src/parsers/base.js +2 -2
- package/dist/src/parsers/csharp.d.ts +1 -1
- package/dist/src/parsers/csharp.js +1 -1
- package/dist/src/parsers/dartTreeSitter.d.ts +1 -1
- package/dist/src/parsers/dartTreeSitter.js +1 -1
- package/dist/src/parsers/go.d.ts +1 -1
- package/dist/src/parsers/go.js +1 -1
- package/dist/src/parsers/java.d.ts +1 -1
- package/dist/src/parsers/java.js +1 -1
- package/dist/src/parsers/kotlin.d.ts +1 -1
- package/dist/src/parsers/kotlin.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 +2 -2
- package/dist/src/parsers/python.js +2 -2
- package/dist/src/parsers/registry.d.ts +1 -1
- package/dist/src/parsers/registry.js +1 -1
- package/dist/src/parsers/ruby.d.ts +2 -2
- package/dist/src/parsers/ruby.js +2 -2
- package/dist/src/parsers/rust.d.ts +1 -1
- package/dist/src/parsers/rust.js +1 -1
- package/dist/src/parsers/typescript.d.ts +1 -1
- package/dist/src/parsers/typescript.js +1 -1
- package/dist/src/tools/pipeline.js +1 -1
- package/dist/src/tools/toolDefinitionsCore.js +3 -3
- package/dist/src/utils/appDir.d.ts +1 -1
- package/dist/src/utils/appDir.js +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 +2 -2
- package/dist/src/utils/diff.js +2 -2
- 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 +1 -1
- package/dist/src/utils/fileWatcher.js +1 -1
- package/dist/src/utils/fuzzySearch.d.ts +1 -1
- package/dist/src/utils/fuzzySearch.js +1 -1
- package/dist/src/utils/gemfileParser.d.ts +1 -1
- package/dist/src/utils/gemfileParser.js +1 -1
- package/dist/src/utils/logger.d.ts +1 -1
- package/dist/src/utils/logger.js +1 -1
- package/dist/src/utils/metaprogramming.d.ts +1 -1
- package/dist/src/utils/metaprogramming.js +1 -1
- package/dist/src/utils/railsRoutes.d.ts +4 -3
- package/dist/src/utils/railsRoutes.js +62 -67
- package/dist/src/utils/railsRoutes.js.map +1 -1
- package/dist/src/utils/rateLimiter.d.ts +1 -1
- package/dist/src/utils/rateLimiter.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 +52 -21
- package/package.json +1 -1
package/dist/src/utils/logger.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Rails Routes Parser - v3.9.
|
|
2
|
+
* Rails Routes Parser - v3.9.1
|
|
3
3
|
* Parses config/routes.rb to map HTTP routes to controller actions.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Uses indentation-based namespace tracking (immune to do/end counting errors).
|
|
5
|
+
* Supports: resources, resource, explicit HTTP verbs, namespace/scope, root.
|
|
6
|
+
* v1 limitations: only:/except:/shallow:/nested resources — emits warnings, no false routes.
|
|
6
7
|
*/
|
|
7
8
|
export interface RouteEntry {
|
|
8
9
|
method: string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Rails Routes Parser - v3.9.
|
|
2
|
+
* Rails Routes Parser - v3.9.1
|
|
3
3
|
* Parses config/routes.rb to map HTTP routes to controller actions.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Uses indentation-based namespace tracking (immune to do/end counting errors).
|
|
5
|
+
* Supports: resources, resource, explicit HTTP verbs, namespace/scope, root.
|
|
6
|
+
* v1 limitations: only:/except:/shallow:/nested resources — emits warnings, no false routes.
|
|
6
7
|
*/
|
|
7
8
|
import * as fs from "node:fs/promises";
|
|
8
9
|
import * as path from "node:path";
|
|
@@ -10,22 +11,22 @@ import * as path from "node:path";
|
|
|
10
11
|
const routesCache = new Map();
|
|
11
12
|
/** Standard 7 REST actions for `resources` */
|
|
12
13
|
const RESOURCES_ACTIONS = [
|
|
13
|
-
{ method: "GET", path: "", action: "index"
|
|
14
|
-
{ method: "GET", path: "/new", action: "new"
|
|
15
|
-
{ method: "POST", path: "", action: "create"
|
|
16
|
-
{ method: "GET", path: "/:id", action: "show"
|
|
17
|
-
{ method: "GET", path: "/:id/edit", action: "edit"
|
|
18
|
-
{ method: "PATCH", path: "/:id", action: "update"
|
|
19
|
-
{ method: "DELETE", path: "/:id", action: "destroy"
|
|
14
|
+
{ method: "GET", path: "", action: "index" },
|
|
15
|
+
{ method: "GET", path: "/new", action: "new" },
|
|
16
|
+
{ method: "POST", path: "", action: "create" },
|
|
17
|
+
{ method: "GET", path: "/:id", action: "show" },
|
|
18
|
+
{ method: "GET", path: "/:id/edit", action: "edit" },
|
|
19
|
+
{ method: "PATCH", path: "/:id", action: "update" },
|
|
20
|
+
{ method: "DELETE", path: "/:id", action: "destroy" },
|
|
20
21
|
];
|
|
21
22
|
/** Standard 6 singular REST actions for `resource` */
|
|
22
23
|
const RESOURCE_ACTIONS = [
|
|
23
|
-
{ method: "GET", path: "/new", action: "new"
|
|
24
|
-
{ method: "POST", path: "", action: "create"
|
|
25
|
-
{ method: "GET", path: "", action: "show"
|
|
26
|
-
{ method: "GET", path: "/edit", action: "edit"
|
|
27
|
-
{ method: "PATCH", path: "", action: "update"
|
|
28
|
-
{ method: "DELETE", path: "", action: "destroy"
|
|
24
|
+
{ method: "GET", path: "/new", action: "new" },
|
|
25
|
+
{ method: "POST", path: "", action: "create" },
|
|
26
|
+
{ method: "GET", path: "", action: "show" },
|
|
27
|
+
{ method: "GET", path: "/edit", action: "edit" },
|
|
28
|
+
{ method: "PATCH", path: "", action: "update" },
|
|
29
|
+
{ method: "DELETE", path: "", action: "destroy" },
|
|
29
30
|
];
|
|
30
31
|
export async function parseRailsRoutes(projectRoot) {
|
|
31
32
|
const routesPath = path.join(projectRoot, "config", "routes.rb");
|
|
@@ -47,52 +48,57 @@ export async function parseRailsRoutes(projectRoot) {
|
|
|
47
48
|
export function parseRoutesContent(content) {
|
|
48
49
|
const routes = [];
|
|
49
50
|
const warnings = [];
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
const nsStack = [];
|
|
52
|
+
// Helper: get current url prefix and controller namespace from stack
|
|
53
|
+
const getPrefix = () => nsStack.length > 0 ? "/" + nsStack.map(e => e.prefix).join("/") : "";
|
|
54
|
+
const getNsPrefix = () => nsStack.length > 0 ? nsStack.map(e => e.nsPrefix).join("/") + "/" : "";
|
|
55
|
+
// Helper: measure leading spaces
|
|
56
|
+
const indentOf = (raw) => raw.match(/^(\s*)/)?.[1].length ?? 0;
|
|
52
57
|
const lines = content.split("\n");
|
|
53
58
|
for (const rawLine of lines) {
|
|
59
|
+
const indent = indentOf(rawLine);
|
|
54
60
|
const line = rawLine.trim();
|
|
55
|
-
// Skip
|
|
56
|
-
if (line
|
|
57
|
-
continue;
|
|
58
|
-
// Namespace/scope push
|
|
59
|
-
const nsMatch = line.match(/^(?:namespace|scope)\s+[:'"]([^'"]+)['"]/);
|
|
60
|
-
if (nsMatch) {
|
|
61
|
-
prefixStack.push(nsMatch[1].replace(/^:/, ""));
|
|
61
|
+
// Skip blank lines and comments
|
|
62
|
+
if (line === "" || line.startsWith("#"))
|
|
62
63
|
continue;
|
|
64
|
+
// Pop namespace stack entries whose indent is >= current indent
|
|
65
|
+
// (meaning we've dedented past them — their `end` was processed)
|
|
66
|
+
while (nsStack.length > 0 && indent <= nsStack[nsStack.length - 1].indent) {
|
|
67
|
+
nsStack.pop();
|
|
63
68
|
}
|
|
64
|
-
//
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
// namespace :admin do / namespace 'admin' do / scope :admin do
|
|
70
|
+
// Handles both symbol (:admin) and string ('admin'/"admin") syntax
|
|
71
|
+
const nsSymbolMatch = line.match(/^(?:namespace|scope)\s+:(\w+)/);
|
|
72
|
+
const nsStringMatch = line.match(/^(?:namespace|scope)\s+['"]([^'"]+)['"]/);
|
|
73
|
+
const nsMatch = nsSymbolMatch ?? nsStringMatch;
|
|
74
|
+
if (nsMatch) {
|
|
75
|
+
const seg = nsMatch[1];
|
|
76
|
+
// scope doesn't add controller namespace, namespace does
|
|
77
|
+
const isNamespace = line.startsWith("namespace");
|
|
78
|
+
nsStack.push({ indent, prefix: seg, nsPrefix: isNamespace ? seg : "" });
|
|
67
79
|
continue;
|
|
68
80
|
}
|
|
69
|
-
const
|
|
70
|
-
|
|
81
|
+
const urlPrefix = getPrefix();
|
|
82
|
+
const ctrlPrefix = getNsPrefix();
|
|
83
|
+
// Detect option flags
|
|
71
84
|
const hasOnlyExcept = /\bonly:\s*\[/.test(line) || /\bexcept:\s*\[/.test(line);
|
|
72
85
|
const hasShallow = /\bshallow:\s*true\b/.test(line);
|
|
73
|
-
|
|
74
|
-
|
|
86
|
+
// Nested resources: line ends with `do` (opens a block we won't parse deeply)
|
|
87
|
+
const hasNestedDo = /\bdo\s*$/.test(line) && (line.startsWith("resources") || line.startsWith("resource"));
|
|
88
|
+
// resources :name / resources :name, only: [...] / resources :name do
|
|
75
89
|
const resourcesMatch = line.match(/^resources\s+:(\w+)/);
|
|
76
90
|
if (resourcesMatch) {
|
|
77
91
|
const name = resourcesMatch[1];
|
|
78
|
-
const controller =
|
|
79
|
-
const basePath = `${
|
|
80
|
-
if (hasOnlyExcept)
|
|
92
|
+
const controller = `${ctrlPrefix}${name}`;
|
|
93
|
+
const basePath = `${urlPrefix}/${name}`;
|
|
94
|
+
if (hasOnlyExcept)
|
|
81
95
|
warnings.push(`resources :${name} uses only:/except: — route list may be incomplete. Full support planned for v2.`);
|
|
82
|
-
|
|
83
|
-
if (hasShallow) {
|
|
96
|
+
if (hasShallow)
|
|
84
97
|
warnings.push(`resources :${name} uses shallow: — nested shallow routes not fully parsed.`);
|
|
85
|
-
|
|
86
|
-
if (hasNested) {
|
|
98
|
+
if (hasNestedDo)
|
|
87
99
|
warnings.push(`resources :${name} has nested resources (do block) — only top-level routes parsed.`);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
routes.push({
|
|
91
|
-
method: action.method,
|
|
92
|
-
path: basePath + action.path,
|
|
93
|
-
controller,
|
|
94
|
-
action: action.action,
|
|
95
|
-
});
|
|
100
|
+
for (const a of RESOURCES_ACTIONS) {
|
|
101
|
+
routes.push({ method: a.method, path: basePath + a.path, controller, action: a.action });
|
|
96
102
|
}
|
|
97
103
|
continue;
|
|
98
104
|
}
|
|
@@ -100,38 +106,32 @@ export function parseRoutesContent(content) {
|
|
|
100
106
|
const resourceMatch = line.match(/^resource\s+:(\w+)/);
|
|
101
107
|
if (resourceMatch) {
|
|
102
108
|
const name = resourceMatch[1];
|
|
103
|
-
const controller =
|
|
104
|
-
const basePath = `${
|
|
105
|
-
if (hasOnlyExcept)
|
|
109
|
+
const controller = `${ctrlPrefix}${name}s`; // pluralize for controller
|
|
110
|
+
const basePath = `${urlPrefix}/${name}`;
|
|
111
|
+
if (hasOnlyExcept)
|
|
106
112
|
warnings.push(`resource :${name} uses only:/except: — route list may be incomplete.`);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
routes.push({
|
|
110
|
-
method: action.method,
|
|
111
|
-
path: basePath + action.path,
|
|
112
|
-
controller,
|
|
113
|
-
action: action.action,
|
|
114
|
-
});
|
|
113
|
+
for (const a of RESOURCE_ACTIONS) {
|
|
114
|
+
routes.push({ method: a.method, path: basePath + a.path, controller, action: a.action });
|
|
115
115
|
}
|
|
116
116
|
continue;
|
|
117
117
|
}
|
|
118
|
-
// Explicit HTTP verb
|
|
118
|
+
// Explicit HTTP verb: get '/path', to: 'controller#action'
|
|
119
119
|
const verbMatch = line.match(/^(get|post|patch|put|delete|head|options)\s+['"]([^'"]+)['"]\s*,\s*to:\s*['"]([^#'"]+)#([^'"]+)['"]/i);
|
|
120
120
|
if (verbMatch) {
|
|
121
121
|
routes.push({
|
|
122
122
|
method: verbMatch[1].toUpperCase(),
|
|
123
|
-
path:
|
|
123
|
+
path: urlPrefix + verbMatch[2],
|
|
124
124
|
controller: verbMatch[3].trim(),
|
|
125
125
|
action: verbMatch[4].trim(),
|
|
126
126
|
});
|
|
127
127
|
continue;
|
|
128
128
|
}
|
|
129
|
-
// root to: 'controller#action'
|
|
129
|
+
// root to: 'controller#action' / root 'controller#action'
|
|
130
130
|
const rootMatch = line.match(/^root\s+(?:to:\s*)?['"]([^#'"]+)#([^'"]+)['"]/);
|
|
131
131
|
if (rootMatch) {
|
|
132
132
|
routes.push({
|
|
133
133
|
method: "GET",
|
|
134
|
-
path:
|
|
134
|
+
path: urlPrefix + "/",
|
|
135
135
|
controller: rootMatch[1].trim(),
|
|
136
136
|
action: rootMatch[2].trim(),
|
|
137
137
|
});
|
|
@@ -140,9 +140,4 @@ export function parseRoutesContent(content) {
|
|
|
140
140
|
}
|
|
141
141
|
return { routes, warnings };
|
|
142
142
|
}
|
|
143
|
-
/** Convert resource name + namespace stack to controller name */
|
|
144
|
-
function nameToController(name, prefixStack) {
|
|
145
|
-
const ns = prefixStack.length > 0 ? prefixStack.join("/") + "/" : "";
|
|
146
|
-
return `${ns}${name}`;
|
|
147
|
-
}
|
|
148
143
|
//# sourceMappingURL=railsRoutes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"railsRoutes.js","sourceRoot":"","sources":["../../../src/utils/railsRoutes.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"railsRoutes.js","sourceRoot":"","sources":["../../../src/utils/railsRoutes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAclC,wCAAwC;AACxC,MAAM,WAAW,GAAG,IAAI,GAAG,EAAmD,CAAC;AAE/E,8CAA8C;AAC9C,MAAM,iBAAiB,GAA4D;IACjF,EAAE,MAAM,EAAE,KAAK,EAAK,IAAI,EAAE,EAAE,EAAW,MAAM,EAAE,OAAO,EAAI;IAC1D,EAAE,MAAM,EAAE,KAAK,EAAK,IAAI,EAAE,MAAM,EAAO,MAAM,EAAE,KAAK,EAAM;IAC1D,EAAE,MAAM,EAAE,MAAM,EAAI,IAAI,EAAE,EAAE,EAAW,MAAM,EAAE,QAAQ,EAAG;IAC1D,EAAE,MAAM,EAAE,KAAK,EAAK,IAAI,EAAE,MAAM,EAAO,MAAM,EAAE,MAAM,EAAK;IAC1D,EAAE,MAAM,EAAE,KAAK,EAAK,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAK;IAC1D,E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E,QAAQ,EAAE,CAAC;AAC9B,CAAC"}
|
package/llms.txt
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
|
-
# mcp-code-context v3.9.
|
|
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.9.
|
|
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.9.
|
|
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.9.
|
|
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.9.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
270
|
-
|
|
271
|
-
## Previously Added Tools (v3.9.0)
|
|
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.9.
|
|
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.9.
|
|
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.9.
|
|
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",
|