genexus-mcp 1.1.0 → 1.1.2

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/README.md CHANGED
@@ -1,192 +1,93 @@
1
- # GeneXus 18 MCP Server (Genexus18MCP)
2
-
1
+ # GeneXus 18 MCP Server (Genexus18MCP)
2
+
3
3
  [![MCP Badge](https://lobehub.com/badge/mcp/lennix1337-genexus18mcp?style=for-the-badge)](https://lobehub.com/mcp/lennix1337-genexus18mcp)
4
4
 
5
- A Model Context Protocol (MCP) server for GeneXus 18 with a .NET 8 gateway, a .NET Framework 4.8 worker, and a VS Code extension that operates directly against the MCP surface.
6
-
7
- ## Key Features
8
-
9
- - Native GeneXus SDK integration through the worker process.
10
- - MCP over stdio and HTTP at `/mcp`.
11
- - MCP-first Nexus-IDE runtime for discovery, VFS, providers, commands, and shadow sync.
12
- - Dynamic tool registry in `src/GxMcp.Gateway/tool_definitions.json`.
13
- - HTTP session handling with protocol-version negotiation and SSE support.
14
-
15
- ## Nexus-IDE
16
-
17
- The repository includes `src/nexus-ide`, a lightweight VS Code extension for GeneXus work:
18
-
19
- - Virtual file system using the `genexus://` scheme
20
- - KB explorer
21
- - Multi-part editing for source, rules, events, and variables
22
- - MCP discovery commands for tools, resources, and prompts
23
-
24
- The extension uses `/mcp` directly. The legacy `/api/command` path has been removed from the gateway.
25
-
26
- ## Installation
27
-
28
- ### NPX (Fastest)
29
-
30
- If you have Node.js installed, you can run the server directly from the npm registry without cloning the repository! Just create your "config.json" file in any directory and run:
31
-
32
- `ash
33
- npx genexus-mcp
34
- ``n
35
- For **Claude Desktop** or other MCP clients, simply configure it like this:
36
-
37
- `json
38
- "genexus": {
39
- "command": "npx",
40
- "args": ["-y", "genexus-mcp"],
41
- "env": {
42
- "GX_CONFIG_PATH": "C:\\path\\to\\your\\config.json"
5
+ A high-performance Model Context Protocol (MCP) server for GeneXus 18. It integrates native GeneXus SDK access via a .NET 8 gateway and a .NET Framework 4.8 worker, exposing direct read/write/analysis operations directly to AI Agents and IDEs.
6
+
7
+ ***
8
+
9
+ ## 🚀 Quick Start (For AI Agents)
10
+
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
+
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!
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).*
17
+
18
+ ### 2. Configure your AI Assistant
19
+ Add the `mcpServers` configuration block into your AI tool (e.g. `claude_desktop_config.json`):
20
+
21
+ ```json
22
+ "mcpServers": {
23
+ "genexus": {
24
+ "command": "npx",
25
+ "args": ["-y", "genexus-mcp@latest"]
26
+ }
27
+ }
28
+ ```
29
+ **That's it!** The AI will automatically download the compiled Windows gateway in the background and bridge the logic directly to your local GeneXus!
30
+
31
+ ---
32
+
33
+ ## 🛠️ Tool Surface (Skills)
34
+ *(See `GEMINI.md` for extended guidelines).* The worker natively exposes the following tools to the MCP Router:
35
+
36
+ - **Search & Discovery**: `genexus_query`, `genexus_read`, `genexus_batch_read`, `genexus_inspect`, `genexus_list_objects`, `genexus_properties`
37
+ - **Editing & Architecture**: `genexus_edit`, `genexus_batch_edit`, `genexus_create_object`, `genexus_refactor`, `genexus_forge`
38
+ - **Analysis:** `genexus_analyze`, `genexus_inject_context`, `genexus_doc`, `genexus_explain_code`, `genexus_summarize`
39
+ - **File System & Assets**: `genexus_asset`, `genexus_export_object`, `genexus_import_object`
40
+ - **History & DB**: `genexus_history`, `genexus_get_sql`, `genexus_structure`
41
+ - **Lifecycle & Build**: `genexus_lifecycle`, `genexus_test`, `genexus_format`
42
+ - **Patterns**: Smart XML generation and interpretation (e.g., WorkWithPlus PatternInstance mapping).
43
+
44
+ ---
45
+
46
+ ## 💻 Development & Building from Source
47
+
48
+ If you want to contribute, build the project yourself, or use the local **Nexus-IDE** VS Code Extension, use the classic source-based workflow.
49
+
50
+ ### One-Click Build
51
+ 1. Clone the repository to your Windows machine.
52
+ 2. Run `.\setup.bat`.
53
+ * *This checks prerequisites, builds the C# components, and auto-registers the local server with Claude, Codex, Antigravity, and Cursor when detected.*
54
+ 3. If GeneXus or your KB are not auto-detected, follow the terminal prompts.
55
+
56
+ ### Nexus-IDE (VS Code)
57
+ The repository includes `src/nexus-ide`, a lightweight VS Code extension containing:
58
+ - Virtual file system using the `genexus://` scheme
59
+ - Dynamic KB explorer with multi-part editing (Source, Rules, Events, Variables)
60
+ - Built-in MCP discovery commands (tools, resources, prompts)
61
+
62
+ ### Advanced Configuration
63
+ You can expand your local `config.json` for advanced networking or timeouts:
64
+
65
+ ```json
66
+ {
67
+ "Server": {
68
+ "HttpPort": 5000,
69
+ "BindAddress": "127.0.0.1",
70
+ "SessionIdleTimeoutMinutes": 10,
71
+ "WorkerIdleTimeoutMinutes": 5
72
+ },
73
+ "GeneXus": {
74
+ "InstallationPath": "C:\\Program Files (x86)\\GeneXus\\GeneXus18",
75
+ "WorkerExecutable": "worker\\GxMcp.Worker.exe"
76
+ },
77
+ "Environment": {
78
+ "KBPath": "C:\\KBs\\YourKB"
43
79
  }
44
80
  }
45
- ``n
46
- ### One-Click (From Source)
47
-
48
- 1. Clone the repository.
49
- 2. Run `.\setup.bat` (Windows).
50
- - This will check prerequisites, build all components, and configure your local tools (Claude, Codex, Antigravity, and Cursor/Cline when detected).
51
- 3. If GeneXus or your KB are not auto-detected, follow the prompts to provide the paths.
52
- 4. Restart your AI tools/IDE to pick up the new MCP server.
53
-
54
- ### Agent-Led Installation (for AI Assistants)
55
-
56
- If you are using an AI agent (like Antigravity, Cline, or Roo), copy and paste the following prompt to have it handle everything for you:
57
-
58
- > [!TIP]
59
- > **Copy-Paste to your Agent:**
60
- > "Install the GeneXus MCP server in this repository.
61
- > 1. Auto-detect the GeneXus 18 installation path and the local KB path.
62
- > 2. Run `.\install.ps1` to build and register the server.
63
- > 3. Verify the `config.json` is valid.
64
- > 4. Update your own MCP configuration to include the 'genexus' server using the generated `start_mcp.bat`."
65
-
66
- ### Manual path
67
-
68
- Notes:
69
-
70
- - The installer updates `config.json`, builds the gateway/worker, packages `src/nexus-ide/nexus-ide.vsix`, configures Claude Desktop and Codex, and updates Antigravity plus Cursor/Cline settings when those clients are present.
71
- - `setup.bat` is a thin bootstrap wrapper that launches `install.ps1` through PowerShell with `-ExecutionPolicy Bypass`.
72
- - Automatic extension installation works with the editor CLIs found in `PATH` among `code`, `code-insiders`, `cursor`, `codium`, and `antigravity`. If none are present, install the generated `.vsix` manually.
73
- - The desktop launcher at `publish/start_mcp.bat` exports `GX_CONFIG_PATH` and reuses the current repository gateway build when available, so local MCP clients and the extension share the repository-root `config.json`.
74
- - `build.ps1` now refreshes both the publish/runtime artifacts and the debug-consumed artifacts in one pass, so `F5` and external MCP clients stop drifting onto different gateway/worker builds.
75
- - The gateway now registers a local process lease keyed by `HttpPort + KBPath + InstallationPath + ShadowPath`, so duplicate launches can reuse a healthy live gateway instead of spawning another one.
76
- - The worker now starts lazily on the first real command and shuts down automatically after the configured idle timeout, which prevents idle `GxMcp.Worker.exe` instances from lingering and locking the build output.
77
-
78
- ### Development build
79
-
80
- ```powershell
81
- .\build.ps1
82
- ```
83
-
84
- ## Configuration
85
-
86
- Edit `config.json`:
87
-
88
- ```json
89
- {
90
- "Server": {
91
- "HttpPort": 5000,
92
- "BindAddress": "127.0.0.1",
93
- "AllowedOrigins": [],
94
- "SessionIdleTimeoutMinutes": 10,
95
- "WorkerIdleTimeoutMinutes": 5
96
- },
97
- "GeneXus": {
98
- "InstallationPath": "C:\\Program Files (x86)\\GeneXus\\GeneXus18",
99
- "WorkerExecutable": "worker\\GxMcp.Worker.exe"
100
- },
101
- "Environment": {
102
- "KBPath": "C:\\KBs\\YourKB"
103
- }
104
- }
105
- ```
106
-
107
- ## Correct MCP Usage
108
-
109
- Official transports:
110
-
111
- - stdio MCP for desktop clients
112
- - HTTP MCP at `http://127.0.0.1:5000/mcp`
113
-
114
- HTTP MCP rules:
115
-
116
- 1. Send `initialize` first.
117
- 2. Include `MCP-Protocol-Version: 2025-06-18`.
118
- 3. Persist and reuse the returned `MCP-Session-Id`.
119
- 4. Use discovery methods before hardcoding assumptions: `tools/list`, `resources/list`, `resources/templates/list`, `prompts/list`.
120
- 5. Execute work with `tools/call`, `resources/read`, and `prompts/get`.
121
- 6. Use `GET /mcp` for SSE notifications when needed.
122
- 7. Use `DELETE /mcp` to close the session.
123
-
124
- The gateway is MCP-only on HTTP. Use `/mcp`.
125
-
126
- ## Process Lifecycle
127
-
128
- - Gateway reuse is controlled by a local lease under `%LOCALAPPDATA%\\GenexusMCP\\gateway-leases`.
129
- - The launcher validates the lease identity and only removes stale or dead instances for that exact identity instead of killing every gateway/worker process.
130
- - The gateway stays resident by default; the worker is started on demand and is stopped after `Server.WorkerIdleTimeoutMinutes` of inactivity when there are no queued or in-flight requests.
131
-
132
- ## Tool Surface
133
-
134
- See `GEMINI.md` for guidance. The main MCP tools are:
135
-
136
- - `genexus_query`
137
- - supports optional `typeFilter` and `domainFilter` for server-side narrowing before ranking/truncation
138
- - `genexus_read`
139
- - defaults to a source-first first page for MCP clients when `offset` and `limit` are omitted
140
- - `genexus_batch_read`
141
- - `genexus_edit`
142
- - `genexus_batch_edit`
143
- - `genexus_open_kb`
144
- - `genexus_inspect`
145
- - `genexus_analyze`
146
- - `genexus_inject_context`
147
- - `genexus_lifecycle`
148
- - `genexus_get_sql`
149
- - `genexus_test`
150
- - `genexus_create_object`
151
- - `genexus_export_object`
152
- - `genexus_import_object`
153
- - `genexus_refactor`
154
- - `genexus_add_variable`
155
- - `genexus_explain_code`
156
- - `genexus_summarize`
157
- - `genexus_forge`
158
- - `genexus_format`
159
- - `genexus_properties`
160
- - `genexus_asset`
161
- - `genexus_history`
162
- - `genexus_structure`
163
- - `genexus_doc`
164
-
165
- `genexus_asset` is metadata-first by design. Use `action='read'` with `includeContent=true` only when the file is small enough to fit the MCP context budget. For larger assets, read metadata only and keep `maxBytes` explicit.
166
-
167
- `genexus_read` and `genexus_edit` also support XML metadata parts such as `Layout`, `WebForm`, and `PatternInstance`. For WorkWithPlus-owned panels, `PatternInstance` resolves through the authoritative `WorkWithPlus{Name}` object instead of the parent WebPanel preview.
168
-
169
- `genexus_open_kb` switches the active Knowledge Base for the current worker session. `genexus_export_object` writes an object part to a text file, and `genexus_import_object` reads a text file and applies it to the requested object part through the same write path used by `genexus_edit`.
170
-
171
- ## Architecture
172
-
173
- ```mermaid
174
- graph LR
175
- A[AI Client or Nexus-IDE] -->|MCP stdio or HTTP /mcp| B[Gateway .NET 8]
176
- B -->|JSON-RPC over process boundary| C[Worker .NET Framework 4.8]
177
- C -->|Native SDK| D[GeneXus KB]
178
- ```
179
-
180
- ## Runtime Lifecycle
181
-
182
- - The gateway now writes a local lease keyed by `HttpPort + KBPath + InstallationPath + GX_SHADOW_PATH` and exits early when an identical live instance already owns that key.
183
- - Nexus-IDE reuses the leased gateway instead of relying only on a port probe, and startup cleanup is now selective to the leased PID instead of broad `taskkill` sweeps.
184
- - The worker is lazy: the gateway creates the worker on the first real command instead of at gateway boot.
185
- - The worker shuts down automatically after `Server.WorkerIdleTimeoutMinutes` of inactivity, then starts again on the next command.
186
- - Gateway lease files live under `%LOCALAPPDATA%\\GenexusMCP\\gateway-leases`.
187
-
188
- ## Current State
189
-
190
- - The extension is MCP-first.
191
- - The gateway and worker remain the production architecture.
192
- - The HTTP transport is MCP-only at `/mcp`.
81
+ ```
82
+
83
+ ### Process Lifecycle & Architecture
84
+ - **Lazy Worker Mapping:** The .NET 8 Gateway is resident, but the heavy .NET 4.8 Worker is lazy (only spins up when the first standard command is received) and automatically terminates after `Server.WorkerIdleTimeoutMinutes` of inactivity to unlock build artifacts.
85
+ - **Gateway Reuse**: Launching multiple local IDE instances reuses a single active gateway using a unique lease file located at `%LOCALAPPDATA%\GenexusMCP\gateway-leases`.
86
+ - **HTTP Mode**: Run via HTTP at `http://127.0.0.1:5000/mcp` (Supports SSE notifications alongside standard POST JSON-RPC). Protocol expects `MCP-Protocol-Version: 2025-06-18`.
87
+
88
+ ```mermaid
89
+ graph LR
90
+ A[AI Client or Nexus-IDE] -->|MCP stdio or HTTP /mcp| B[Gateway .NET 8]
91
+ B -->|JSON-RPC over process boundary| C[Worker .NET Framework 4.8]
92
+ C -->|Native SDK| D[GeneXus KB]
93
+ ```
package/cli/run.js ADDED
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+ const { spawn } = require('child_process');
3
+ const path = require('path');
4
+ const fs = require('fs');
5
+
6
+ const cwdConfigPath = path.join(process.cwd(), 'config.json');
7
+
8
+ // Check if config.json exists in CWD. If so, bind it to GX_CONFIG_PATH.
9
+ if (fs.existsSync(cwdConfigPath)) {
10
+ process.env.GX_CONFIG_PATH = cwdConfigPath;
11
+ } else if (!process.env.GX_CONFIG_PATH) {
12
+ const possibleGxPaths = [
13
+ "C:\\Program Files (x86)\\GeneXus\\GeneXus18",
14
+ "C:\\Program Files (x86)\\GeneXus\\GeneXus17",
15
+ "C:\\Program Files (x86)\\GeneXus\\GeneXus16",
16
+ "C:\\Program Files\\GeneXus\\GeneXus18",
17
+ "C:\\Program Files\\GeneXus\\GeneXus17"
18
+ ];
19
+
20
+ let foundGxPath = null;
21
+ for (const p of possibleGxPaths) {
22
+ if (fs.existsSync(path.join(p, 'genexus.exe'))) {
23
+ foundGxPath = p;
24
+ break;
25
+ }
26
+ }
27
+
28
+ 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;
39
+ } else {
40
+ console.error('[genexus-mcp] ERROR: No config.json found in the current directory!');
41
+ 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.');
43
+ process.exit(1);
44
+ }
45
+ }
46
+
47
+ // Locate the bundled .NET executable inside the publish folder
48
+ const gatewayExePath = path.join(__dirname, '..', 'publish', 'GxMcp.Gateway.exe');
49
+
50
+ if (!fs.existsSync(gatewayExePath)) {
51
+ console.error(`[genexus-mcp] ERROR: The gateway executable was not found at ${gatewayExePath}`);
52
+ console.error(`[genexus-mcp] Please ensure you installed the package correctly on a Windows environment.`);
53
+ process.exit(1);
54
+ }
55
+
56
+ // Pass everything transparently through stdio
57
+ const child = spawn(gatewayExePath, process.argv.slice(2), {
58
+ stdio: 'inherit',
59
+ env: process.env,
60
+ windowsHide: true,
61
+ shell: true
62
+ });
63
+
64
+ child.on('error', (err) => {
65
+ console.error('[genexus-mcp] ERROR: Failed to start the MCP Gateway process:', err.message);
66
+ process.exit(1);
67
+ });
68
+
69
+ child.on('exit', (code, signal) => {
70
+ if (signal) {
71
+ process.exit(1);
72
+ }
73
+ process.exit(code || 0);
74
+ });
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "genexus-mcp",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "A high-performance Model Context Protocol (MCP) server for GeneXus 18",
5
5
  "bin": {
6
- "genexus-mcp": "bin/run.js"
6
+ "genexus-mcp": "cli/run.js"
7
7
  },
8
8
  "files": [
9
- "bin",
9
+ "cli",
10
10
  "publish"
11
11
  ],
12
12
  "engines": {
@@ -5936,3 +5936,12 @@
5936
5936
  [2026-04-01 15:07:49.469] [HTTP] Received tools/list (ID: 1) - Body: {"jsonrpc":"2.0","id":1,"method":"tools/list","params":{"_meta":{"progressToken":0}}}
5937
5937
  [2026-04-01 15:07:49.470] [HTTP] Serializing response for 1...
5938
5938
  [2026-04-01 15:07:49.470] [HTTP] Sending 14100 bytes to 1
5939
+ [2026-04-09 15:48:11.283] === Gateway starting (Stdio Mode) ===
5940
+ [2026-04-09 15:48:11.300] [Gateway] Loading config from: C:\Users\2635801\.gemini\antigravity\brain\7365ac0f-28d5-4326-a546-3e37e2ba58e9\scratch_test\config.json
5941
+ [2026-04-09 15:48:11.362] [Gateway] KB Path configured: C:\Users\2635801\.gemini\antigravity\brain\7365ac0f-28d5-4326-a546-3e37e2ba58e9\scratch_test
5942
+ [2026-04-09 15:48:11.365] [Gateway] Startup orphan-kill disabled. Existing gateway reuse is handled by the extension client.
5943
+ [2026-04-09 15:48:11.387] === Gateway starting (Stdio Mode) ===
5944
+ [2026-04-09 15:48:11.388] [Gateway] Initializing Worker lifecycle...
5945
+ [2026-04-09 15:48:11.391] [Gateway] Worker lifecycle ready.
5946
+ [2026-04-09 15:48:11.391] [Gateway] Setting up .gx_mirror watcher...
5947
+ [2026-04-09 15:48:11.392] [Gateway] .gx_mirror watcher active.
package/bin/run.js DELETED
@@ -1,45 +0,0 @@
1
- #!/usr/bin/env node
2
- const { spawn } = require('child_process');
3
- const path = require('path');
4
- const fs = require('fs');
5
-
6
- const cwdConfigPath = path.join(process.cwd(), 'config.json');
7
-
8
- // Check if config.json exists in CWD. If so, bind it to GX_CONFIG_PATH.
9
- if (fs.existsSync(cwdConfigPath)) {
10
- process.env.GX_CONFIG_PATH = cwdConfigPath;
11
- } else if (!process.env.GX_CONFIG_PATH) {
12
- console.error('[genexus-mcp] ERROR: No config.json found in the current directory!');
13
- console.error('[genexus-mcp] Please create a config.json file here with at least the KBPath and GeneXus InstallationPath.');
14
- console.error('[genexus-mcp] Or specify the path via the GX_CONFIG_PATH environment variable.');
15
- process.exit(1);
16
- }
17
-
18
- // Locate the bundled .NET executable inside the publish folder
19
- const gatewayExePath = path.join(__dirname, '..', 'publish', 'GxMcp.Gateway.exe');
20
-
21
- if (!fs.existsSync(gatewayExePath)) {
22
- console.error(`[genexus-mcp] ERROR: The gateway executable was not found at ${gatewayExePath}`);
23
- console.error(`[genexus-mcp] Please ensure you installed the package correctly on a Windows environment.`);
24
- process.exit(1);
25
- }
26
-
27
- // Pass everything transparently through stdio
28
- const child = spawn(gatewayExePath, process.argv.slice(2), {
29
- stdio: 'inherit',
30
- env: process.env,
31
- windowsHide: true,
32
- shell: false
33
- });
34
-
35
- child.on('error', (err) => {
36
- console.error('[genexus-mcp] ERROR: Failed to start the MCP Gateway process:', err.message);
37
- process.exit(1);
38
- });
39
-
40
- child.on('exit', (code, signal) => {
41
- if (signal) {
42
- process.exit(1);
43
- }
44
- process.exit(code || 0);
45
- });