@softerist/heuristic-mcp 2.1.4 → 2.1.5
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 +19 -13
- package/features/lifecycle.js +45 -0
- package/features/register.js +1 -1
- package/index.js +11 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -126,15 +126,7 @@ Install globally via npm:
|
|
|
126
126
|
npm install -g @softerist/heuristic-mcp
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
```bash
|
|
132
|
-
npm update -g @softerist/heuristic-mcp
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
## Configuration
|
|
136
|
-
|
|
137
|
-
Add to your MCP configuration file. The location depends on your IDE and OS:
|
|
129
|
+
That's it! The installer will automatically detect your IDE (Antigravity, Claude, Cursor) and configure it for you.
|
|
138
130
|
|
|
139
131
|
| IDE | OS | Config Path |
|
|
140
132
|
| -------------------- | ------- | ----------------------------------------------------------------- |
|
|
@@ -176,20 +168,34 @@ Add the server configuration to the `mcpServers` object in your config file:
|
|
|
176
168
|
}
|
|
177
169
|
```
|
|
178
170
|
|
|
179
|
-
###
|
|
171
|
+
### Troubleshooting
|
|
180
172
|
|
|
181
|
-
|
|
173
|
+
If for some reason the server isn't detected automatically, you can trigger the registration manually:
|
|
182
174
|
|
|
183
175
|
```bash
|
|
184
176
|
heuristic-mcp --register
|
|
185
177
|
```
|
|
186
178
|
|
|
187
|
-
|
|
179
|
+
### Starting and Stopping
|
|
180
|
+
|
|
181
|
+
If you need to restart the server or kill a zombie process:
|
|
182
|
+
|
|
183
|
+
**Stop the server:**
|
|
188
184
|
|
|
189
185
|
```bash
|
|
190
|
-
heuristic-mcp --
|
|
186
|
+
heuristic-mcp --stop
|
|
191
187
|
```
|
|
192
188
|
|
|
189
|
+
*(This kills any running instances of the server)*
|
|
190
|
+
|
|
191
|
+
**Start/Enable the server:**
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
heuristic-mcp --start
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
*(This re-runs the configuration step to ensure it is enabled in your IDE)*
|
|
198
|
+
|
|
193
199
|
---
|
|
194
200
|
|
|
195
201
|
## Environment Variables
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { exec } from 'child_process';
|
|
2
|
+
import util from 'util';
|
|
3
|
+
const execPromise = util.promisify(exec);
|
|
4
|
+
|
|
5
|
+
export async function stop() {
|
|
6
|
+
console.log('[Lifecycle] Stopping Heuristic MCP servers...');
|
|
7
|
+
try {
|
|
8
|
+
const platform = process.platform;
|
|
9
|
+
let command = '';
|
|
10
|
+
|
|
11
|
+
if (platform === 'win32') {
|
|
12
|
+
// Windows: Use wmic to find node processes running our script
|
|
13
|
+
command = `wmic process where "CommandLine like '%heuristic-mcp/index.js%'" delete`;
|
|
14
|
+
} else {
|
|
15
|
+
// Unix/Linux/Mac: Use pkill to find the process matching the script path
|
|
16
|
+
// We exclude the current process to avoid suicide if we are running from the same script
|
|
17
|
+
// however, usually the CLI runner is a different PID than the server.
|
|
18
|
+
command = `pkill -f "heuristic-mcp/index.js"`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
await execPromise(command);
|
|
22
|
+
console.log('[Lifecycle] ✅ Stopped all running instances.');
|
|
23
|
+
} catch (error) {
|
|
24
|
+
// pkill returns non-zero if no process found, which is fine
|
|
25
|
+
if (error.code === 1 || error.message.includes('No Instance(s) Available')) {
|
|
26
|
+
console.log('[Lifecycle] No running instances found.');
|
|
27
|
+
} else {
|
|
28
|
+
// Don't fail hard, just warn
|
|
29
|
+
console.warn(`[Lifecycle] Note: Could not stop server (it might not be running). Detail: ${error.message}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export async function start() {
|
|
35
|
+
console.log('[Lifecycle] Ensuring server is configured...');
|
|
36
|
+
// Re-use the registration logic to ensure the config is present and correct
|
|
37
|
+
try {
|
|
38
|
+
const { register } = await import('./register.js');
|
|
39
|
+
await register();
|
|
40
|
+
console.log('[Lifecycle] ✅ Configuration checked.');
|
|
41
|
+
console.log('[Lifecycle] To start the server, please reload your IDE window or restart the IDE.');
|
|
42
|
+
} catch (err) {
|
|
43
|
+
console.error(`[Lifecycle] Failed to configure server: ${err.message}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
package/features/register.js
CHANGED
|
@@ -62,7 +62,7 @@ export async function register(filter = null) {
|
|
|
62
62
|
|
|
63
63
|
const serverConfig = {
|
|
64
64
|
command: binaryPath,
|
|
65
|
-
args: [scriptPath, "--workspace",
|
|
65
|
+
args: [scriptPath, "--workspace", "${workspaceFolder}"],
|
|
66
66
|
disabled: false,
|
|
67
67
|
autoRegistered: true // Marker to know we did this
|
|
68
68
|
};
|
package/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
|
+
import { stop, start } from "./features/lifecycle.js";
|
|
3
4
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
5
|
import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
5
6
|
import { pipeline } from "@xenova/transformers";
|
|
@@ -24,6 +25,16 @@ import { register } from "./features/register.js";
|
|
|
24
25
|
// Parse workspace from command line arguments
|
|
25
26
|
const args = process.argv.slice(2);
|
|
26
27
|
|
|
28
|
+
if (args.includes('--stop')) {
|
|
29
|
+
await stop();
|
|
30
|
+
process.exit(0);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (args.includes('--start')) {
|
|
34
|
+
await start();
|
|
35
|
+
process.exit(0);
|
|
36
|
+
}
|
|
37
|
+
|
|
27
38
|
// Check if --register flag is present
|
|
28
39
|
if (args.includes('--register')) {
|
|
29
40
|
// Extract optional filter (e.g. --register antigravity)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softerist/heuristic-mcp",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"description": "An enhanced MCP server providing intelligent semantic code search with find-similar-code, recency ranking, and improved chunking. Fork of smart-coding-mcp.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"dev": "node --watch index.js",
|
|
13
13
|
"test": "vitest run",
|
|
14
14
|
"test:watch": "vitest",
|
|
15
|
-
"clear-cache": "node scripts/clear-cache.js"
|
|
15
|
+
"clear-cache": "node scripts/clear-cache.js",
|
|
16
|
+
"postinstall": "node index.js --register"
|
|
16
17
|
},
|
|
17
18
|
"keywords": [
|
|
18
19
|
"mcp",
|