genat-mcp 2.2.6 → 2.2.7
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 +19 -0
- package/index.js +11 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,6 +39,7 @@ npm install /path/to/n8n_playwright_tests/mcp-genat
|
|
|
39
39
|
| **N8N_SCOPE_TO_REGIONS** | No | (none) | Comma-separated regions to focus tests on (e.g. `header,main,table`). Used as default when the tool is invoked without `scopeToRegions`; also used by run-genat.mjs. |
|
|
40
40
|
| **N8N_ANALYZE_STATES** | No | (off) | Set to `1`, `true`, or `yes` to analyze dropdown/combobox expanded states and include state-specific violations in generated tests. Used as default when the tool is invoked without `analyzeStates`; also used by run-genat.mjs. Increases analysis time. |
|
|
41
41
|
| **GENAT_PROJECT_ROOT** | No | (cwd) | Base path for resolving `parentProjectFolder`. When set, `parentProjectFolder` is resolved relative to this path. Use when your project is outside the MCP's working directory. Example: if your pytest project is at `/Users/me/projects/ill_tests`, set `GENAT_PROJECT_ROOT=/Users/me/projects` and use `parentProjectFolder ill_tests` in the prompt. |
|
|
42
|
+
| **GENAT_FETCH_TIMEOUT_MS** | No | 600000 (10 min) | Max time in milliseconds to wait for the n8n webhook response. Increase if GenAT times out before the workflow completes (e.g. complex pages with JIRA + AI Agent). Set in MCP env, e.g. `GENAT_FETCH_TIMEOUT_MS=900000` for 15 minutes. |
|
|
42
43
|
|
|
43
44
|
## Framework detection and auto-discovery
|
|
44
45
|
|
|
@@ -108,6 +109,24 @@ GenAT detects **language** (TypeScript, JavaScript, Python), **BDD framework** (
|
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
```
|
|
112
|
+
|
|
113
|
+
**With GENAT_FETCH_TIMEOUT_MS** (increase timeout when workflow takes longer):
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"mcpServers": {
|
|
118
|
+
"GenAT": {
|
|
119
|
+
"command": "npx",
|
|
120
|
+
"args": ["genat-mcp"],
|
|
121
|
+
"env": {
|
|
122
|
+
"GENAT_FETCH_TIMEOUT_MS": "900000",
|
|
123
|
+
"N8N_WEBHOOK_URL": "https://n8n.example.com/webhook-test/webhook-genat-login"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
(900000 = 15 minutes. Default is 600000 = 10 minutes.)
|
|
111
130
|
Then use `parentProjectFolder ill_tests` in the prompt to target `/Users/me/projects/ill_tests`.
|
|
112
131
|
|
|
113
132
|
**With optional params for complex pages** (`N8N_MAX_ASSERTIONS`, `N8N_SCOPE_TO_REGIONS`, `N8N_ANALYZE_STATES`):
|
package/index.js
CHANGED
|
@@ -16,12 +16,14 @@ import { writeGeneratedFiles } from './write-files.js';
|
|
|
16
16
|
const N8N_WEBHOOK_URL = process.env.N8N_WEBHOOK_URL || 'http://localhost:5678/webhook-test/webhook-genat-login';
|
|
17
17
|
const SERVICE_BASE_URL = process.env.SERVICE_BASE_URL || null;
|
|
18
18
|
const N8N_INSECURE_TLS = /^1|true|yes$/i.test(process.env.N8N_INSECURE_TLS || '');
|
|
19
|
+
const GENAT_FETCH_TIMEOUT_MS = Math.max(60000, parseInt(process.env.GENAT_FETCH_TIMEOUT_MS || '600000', 10) || 600000);
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* HTTPS fetch with rejectUnauthorized: false for self-signed/internal CA certs.
|
|
22
23
|
* Returns a Response-like object { ok, status, text(), json() }.
|
|
24
|
+
* Supports signal for timeout.
|
|
23
25
|
*/
|
|
24
|
-
function insecureHttpsFetch(url, { method = 'GET', headers = {}, body }) {
|
|
26
|
+
function insecureHttpsFetch(url, { method = 'GET', headers = {}, body, signal }) {
|
|
25
27
|
return new Promise((resolve, reject) => {
|
|
26
28
|
const req = https.request(
|
|
27
29
|
url,
|
|
@@ -29,6 +31,7 @@ function insecureHttpsFetch(url, { method = 'GET', headers = {}, body }) {
|
|
|
29
31
|
method,
|
|
30
32
|
headers: { 'Content-Type': 'application/json', ...headers },
|
|
31
33
|
agent: new https.Agent({ rejectUnauthorized: false }),
|
|
34
|
+
signal,
|
|
32
35
|
},
|
|
33
36
|
(res) => {
|
|
34
37
|
let data = '';
|
|
@@ -52,7 +55,7 @@ function insecureHttpsFetch(url, { method = 'GET', headers = {}, body }) {
|
|
|
52
55
|
const server = new McpServer(
|
|
53
56
|
{
|
|
54
57
|
name: 'GenAT',
|
|
55
|
-
version: '2.2.
|
|
58
|
+
version: '2.2.7',
|
|
56
59
|
},
|
|
57
60
|
{
|
|
58
61
|
capabilities: {
|
|
@@ -171,10 +174,13 @@ server.registerTool(
|
|
|
171
174
|
};
|
|
172
175
|
|
|
173
176
|
const useInsecureTls = N8N_INSECURE_TLS && N8N_WEBHOOK_URL.startsWith('https://');
|
|
177
|
+
const controller = new AbortController();
|
|
178
|
+
const timeoutId = setTimeout(() => controller.abort(), GENAT_FETCH_TIMEOUT_MS);
|
|
174
179
|
const fetchOpts = {
|
|
175
180
|
method: 'POST',
|
|
176
181
|
headers: { 'Content-Type': 'application/json' },
|
|
177
182
|
body: JSON.stringify(body),
|
|
183
|
+
signal: controller.signal,
|
|
178
184
|
};
|
|
179
185
|
let response;
|
|
180
186
|
try {
|
|
@@ -190,13 +196,15 @@ server.registerTool(
|
|
|
190
196
|
text: JSON.stringify({
|
|
191
197
|
error: 'Failed to call n8n webhook',
|
|
192
198
|
message: err instanceof Error ? err.message : String(err),
|
|
193
|
-
hint: 'Set N8N_WEBHOOK_URL to your n8n webhook URL. For self-signed/internal certs, set N8N_INSECURE_TLS=1',
|
|
199
|
+
hint: err?.name === 'AbortError' ? `Request timed out after ${GENAT_FETCH_TIMEOUT_MS / 1000}s. Set GENAT_FETCH_TIMEOUT_MS in MCP env to increase (default 600000).` : 'Set N8N_WEBHOOK_URL to your n8n webhook URL. For self-signed/internal certs, set N8N_INSECURE_TLS=1',
|
|
194
200
|
workaround: `Run: N8N_WEBHOOK_URL='${loginUrl}' N8N_INSECURE_TLS=1 node node_modules/genat-mcp/run-genat.mjs "<url>" . Use node_modules/genat-mcp/run-genat.mjs only (delete any run-genat.mjs in project root that uses webhook-genat).`,
|
|
195
201
|
}),
|
|
196
202
|
},
|
|
197
203
|
],
|
|
198
204
|
isError: true,
|
|
199
205
|
};
|
|
206
|
+
} finally {
|
|
207
|
+
clearTimeout(timeoutId);
|
|
200
208
|
}
|
|
201
209
|
|
|
202
210
|
if (!response.ok) {
|
package/package.json
CHANGED