@softerist/heuristic-mcp 2.1.33 → 2.1.35

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.
@@ -93,14 +93,21 @@ function forceLog(message) {
93
93
  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
+ const currentIDE = detectCurrentIDE();
97
+
98
+ // For Antigravity, we MUST use absolute path because ${workspaceFolder} variable expansion
99
+ // is not supported in the current version, and '.' uses the wrong CWD.
100
+ // For other IDEs, '.' is usually safer or they support variables.
101
+ const workspacePath = currentIDE === 'Antigravity' ? process.cwd() : '.';
96
102
 
97
103
  const serverConfig = {
98
104
  command: binaryPath,
99
- args: [scriptPath, "--workspace", "."], // Use . (CWD) to avoid variable expansion issues
105
+ args: [scriptPath, "--workspace", workspacePath],
100
106
  disabled: false,
101
107
  autoRegistered: true // Marker to know we did this
102
108
  };
103
109
 
110
+
104
111
  const configPaths = getConfigPaths();
105
112
  let registeredCount = 0;
106
113
 
@@ -140,11 +147,17 @@ export async function register(filter = null) {
140
147
  if (fileExists) {
141
148
  const content = await fs.readFile(configPath, 'utf-8');
142
149
  try {
143
- config = JSON.parse(content);
150
+ if (!content || content.trim() === '') {
151
+ // Empty file - treat as new
152
+ config = {};
153
+ } else {
154
+ config = JSON.parse(content);
155
+ }
144
156
  } catch (e) {
145
- forceLog(`[Auto-Register] Error parsing ${name} config: ${e.message}`);
146
- continue;
157
+ forceLog(`[Auto-Register] Warning: Corrupt/empty ${name} config, resetting to default. Error: ${e.message}`);
158
+ config = {};
147
159
  }
160
+
148
161
  }
149
162
 
150
163
  // 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.33",
3
+ "version": "2.1.35",
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",