genexus-mcp 1.1.2 → 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.
Files changed (3) hide show
  1. package/README.md +14 -6
  2. package/cli/run.js +116 -11
  3. package/package.json +25 -25
package/README.md CHANGED
@@ -10,19 +10,27 @@ A high-performance Model Context Protocol (MCP) server for GeneXus 18. It integr
10
10
 
11
11
  You **do not** need to clone this repository or install anything globally if you have Node.js installed. You can configure your AI Assistant (Claude Desktop, Cursor, RooCode, etc.) to fetch and run the server dynamically!
12
12
 
13
- ### 1. Go to your Knowledge Base folder
14
- You don't need to configure anything. By default, the `genexus-mcp` automatically discovers where GeneXus 18/17 is installed on your `C:\` drive and dynamically maps the Knowledge Base to your Current Working Directory!
13
+ ### 1. Zero Configuration (For Cursor, Cline & Roo)
14
+ If your AI Tool runs inside an IDE (where the Current Working Directory is your KB), you don't need to configure anything. `genexus-mcp` automatically discovers where GeneXus is installed and dynamically binds to your current Knowledge Base!
15
15
 
16
- *(If you are running the AI tool outside your KB directory, you can manually create a `config.json` with `Environment.KBPath` and `GeneXus.InstallationPath` to override the auto-discovery).*
16
+ ### 2. Guided Setup Wizard (For Claude Desktop & Antigravity)
17
+ If you are using a Global Desktop Agent, its "Current Directory" is the global `Program Files` directory, not your project. Therefore, you must generate a `config.json` file.
18
+ Open a terminal in any folder and run our **Setup Wizard**:
17
19
 
18
- ### 2. Configure your AI Assistant
19
- Add the `mcpServers` configuration block into your AI tool (e.g. `claude_desktop_config.json`):
20
+ ```bash
21
+ npx genexus-mcp init
22
+ ```
23
+ *The wizard will ask you for your KB folder and GeneXus path, create the configuration, and output the exact JSON snippet you must paste into your AI Assistant!*
24
+
25
+ ### 3. Add to your AI Assistant
26
+ Add the `mcpServers` configuration block into your AI Tool settings.
20
27
 
21
28
  ```json
22
29
  "mcpServers": {
23
30
  "genexus": {
24
- "command": "npx",
31
+ "command": "npx.cmd", // Windows requires npx.cmd
25
32
  "args": ["-y", "genexus-mcp@latest"]
33
+ // "env": { "GX_CONFIG_PATH": "C:\\path\\to\\your\\config.json" } // Only if generated by 'init'!
26
34
  }
27
35
  }
28
36
  ```
package/cli/run.js CHANGED
@@ -4,6 +4,97 @@ const path = require('path');
4
4
  const fs = require('fs');
5
5
 
6
6
  const cwdConfigPath = path.join(process.cwd(), 'config.json');
7
+ const args = process.argv.slice(2);
8
+
9
+ // Interactive Setup Wizard
10
+ if (args[0] === 'init' || args[0] === 'setup') {
11
+ console.log('================================================');
12
+ console.log('šŸš€ GeneXus MCP - Zero Configuration Setup Wizard');
13
+ console.log('================================================\n');
14
+
15
+ const readline = require('readline');
16
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
17
+
18
+ let defaultGx = "C:\\Program Files (x86)\\GeneXus\\GeneXus18";
19
+ const possibleGxPaths = [
20
+ "C:\\Program Files (x86)\\GeneXus\\GeneXus18",
21
+ "C:\\Program Files (x86)\\GeneXus\\GeneXus17",
22
+ "C:\\Program Files\\GeneXus\\GeneXus18"
23
+ ];
24
+ for (const p of possibleGxPaths) {
25
+ if (fs.existsSync(path.join(p, 'genexus.exe'))) { defaultGx = p; break; }
26
+ }
27
+
28
+ rl.question('1. Enter your Knowledge Base folder path\n (Default: ' + process.cwd() + '):\n > ', (kbAnswer) => {
29
+ const finalKb = kbAnswer.trim() || process.cwd();
30
+
31
+ rl.question('\n2. Enter your GeneXus Installation path\n (Default: ' + defaultGx + '):\n > ', (gxAnswer) => {
32
+ const finalGx = gxAnswer.trim() || defaultGx;
33
+
34
+ const targetConfigPath = path.join(finalKb, 'config.json');
35
+ const defaultConfig = {
36
+ GeneXus: { InstallationPath: finalGx },
37
+ Environment: { KBPath: finalKb }
38
+ };
39
+
40
+ try {
41
+ if (!fs.existsSync(finalKb)) fs.mkdirSync(finalKb, { recursive: true });
42
+ fs.writeFileSync(targetConfigPath, JSON.stringify(defaultConfig, null, 2));
43
+
44
+ const os = require('os');
45
+ console.log('\nāœ… Success! Configuration saved at: ' + targetConfigPath + '\n');
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
+ }
89
+ } catch (err) {
90
+ console.error('\nāŒ Failed to save configuration: ' + err.message);
91
+ }
92
+ rl.close();
93
+ process.exit(0);
94
+ });
95
+ });
96
+ return; // Stop execution
97
+ }
7
98
 
