genat-mcp 2.2.2 → 2.2.4

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
@@ -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.2',
55
+ version: '2.2.4',
55
56
  },
56
57
  {
57
58
  capabilities: {
@@ -64,12 +65,12 @@ server.registerTool(
64
65
  'GenAT',
65
66
  {
66
67
  description:
67
- 'Generate accessibility tests for a URL based on the project folder. Analyzes the page (DOM + a11y), detects project framework (TypeScript, JavaScript, or Python, BDD, Page Object), and returns generated test files (feature, spec/step defs, page objects). Optionally write files to the project folder. On failure: run node node_modules/genat-mcp/run-genat.mjs (NOT run-genat.mjs in project root). Use webhook-genat-login in N8N_WEBHOOK_URL (never webhook-genat).',
68
+ 'Generate accessibility tests for a URL based on the project folder. Analyzes the page (DOM + a11y), detects project framework (TypeScript, JavaScript, or Python, BDD, Page Object), and returns generated test files (feature, spec/step defs, page objects). Optionally write files to the project folder. IMPORTANT: When the user mentions a JIRA ticket (e.g. "JIRA RB-40039"), pass jiraNumber with the key only (e.g. RB-40039) so the workflow can fetch acceptance criteria. On failure: run node node_modules/genat-mcp/run-genat.mjs (NOT run-genat.mjs in project root). Use webhook-genat-login in N8N_WEBHOOK_URL (never webhook-genat).',
68
69
  inputSchema: {
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 containing TypeScript, JavaScript, or Python Playwright code'),
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) for acceptance criteria'),
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(parentProjectFolder || '.');
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(parentProjectFolder || '.') || {};
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 && parentProjectFolder && data) {
233
+ if (writeToProject && resolvedPath && data) {
230
234
  try {
231
- const written = writeGeneratedFiles(parentProjectFolder, data);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genat-mcp",
3
- "version": "2.2.2",
3
+ "version": "2.2.4",
4
4
  "mcpName": "io.github.asokans@oclc.org/genat",
5
5
  "description": "MCP server GenAT: generate accessibility tests via n8n workflow (url + project folder)",
6
6
  "type": "module",
@@ -27,3 +27,7 @@ Example:
27
27
  ```bash
28
28
  N8N_WEBHOOK_URL='https://your-n8n/webhook-test/webhook-genat-login' N8N_INSECURE_TLS=1 node node_modules/genat-mcp/run-genat.mjs https://example.com .
29
29
  ```
30
+
31
+ ## When invoking GenAT with JIRA
32
+
33
+ When the user mentions a JIRA ticket in their prompt (e.g. "JIRA RB-40039", "JIRA ticket PROJ-123", "JIRA RB-40039"), **always pass `jiraNumber`** to the GenAT tool with the extracted key only (e.g. `RB-40039`, not "JIRA RB-40039"). The workflow uses this to fetch acceptance criteria. If you omit it, jiraNumber will be null and JIRA integration will not run.