@softerist/heuristic-mcp 2.1.33 → 2.1.34
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/features/register.js +16 -4
- package/index.js +13 -1
- package/lib/config.js +1 -1
- package/package.json +1 -1
package/features/register.js
CHANGED
|
@@ -94,13 +94,19 @@ export async function register(filter = null) {
|
|
|
94
94
|
const binaryPath = process.execPath; // The node binary
|
|
95
95
|
const scriptPath = fileURLToPath(new URL('../index.js', import.meta.url)); // Absolute path to index.js
|
|
96
96
|
|
|
97
|
+
// For Antigravity, we MUST use absolute path because ${workspaceFolder} variable expansion
|
|
98
|
+
// is not supported in the current version, and '.' uses the wrong CWD.
|
|
99
|
+
// For other IDEs, '.' is usually safer or they support variables.
|
|
100
|
+
const workspacePath = currentIDE === 'Antigravity' ? process.cwd() : '.';
|
|
101
|
+
|
|
97
102
|
const serverConfig = {
|
|
98
103
|
command: binaryPath,
|
|
99
|
-
args: [scriptPath, "--workspace",
|
|
104
|
+
args: [scriptPath, "--workspace", workspacePath],
|
|
100
105
|
disabled: false,
|
|
101
106
|
autoRegistered: true // Marker to know we did this
|
|
102
107
|
};
|
|
103
108
|
|
|
109
|
+
|
|
104
110
|
const configPaths = getConfigPaths();
|
|
105
111
|
let registeredCount = 0;
|
|
106
112
|
|
|
@@ -140,11 +146,17 @@ export async function register(filter = null) {
|
|
|
140
146
|
if (fileExists) {
|
|
141
147
|
const content = await fs.readFile(configPath, 'utf-8');
|
|
142
148
|
try {
|
|
143
|
-
|
|
149
|
+
if (!content || content.trim() === '') {
|
|
150
|
+
// Empty file - treat as new
|
|
151
|
+
config = {};
|
|
152
|
+
} else {
|
|
153
|
+
config = JSON.parse(content);
|
|
154
|
+
}
|
|
144
155
|
} catch (e) {
|
|
145
|
-
forceLog(`[Auto-Register]
|
|
146
|
-
|
|
156
|
+
forceLog(`[Auto-Register] Warning: Corrupt/empty ${name} config, resetting to default. Error: ${e.message}`);
|
|
157
|
+
config = {};
|
|
147
158
|
}
|
|
159
|
+
|
|
148
160
|
}
|
|
149
161
|
|
|
150
162
|
// Init mcpServers if missing
|
package/index.js
CHANGED
|
@@ -5,13 +5,16 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
5
5
|
import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
6
6
|
import { pipeline } from "@xenova/transformers";
|
|
7
7
|
import fs from "fs/promises";
|
|
8
|
+
import path from "path";
|
|
9
|
+
|
|
8
10
|
import { createRequire } from "module";
|
|
9
11
|
|
|
10
12
|
// Import package.json for version
|
|
11
13
|
const require = createRequire(import.meta.url);
|
|
12
14
|
const packageJson = require("./package.json");
|
|
13
15
|
|
|
14
|
-
import { loadConfig } from "./lib/config.js";
|
|
16
|
+
import { loadConfig, getGlobalCacheDir } from "./lib/config.js";
|
|
17
|
+
|
|
15
18
|
import { EmbeddingsCache } from "./lib/cache.js";
|
|
16
19
|
import { CodebaseIndexer } from "./features/index-codebase.js";
|
|
17
20
|
import { HybridSearch } from "./features/hybrid-search.js";
|
|
@@ -23,6 +26,15 @@ import * as FindSimilarCodeFeature from "./features/find-similar-code.js";
|
|
|
23
26
|
import * as AnnConfigFeature from "./features/ann-config.js";
|
|
24
27
|
import { register } from "./features/register.js";
|
|
25
28
|
|
|
29
|
+
// Log cache directory logic for debugging
|
|
30
|
+
try {
|
|
31
|
+
const globalCache = path.join(getGlobalCacheDir(), 'heuristic-mcp');
|
|
32
|
+
const localCache = path.join(process.cwd(), '.heuristic-mcp');
|
|
33
|
+
console.error(`[Server] Cache debug: Global=${globalCache}, Local=${localCache}`);
|
|
34
|
+
console.error(`[Server] Process CWD: ${process.cwd()}`);
|
|
35
|
+
} catch (e) {}
|
|
36
|
+
|
|
37
|
+
|
|
26
38
|
// Parse workspace from command line arguments
|
|
27
39
|
const args = process.argv.slice(2);
|
|
28
40
|
|
package/lib/config.js
CHANGED
|
@@ -407,7 +407,7 @@ export async function loadConfig(workspaceDir = null) {
|
|
|
407
407
|
/**
|
|
408
408
|
* Get platform-specific global cache directory
|
|
409
409
|
*/
|
|
410
|
-
function getGlobalCacheDir() {
|
|
410
|
+
export function getGlobalCacheDir() {
|
|
411
411
|
if (process.platform === 'win32') {
|
|
412
412
|
return process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local');
|
|
413
413
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softerist/heuristic-mcp",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.34",
|
|
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",
|