genexus-mcp 1.1.7 → 1.2.1

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,165 +1,195 @@
1
- # GeneXus 18 MCP Server (Genexus18MCP)
2
-
3
- [![MCP Badge](https://lobehub.com/badge/mcp/lennix1337-genexus18mcp?style=for-the-badge)](https://lobehub.com/mcp/lennix1337-genexus18mcp)
4
-
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 (Installation & Configuration)
10
-
11
- You **do NOT** need to clone this repository, and you **do NOT** need to install anything globally via `npm i -g`. The standard Node.js `npx` runner will dynamically fetch and launch the compiled gateway for you.
12
-
13
- ### Step 1: Configure (Non-Interactive First)
14
-
15
- To initialize configuration in a deterministic, agent-friendly way:
16
-
17
- ```bash
18
- npx genexus-mcp@latest init --kb "C:\KBs\YourKB" --gx "C:\Program Files (x86)\GeneXus\GeneXus18"
19
- ```
20
-
21
- If you want the setup wizard prompts explicitly, run:
22
-
23
- ```bash
24
- npx genexus-mcp@latest init --interactive
25
- ```
26
-
27
- ### Step 2: Restart your AI Assistant
28
-
29
- Once the wizard outputs `🎉 You are all set!`, simply **Restart** or **Refresh** your AI Assistant (Claude Desktop, Antigravity, Cursor, etc.). The AI will automatically spin up the server in the background and connect.
30
-
31
- ---
32
-
33
- ### 🤖 Auto-Installer Prompt (Copy & Paste to your AI)
34
-
35
- If you want your AI Assistant to install and configure everything itself without you touching the terminal, copy and paste this exact prompt into your chat window:
36
-
37
- ```markdown
38
- Please configure your Model Context Protocol (MCP) server to connect to my GeneXus Knowledge Base by following these exact steps:
39
-
40
- 1. Run the command `npx genexus-mcp@latest init` directly in the terminal in non-interactive mode using this configuration format (do not use interactive prompts). You must inject my raw KB path and GX path via environment variables or a direct config patch if needed, or simply let the zero-config auto-discovery handle it if we are already in the KB folder.
41
- 2. If I haven't told you my GeneXus path or KB path, STOP and ask me for them now.
42
- 3. Once the setup is complete, read the generated JSON block from the console output.
43
- 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.
44
- 5. Provide a summary of the installation and notify me when you are ready to query GeneXus!
45
- ```
46
-
47
- ---
48
-
49
- ## AXI CLI Commands
50
-
51
- The package now includes agent-facing commands optimized for shell automation:
52
-
53
- ```bash
54
- genexus-mcp home
55
- genexus-mcp axi home
56
- genexus-mcp llm help
57
- genexus-mcp status
58
- genexus-mcp doctor --mcp-smoke
59
- genexus-mcp tools list
60
- genexus-mcp config show
61
- ```
62
-
63
- Global AXI flags:
64
- - `--format toon|json|text` (default for AXI commands: `toon`)
65
- - `--fields f1,f2,...` (minimal schema by default; request extra fields explicitly)
66
- - `--limit <n>` (for list commands)
67
- - `--query <text>` (for `tools list`)
68
- - `--full` (expand truncated long-form content when supported)
69
- - `--mcp-smoke` (for `doctor`; executes protocol smoke checks)
70
- - `--quiet` and `--no-color` (agent-safe output control)
71
-
72
- Notes:
73
- - Structured data/errors are emitted on `stdout`.
74
- - Diagnostic/progress output stays on `stderr`.
75
- - `meta.command` is always present for stable command identity in AXI outputs.
76
- - Use `genexus-mcp <command> --help` for command-specific usage/examples.
77
- - Output metadata includes `meta.schemaVersion` for contract stability.
78
- - `--fields` is validated strictly per command; invalid fields return `usage_error` and exit code `2`.
79
- - Running `genexus-mcp` without an AXI subcommand keeps the original MCP gateway launcher behavior.
80
- - `genexus-mcp home` (`genexus-mcp axi home`) is the explicit content-first AXI entrypoint.
81
- - `genexus-mcp llm help` returns protocol-first usage guidance for agents.
82
- - Full LLM-facing AXI contract: [`docs/axi_cli_contract.md`](docs/axi_cli_contract.md)
83
- - LLM usage playbook (CLI + MCP best practices): [`docs/llm_cli_mcp_playbook.md`](docs/llm_cli_mcp_playbook.md)
84
-
85
- ---
86
-
87
- ## 🛠️ Tool Surface (Skills)
88
- *(See `GEMINI.md` for extended guidelines).* The worker natively exposes the following tools to the MCP Router:
89
-
90
- - **Search & Discovery**: `genexus_query`, `genexus_read`, `genexus_batch_read`, `genexus_inspect`, `genexus_list_objects`, `genexus_properties`
91
- - **Editing & Architecture**: `genexus_edit`, `genexus_batch_edit`, `genexus_create_object`, `genexus_refactor`, `genexus_forge`
92
- - **Analysis:** `genexus_analyze`, `genexus_inject_context`, `genexus_doc`, `genexus_explain_code`, `genexus_summarize`
93
- - **File System & Assets**: `genexus_asset`, `genexus_export_object`, `genexus_import_object`
94
- - **History & DB**: `genexus_history`, `genexus_get_sql`, `genexus_structure`
95
- - **Lifecycle & Build**: `genexus_lifecycle`, `genexus_test`, `genexus_format`
96
- - **Patterns**: Smart XML generation and interpretation (e.g., WorkWithPlus PatternInstance mapping).
97
-
98
- ### MCP tool response ergonomics
99
-
100
- For `tools/call`, the gateway keeps MCP compatibility and adds lightweight response metadata:
101
-
102
- - `meta.schemaVersion` currently `mcp-axi/1`
103
- - `meta.tool` with the normalized tool name
104
- - collection helpers such as `returned`, `total`, `empty`, and (when inferable) `hasMore` and `nextOffset`
105
- - truncation signals via `meta.truncated` plus contextual `help`
106
-
107
- For list-heavy calls (`genexus_query`, `genexus_list_objects`), optional arguments can reduce token usage:
108
-
109
- - `fields`: explicit projection (`["name","type"]` or `"name,type"`)
110
- - `axiCompact: true`: compact default projection
111
-
112
- Timeout behavior for long-running MCP tools:
113
- - Gateway may return `result.isError=true` with `status=Running` plus `operationId`/`correlationId`.
114
- - In this case, do not fail fast. Continue with `genexus_lifecycle(action='status'|'result', target='op:<operationId>')`.
115
-
116
- ---
117
-
118
- ## 💻 Development & Building from Source
119
-
120
- If you want to contribute, build the project yourself, or use the local **Nexus-IDE** VS Code Extension, use the classic source-based workflow.
121
-
122
- ### One-Click Build
123
- 1. Clone the repository to your Windows machine.
124
- 2. Run `.\setup.bat`.
125
- * *This checks prerequisites, builds the C# components, and auto-registers the local server with Claude, Codex, Antigravity, and Cursor when detected.*
126
- 3. If GeneXus or your KB are not auto-detected, follow the terminal prompts.
127
-
128
- ### Nexus-IDE (VS Code)
129
- The repository includes `src/nexus-ide`, a lightweight VS Code extension containing:
130
- - Virtual file system using the `genexus://` scheme
131
- - Dynamic KB explorer with multi-part editing (Source, Rules, Events, Variables)
132
- - Built-in MCP discovery commands (tools, resources, prompts)
133
-
134
- ### Advanced Configuration
135
- You can expand your local `config.json` for advanced networking or timeouts:
136
-
137
- ```json
138
- {
139
- "Server": {
140
- "HttpPort": 5000,
141
- "BindAddress": "127.0.0.1",
142
- "SessionIdleTimeoutMinutes": 10,
143
- "WorkerIdleTimeoutMinutes": 5
144
- },
145
- "GeneXus": {
146
- "InstallationPath": "C:\\Program Files (x86)\\GeneXus\\GeneXus18",
147
- "WorkerExecutable": "worker\\GxMcp.Worker.exe"
148
- },
149
- "Environment": {
150
- "KBPath": "C:\\KBs\\YourKB"
151
- }
152
- }
153
- ```
154
-
155
- ### Process Lifecycle & Architecture
156
- - **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.
157
- - **Gateway Reuse**: Launching multiple local IDE instances reuses a single active gateway using a unique lease file located at `%LOCALAPPDATA%\GenexusMCP\gateway-leases`.
158
- - **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`.
159
-
160
- ```mermaid
161
- graph LR
162
- A[AI Client or Nexus-IDE] -->|MCP stdio or HTTP /mcp| B[Gateway .NET 8]
163
- B -->|JSON-RPC over process boundary| C[Worker .NET Framework 4.8]
164
- C -->|Native SDK| D[GeneXus KB]
165
- ```
1
+ # GeneXus 18 MCP Server (Genexus18MCP)
2
+
3
+ [![MCP Badge](https://lobehub.com/badge/mcp/lennix1337-genexus18mcp?style=for-the-badge)](https://lobehub.com/mcp/lennix1337-genexus18mcp)
4
+
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 (Installation & Configuration)
10
+
11
+ You **do NOT** need to clone this repository, and you **do NOT** need to install anything globally via `npm i -g`. The standard Node.js `npx` runner will dynamically fetch and launch the compiled gateway for you.
12
+
13
+ ### Step 1: Configure (Non-Interactive First)
14
+
15
+ To initialize configuration in a deterministic, agent-friendly way:
16
+
17
+ ```bash
18
+ npx genexus-mcp@latest init --kb "C:\KBs\YourKB" --gx "C:\Program Files (x86)\GeneXus\GeneXus18"
19
+ ```
20
+
21
+ If you want the setup wizard prompts explicitly, run:
22
+
23
+ ```bash
24
+ npx genexus-mcp@latest init --interactive
25
+ ```
26
+
27
+ ### Step 2: Restart your AI Assistant
28
+
29
+ Once the wizard outputs `🎉 You are all set!`, simply **Restart** or **Refresh** your AI Assistant (Claude Desktop, Antigravity, Cursor, etc.). The AI will automatically spin up the server in the background and connect.
30
+
31
+ ---
32
+
33
+ ### 🤖 Auto-Installer Prompt (Copy & Paste to your AI)
34
+
35
+ If you want your AI Assistant to install and configure everything itself without you touching the terminal, copy and paste this exact prompt into your chat window:
36
+
37
+ ```markdown
38
+ Please configure your Model Context Protocol (MCP) server to connect to my GeneXus Knowledge Base by following these exact steps:
39
+
40
+ 1. Run the command `npx genexus-mcp@latest init` directly in the terminal in non-interactive mode using this configuration format (do not use interactive prompts). You must inject my raw KB path and GX path via environment variables or a direct config patch if needed, or simply let the zero-config auto-discovery handle it if we are already in the KB folder.
41
+ 2. If I haven't told you my GeneXus path or KB path, STOP and ask me for them now.
42
+ 3. Once the setup is complete, read the generated JSON block from the console output.
43
+ 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.
44
+ 5. Provide a summary of the installation and notify me when you are ready to query GeneXus!
45
+ ```
46
+
47
+ ---
48
+
49
+ ## AXI CLI Commands
50
+
51
+ The package now includes agent-facing commands optimized for shell automation:
52
+
53
+ ```bash
54
+ genexus-mcp home
55
+ genexus-mcp axi home
56
+ genexus-mcp llm help
57
+ genexus-mcp status
58
+ genexus-mcp doctor --mcp-smoke
59
+ genexus-mcp tools list
60
+ genexus-mcp config show
61
+ genexus-mcp layout status
62
+ genexus-mcp layout run --action activate-layout
63
+ genexus-mcp layout run --action activate-tab --tab "Layout"
64
+ genexus-mcp layout inspect --tab "Layout"
65
+ ```
66
+
67
+ Global AXI flags:
68
+ - `--format toon|json|text` (default for AXI commands: `toon`)
69
+ - `--fields f1,f2,...` (minimal schema by default; request extra fields explicitly)
70
+ - `--limit <n>` (for list commands)
71
+ - `--query <text>` (for `tools list`)
72
+ - `--full` (expand truncated long-form content when supported)
73
+ - `--mcp-smoke` (for `doctor`; executes protocol smoke checks)
74
+ - `--quiet` and `--no-color` (agent-safe output control)
75
+
76
+ Layout automation flags (`layout run`):
77
+ - `--action focus|activate-layout|activate-tab|send-keys|type-text|click`
78
+ - `--title "<window-title-fragment>"` to target a specific GeneXus window
79
+ - `--tab "<tab-name>"` for `activate-tab`
80
+ - `--keys "<sendkeys-pattern>"` for `send-keys`
81
+ - `--text "<text>"` for `type-text`
82
+ - `--x <screenX> --y <screenY>` for `click`
83
+
84
+ Layout inspection:
85
+ - `genexus-mcp layout inspect [--tab "<tab-name>"] [--limit N] [--full] [--title "<window-title-fragment>"]`
86
+ - Returns UI Automation controls with bounding rectangles (`bounds.x/y/width/height`) to support deterministic replay.
87
+
88
+ Notes:
89
+ - Structured data/errors are emitted on `stdout`.
90
+ - Diagnostic/progress output stays on `stderr`.
91
+ - `meta.command` is always present for stable command identity in AXI outputs.
92
+ - Use `genexus-mcp <command> --help` for command-specific usage/examples.
93
+ - Output metadata includes `meta.schemaVersion` for contract stability.
94
+ - `--fields` is validated strictly per command; invalid fields return `usage_error` and exit code `2`.
95
+ - Running `genexus-mcp` without an AXI subcommand keeps the original MCP gateway launcher behavior.
96
+ - `genexus-mcp home` (`genexus-mcp axi home`) is the explicit content-first AXI entrypoint.
97
+ - `genexus-mcp llm help` returns protocol-first usage guidance for agents.
98
+ - Full LLM-facing AXI contract: [`docs/axi_cli_contract.md`](docs/axi_cli_contract.md)
99
+ - LLM usage playbook (CLI + MCP best practices): [`docs/llm_cli_mcp_playbook.md`](docs/llm_cli_mcp_playbook.md)
100
+
101
+ ---
102
+
103
+ ## 🛠️ Tool Surface (Skills)
104
+ *(See `GEMINI.md` for extended guidelines).* The worker natively exposes the following tools to the MCP Router:
105
+
106
+ - **Search & Discovery**: `genexus_query`, `genexus_read`, `genexus_batch_read`, `genexus_inspect`, `genexus_list_objects`, `genexus_properties`
107
+ - **Editing & Architecture**: `genexus_edit`, `genexus_batch_edit`, `genexus_create_object`, `genexus_refactor`, `genexus_forge`
108
+ - **Analysis:** `genexus_analyze`, `genexus_inject_context`, `genexus_doc`, `genexus_explain_code`, `genexus_summarize`
109
+ - **File System & Assets**: `genexus_asset`, `genexus_export_object`, `genexus_import_object`
110
+ - **History & DB**: `genexus_history`, `genexus_get_sql`, `genexus_structure`
111
+ - **Native Layout SDK**: `genexus_layout` (`get_tree`, `find_controls`, `set_property`, `set_properties`, `rename_printblock`, `add_printblock`, `get_preview`, `scan_mutators`)
112
+
113
+ Layout color note:
114
+ - 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.
115
+ - **Lifecycle & Build**: `genexus_lifecycle`, `genexus_test`, `genexus_format`
116
+ - **Patterns**: Smart XML generation and interpretation (e.g., WorkWithPlus PatternInstance mapping).
117
+
118
+ ### MCP tool response ergonomics
119
+
120
+ For `tools/call`, the gateway keeps MCP compatibility and adds lightweight response metadata:
121
+
122
+ - `meta.schemaVersion` currently `mcp-axi/1`
123
+ - `meta.tool` with the normalized tool name
124
+ - collection helpers such as `returned`, `total`, `empty`, and (when inferable) `hasMore` and `nextOffset`
125
+ - truncation signals via `meta.truncated` plus contextual `help`
126
+
127
+ For list-heavy calls (`genexus_query`, `genexus_list_objects`), optional arguments can reduce token usage:
128
+
129
+ - `fields`: explicit projection (`["name","type"]` or `"name,type"`)
130
+ - `axiCompact: true`: compact default projection
131
+
132
+ Timeout behavior for long-running MCP tools:
133
+ - Gateway may return `result.isError=true` with `status=Running` plus `operationId`/`correlationId`.
134
+ - In this case, do not fail fast. Continue with `genexus_lifecycle(action='status'|'result', target='op:<operationId>')`.
135
+
136
+ ---
137
+
138
+ ## 💻 Development & Building from Source
139
+
140
+ If you want to contribute, build the project yourself, or use the local **Nexus-IDE** VS Code Extension, use the classic source-based workflow.
141
+
142
+ ### Automated Release (npm + GitHub)
143
+ - Workflow: `.github/workflows/release.yml`
144
+ - Trigger: `push` na `main` com mudança em `package.json`
145
+ - Behavior:
146
+ - compara a versão atual com a versão do commit anterior
147
+ - publica no npm apenas se a versão for nova
148
+ - cria GitHub Release com tag `v<version>`
149
+ - Required secret:
150
+ - `NPM_TOKEN` (token de publicação no npm com permissão para o pacote `genexus-mcp`)
151
+
152
+ ### One-Click Build
153
+ 1. Clone the repository to your Windows machine.
154
+ 2. Run `.\setup.bat`.
155
+ * *This checks prerequisites, builds the C# components, and auto-registers the local server with Claude, Codex, Antigravity, and Cursor when detected.*
156
+ 3. If GeneXus or your KB are not auto-detected, follow the terminal prompts.
157
+
158
+ ### Nexus-IDE (VS Code)
159
+ The repository includes `src/nexus-ide`, a lightweight VS Code extension containing:
160
+ - Virtual file system using the `genexus://` scheme
161
+ - Dynamic KB explorer with multi-part editing (Source, Rules, Events, Variables)
162
+ - Built-in MCP discovery commands (tools, resources, prompts)
163
+
164
+ ### Advanced Configuration
165
+ You can expand your local `config.json` for advanced networking or timeouts:
166
+
167
+ ```json
168
+ {
169
+ "Server": {
170
+ "HttpPort": 5000,
171
+ "BindAddress": "127.0.0.1",
172
+ "SessionIdleTimeoutMinutes": 10,
173
+ "WorkerIdleTimeoutMinutes": 5
174
+ },
175
+ "GeneXus": {
176
+ "InstallationPath": "C:\\Program Files (x86)\\GeneXus\\GeneXus18",
177
+ "WorkerExecutable": "worker\\GxMcp.Worker.exe"
178
+ },
179
+ "Environment": {
180
+ "KBPath": "C:\\KBs\\YourKB"
181
+ }
182
+ }
183
+ ```
184
+
185
+ ### Process Lifecycle & Architecture
186
+ - **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.
187
+ - **Gateway Reuse**: Launching multiple local IDE instances reuses a single active gateway using a unique lease file located at `%LOCALAPPDATA%\GenexusMCP\gateway-leases`.
188
+ - **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`.
189
+
190
+ ```mermaid
191
+ graph LR
192
+ A[AI Client or Nexus-IDE] -->|MCP stdio or HTTP /mcp| B[Gateway .NET 8]
193
+ B -->|JSON-RPC over process boundary| C[Worker .NET Framework 4.8]
194
+ C -->|Native SDK| D[GeneXus KB]
195
+ ```