@softerist/heuristic-mcp 2.1.4 → 2.1.6

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 CHANGED
@@ -126,15 +126,7 @@ Install globally via npm:
126
126
  npm install -g @softerist/heuristic-mcp
127
127
  ```
128
128
 
129
- To update to the latest version:
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
- ### Auto-Fix Configuration (New!)
171
+ ### Troubleshooting
180
172
 
181
- To automatically configure your IDEs (Antigravity, Claude, Cursor) with the correct path:
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
- This will automatically find your IDE config files and inject the correct absolute path to the server. You can also target a specific IDE:
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 --register antigravity
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
+ }
@@ -62,7 +62,7 @@ export async function register(filter = null) {
62
62
 
63
63
  const serverConfig = {
64
64
  command: binaryPath,
65
- args: [scriptPath, "--workspace", process.cwd()],
65
+ args: [scriptPath, "--workspace", "${workspaceFolder}"],
66
66
  disabled: false,
67
67
  autoRegistered: true // Marker to know we did this
68
68
  };
@@ -106,7 +106,7 @@ export async function register(filter = null) {
106
106
 
107
107
  // Write back
108
108
  await fs.writeFile(configPath, JSON.stringify(config, null, 2));
109
- console.log(`[Auto-Register] ✅ Successfully registered with ${name}`);
109
+ console.log(`\x1b[32m[Auto-Register] ✅ Successfully registered with ${name}\x1b[0m`);
110
110
  registeredCount++;
111
111
 
112
112
  } catch (err) {
@@ -117,5 +117,22 @@ export async function register(filter = null) {
117
117
  if (registeredCount === 0) {
118
118
  console.log(`[Auto-Register] No compatible IDE configurations found to update.`);
119
119
  console.log(`[Auto-Register] Manual Config:\n${JSON.stringify({ mcpServers: { "heuristic-mcp": serverConfig } }, null, 2)}`);
120
+ } else {
121
+ // Friendly Banner
122
+ console.log('\n\x1b[36m' + '='.repeat(60));
123
+ console.log(' 🚀 Heuristic MCP Installed & Configured! ');
124
+ console.log('='.repeat(60) + '\x1b[0m');
125
+ console.log(`
126
+ \x1b[33mACTION REQUIRED:\x1b[0m
127
+ 1. \x1b[1mRestart your IDE\x1b[0m (or reload the window) to load the new config.
128
+ 2. The server will start automatically in the background.
129
+
130
+ \x1b[32mSTATUS:\x1b[0m
131
+ - \x1b[1mIndexing:\x1b[0m Will begin immediately after restart.
132
+ - \x1b[1mUsage:\x1b[0m You can work while it indexes (it catches up!).
133
+ - \x1b[1mLogs:\x1b[0m Check your IDE's MCP logs if you are curious.
134
+
135
+ \x1b[36mHappy Coding! 🤖\x1b[0m
136
+ `);
120
137
  }
121
138
  }
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.4",
3
+ "version": "2.1.6",
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",