genexus-mcp 1.1.3 ā 1.1.4
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/cli/run.js +45 -5
- package/package.json +1 -1
package/cli/run.js
CHANGED
|
@@ -40,12 +40,52 @@ if (args[0] === 'init' || args[0] === 'setup') {
|
|
|
40
40
|
try {
|
|
41
41
|
if (!fs.existsSync(finalKb)) fs.mkdirSync(finalKb, { recursive: true });
|
|
42
42
|
fs.writeFileSync(targetConfigPath, JSON.stringify(defaultConfig, null, 2));
|
|
43
|
+
|
|
44
|
+
const os = require('os');
|
|
43
45
|
console.log('\nā
Success! Configuration saved at: ' + targetConfigPath + '\n');
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
|
|
47
|
+
// AI Client Auto-Patching
|
|
48
|
+
const claudeWin = path.join(os.homedir(), 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json');
|
|
49
|
+
const claudeMac = path.join(os.homedir(), 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
|
|
50
|
+
const antigravityCfg = path.join(os.homedir(), '.gemini', 'antigravity', 'mcp_config.json');
|
|
51
|
+
|
|
52
|
+
const patchConfig = (cfgPath, clientName) => {
|
|
53
|
+
if (fs.existsSync(cfgPath)) {
|
|
54
|
+
try {
|
|
55
|
+
const rawStr = fs.readFileSync(cfgPath, 'utf8');
|
|
56
|
+
const cfgStr = rawStr.replace(/^\uFEFF/, ''); // Strip BOM if present
|
|
57
|
+
let cfgObj = {};
|
|
58
|
+
if (cfgStr.trim() !== '') cfgObj = JSON.parse(cfgStr);
|
|
59
|
+
|
|
60
|
+
cfgObj.mcpServers = cfgObj.mcpServers || {};
|
|
61
|
+
cfgObj.mcpServers["genexus"] = {
|
|
62
|
+
command: process.platform === 'win32' ? "npx.cmd" : "npx",
|
|
63
|
+
args: ["-y", "genexus-mcp@latest"],
|
|
64
|
+
env: { "GX_CONFIG_PATH": targetConfigPath }
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
fs.writeFileSync(cfgPath, JSON.stringify(cfgObj, null, 2));
|
|
68
|
+
console.log(`š¤ Auto-configured ${clientName} successfully!`);
|
|
69
|
+
return true;
|
|
70
|
+
} catch (e) {
|
|
71
|
+
console.log(`ā ļø Found ${clientName} but couldn't parse its config: ${e.message}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const claudePatched = patchConfig(claudeWin, 'Claude Desktop') || patchConfig(claudeMac, 'Claude Desktop');
|
|
78
|
+
const antiPatched = patchConfig(antigravityCfg, 'Antigravity');
|
|
79
|
+
|
|
80
|
+
if (claudePatched || antiPatched) {
|
|
81
|
+
console.log('\nš You are all set! Please restart your AI Assistant to connect to GeneXus.');
|
|
82
|
+
} else {
|
|
83
|
+
console.log('If you are using a Global Agent (like Claude Desktop or Antigravity),');
|
|
84
|
+
console.log('you MUST copy this exact path and put it in your AI configuration:\n');
|
|
85
|
+
console.log(` "env": {`);
|
|
86
|
+
console.log(` "GX_CONFIG_PATH": "${targetConfigPath.replace(/\\/g, '\\\\')}"`);
|
|
87
|
+
console.log(` }\n`);
|
|
88
|
+
}
|
|
49
89
|
} catch (err) {
|
|
50
90
|
console.error('\nā Failed to save configuration: ' + err.message);
|
|
51
91
|
}
|