@softerist/heuristic-mcp 2.1.26 → 2.1.28
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/lifecycle.js +3 -14
- package/features/register.js +56 -28
- package/package.json +1 -1
package/features/lifecycle.js
CHANGED
|
@@ -213,7 +213,8 @@ export async function logs() {
|
|
|
213
213
|
const { execSync } = await import('child_process');
|
|
214
214
|
let npmBin = 'unknown';
|
|
215
215
|
try {
|
|
216
|
-
|
|
216
|
+
const prefix = execSync('npm config get prefix', { encoding: 'utf-8' }).trim();
|
|
217
|
+
npmBin = path.join(prefix, 'bin');
|
|
217
218
|
} catch {}
|
|
218
219
|
|
|
219
220
|
// Check all known MCP config paths (same as register.js)
|
|
@@ -237,19 +238,7 @@ export async function logs() {
|
|
|
237
238
|
mcpConfigs.push({ name: 'Claude Desktop', path: claudeConfig, exists: claudeExists });
|
|
238
239
|
}
|
|
239
240
|
|
|
240
|
-
//
|
|
241
|
-
let vscodeConfig = null;
|
|
242
|
-
if (process.platform === 'darwin') {
|
|
243
|
-
vscodeConfig = path.join(home, 'Library', 'Application Support', 'Code', 'User', 'settings.json');
|
|
244
|
-
} else if (process.platform === 'win32') {
|
|
245
|
-
vscodeConfig = path.join(process.env.APPDATA || '', 'Code', 'User', 'settings.json');
|
|
246
|
-
} else {
|
|
247
|
-
vscodeConfig = path.join(home, '.config', 'Code', 'User', 'settings.json');
|
|
248
|
-
}
|
|
249
|
-
const vscodeExists = await fs.access(vscodeConfig).then(() => true).catch(() => false);
|
|
250
|
-
mcpConfigs.push({ name: 'VS Code', path: vscodeConfig, exists: vscodeExists });
|
|
251
|
-
|
|
252
|
-
// Cursor (uses similar structure to VS Code)
|
|
241
|
+
// Cursor (uses settings.json with mcpServers key)
|
|
253
242
|
let cursorConfig = null;
|
|
254
243
|
if (process.platform === 'darwin') {
|
|
255
244
|
cursorConfig = path.join(home, 'Library', 'Application Support', 'Cursor', 'User', 'settings.json');
|
package/features/register.js
CHANGED
|
@@ -16,53 +16,77 @@ function expandPath(p) {
|
|
|
16
16
|
return p;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
// Detect which IDE is running the install
|
|
20
|
+
function detectCurrentIDE() {
|
|
21
|
+
// Check environment variables to determine which IDE is running
|
|
22
|
+
if (process.env.ANTIGRAVITY_AGENT) {
|
|
23
|
+
return 'Antigravity';
|
|
24
|
+
}
|
|
25
|
+
if (process.env.CURSOR_AGENT) {
|
|
26
|
+
return 'Cursor';
|
|
27
|
+
}
|
|
28
|
+
// Claude Desktop doesn't have a known env var, so we rely on existing config detection
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
19
32
|
// Known config paths for different IDEs
|
|
20
|
-
function getConfigPaths() {
|
|
33
|
+
function getConfigPaths(filterToCurrentIDE = true) {
|
|
21
34
|
const platform = process.platform;
|
|
22
35
|
const home = os.homedir();
|
|
23
|
-
const
|
|
36
|
+
const allPaths = [];
|
|
24
37
|
|
|
25
38
|
// Antigravity
|
|
26
|
-
|
|
39
|
+
allPaths.push({
|
|
27
40
|
name: 'Antigravity',
|
|
28
|
-
path: path.join(home, '.gemini', 'antigravity', 'mcp_config.json')
|
|
41
|
+
path: path.join(home, '.gemini', 'antigravity', 'mcp_config.json'),
|
|
42
|
+
canCreate: true // Dedicated MCP config, safe to create
|
|
29
43
|
});
|
|
30
44
|
|
|
31
45
|
// Claude Desktop
|
|
32
46
|
if (platform === 'darwin') {
|
|
33
|
-
|
|
47
|
+
allPaths.push({
|
|
34
48
|
name: 'Claude Desktop',
|
|
35
|
-
path: path.join(home, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json')
|
|
49
|
+
path: path.join(home, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json'),
|
|
50
|
+
canCreate: true // Dedicated config file
|
|
36
51
|
});
|
|
37
52
|
} else if (platform === 'win32') {
|
|
38
|
-
|
|
53
|
+
allPaths.push({
|
|
39
54
|
name: 'Claude Desktop',
|
|
40
|
-
path: path.join(process.env.APPDATA || '', 'Claude', 'claude_desktop_config.json')
|
|
55
|
+
path: path.join(process.env.APPDATA || '', 'Claude', 'claude_desktop_config.json'),
|
|
56
|
+
canCreate: true
|
|
41
57
|
});
|
|
42
58
|
}
|
|
43
59
|
|
|
44
|
-
//
|
|
45
|
-
// because settings.json is a general config file that should not be auto-modified.
|
|
46
|
-
|
|
47
|
-
// Cursor (has MCP support, uses settings.json key)
|
|
60
|
+
// Cursor (uses settings.json with mcpServers key)
|
|
48
61
|
if (platform === 'darwin') {
|
|
49
|
-
|
|
62
|
+
allPaths.push({
|
|
50
63
|
name: 'Cursor',
|
|
51
|
-
path: path.join(home, 'Library', 'Application Support', 'Cursor', 'User', 'settings.json')
|
|
64
|
+
path: path.join(home, 'Library', 'Application Support', 'Cursor', 'User', 'settings.json'),
|
|
65
|
+
canCreate: false // Shared settings file, only update if exists
|
|
52
66
|
});
|
|
53
67
|
} else if (platform === 'win32') {
|
|
54
|
-
|
|
68
|
+
allPaths.push({
|
|
55
69
|
name: 'Cursor',
|
|
56
|
-
path: path.join(process.env.APPDATA || '', 'Cursor', 'User', 'settings.json')
|
|
70
|
+
path: path.join(process.env.APPDATA || '', 'Cursor', 'User', 'settings.json'),
|
|
71
|
+
canCreate: false
|
|
57
72
|
});
|
|
58
73
|
} else {
|
|
59
|
-
|
|
74
|
+
allPaths.push({
|
|
60
75
|
name: 'Cursor',
|
|
61
|
-
path: path.join(home, '.config', 'Cursor', 'User', 'settings.json')
|
|
76
|
+
path: path.join(home, '.config', 'Cursor', 'User', 'settings.json'),
|
|
77
|
+
canCreate: false
|
|
62
78
|
});
|
|
63
79
|
}
|
|
64
80
|
|
|
65
|
-
|
|
81
|
+
// Filter to current IDE if detected and requested
|
|
82
|
+
if (filterToCurrentIDE) {
|
|
83
|
+
const currentIDE = detectCurrentIDE();
|
|
84
|
+
if (currentIDE) {
|
|
85
|
+
return allPaths.filter(p => p.name === currentIDE);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return allPaths;
|
|
66
90
|
}
|
|
67
91
|
|
|
68
92
|
// Helper to force output to terminal, bypassing npm's silence
|
|
@@ -94,13 +118,13 @@ export async function register(filter = null) {
|
|
|
94
118
|
|
|
95
119
|
forceLog(`[Auto-Register] Detecting IDE configurations...`);
|
|
96
120
|
|
|
97
|
-
for (const { name, path: configPath } of configPaths) {
|
|
121
|
+
for (const { name, path: configPath, canCreate } of configPaths) {
|
|
98
122
|
if (filter && name.toLowerCase() !== filter.toLowerCase()) {
|
|
99
123
|
continue;
|
|
100
124
|
}
|
|
101
125
|
|
|
102
126
|
try {
|
|
103
|
-
// Check if file exists -
|
|
127
|
+
// Check if file exists - create if canCreate is true for this IDE
|
|
104
128
|
let config = {};
|
|
105
129
|
let fileExists = true;
|
|
106
130
|
|
|
@@ -109,13 +133,17 @@ export async function register(filter = null) {
|
|
|
109
133
|
} catch {
|
|
110
134
|
fileExists = false;
|
|
111
135
|
|
|
112
|
-
//
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
136
|
+
// Only create config if this IDE allows it (has dedicated MCP config file)
|
|
137
|
+
if (canCreate) {
|
|
138
|
+
try {
|
|
139
|
+
await fs.mkdir(path.dirname(configPath), { recursive: true });
|
|
140
|
+
forceLog(`[Auto-Register] Creating ${name} config at ${configPath}`);
|
|
141
|
+
} catch (mkdirErr) {
|
|
142
|
+
forceLog(`[Auto-Register] Skipped ${name}: Cannot create config directory: ${mkdirErr.message}`);
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
// Skip IDEs that use shared settings files if they don't exist
|
|
119
147
|
continue;
|
|
120
148
|
}
|
|
121
149
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softerist/heuristic-mcp",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.28",
|
|
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",
|