smart-coding-mcp 1.2.1 → 1.2.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.
- package/README.md +41 -15
- package/config.json +51 -4
- package/features/clear-cache.js +7 -0
- package/features/hybrid-search.js +7 -0
- package/features/index-codebase.js +7 -5
- package/index.js +14 -9
- package/lib/config.js +26 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,7 +38,17 @@ npm install -g smart-coding-mcp
|
|
|
38
38
|
|
|
39
39
|
## Configuration
|
|
40
40
|
|
|
41
|
-
Add to your MCP configuration file
|
|
41
|
+
Add to your MCP configuration file. The location depends on your IDE and OS:
|
|
42
|
+
|
|
43
|
+
| IDE | OS | Config Path |
|
|
44
|
+
| -------------------- | ------- | ----------------------------------------------------------------- |
|
|
45
|
+
| **Claude Desktop** | macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` |
|
|
46
|
+
| **Claude Desktop** | Windows | `%APPDATA%\Claude\claude_desktop_config.json` |
|
|
47
|
+
| **Cascade (Cursor)** | All | Configured via UI Settings > Features > MCP |
|
|
48
|
+
| **Antigravity** | macOS | `~/.gemini/antigravity/mcp_config.json` |
|
|
49
|
+
| **Antigravity** | Windows | `%USERPROFILE%\.gemini\antigravity\mcp_config.json` |
|
|
50
|
+
|
|
51
|
+
Add the server configuration to the `mcpServers` object in your config file:
|
|
42
52
|
|
|
43
53
|
### Option 1: Specific Project (Recommended)
|
|
44
54
|
|
|
@@ -86,14 +96,17 @@ Add to your MCP configuration file (e.g., `~/.config/claude/mcp.json` or similar
|
|
|
86
96
|
|
|
87
97
|
Override configuration settings via environment variables in your MCP config:
|
|
88
98
|
|
|
89
|
-
| Variable
|
|
90
|
-
|
|
|
91
|
-
| `SMART_CODING_VERBOSE`
|
|
92
|
-
| `SMART_CODING_BATCH_SIZE`
|
|
93
|
-
| `SMART_CODING_MAX_FILE_SIZE`
|
|
94
|
-
| `SMART_CODING_CHUNK_SIZE`
|
|
95
|
-
| `SMART_CODING_MAX_RESULTS`
|
|
96
|
-
| `SMART_CODING_SMART_INDEXING`
|
|
99
|
+
| Variable | Type | Default | Description |
|
|
100
|
+
| -------------------------------- | ------- | --------- | ------------------------------------- |
|
|
101
|
+
| `SMART_CODING_VERBOSE` | boolean | `false` | Enable detailed logging |
|
|
102
|
+
| `SMART_CODING_BATCH_SIZE` | number | `100` | Files to process in parallel |
|
|
103
|
+
| `SMART_CODING_MAX_FILE_SIZE` | number | `1048576` | Max file size in bytes (1MB) |
|
|
104
|
+
| `SMART_CODING_CHUNK_SIZE` | number | `15` | Lines of code per chunk |
|
|
105
|
+
| `SMART_CODING_MAX_RESULTS` | number | `5` | Max search results |
|
|
106
|
+
| `SMART_CODING_SMART_INDEXING` | boolean | `true` | Enable smart project detection |
|
|
107
|
+
| `SMART_CODING_WATCH_FILES` | boolean | `false` | Enable file watching for auto-reindex |
|
|
108
|
+
| `SMART_CODING_SEMANTIC_WEIGHT` | number | `0.7` | Weight for semantic similarity (0-1) |
|
|
109
|
+
| `SMART_CODING_EXACT_MATCH_BOOST` | number | `1.5` | Boost for exact text matches |
|
|
97
110
|
|
|
98
111
|
**Example with environment variables:**
|
|
99
112
|
|
|
@@ -353,11 +366,24 @@ Potential areas for improvement:
|
|
|
353
366
|
|
|
354
367
|
## License
|
|
355
368
|
|
|
356
|
-
MIT
|
|
369
|
+
MIT License
|
|
370
|
+
|
|
371
|
+
Copyright (c) 2025 Omar Haris
|
|
372
|
+
|
|
373
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
374
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
375
|
+
in the Software without restriction, including without limitation the rights
|
|
376
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
377
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
378
|
+
furnished to do so, subject to the following conditions:
|
|
357
379
|
|
|
358
|
-
|
|
380
|
+
The above copyright notice and this permission notice shall be included in all
|
|
381
|
+
copies or substantial portions of the Software.
|
|
359
382
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
383
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
384
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
385
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
386
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
387
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
388
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
389
|
+
SOFTWARE.
|
package/config.json
CHANGED
|
@@ -1,7 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"searchDirectory": ".",
|
|
3
|
-
"fileExtensions": [
|
|
4
|
-
|
|
3
|
+
"fileExtensions": [
|
|
4
|
+
"js",
|
|
5
|
+
"ts",
|
|
6
|
+
"jsx",
|
|
7
|
+
"tsx",
|
|
8
|
+
"mjs",
|
|
9
|
+
"cjs",
|
|
10
|
+
"css",
|
|
11
|
+
"scss",
|
|
12
|
+
"sass",
|
|
13
|
+
"less",
|
|
14
|
+
"html",
|
|
15
|
+
"htm",
|
|
16
|
+
"xml",
|
|
17
|
+
"svg",
|
|
18
|
+
"py",
|
|
19
|
+
"pyw",
|
|
20
|
+
"java",
|
|
21
|
+
"kt",
|
|
22
|
+
"scala",
|
|
23
|
+
"c",
|
|
24
|
+
"cpp",
|
|
25
|
+
"h",
|
|
26
|
+
"hpp",
|
|
27
|
+
"cs",
|
|
28
|
+
"go",
|
|
29
|
+
"rs",
|
|
30
|
+
"rb",
|
|
31
|
+
"php",
|
|
32
|
+
"swift",
|
|
33
|
+
"sh",
|
|
34
|
+
"bash",
|
|
35
|
+
"json",
|
|
36
|
+
"yaml",
|
|
37
|
+
"yml",
|
|
38
|
+
"toml",
|
|
39
|
+
"sql"
|
|
40
|
+
],
|
|
41
|
+
"excludePatterns": [
|
|
42
|
+
"**/node_modules/**",
|
|
43
|
+
"**/dist/**",
|
|
44
|
+
"**/build/**",
|
|
45
|
+
"**/.git/**",
|
|
46
|
+
"**/coverage/**",
|
|
47
|
+
"**/.next/**",
|
|
48
|
+
"**/target/**",
|
|
49
|
+
"**/vendor/**",
|
|
50
|
+
"**/.smart-coding-cache/**"
|
|
51
|
+
],
|
|
5
52
|
"smartIndexing": true,
|
|
6
53
|
"chunkSize": 15,
|
|
7
54
|
"chunkOverlap": 3,
|
|
@@ -10,9 +57,9 @@
|
|
|
10
57
|
"maxResults": 5,
|
|
11
58
|
"enableCache": true,
|
|
12
59
|
"cacheDirectory": "./.smart-coding-cache",
|
|
13
|
-
"watchFiles":
|
|
60
|
+
"watchFiles": false,
|
|
14
61
|
"verbose": false,
|
|
15
62
|
"embeddingModel": "Xenova/all-MiniLM-L6-v2",
|
|
16
63
|
"semanticWeight": 0.7,
|
|
17
64
|
"exactMatchBoost": 1.5
|
|
18
|
-
}
|
|
65
|
+
}
|
package/features/clear-cache.js
CHANGED
|
@@ -21,6 +21,13 @@ export function getToolDefinition() {
|
|
|
21
21
|
inputSchema: {
|
|
22
22
|
type: "object",
|
|
23
23
|
properties: {}
|
|
24
|
+
},
|
|
25
|
+
annotations: {
|
|
26
|
+
title: "Clear Embeddings Cache",
|
|
27
|
+
readOnlyHint: false,
|
|
28
|
+
destructiveHint: true,
|
|
29
|
+
idempotentHint: true,
|
|
30
|
+
openWorldHint: false
|
|
24
31
|
}
|
|
25
32
|
};
|
|
26
33
|
}
|
|
@@ -89,6 +89,13 @@ export function getToolDefinition(config) {
|
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
required: ["query"]
|
|
92
|
+
},
|
|
93
|
+
annotations: {
|
|
94
|
+
title: "Semantic Code Search",
|
|
95
|
+
readOnlyHint: true,
|
|
96
|
+
destructiveHint: false,
|
|
97
|
+
idempotentHint: true,
|
|
98
|
+
openWorldHint: false
|
|
92
99
|
}
|
|
93
100
|
};
|
|
94
101
|
}
|
|
@@ -161,11 +161,6 @@ export class CodebaseIndexer {
|
|
|
161
161
|
|
|
162
162
|
console.error("[Indexer] File watcher enabled for incremental indexing");
|
|
163
163
|
}
|
|
164
|
-
|
|
165
|
-
async initialize() {
|
|
166
|
-
await this.indexAll();
|
|
167
|
-
this.setupFileWatcher();
|
|
168
|
-
}
|
|
169
164
|
}
|
|
170
165
|
|
|
171
166
|
// MCP Tool definition for this feature
|
|
@@ -182,6 +177,13 @@ export function getToolDefinition() {
|
|
|
182
177
|
default: false
|
|
183
178
|
}
|
|
184
179
|
}
|
|
180
|
+
},
|
|
181
|
+
annotations: {
|
|
182
|
+
title: "Reindex Codebase",
|
|
183
|
+
readOnlyHint: false,
|
|
184
|
+
destructiveHint: false,
|
|
185
|
+
idempotentHint: true,
|
|
186
|
+
openWorldHint: false
|
|
185
187
|
}
|
|
186
188
|
};
|
|
187
189
|
}
|
package/index.js
CHANGED
|
@@ -54,17 +54,17 @@ let indexer = null;
|
|
|
54
54
|
let hybridSearch = null;
|
|
55
55
|
let config = null;
|
|
56
56
|
|
|
57
|
-
// Feature registry
|
|
57
|
+
// Feature registry - ordered by priority (semantic_search first as primary tool)
|
|
58
58
|
const features = [
|
|
59
59
|
{
|
|
60
|
-
module:
|
|
60
|
+
module: HybridSearchFeature,
|
|
61
61
|
instance: null,
|
|
62
|
-
handler:
|
|
62
|
+
handler: HybridSearchFeature.handleToolCall
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
|
-
module:
|
|
65
|
+
module: IndexCodebaseFeature,
|
|
66
66
|
instance: null,
|
|
67
|
-
handler:
|
|
67
|
+
handler: IndexCodebaseFeature.handleToolCall
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
70
|
module: ClearCacheFeature,
|
|
@@ -99,14 +99,19 @@ async function initialize() {
|
|
|
99
99
|
hybridSearch = new HybridSearch(embedder, cache, config);
|
|
100
100
|
const cacheClearer = new ClearCacheFeature.CacheClearer(embedder, cache, config);
|
|
101
101
|
|
|
102
|
-
// Store feature instances
|
|
103
|
-
features[0].instance =
|
|
104
|
-
features[1].instance =
|
|
102
|
+
// Store feature instances (matches features array order)
|
|
103
|
+
features[0].instance = hybridSearch;
|
|
104
|
+
features[1].instance = indexer;
|
|
105
105
|
features[2].instance = cacheClearer;
|
|
106
106
|
|
|
107
107
|
// Start indexing in background (non-blocking)
|
|
108
108
|
console.error("[Server] Starting background indexing...");
|
|
109
|
-
indexer.
|
|
109
|
+
indexer.indexAll().then(() => {
|
|
110
|
+
// Only start file watcher if explicitly enabled in config
|
|
111
|
+
if (config.watchFiles) {
|
|
112
|
+
indexer.setupFileWatcher();
|
|
113
|
+
}
|
|
114
|
+
}).catch(err => {
|
|
110
115
|
console.error("[Server] Background indexing error:", err.message);
|
|
111
116
|
});
|
|
112
117
|
}
|
package/lib/config.js
CHANGED
|
@@ -57,7 +57,7 @@ const DEFAULT_CONFIG = {
|
|
|
57
57
|
maxResults: 5,
|
|
58
58
|
enableCache: true,
|
|
59
59
|
cacheDirectory: "./.smart-coding-cache",
|
|
60
|
-
watchFiles:
|
|
60
|
+
watchFiles: false,
|
|
61
61
|
verbose: false,
|
|
62
62
|
embeddingModel: "Xenova/all-MiniLM-L6-v2",
|
|
63
63
|
semanticWeight: 0.7,
|
|
@@ -187,6 +187,31 @@ export async function loadConfig(workspaceDir = null) {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
if (process.env.SMART_CODING_WATCH_FILES !== undefined) {
|
|
191
|
+
const value = process.env.SMART_CODING_WATCH_FILES;
|
|
192
|
+
if (value === 'true' || value === 'false') {
|
|
193
|
+
config.watchFiles = value === 'true';
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (process.env.SMART_CODING_SEMANTIC_WEIGHT !== undefined) {
|
|
198
|
+
const value = parseFloat(process.env.SMART_CODING_SEMANTIC_WEIGHT);
|
|
199
|
+
if (!isNaN(value) && value >= 0 && value <= 1) {
|
|
200
|
+
config.semanticWeight = value;
|
|
201
|
+
} else {
|
|
202
|
+
console.error(`[Config] Invalid SMART_CODING_SEMANTIC_WEIGHT: ${process.env.SMART_CODING_SEMANTIC_WEIGHT}, using default (must be 0-1)`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (process.env.SMART_CODING_EXACT_MATCH_BOOST !== undefined) {
|
|
207
|
+
const value = parseFloat(process.env.SMART_CODING_EXACT_MATCH_BOOST);
|
|
208
|
+
if (!isNaN(value) && value >= 0) {
|
|
209
|
+
config.exactMatchBoost = value;
|
|
210
|
+
} else {
|
|
211
|
+
console.error(`[Config] Invalid SMART_CODING_EXACT_MATCH_BOOST: ${process.env.SMART_CODING_EXACT_MATCH_BOOST}, using default`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
190
215
|
return config;
|
|
191
216
|
}
|
|
192
217
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smart-coding-mcp",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "An extensible MCP server that enhances coding productivity with AI-powered features including semantic code search, intelligent indexing, and more, using local LLMs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|