genexus-mcp 3.6.0 → 3.7.0

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 (34) hide show
  1. package/README.md +136 -24
  2. package/cli/commands/axi.js +311 -64
  3. package/cli/lib/config.js +129 -32
  4. package/cli/run.test.js +258 -0
  5. package/config/gx-versions.json +5 -3
  6. package/package.json +2 -2
  7. package/publish/GxMcp.Gateway.deps.json +2 -2
  8. package/publish/GxMcp.Gateway.dll +0 -0
  9. package/publish/GxMcp.Gateway.exe +0 -0
  10. package/publish/config/gx-versions.json +5 -3
  11. package/publish/config.json +6 -6
  12. package/publish/gxmcp-manifest.json +10 -10
  13. package/publish/gxmcp-sbom.json +4 -4
  14. package/publish/tool_definitions.json +5 -5
  15. package/publish/worker/GxMcp.Worker.exe +0 -0
  16. package/publish/worker/GxMcp.Worker.exe.config +12 -0
  17. package/publish/worker/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
  18. package/publish/worker/Microsoft.Bcl.HashCode.dll +0 -0
  19. package/publish/worker/Microsoft.Extensions.DependencyInjection.Abstractions.dll +0 -0
  20. package/publish/worker/Microsoft.Extensions.Logging.Abstractions.dll +0 -0
  21. package/publish/worker/Npgsql.dll +0 -0
  22. package/publish/worker/System.Buffers.dll +0 -0
  23. package/publish/worker/System.Collections.Immutable.dll +0 -0
  24. package/publish/worker/System.Diagnostics.DiagnosticSource.dll +0 -0
  25. package/publish/worker/System.Memory.dll +0 -0
  26. package/publish/worker/System.Numerics.Vectors.dll +0 -0
  27. package/publish/worker/System.Runtime.CompilerServices.Unsafe.dll +0 -0
  28. package/publish/worker/System.Text.Encodings.Web.dll +0 -0
  29. package/publish/worker/System.Text.Json.dll +0 -0
  30. package/publish/worker/System.Threading.Channels.dll +0 -0
  31. package/publish/worker/System.Threading.Tasks.Extensions.dll +0 -0
  32. package/publish/worker/System.ValueTuple.dll +0 -0
  33. package/publish/worker/config/gx-versions.json +5 -3
  34. package/publish/worker/gx-versions.json +5 -3
package/README.md CHANGED
@@ -12,19 +12,21 @@
12
12
 
13
13
  ---
14
14
 
15
- **GeneXus MCP Server** lets AI agents — Claude Desktop, Claude Code, Cursor, Antigravity, and any MCP-compatible client — read, edit, analyze, and refactor objects inside a Knowledge Base supported by the selected GeneXus SDK. It talks to the **native GeneXus SDK**, so the agent works with the *real* KB, not a copy or a parsed approximation.
15
+ **GeneXus MCP Server** lets AI agents — Claude Desktop, Claude Code, Cursor, Antigravity, and any MCP-compatible client — read, edit, analyze, and refactor objects inside a Knowledge Base supported by the selected native SDK or legacy compatibility driver. Native SDK paths work with the **real GeneXus SDK** and legacy paths use explicit reflection/COM adapters; neither path relies on a parsed copy of the KB.
16
16
 
17
17
  In practice: you point the MCP at your KB, then ask your AI assistant things like *"list all transactions with attribute CustomerId"*, *"add a rule to the Order transaction that validates the total"*, or *"refactor this procedure to use the new SDT"* — and it does it.
18
18
 
19
19
  ---
20
20
 
21
- ## Multi-version SDK support
21
+ ## Multi-version GeneXus support
22
22
 
