genexus-mcp 2.0.3 → 2.1.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.
- package/README.md +155 -132
- package/cli/commands/axi.js +423 -32
- package/cli/index.js +48 -1
- package/cli/lib/config.js +219 -18
- package/cli/run.test.js +256 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -5,177 +5,167 @@
|
|
|
5
5
|
[](https://lobehub.com/mcp/lennix1337-genexus18mcp)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
> **¿Hablás español?** → [Guía de inicio en español](docs/GETTING_STARTED.es.md)
|
|
9
|
+
> **Stuck?** → [Troubleshooting guide](TROUBLESHOOTING.md)
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
**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 GeneXus 18 Knowledge Base. It talks to the **native GeneXus SDK**, so the agent works with the *real* KB, not a copy or a parsed approximation.
|
|
14
|
+
|
|
15
|
+
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.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Prerequisites
|
|
20
|
+
|
|
21
|
+
Before you start, make sure you have:
|
|
11
22
|
|
|
12
|
-
|
|
23
|
+
- ✅ **Windows** (GeneXus is Windows-only — this MCP runs on Windows)
|
|
24
|
+
- ✅ **GeneXus 18** installed locally (usually `C:\Program Files (x86)\GeneXus\GeneXus18`)
|
|
25
|
+
- ✅ **A GeneXus 18 Knowledge Base** opened at least once in the IDE (so it has been built/initialized)
|
|
26
|
+
- ✅ **Node.js 18+** ([download](https://nodejs.org/))
|
|
27
|
+
- ✅ **An MCP-compatible AI client** — [Claude Desktop](https://claude.ai/download), [Claude Code](https://claude.com/claude-code), Cursor, Antigravity, etc.
|
|
13
28
|
|
|
14
|
-
|
|
29
|
+
You do **not** need to clone this repo or install anything globally — `npx` handles it.
|
|
15
30
|
|
|
16
|
-
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Quickstart (3 steps)
|
|
17
34
|
|
|
18
|
-
### Step 1
|
|
35
|
+
### Step 1 — Run the installer
|
|
19
36
|
|
|
20
|
-
|
|
37
|
+
Open a terminal and run, replacing the paths with **your** KB folder and **your** GeneXus install:
|
|
21
38
|
|
|
22
39
|
```bash
|
|
23
40
|
npx genexus-mcp@latest init --kb "C:\KBs\YourKB" --gx "C:\Program Files (x86)\GeneXus\GeneXus18"
|
|
24
41
|
```
|
|
25
42
|
|
|
26
|
-
|
|
43
|
+
> Prefer the wizard? Run `npx genexus-mcp@latest init --interactive` and answer the prompts.
|
|
27
44
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
45
|
+
When it finishes you should see `🎉 You are all set!` plus a JSON snippet for your AI client.
|
|
46
|
+
|
|
47
|
+
### Step 2 — Register the MCP in your AI client
|
|
48
|
+
|
|
49
|
+
The installer **auto-registers** the server with Claude Desktop, Claude Code, Cursor, and Antigravity when it detects them. If yours wasn't detected, copy the JSON snippet from Step 1 into your client's MCP config manually. See the [client setup guide](TROUBLESHOOTING.md#client-setup) if unsure where that file lives.
|
|
50
|
+
|
|
51
|
+
### Step 3 — Restart your AI client and test
|
|
31
52
|
|
|
32
|
-
|
|
53
|
+
Fully close and reopen Claude / Cursor / etc. Then try this prompt:
|
|
33
54
|
|
|
34
|
-
|
|
55
|
+
> *"Using the GeneXus MCP, list the first 5 transactions in my KB and show their names."*
|
|
56
|
+
|
|
57
|
+
If you get a list back — **you're done**. Skip to [What can I ask the AI?](#what-can-i-ask-the-ai) for ideas.
|
|
58
|
+
|
|
59
|
+
If something didn't work, go straight to [Troubleshooting](TROUBLESHOOTING.md) — most issues are covered there.
|
|
35
60
|
|
|
36
61
|
---
|
|
37
62
|
|
|
38
|
-
|
|
63
|
+
## 🤖 Let your AI install it for you
|
|
39
64
|
|
|
40
|
-
If you
|
|
65
|
+
If you'd rather not run anything in the terminal yourself, paste this into your AI chat:
|
|
41
66
|
|
|
42
|
-
|
|
43
|
-
Please configure your Model Context Protocol (MCP) server to connect to my GeneXus Knowledge Base by following these exact steps:
|
|
67
|
+
> Please configure the GeneXus MCP server. Run `npx genexus-mcp@latest init --kb "<MY_KB_PATH>" --gx "<MY_GENEXUS_PATH>"` in the terminal. If I haven't told you my GeneXus path and KB path yet, ask me first. Once it succeeds, read the JSON block it printed and add it to my MCP client config. Tell me when I should restart the client to start using GeneXus tools.
|
|
44
68
|
|
|
45
|
-
|
|
46
|
-
2. If I haven't told you my GeneXus path or KB path, STOP and ask me for them now.
|
|
47
|
-
3. Once the setup is complete, read the generated JSON block from the console output.
|
|
48
|
-
4. If you use a global configuration file (like `mcp_config.json` or `claude_desktop_config.json`), insert the exact `mcpServers` block provided in the console output. Use `npx.cmd` as the command.
|
|
49
|
-
5. Provide a summary of the installation and notify me when you are ready to query GeneXus!
|
|
50
|
-
```
|
|
69
|
+
Replace the placeholders or let the AI ask you for them.
|
|
51
70
|
|
|
52
71
|
---
|
|
53
72
|
|
|
54
|
-
##
|
|
73
|
+
## What can I ask the AI?
|
|
55
74
|
|
|
56
|
-
|
|
75
|
+
Once installed, here's what unlocks. Try these as your first prompts:
|
|
57
76
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
77
|
+
**Exploration**
|
|
78
|
+
- *"List all objects of type Procedure in the KB."*
|
|
79
|
+
- *"Show me the source of the procedure CalculateInvoiceTotal."*
|
|
80
|
+
- *"Find all transactions that reference the attribute CustomerId."*
|
|
81
|
+
|
|
82
|
+
**Editing**
|
|
83
|
+
- *"Add a rule to the Order transaction: error('Total must be positive') if Total < 0."*
|
|
84
|
+
- *"Add a new attribute CreatedAt of type DateTime to the Customer transaction."*
|
|
85
|
+
- *"Rename the variable &qty to &quantity in procedure CreateOrder."*
|
|
86
|
+
|
|
87
|
+
**Analysis**
|
|
88
|
+
- *"Explain what the procedure ProcessShipment does, step by step."*
|
|
89
|
+
- *"What SQL does the query in WebPanel CustomerList generate?"*
|
|
90
|
+
- *"Summarize the structure of the Sales module."*
|
|
71
91
|
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
- `--full` (expand truncated long-form content when supported)
|
|
78
|
-
- `--mcp-smoke` (for `doctor`; executes protocol smoke checks)
|
|
79
|
-
- `--quiet` and `--no-color` (agent-safe output control)
|
|
80
|
-
|
|
81
|
-
Layout automation flags (`layout run`):
|
|
82
|
-
- `--action focus|activate-layout|activate-tab|send-keys|type-text|click`
|
|
83
|
-
- `--title "<window-title-fragment>"` to target a specific GeneXus window
|
|
84
|
-
- `--tab "<tab-name>"` for `activate-tab`
|
|
85
|
-
- `--keys "<sendkeys-pattern>"` for `send-keys`
|
|
86
|
-
- `--text "<text>"` for `type-text`
|
|
87
|
-
- `--x <screenX> --y <screenY>` for `click`
|
|
88
|
-
|
|
89
|
-
Layout inspection:
|
|
90
|
-
- `genexus-mcp layout inspect [--tab "<tab-name>"] [--limit N] [--full] [--title "<window-title-fragment>"]`
|
|
91
|
-
- Returns UI Automation controls with bounding rectangles (`bounds.x/y/width/height`) to support deterministic replay.
|
|
92
|
-
|
|
93
|
-
Notes:
|
|
94
|
-
- Structured data/errors are emitted on `stdout`.
|
|
95
|
-
- Diagnostic/progress output stays on `stderr`.
|
|
96
|
-
- `meta.command` is always present for stable command identity in AXI outputs.
|
|
97
|
-
- Use `genexus-mcp <command> --help` for command-specific usage/examples.
|
|
98
|
-
- Output metadata includes `meta.schemaVersion` for contract stability.
|
|
99
|
-
- `--fields` is validated strictly per command; invalid fields return `usage_error` and exit code `2`.
|
|
100
|
-
- Running `genexus-mcp` without an AXI subcommand keeps the original MCP gateway launcher behavior.
|
|
101
|
-
- `genexus-mcp home` (`genexus-mcp axi home`) is the explicit content-first AXI entrypoint.
|
|
102
|
-
- `genexus-mcp llm help` returns protocol-first usage guidance for agents.
|
|
103
|
-
- Full LLM-facing AXI contract: [`docs/axi_cli_contract.md`](docs/axi_cli_contract.md)
|
|
104
|
-
- LLM usage playbook (CLI + MCP best practices): [`docs/llm_cli_mcp_playbook.md`](docs/llm_cli_mcp_playbook.md)
|
|
92
|
+
**Build & lifecycle**
|
|
93
|
+
- *"Build the KB and report any errors."*
|
|
94
|
+
- *"Run the unit tests and show me which failed."*
|
|
95
|
+
|
|
96
|
+
The agent picks the right tool from the **30+ tools** the MCP exposes (read, edit, refactor, analyze, build, layout automation, history, SQL preview, etc.). The full tool list is in [Tool Surface](#tool-surface) below.
|
|
105
97
|
|
|
106
98
|
---
|
|
107
99
|
|
|
108
|
-
##
|
|
109
|
-
|
|
100
|
+
## Supported AI clients
|
|
101
|
+
|
|
102
|
+
Auto-detected and auto-configured by the installer:
|
|
110
103
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
104
|
+
| Client | Auto-config | Notes |
|
|
105
|
+
|---|---|---|
|
|
106
|
+
| Claude Desktop | ✅ | Restart required after install |
|
|
107
|
+
| Claude Code (CLI) | ✅ | Reload session |
|
|
108
|
+
| Cursor | ✅ | Restart required |
|
|
109
|
+
| Antigravity | ✅ | Restart required |
|
|
110
|
+
| Any MCP client | Manual | Use the JSON snippet printed by `init` |
|
|
111
|
+
|
|
112
|
+
---
|
|
117
113
|
|
|
118
|
-
|
|
119
|
-
>
|
|
120
|
-
> **All write tools** accept `dryRun: true` (returns a preview `plan` envelope without mutating the KB) and `idempotencyKey` (safe retries — concurrent calls with same key are coalesced; results cached for 15 min by default).
|
|
114
|
+
## Troubleshooting
|
|
121
115
|
|
|
122
|
-
|
|
123
|
-
- For `ForeColor`, `BackColor`, `BorderColor`, send color values as palette names (`Black`, `Blue`, `Red`, `Transparent`) or RGB token (`R; G; B|`) to avoid nested SDK wrappers.
|
|
124
|
-
- **Lifecycle & Build**: `genexus_lifecycle`, `genexus_test`, `genexus_format`
|
|
125
|
-
- **Patterns**: Smart XML generation and interpretation (e.g., WorkWithPlus PatternInstance mapping).
|
|
116
|
+
Most install issues fall into a handful of buckets — see **[TROUBLESHOOTING.md](TROUBLESHOOTING.md)** for fixes:
|
|
126
117
|
|
|
127
|
-
|
|
118
|
+
- Installer can't find GeneXus or the KB
|
|
119
|
+
- AI client doesn't see the GeneXus tools after restart
|
|
120
|
+
- "Worker failed to start" / .NET 4.8 errors
|
|
121
|
+
- KB build errors / locked artifacts
|
|
122
|
+
- Port 5000 already in use
|
|
123
|
+
- Permissions on `%LOCALAPPDATA%\GenexusMCP\`
|
|
124
|
+
|
|
125
|
+
Still stuck? [Open an issue](https://github.com/lennix1337/Genexus18MCP/issues) with the output of `npx genexus-mcp doctor --mcp-smoke`.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
## Tool Surface
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
- `_meta.tool` with the normalized tool name
|
|
133
|
-
- collection helpers such as `returned`, `total`, `empty`, and (when inferable) `hasMore` and `nextOffset`
|
|
134
|
-
- truncation signals via `_meta.truncated` plus contextual `help`
|
|
135
|
-
- `_meta.idempotent: true` on cache-hit responses
|
|
136
|
-
- `_meta.batched: true` on `targets[]` multi-object responses
|
|
137
|
-
- `_meta.dryRun: true` on dry-run preview responses
|
|
138
|
-
- `_meta.removedTools` advertised on `initialize` for proactive agent detection of removed tools
|
|
131
|
+
The worker exposes these tool families to the MCP router. *(Detailed schemas in [`GEMINI.md`](GEMINI.md).)*
|
|
139
132
|
|
|
140
|
-
|
|
133
|
+
- **Search & Discovery** — `genexus_query`, `genexus_read`, `genexus_inspect`, `genexus_list_objects`, `genexus_properties`
|
|
134
|
+
- **Editing & Architecture** — `genexus_edit`, `genexus_create_object`, `genexus_refactor`, `genexus_forge`, `genexus_add_variable`
|
|
135
|
+
- **Analysis** — `genexus_analyze`, `genexus_inject_context`, `genexus_doc`, `genexus_explain_code`, `genexus_summarize`
|
|
136
|
+
- **File System & Assets** — `genexus_asset`, `genexus_export_object`, `genexus_import_object`
|
|
137
|
+
- **History & DB** — `genexus_history`, `genexus_get_sql`, `genexus_structure`
|
|
138
|
+
- **Lifecycle & Build** — `genexus_lifecycle`, `genexus_test`, `genexus_format`
|
|
139
|
+
- **Native Layout SDK** — `genexus_layout` (`get_tree`, `find_controls`, `set_property`, `rename_printblock`, `add_printblock`, `get_preview`, …)
|
|
140
|
+
- **Patterns** — Smart XML generation/interpretation (e.g., WorkWithPlus PatternInstance).
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
- `axiCompact: true`: compact default projection
|
|
142
|
+
**Edit modes** (`genexus_edit`): `xml` (full replacement, default), `ops` (typed semantic ops like `set_attribute`, `add_rule`), `patch` (JSON-Patch RFC 6902).
|
|
144
143
|
|
|
145
|
-
|
|
146
|
-
- Gateway may return `result.isError=true` with `status=Running` plus `operationId`/`correlationId`.
|
|
147
|
-
- In this case, do not fail fast. Continue with `genexus_lifecycle(action='status'|'result', target='op:<operationId>')`.
|
|
144
|
+
**Safe by default**: all write tools accept `dryRun: true` (returns a preview without mutating the KB) and `idempotencyKey` (safe retries; concurrent calls coalesce, results cached 15 min).
|
|
148
145
|
|
|
149
146
|
---
|
|
150
147
|
|
|
151
|
-
##
|
|
148
|
+
## AXI CLI (for agents and automation)
|
|
152
149
|
|
|
153
|
-
|
|
150
|
+
The `genexus-mcp` command itself is also an agent-facing CLI with token-optimized output:
|
|
154
151
|
|
|
155
|
-
|
|
156
|
-
-
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
-
|
|
160
|
-
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
1. Clone the repository to your Windows machine.
|
|
167
|
-
2. Run `.\setup.bat`.
|
|
168
|
-
* *This checks prerequisites, builds the C# components, and auto-registers the local server with Claude, Codex, Antigravity, and Cursor when detected.*
|
|
169
|
-
3. If GeneXus or your KB are not auto-detected, follow the terminal prompts.
|
|
170
|
-
|
|
171
|
-
### Nexus-IDE (VS Code)
|
|
172
|
-
The repository includes `src/nexus-ide`, a lightweight VS Code extension containing:
|
|
173
|
-
- Virtual file system using the `genexus://` scheme
|
|
174
|
-
- Dynamic KB explorer with multi-part editing (Source, Rules, Events, Variables)
|
|
175
|
-
- Built-in MCP discovery commands (tools, resources, prompts)
|
|
152
|
+
```bash
|
|
153
|
+
genexus-mcp status # gateway/worker state
|
|
154
|
+
genexus-mcp doctor --mcp-smoke # health check + protocol probe
|
|
155
|
+
genexus-mcp tools list # list available tools
|
|
156
|
+
genexus-mcp config show # current resolved config
|
|
157
|
+
genexus-mcp layout status # native layout automation state
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Global flags: `--format toon|json|text` · `--fields f1,f2,...` · `--limit N` · `--query <text>` · `--quiet` · `--no-color`.
|
|
161
|
+
|
|
162
|
+
Full contract: [`docs/axi_cli_contract.md`](docs/axi_cli_contract.md). Best-practices playbook: [`docs/llm_cli_mcp_playbook.md`](docs/llm_cli_mcp_playbook.md).
|
|
176
163
|
|
|
177
|
-
|
|
178
|
-
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Advanced Configuration
|
|
167
|
+
|
|
168
|
+
The installer writes a `config.json` for you. To customize networking, timeouts, or shadow paths:
|
|
179
169
|
|
|
180
170
|
```json
|
|
181
171
|
{
|
|
@@ -195,14 +185,47 @@ You can expand your local `config.json` for advanced networking or timeouts:
|
|
|
195
185
|
}
|
|
196
186
|
```
|
|
197
187
|
|
|
198
|
-
###
|
|
199
|
-
- **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.
|
|
200
|
-
- **Gateway Reuse**: Launching multiple local IDE instances reuses a single active gateway using a unique lease file located at `%LOCALAPPDATA%\GenexusMCP\gateway-leases`.
|
|
201
|
-
- **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`.
|
|
188
|
+
### Architecture
|
|
202
189
|
|
|
203
190
|
```mermaid
|
|
204
191
|
graph LR
|
|
205
|
-
A[AI Client
|
|
192
|
+
A[AI Client / Nexus-IDE] -->|MCP stdio or HTTP /mcp| B[Gateway .NET 8]
|
|
206
193
|
B -->|JSON-RPC over process boundary| C[Worker .NET Framework 4.8]
|
|
207
194
|
C -->|Native SDK| D[GeneXus KB]
|
|
208
195
|
```
|
|
196
|
+
|
|
197
|
+
- **Lazy worker**: the heavy .NET 4.8 worker only spins up on first command and shuts down after `WorkerIdleTimeoutMinutes` of inactivity to unlock build artifacts.
|
|
198
|
+
- **Gateway reuse**: multiple IDE instances share one gateway via lease files at `%LOCALAPPDATA%\GenexusMCP\gateway-leases`.
|
|
199
|
+
- **HTTP mode**: also available at `http://127.0.0.1:5000/mcp` with SSE. Header: `MCP-Protocol-Version: 2025-06-18`.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Development & building from source
|
|
204
|
+
|
|
205
|
+
Want to contribute or run a local dev build?
|
|
206
|
+
|
|
207
|
+
1. Clone this repo on Windows.
|
|
208
|
+
2. Run `.\setup.bat` — checks prerequisites, builds the C# components, and auto-registers the local build with detected AI clients.
|
|
209
|
+
3. If GeneXus or your KB aren't auto-detected, follow the prompts.
|
|
210
|
+
|
|
211
|
+
### Nexus-IDE (VS Code extension)
|
|
212
|
+
|
|
213
|
+
`src/nexus-ide` is a lightweight VS Code extension that ships with the repo:
|
|
214
|
+
- Virtual filesystem using the `genexus://` scheme
|
|
215
|
+
- Dynamic KB explorer with multi-part editing (Source, Rules, Events, Variables)
|
|
216
|
+
- Built-in MCP discovery commands (tools, resources, prompts)
|
|
217
|
+
|
|
218
|
+
### Automated release
|
|
219
|
+
|
|
220
|
+
- Workflow: `.github/workflows/release.yml`
|
|
221
|
+
- Trigger: push to `main` with a `package.json` version bump
|
|
222
|
+
- Behavior: publishes to npm if version is new + creates a GitHub Release tagged `v<version>`
|
|
223
|
+
- Required secret: `NPM_TOKEN`
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## License
|
|
228
|
+
|
|
229
|
+
MIT — see [LICENSE](LICENSE).
|
|
230
|
+
|
|
231
|
+
> **Search keywords:** GeneXus MCP · GeneXus 18 MCP · GeneXus AI · GeneXus Claude · Model Context Protocol GeneXus · GeneXus low-code AI agent · GeneXus Cursor · GeneXus Antigravity
|