genat-mcp 2.2.2 → 2.2.3
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 +18 -0
- package/index.js +11 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ npm install /path/to/n8n_playwright_tests/mcp-genat
|
|
|
38
38
|
| **N8N_MAX_ASSERTIONS** | No | (none) | Override assertion count for complex pages (e.g. `25`). Used as default when the tool is invoked without `maxAssertions`; also used by run-genat.mjs. |
|
|
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
|
+
| **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. |
|
|
41
42
|
|
|
42
43
|
## Cursor MCP config
|
|
43
44
|
|
|
@@ -84,6 +85,23 @@ npm install /path/to/n8n_playwright_tests/mcp-genat
|
|
|
84
85
|
}
|
|
85
86
|
```
|
|
86
87
|
|
|
88
|
+
**With GENAT_PROJECT_ROOT** (when project is outside MCP working directory):
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"mcpServers": {
|
|
93
|
+
"GenAT": {
|
|
94
|
+
"command": "npx",
|
|
95
|
+
"args": ["genat-mcp"],
|
|
96
|
+
"env": {
|
|
97
|
+
"GENAT_PROJECT_ROOT": "/Users/me/projects"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
Then use `parentProjectFolder ill_tests` in the prompt to target `/Users/me/projects/ill_tests`.
|
|
104
|
+
|
|
87
105
|
**With optional params for complex pages** (`N8N_MAX_ASSERTIONS`, `N8N_SCOPE_TO_REGIONS`, `N8N_ANALYZE_STATES`):
|
|
88
106
|
|
|
89
107
|
```json
|
package/index.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Detects framework (language, BDD, Page Object), POSTs to n8n webhook, returns generated files.
|
|
6
6
|
*/
|
|
7
7
|
import https from 'node:https';
|
|
8
|
+
import path from 'node:path';
|
|
8
9
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
9
10
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
10
11
|
import { z } from 'zod';
|
|
@@ -51,7 +52,7 @@ function insecureHttpsFetch(url, { method = 'GET', headers = {}, body }) {
|
|
|
51
52
|
const server = new McpServer(
|
|
52
53
|
{
|
|
53
54
|
name: 'GenAT',
|
|
54
|
-
version: '2.2.
|
|
55
|
+
version: '2.2.3',
|
|
55
56
|
},
|
|
56
57
|
{
|
|
57
58
|
capabilities: {
|
|
@@ -69,7 +70,7 @@ server.registerTool(
|
|
|
69
70
|
url: z.string().describe('Page URL to analyze for accessibility (e.g. https://example.com)'),
|
|
70
71
|
parentProjectFolder: z
|
|
71
72
|
.string()
|
|
72
|
-
.describe('Absolute or relative path to the project root
|
|
73
|
+
.describe('Absolute or relative path to the project root. When GENAT_PROJECT_ROOT is set, resolved relative to it; otherwise relative to process.cwd().'),
|
|
73
74
|
writeToProject: z
|
|
74
75
|
.boolean()
|
|
75
76
|
.optional()
|
|
@@ -101,7 +102,7 @@ server.registerTool(
|
|
|
101
102
|
jiraNumber: z
|
|
102
103
|
.string()
|
|
103
104
|
.optional()
|
|
104
|
-
.describe('JIRA issue key (e.g. PROJ-123)
|
|
105
|
+
.describe('JIRA issue key (e.g. PROJ-123, RB-40039). Extract from prompts like "JIRA RB-40039" or "JIRA ticket PROJ-123". Pass only the key (e.g. RB-40039), not "JIRA RB-40039".'),
|
|
105
106
|
},
|
|
106
107
|
},
|
|
107
108
|
async ({ url, parentProjectFolder, writeToProject, maxAssertions, scopeToRegions, analyzeStates, loginUsername, loginPassword, loginUrl, jiraNumber }) => {
|
|
@@ -112,9 +113,12 @@ server.registerTool(
|
|
|
112
113
|
};
|
|
113
114
|
}
|
|
114
115
|
|
|
116
|
+
const base = process.env.GENAT_PROJECT_ROOT || process.cwd();
|
|
117
|
+
const resolvedPath = path.resolve(base, parentProjectFolder || '.');
|
|
118
|
+
|
|
115
119
|
let framework;
|
|
116
120
|
try {
|
|
117
|
-
framework = detectFramework(
|
|
121
|
+
framework = detectFramework(resolvedPath);
|
|
118
122
|
} catch (err) {
|
|
119
123
|
return {
|
|
120
124
|
content: [
|
|
@@ -133,7 +137,7 @@ server.registerTool(
|
|
|
133
137
|
|
|
134
138
|
let login = {};
|
|
135
139
|
try {
|
|
136
|
-
login = detectLogin(
|
|
140
|
+
login = detectLogin(resolvedPath) || {};
|
|
137
141
|
} catch (_) {}
|
|
138
142
|
|
|
139
143
|
// Tool params override .env
|
|
@@ -226,9 +230,9 @@ server.registerTool(
|
|
|
226
230
|
};
|
|
227
231
|
}
|
|
228
232
|
|
|
229
|
-
if (writeToProject &&
|
|
233
|
+
if (writeToProject && resolvedPath && data) {
|
|
230
234
|
try {
|
|
231
|
-
const written = writeGeneratedFiles(
|
|
235
|
+
const written = writeGeneratedFiles(resolvedPath, data);
|
|
232
236
|
data._written = written;
|
|
233
237
|
} catch (err) {
|
|
234
238
|
data._writeError = err instanceof Error ? err.message : String(err);
|
package/package.json
CHANGED