23
- The same MCP distribution supports the SDK majors listed in the generated
24
- compatibility document. Each configured MCP process selects one installed SDK
25
- with `--gx`; no separate MCP installation is required. The commands below are
26
- examples of switching the existing configuration, not running two majors in
27
- the same process:
23
+ The same MCP distribution supports the official native SDK majors listed in the
24
+ generated compatibility document. It also includes basic, best-effort
25
+ compatibility for the legacy versions listed there through separate drivers;
26
+ that path is not equivalent to full native-SDK support. A process can route
27
+ each declared KB to its own SDK/driver; `--gx` remains the convenient global
28
+ default for a single-major configuration. The commands below are examples of
29
+ switching the existing configuration:
28
30
 
29
31
  ```bash
30
32
  npx genexus-mcp@latest init --kb "C:\KBs\KBTeste17" --gx "C:\Program Files (x86)\GeneXus\GeneXus17Trial"
@@ -36,6 +38,32 @@ After switching the SDK or KB, fully restart the AI client so it reloads the
36
38
  MCP process and its tool schemas. If GX17 and GX18 must run simultaneously,
37
39
  use separate MCP configurations and ports.
38
40
 
41
+ Classic GX8/GX9 KBs can be opened without changing the global GX18 default by
42
+ declaring their driver and installation per KB (the Gateway accepts both the
43
+ list and object catalog shapes):
44
+
45
+ ```json
46
+ {
47
+ "Environment": {
48
+ "KBs": {
49
+ "SECT80": {
50
+ "Path": "D:\\GX80\\SECT",
51
+ "Driver": "com-gxpublic",
52
+ "InstallationPath": "C:\\Program Files (x86)\\ARTech\\GeneXus\\gxw80",
53
+ "Major": "8"
54
+ }
55
+ }
56
+ }
57
+ }
58
+ ```
59
+
60
+ The equivalent one-shot request is `genexus_kb action=open` with `path`,
61
+ `alias`, `driver: "com-gxpublic"`, `installationPath`, and `major: "8"`.
62
+ GX8 uses the registered 32-bit GXPublic provider; the documented `.4` ProgID
63
+ and the installed `GXPubGXX.GXPublic(.5)` compatibility registration are
64
+ recognized. Classic DAT KB roots are identified from their legacy markers
65
+ (`DATA001`, `GXSPC001`, `kbdata`, `ATTRIBUT.DAT`, or `ATT.XPW`).
66
+
39
67
  `init` also reads the KB `.gxw` major and the selected `GeneXus.exe` metadata.
40
68
  It aborts before writing `config.json` when the majors conflict or an automatic
41
69
  selection cannot be verified. `genexus-mcp doctor` exposes the same result as
@@ -45,7 +73,9 @@ that checks every supported major against one published artifact.
45
73
 
46
74
  The Gateway reports the detected SDK through `genexus_whoami`:
47
75
 
48
- - `geneXus.supportedMajors`: explicitly validated SDK majors from the version catalog
76
+ - `geneXus.supportedMajors`: explicitly validated native SDK majors from the version catalog
77
+ - `geneXus.legacyMajors`: catalogued legacy majors handled by their compatibility drivers
78
+ - `geneXus.sdkCompatibility.supportLevel`: `native-sdk` or `basic-legacy` for the detected installation
49
79
  - `geneXus.matchedMajor`: the major detected for the configured installation
50
80
  - `geneXus.versionMatches`: whether the detected installation is in that catalog
51
81
  - `geneXus.supportedMajor`: retained as the legacy single-major alias for the catalog primary
@@ -57,23 +87,88 @@ needed. Existing tool names, arguments, and MCP client configuration formats do
57
87
  not change.
58
88
 
59
89
  <!-- BEGIN GENERATED: gx-compatibility -->
60
- Supported SDK majors: **GeneXus 16, GeneXus 17, GeneXus 18**.
90
+ Supported SDK majors: **GeneXus 16, GeneXus 17, GeneXus 18** (native SDK).
91
+ Basic legacy compatibility: **GeneXus Evolution 3, GeneXus Evolution 2, GeneXus Evolution 1, GeneXus 15, GeneXus 9.0, GeneXus 8.0** via `com-gxpublic` and `dotnet-reflection` (not the native SDK build).
61
92
  Primary SDK: **GeneXus 18**.
62
93
  Source of truth: `config/gx-versions.json`.
63
94
  <!-- END GENERATED: gx-compatibility -->
64
95
 
65
- To add another GeneXus major in the future, add it to the explicit version
66
- catalog only after compiling the Worker with that SDK and passing the focused
67
- tests plus a live KB smoke. This prevents the server from claiming compatibility
68
- based only on a version string.
96
+ To add another native-SDK major in the future, add it to the explicit
97
+ `supportedMajors` catalog only after compiling the Worker with that SDK and
98
+ passing the focused tests plus a live KB smoke. This prevents the server from
99
+ claiming native-SDK compatibility based only on a version string.
69
100
 
70
- ### Legacy GeneXus compatibility (GX8 to GX15)
101
+ ### Basic legacy compatibility (not native SDK support)
71
102
 
72
- The server also includes best-effort dynamic compatibility for legacy installations:
103
+ Every legacy version currently declared in `legacyMajors` uses a best-effort
104
+ driver rather than the native SDK build:
73
105
  - **GeneXus Evolution 1 (10.1), Evolution 2 (10.2), Evolution 3 (10.3), and GeneXus 15**: Driven via runtime reflection (`dotnet-reflection`), dynamically adapting to missing types or structural differences (such as module-less KBs without `QualifiedName`).
74
- - **GeneXus 8.0 and GeneXus 9.0**: Driven via classic Win32 COM automation (`com-gxpublic`), late-binding to `GXPublic.GXPublic` on an STA thread to open, inspect, and read objects from classic `.gxi` Knowledge Bases.
106
+ - **GeneXus 8.0 and GeneXus 9.0**: Driven through the classic GXPublic surface (`com-gxpublic`), detected from `gxw32.exe`/`gx.exe`/`gxdl32.dll` and classic `.gxi` Knowledge Bases. GXPublic is a metadata-oriented OLE DB surface; this path is intentionally limited to basic metadata/core operations and does not claim native-SDK source/edit parity.
75
107
  - **Graceful degradation**: Modern tools that require features introduced in newer GeneXus versions (such as `genexus_api`, `genexus_gam`, or `genexus_module`) return structured `UNSUPPORTED_IN_GENEXUS_VERSION` errors indicating the required minimum version rather than failing ungracefully.
76
108
 
109
+ This legacy path is intended for basic core operations where implemented; it
110
+ does not claim the same feature parity as the native SDK contract for GeneXus
111
+ 16, 17, and 18.
112
+
113
+ ---
114
+
115
+ ## Sharing one Worker between MCP clients
116
+
117
+ The Gateway and the GeneXus SDK Worker have different responsibilities. By
118
+ default, `Server.WorkerSharingMode` is `"isolated"`: each Gateway owns its own
119
+ Worker process. Keep that mode when an agent intentionally needs multiple
120
+ independent Workers.
121
+
122
+ When two or more independent MCP clients need to work on the same physical KB,
123
+ set `WorkerSharingMode` to `"shared-host"` in a `stdio-isolated` configuration:
124
+
125
+ ```json
126
+ {
127
+ "ConfigSchemaVersion": 2,
128
+ "GatewayMode": "stdio-isolated",
129
+ "GeneXus": {
130
+ "InstallationPath": "C:\\Program Files (x86)\\GeneXus\\GeneXus18",
131
+ "WorkerExecutable": "C:\\path\\to\\GxMcp.Worker.exe"
132
+ },
133
+ "Server": {
134
+ "HttpPort": 0,
135
+ "McpStdio": true,
136
+ "WorkerSharingMode": "shared-host"
137
+ },
138
+ "Environment": {
139
+ "ResolutionPolicy": "strict",
140
+ "KBs": [
141
+ { "alias": "main", "path": "C:\\KBs\\YourKB" }
142
+ ]
143
+ }
144
+ }
145
+ ```
146
+
147
+ `shared-host` shares only the per-KB broker-owned SDK Worker through bounded
148
+ local named-pipe attachments. The Gateways remain independent: MCP sessions,
149
+ authorization, KB selection, caches, request tracking, cancellation, progress,
150
+ notifications, and generated artifacts do not cross the process boundary.
151
+ Sharing is accepted only when the physical KB, Worker executable, GeneXus
152
+ installation, driver, and target major are compatible; a mismatch fails closed
153
+ instead of attaching to the wrong SDK process.
154
+
155
+ Writes carry a Gateway-local owner into the Worker. The same object/part cannot
156
+ be written concurrently by two attached clients, while writes to distinct
157
+ objects may proceed independently through the shared SDK boundary. The Worker
158
+ itself remains a single STA process, so calls that reach the same SDK are still
159
+ serialized as required by GeneXus.
160
+
161
+ For a healthy shared attachment, `genexus_whoami` and `genexus_doctor` report the
162
+ mode, identity key, pipe, host/Worker PIDs, generation, attachment ID, connection
163
+ state, and the latest startup/failure diagnostic. When something fails, inspect
164
+ `worker.diagnostics` and `workerHealth` before restarting or deleting local
165
+ state; these fields distinguish configuration/identity, mutex or registry,
166
+ pipe/handshake, startup, child exit/respawn, TTL, and frame failures.
167
+
168
+ See [Worker ownership](docs/worker-ownership.md) for the lifecycle contract and
169
+ [the shared-Worker benchmark](docs/benchmarks/2026-09-18-shared-worker.md) for
170
+ the measured two-client smoke and backpressure results.
171
+
77
172
  ---
78
173
 
79
174
  ## What you can do with it
@@ -93,7 +188,10 @@ A quick map of what the agent can do against your real KB through the **50 tools
93
188
  | 🌿 **Versioning, transfer & teams** | KB model versions/branches, **real XPZ export/import** (dependency-aware), GXserver (Team Development) sync + **CI pipelines**, git-style history, multi-KB parallel work |
94
189
  | 🔐 **Security** | GAM / integrated-security provisioning, KB security audit + native Security Scanner |
95
190
 
96
- It works through the **native GeneXus SDK** — the same code paths the IDE uses — so edits are real and validated, not text hacks on KB files.
191
+ Native SDK support works through the **native GeneXus SDK** — the same code paths
192
+ the IDE uses — so edits are real and validated, not text hacks on KB files.
193
+ Legacy support uses the reflection or COM driver listed in the catalog and
194
+ degrades unsupported modern tools explicitly.
97
195
 
98
196
  ---
99
197
 
@@ -102,9 +200,9 @@ It works through the **native GeneXus SDK** — the same code paths the IDE uses
102
200
  Before you start, make sure you have:
103
201
 
104
202
  - ✅ **Windows** (GeneXus is Windows-only)
105
- - ✅ **A supported GeneXus SDK** installed locally (see [`docs/generated/supported-versions.md`](docs/generated/supported-versions.md); pass another install path explicitly when needed)
106
- - ✅ **GeneXus 18** installed locally (the primary supported SDK; other catalogued majors are also supported)
107
- - ✅ **A Knowledge Base created with a supported GeneXus major** and opened at least once in the IDE (so it's initialized)
203
+ - ✅ **A supported GeneXus installation** installed locally: GeneXus 16, 17, or 18 for native SDK support, or a catalogued legacy installation for basic compatibility (see [`docs/generated/supported-versions.md`](docs/generated/supported-versions.md); pass another install path explicitly when needed)
204
+ - ✅ **GeneXus 18** installed locally for the primary native-SDK path; other catalogued native and legacy versions are also supported according to their listed driver
205
+ - ✅ **A Knowledge Base created with a supported native or legacy GeneXus major** and opened at least once in the IDE (so it's initialized)
108
206
  - ✅ **Node.js 22+** — check with `node --version` in a terminal; install from [nodejs.org](https://nodejs.org/) if missing
109
207
  - ✅ **An MCP-compatible AI client** — [Claude Desktop](https://claude.ai/download), [Claude Code](https://claude.com/claude-code), Cursor, Antigravity, etc.
110
208
 
@@ -312,7 +410,18 @@ same path when a previous failure is present. Read it before changing the instal
312
410
  using a global npm install; if the Antigravity launcher is stale, re-register it with
313
411
  `npx genexus-mcp@latest clients add --clients antigravity`.
314
412
 
315
- Still stuck? [Open an issue](https://github.com/lennix1337/Genexus18MCP/issues) with the output of `npx genexus-mcp doctor --mcp-smoke`.
413
+ ### Diagnosing a shared Worker failure
414
+
415
+ If `shared-host` does not attach or a Worker is restarted, run
416
+ `genexus_whoami` and `genexus_doctor` from the affected client and preserve the
417
+ structured `worker.diagnostics`/`workerHealth` block. The useful evidence is the
418
+ mode, identity, host/Worker PID, generation, attachment state, connection error,
419
+ and failure diagnostic — not only the final `no_worker` or `startup_failed`
420
+ summary. Do not remove a shared-worker registry file while a matching host is
421
+ still running; the broker owns that lifecycle and stale records are recovered
422
+ after PID/start-time validation.
423
+
424
+ Still stuck? [Open an issue](https://github.com/lennix1337/Genexus18MCP/issues) with the output of `npx genexus-mcp doctor --mcp-smoke` and the bounded diagnostic fields above. Redact credentials, tokens, connection strings, and other sensitive values.
316
425
 
317
426
  ---
318
427
 
@@ -576,13 +685,16 @@ When the pool is full and no Worker is idle, the server returns `KB_POOL_FULL`
576
685
 
577
686
  ```mermaid
