smart-context-mcp 1.15.0 → 1.16.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/README.md +13 -2
- package/package.json +3 -1
- package/scripts/init-clients.js +6 -0
- package/server.json +2 -2
- package/src/tools/smart-context.js +1 -0
- package/src/tools/smart-read/code.js +18 -0
- package/src/tools/smart-search.js +2 -1
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ Restart your AI client. Done.
|
|
|
56
56
|
# Check installed version
|
|
57
57
|
npm list -g smart-context-mcp
|
|
58
58
|
|
|
59
|
-
# Should show: smart-context-mcp@1.
|
|
59
|
+
# Should show: smart-context-mcp@1.16.1 (or later)
|
|
60
60
|
|
|
61
61
|
# Update to latest version
|
|
62
62
|
npm update -g smart-context-mcp
|
|
@@ -66,7 +66,18 @@ npm uninstall -g smart-context-mcp
|
|
|
66
66
|
npm install -g smart-context-mcp
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
**After updating:**
|
|
69
|
+
**After updating:** The binary is updated globally, but agent rules (`.cursorrules`, `CLAUDE.md`, `AGENTS.md`) in each project are generated from the installed version and are **not updated automatically**.
|
|
70
|
+
|
|
71
|
+
Re-run init after each update to get the latest rules:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Re-apply rules to a project after updating
|
|
75
|
+
npx smart-context-init --target /path/to/your/project --clients cursor
|
|
76
|
+
# or for all clients
|
|
77
|
+
npx smart-context-init --target /path/to/your/project --clients all
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Then restart your AI client to load the new version.
|
|
70
81
|
|
|
71
82
|
---
|
|
72
83
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smart-context-mcp",
|
|
3
3
|
"mcpName": "io.github.Arrayo/smart-context-mcp",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.16.1",
|
|
5
5
|
"description": "MCP server that reduces agent token usage by 90% with intelligent context compression, task checkpoint persistence, and workflow-aware agent guidance.",
|
|
6
6
|
"author": "Francisco Caballero Portero <fcp1978@hotmail.com>",
|
|
7
7
|
"type": "module",
|
|
@@ -69,6 +69,8 @@
|
|
|
69
69
|
"eval:context": "node ./evals/harness.js --tool=context",
|
|
70
70
|
"eval:both": "node ./evals/harness.js --tool=both",
|
|
71
71
|
"eval:self": "node ./evals/harness.js --root=../.. --corpus=./evals/corpus/self-tasks.json",
|
|
72
|
+
"eval:realworld": "node ./evals/realworld-eval.js",
|
|
73
|
+
"eval:realworld:json": "node ./evals/realworld-eval.js --json",
|
|
72
74
|
"eval:report": "node ./evals/report.js",
|
|
73
75
|
"report:metrics": "node ./scripts/report-metrics.js",
|
|
74
76
|
"report:workflows": "node ./scripts/report-workflow-metrics.js",
|
package/scripts/init-clients.js
CHANGED
|
@@ -414,6 +414,12 @@ Prefer devctx MCP for non-trivial tasks:
|
|
|
414
414
|
- smart_shell instead of Shell for safe diagnostics
|
|
415
415
|
- smart_turn(end, event=milestone) after meaningful progress
|
|
416
416
|
|
|
417
|
+
Tool substitution rules (use devctx INSTEAD of native tools):
|
|
418
|
+
- smart_search OVER Grep/SemanticSearch for any codebase exploration or "how does X work" queries
|
|
419
|
+
- smart_read/smart_read_batch OVER Read when reading multiple files or large files (>200 lines) for context
|
|
420
|
+
- smart_shell OVER Shell for build/test/lint/git checks
|
|
421
|
+
- smart_turn(end, event=milestone) after EVERY significant code change, not just at session end
|
|
422
|
+
|
|
417
423
|
If devctx MCP is installed and enabled, default to devctx on every non-trivial multi-file or multi-step task. Skip it only for genuinely trivial work, and then state why it was skipped.
|
|
418
424
|
|
|
419
425
|
Client contract:
|
package/server.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"url": "https://github.com/Arrayo/smart-context-mcp",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.16.1",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "smart-context-mcp",
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.16.1",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
},
|
|
@@ -275,6 +275,7 @@ const shouldReadContentForItem = (item, payload, detailMode, includeSet, intent)
|
|
|
275
275
|
}
|
|
276
276
|
|
|
277
277
|
if (item.role === 'dependency') {
|
|
278
|
+
if ((item.matchedSymbols?.length ?? 0) > 0) return true;
|
|
278
279
|
return !strongIndexSignal && (payload.symbols?.length ?? 0) === 0;
|
|
279
280
|
}
|
|
280
281
|
|
|
@@ -114,6 +114,18 @@ const getFunctionSignature = (statement, sourceFile) => {
|
|
|
114
114
|
return sig.length > 120 ? `${sig.slice(0, 120)}...` : sig;
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
+
const getVariableFunctionSignature = (declaration, sourceFile) => {
|
|
118
|
+
const init = declaration.initializer;
|
|
119
|
+
if (!init) return null;
|
|
120
|
+
if (!ts.isArrowFunction(init) && !ts.isFunctionExpression(init)) return null;
|
|
121
|
+
const body = init.body;
|
|
122
|
+
if (!body) return null;
|
|
123
|
+
const fullText = declaration.getText(sourceFile);
|
|
124
|
+
const bodyOffset = body.getStart(sourceFile) - declaration.getStart(sourceFile);
|
|
125
|
+
const sig = fullText.slice(0, bodyOffset).replace(/\s+$/, '');
|
|
126
|
+
return sig.length > 120 ? `${sig.slice(0, 120)}...` : sig;
|
|
127
|
+
};
|
|
128
|
+
|
|
117
129
|
const formatTopLevelStatement = (statement, sourceFile, mode = 'outline') => {
|
|
118
130
|
const exported = statement.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword) ?? false;
|
|
119
131
|
const prefix = exported ? 'export ' : '';
|
|
@@ -149,6 +161,12 @@ const formatTopLevelStatement = (statement, sourceFile, mode = 'outline') => {
|
|
|
149
161
|
: statement.declarationList.flags & ts.NodeFlags.Let
|
|
150
162
|
? 'let'
|
|
151
163
|
: 'var';
|
|
164
|
+
|
|
165
|
+
if (mode === 'signatures' && statement.declarationList.declarations.length === 1) {
|
|
166
|
+
const sig = getVariableFunctionSignature(statement.declarationList.declarations[0], sourceFile);
|
|
167
|
+
if (sig) return `${prefix}${declarationKind} ${sig}`;
|
|
168
|
+
}
|
|
169
|
+
|
|
152
170
|
return `${prefix}${declarationKind} ${collectVariableNames(statement.declarationList).join(', ')}`;
|
|
153
171
|
}
|
|
154
172
|
|
|
@@ -533,7 +533,8 @@ export const smartSearch = async ({ query, cwd = '.', intent, maxFiles, _testFor
|
|
|
533
533
|
...(validIntent ? { intent: validIntent } : {}),
|
|
534
534
|
...(indexHits ? { indexBoosted: indexHits.size } : {}),
|
|
535
535
|
totalMatches: dedupedMatches.length,
|
|
536
|
-
matchedFiles:
|
|
536
|
+
matchedFiles: cappedGroups.length,
|
|
537
|
+
...(groups.length > cappedGroups.length ? { totalFiles: groups.length } : {}),
|
|
537
538
|
topFiles: cappedGroups.slice(0, 10).map((group) => ({ file: group.file, count: group.count, score: group.score })),
|
|
538
539
|
matches: compressedText,
|
|
539
540
|
};
|