8
99
  // Check if config.json exists in CWD. If so, bind it to GX_CONFIG_PATH.
9
100
  if (fs.existsSync(cwdConfigPath)) {
@@ -26,20 +117,34 @@ if (fs.existsSync(cwdConfigPath)) {
26
117
  }
27
118
 
28
119
  if (foundGxPath) {
29
- console.error(`[genexus-mcp] Auto-discovered GeneXus at: ${foundGxPath}`);
30
- console.error(`[genexus-mcp] Generating default config.json for KB at: ${process.cwd()}`);
31
-
32
- const defaultConfig = {
33
- GeneXus: { InstallationPath: foundGxPath },
34
- Environment: { KBPath: process.cwd() }
35
- };
36
-
37
- fs.writeFileSync(cwdConfigPath, JSON.stringify(defaultConfig, null, 2));
38
- process.env.GX_CONFIG_PATH = cwdConfigPath;
120
+ // Smart Safety: Only auto-generate config if CWD actually looks like a GeneXus KB!
121
+ // Desktop Agents like Claude or Antigravity often execute in their Program Files.
122
+ const filesInCwd = fs.readdirSync(process.cwd());
123
+ const isActuallyAKB = filesInCwd.some(f => f.toLowerCase().endsWith('.gxw') || f.toLowerCase() === 'knowledgebase.connection');
124
+
125
+ if (isActuallyAKB) {
126
+ console.error(`[genexus-mcp] Auto-discovered GeneXus at: ${foundGxPath}`);
127
+ console.error(`[genexus-mcp] Generating default config.json for KB at: ${process.cwd()}`);
128
+
129
+ const defaultConfig = {
130
+ GeneXus: { InstallationPath: foundGxPath },
131
+ Environment: { KBPath: process.cwd() }
132
+ };
133
+
134
+ fs.writeFileSync(cwdConfigPath, JSON.stringify(defaultConfig, null, 2));
135
+ process.env.GX_CONFIG_PATH = cwdConfigPath;
136
+ } else {
137
+ console.error('[genexus-mcp] ERROR: Zero-Config failed. The current executing directory is NOT a GeneXus Knowledge Base.');
138
+ console.error(`[genexus-mcp] CWD: ${process.cwd()}`);
139
+ console.error('\n[!!] Fix this issue by running the interactive setup wizard:');
140
+ console.error(' npx genexus-mcp init\n');
141
+ process.exit(1);
142
+ }
39
143
  } else {
40
144
  console.error('[genexus-mcp] ERROR: No config.json found in the current directory!');
41
145
  console.error('[genexus-mcp] Auto-discovery for GeneXus installation failed.');
42
- console.error('[genexus-mcp] Please create a config.json file manually with at least the KBPath and GeneXus InstallationPath.');
146
+ console.error('\n[!!] Fix this issue by running the interactive setup wizard:');
147
+ console.error(' npx genexus-mcp init\n');
43
148
  process.exit(1);
44
149
  }
45
150
  }
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
- {
2
- "name": "genexus-mcp",
3
- "version": "1.1.2",
4
- "description": "A high-performance Model Context Protocol (MCP) server for GeneXus 18",
5
- "bin": {
6
- "genexus-mcp": "cli/run.js"
7
- },
8
- "files": [
9
- "cli",
10
- "publish"
11
- ],
12
- "engines": {
13
- "node": ">=18.0.0"
14
- },
15
- "author": "lennix1337",
16
- "license": "MIT",
17
- "repository": {
18
- "type": "git",
19
- "url": "git+https://github.com/lennix1337/Genexus18MCP.git"
20
- },
21
- "bugs": {
22
- "url": "https://github.com/lennix1337/Genexus18MCP/issues"
23
- },
24
- "homepage": "https://github.com/lennix1337/Genexus18MCP#readme"
25
- }
1
+ {
2
+ "name": "genexus-mcp",
3
+ "version": "1.1.4",
4
+ "description": "A high-performance Model Context Protocol (MCP) server for GeneXus 18",
5
+ "bin": {
6
+ "genexus-mcp": "cli/run.js"
7
+ },
8
+ "files": [
9
+ "cli",
10
+ "publish"
11
+ ],
12
+ "engines": {
13
+ "node": ">=18.0.0"
14
+ },
15
+ "author": "lennix1337",
16
+ "license": "MIT",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/lennix1337/Genexus18MCP.git"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/lennix1337/Genexus18MCP/issues"
23
+ },
24
+ "homepage": "https://github.com/lennix1337/Genexus18MCP#readme"
25
+ }