578
687
  graph LR
579
- A[AI Client / Nexus-IDE] -->|MCP stdio or HTTP /mcp| B[Gateway .NET 10]
580
- B -->|JSON-RPC over process boundary| C[Worker .NET Framework 4.8]
688
+ A[AI Client / Nexus-IDE] -->|MCP stdio or HTTP /mcp| B[Independent Gateway .NET 10]
689
+ B -->|isolated stdio: direct child| C[Worker .NET Framework 4.8]
690
+ B -->|shared-host: named-pipe attachment| H[Per-KB WorkerHost broker]
691
+ H -->|one compatible child| C
581
692
  C -->|Native SDK| D[GeneXus KB]
582
693
  ```
583
694
 
584
- - **Worker pool (v2.3.0+)**: one .NET 4.8 Worker process per open KB, capped by `MaxOpenKbs` (default 3). Workers are spawned lazily, recycled by `WorkerIdleTimeoutMinutes`, and evicted LRU when the pool is full.
695
+ - **Worker pool (v2.3.0+)**: in isolated mode, one .NET 4.8 Worker process per open KB in each Gateway, capped by `MaxOpenKbs` (default 3). With `shared-host`, compatible Gateways attach to one broker-owned Worker per physical KB instead of starting duplicate SDK processes. Workers are spawned lazily, recycled by `WorkerIdleTimeoutMinutes`, and evicted LRU when the pool is full.
585
696
  - **Cross-KB parallelism**: tool calls to different KBs run on different Worker processes and never block each other. Calls to the same KB are still serialized by the GeneXus SDK's STA requirement.
697
+ - **Gateway isolation**: `shared-host` does not turn one Gateway into a master or proxy for another; each client keeps its own MCP state and only the SDK Worker is shared.
586
698
  - **Gateway reuse**: multiple IDE instances share one gateway via lease files at `%LOCALAPPDATA%\GenexusMCP\gateway-leases`.
587
699
  - **HTTP mode**: also available at `http://127.0.0.1:5000/mcp` with SSE. Header: `MCP-Protocol-Version: 2025-11-25`.
588
700