Skip to content

Commit 2d446f9

Browse files
docs: fix CDP header env name (#1661)
1 parent 511320d commit 2d446f9

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ Playwright MCP server supports following arguments. They can be provided in the
393393
| --browser <browser> | browser or chrome channel to use, possible values: chrome, firefox, webkit, msedge.<br>*env* `PLAYWRIGHT_MCP_BROWSER` |
394394
| --caps <caps> | comma-separated list of additional capabilities to enable, possible values: vision, pdf, devtools.<br>*env* `PLAYWRIGHT_MCP_CAPS` |
395395
| --cdp-endpoint <endpoint> | CDP endpoint to connect to.<br>*env* `PLAYWRIGHT_MCP_CDP_ENDPOINT` |
396-
| --cdp-header <headers...> | CDP headers to send with the connect request, multiple can be specified.<br>*env* `PLAYWRIGHT_MCP_CDP_HEADER` |
396+
| --cdp-header <headers...> | CDP headers to send with the connect request, multiple can be specified.<br>*env* `PLAYWRIGHT_MCP_CDP_HEADERS` |
397397
| --cdp-timeout <timeout> | timeout in milliseconds for connecting to CDP endpoint, defaults to 30000ms<br>*env* `PLAYWRIGHT_MCP_CDP_TIMEOUT` |
398398
| --codegen <lang> | specify the language to use for code generation, possible values: "typescript", "none". Default is "typescript".<br>*env* `PLAYWRIGHT_MCP_CODEGEN` |
399399
| --config <path> | path to the configuration file.<br>*env* `PLAYWRIGHT_MCP_CONFIG` |

update-readme.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,18 @@ async function updateTools(content) {
140140
return updateSection(content, startMarker, endMarker, generatedLines);
141141
}
142142

143+
/**
144+
* @param {string} prefix
145+
* @returns {string}
146+
*/
147+
function optionEnvName(prefix) {
148+
if (prefix === 'secrets')
149+
return 'PLAYWRIGHT_MCP_SECRETS_FILE';
150+
if (prefix === 'cdp-header')
151+
return 'PLAYWRIGHT_MCP_CDP_HEADERS';
152+
return `PLAYWRIGHT_MCP_` + prefix.toUpperCase().replace(/-/g, '_');
153+
}
154+
143155
/**
144156
* @param {string} content
145157
* @returns {Promise<string>}
@@ -177,9 +189,7 @@ async function updateOptions(content) {
177189
table.push(`|--------|-------------|`);
178190
for (const option of options) {
179191
const prefix = option.name.split(' ')[0];
180-
const envName = prefix === 'secrets'
181-
? 'PLAYWRIGHT_MCP_SECRETS_FILE'
182-
: `PLAYWRIGHT_MCP_` + prefix.toUpperCase().replace(/-/g, '_');
192+
const envName = optionEnvName(prefix);
183193
table.push(`| --${option.name} | ${option.value}<br>*env* \`${envName}\` |`);
184194
}
185195

@@ -189,7 +199,7 @@ async function updateOptions(content) {
189199
envTable.push(`|-------------|`);
190200
for (const option of options) {
191201
const prefix = option.name.split(' ')[0];
192-
const envName = `PLAYWRIGHT_MCP_` + prefix.toUpperCase().replace(/-/g, '_');
202+
const envName = optionEnvName(prefix);
193203
envTable.push(`| \`${envName}\` ${option.value} |`);
194204
}
195205
console.log(envTable.join('\n'));

0 commit comments

Comments
 (0)