genat-mcp 1.2.0 → 1.2.2

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.
Files changed (3) hide show
  1. package/README.md +1 -0
  2. package/index.js +45 -7
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -33,6 +33,7 @@ npm install /path/to/n8n_playwright_tests/mcp-genat
33
33
  | Variable | Required | Default | Description |
34
34
  |--------------------|----------|---------|-------------|
35
35
  | **N8N_WEBHOOK_URL** | No | `http://localhost:5678/webhook-test/webhook-genat` | n8n GenAT webhook URL. Set this if your n8n instance is elsewhere (e.g. `https://your-n8n-host/webhook-test/webhook-genat`). |
36
+ | **N8N_INSECURE_TLS** | No | (off) | Set to `1`, `true`, or `yes` to skip TLS certificate verification for HTTPS webhooks. Use only for dev/internal n8n with self-signed or internal CA certs (e.g. K8s). Not recommended for production. |
36
37
  | **SERVICE_BASE_URL** | No | (none) | Base URL for DOM Analyzer and Accessibility Analyzer (e.g. `http://host.docker.internal` or `http://your-tunnel.ngrok.io`). Required when n8n runs on a remote host (K8s) so the workflow can reach the services. The workflow appends `:3456/analyze-dom` and `:3458/analyze-accessibility`. |
37
38
 
38
39
  ## Cursor MCP config
package/index.js CHANGED
@@ -4,6 +4,7 @@
4
4
  * Inputs: url, parentProjectFolder (path to TypeScript, JavaScript, or Python Playwright project).
5
5
  * Detects framework (language, BDD, Page Object), POSTs to n8n webhook, returns generated files.
6
6
  */
7
+ import https from 'node:https';
7
8
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
8
9
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
9
10
  import { z } from 'zod';
@@ -12,11 +13,44 @@ import { writeGeneratedFiles } from './write-files.js';
12
13
 
13
14
  const N8N_WEBHOOK_URL = process.env.N8N_WEBHOOK_URL || 'http://localhost:5678/webhook-test/webhook-genat';
14
15
  const SERVICE_BASE_URL = process.env.SERVICE_BASE_URL || null;
16
+ const N8N_INSECURE_TLS = /^1|true|yes$/i.test(process.env.N8N_INSECURE_TLS || '');
17
+
18
+ /**
19
+ * HTTPS fetch with rejectUnauthorized: false for self-signed/internal CA certs.
20
+ * Returns a Response-like object { ok, status, text(), json() }.
21
+ */
22
+ function insecureHttpsFetch(url, { method = 'GET', headers = {}, body }) {
23
+ return new Promise((resolve, reject) => {
24
+ const req = https.request(
25
+ url,
26
+ {
27
+ method,
28
+ headers: { 'Content-Type': 'application/json', ...headers },
29
+ agent: new https.Agent({ rejectUnauthorized: false }),
30
+ },
31
+ (res) => {
32
+ let data = '';
33
+ res.on('data', (chunk) => (data += chunk));
34
+ res.on('end', () => {
35
+ resolve({
36
+ ok: res.statusCode >= 200 && res.statusCode < 300,
37
+ status: res.statusCode ?? 0,
38
+ text: () => Promise.resolve(data),
39
+ json: () => Promise.resolve(JSON.parse(data || 'null')),
40
+ });
41
+ });
42
+ }
43
+ );
44
+ req.on('error', reject);
45
+ if (body) req.write(typeof body === 'string' ? body : JSON.stringify(body));
46
+ req.end();
47
+ });
48
+ }
15
49
 
16
50
  const server = new McpServer(
17
51
  {
18
52
  name: 'GenAT',
19
- version: '1.0.0',
53
+ version: '1.2.2',
20
54
  },
21
55
  {
22
56
  capabilities: {
@@ -77,13 +111,17 @@ server.registerTool(
77
111
  ...(SERVICE_BASE_URL && { serviceBaseUrl: SERVICE_BASE_URL }),
78
112
  };
79
113
 
114
+ const useInsecureTls = N8N_INSECURE_TLS && N8N_WEBHOOK_URL.startsWith('https://');
115
+ const fetchOpts = {
116
+ method: 'POST',
117
+ headers: { 'Content-Type': 'application/json' },
118
+ body: JSON.stringify(body),
119
+ };
80
120
  let response;
81
121
  try {
82
- response = await fetch(N8N_WEBHOOK_URL, {
83
- method: 'POST',
84
- headers: { 'Content-Type': 'application/json' },
85
- body: JSON.stringify(body),
86
- });
122
+ response = useInsecureTls
123
+ ? await insecureHttpsFetch(N8N_WEBHOOK_URL, fetchOpts)
124
+ : await fetch(N8N_WEBHOOK_URL, fetchOpts);
87
125
  } catch (err) {
88
126
  return {
89
127
  content: [
@@ -92,7 +130,7 @@ server.registerTool(
92
130
  text: JSON.stringify({
93
131
  error: 'Failed to call n8n webhook',
94
132
  message: err instanceof Error ? err.message : String(err),
95
- hint: 'Set N8N_WEBHOOK_URL to your n8n webhook URL (e.g. https://your-n8n/webhook-test/webhook-genat)',
133
+ hint: 'Set N8N_WEBHOOK_URL to your n8n webhook URL. For self-signed/internal certs, set N8N_INSECURE_TLS=1',
96
134
  }),
97
135
  },
98
136
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genat-mcp",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
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",