rae-playwright-mcp 0.0.7 → 0.0.8

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
@@ -320,7 +320,8 @@ Playwright MCP server supports following arguments. They can be provided in the
320
320
 
321
321
  This fork includes additional features beyond the original Playwright MCP:
322
322
 
323
- - **`--run-id <id>`**: Specify a custom UUID for HAR file organization. HAR files are saved to `~/.reverse-api/runs/har/{run-id}/network.har`. If not provided, a UUID is automatically generated.
323
+ - **`--run-id <id>`**: Specify a custom UUID for HAR file organization. HAR files are saved to `{save-har-path}/{run-id}/recording.har` (or `~/.reverse-api/runs/har/{run-id}/recording.har` by default). If not provided, a UUID is automatically generated.
324
+ - **`--save-har-path <path>`**: Specify a custom directory path where HAR files should be saved. HAR files will be saved to `{path}/{run-id}/recording.har`. If not provided, defaults to `~/.reverse-api/runs/har`.
324
325
  - **Automatic HAR Recording**: All browser sessions automatically record network traffic in HAR format. The HAR file path is logged when the server starts.
325
326
  - **Default Tracing**: Tracing capabilities are enabled by default with source code capture (`sources: true`)
326
327
  - **Self-contained Package**: All MCP code is bundled in the package, no dependency on the Playwright monorepo
@@ -331,6 +332,7 @@ This is a fork of the official [Playwright MCP](https://github.com/microsoft/pla
331
332
 
332
333
  - HAR recording enabled by default for all browser contexts
333
334
  - Custom `--run-id` CLI option for organizing HAR files
335
+ - Custom `--save-har-path` CLI option for specifying HAR file directory
334
336
  - Tracing enabled by default with source code capture
335
337
  - Self-contained package (all code bundled, no monorepo dependency)
336
338
 
@@ -448,6 +450,9 @@ Options:
448
450
  --run-id <id> External UUID to use for HAR directory.
449
451
  If not provided, a UUID will be
450
452
  generated.
453
+ --save-har-path <path> path to the directory where HAR files
454
+ should be saved. HAR files will be saved
455
+ to {path}/{run-id}/recording.har
451
456
  ```
452
457
 
453
458
  <!--- End of options generated section -->
@@ -718,6 +723,12 @@ npx rae-playwright-mcp@latest --config path/to/config.json
718
723
  * External UUID to use for HAR directory. If not provided, a UUID will be generated.
719
724
  */
720
725
  runId?: string;
726
+
727
+ /**
728
+ * Path to the directory where HAR files should be saved. HAR files will be saved to {saveHarPath}/{runId}/recording.har.
729
+ * If not provided, defaults to ~/.reverse-api/runs/har/{runId}/recording.har.
730
+ */
731
+ saveHarPath?: string;
721
732
  }
722
733
  ```
723
734
 
package/config.d.ts CHANGED
@@ -194,4 +194,10 @@ export type Config = {
194
194
  * External UUID to use for HAR directory. If not provided, a UUID will be generated.
195
195
  */
196
196
  runId?: string;
197
+
198
+ /**
199
+ * Path to the directory where HAR files should be saved. HAR files will be saved to {saveHarPath}/{runId}/recording.har.
200
+ * If not provided, defaults to ~/.reverse-api/runs/har/{runId}/recording.har.
201
+ */
202
+ saveHarPath?: string;
197
203
  };
@@ -91,7 +91,7 @@ class BaseContextFactory {
91
91
  async createContext(clientInfo) {
92
92
  (0, import_log.testDebug)(`create browser context (${this._logName})`);
93
93
  const browser = await this._obtainBrowser(clientInfo);
94
- const harDir = await computeHarDir(clientInfo, this.config.runId);
94
+ const harDir = await computeHarDir(this.config, clientInfo, this.config.runId);
95
95
  const browserContext = await this._doCreateContext(browser, harDir);
96
96
  await addInitScript(browserContext, this.config.browser.initScript);
97
97
  return {
@@ -182,7 +182,7 @@ class PersistentContextFactory {
182
182
  const tracesDir = await computeTracesDir(this.config, clientInfo);
183
183
  if (tracesDir && this.config.saveTrace)
184
184
  await startTraceServer(this.config, tracesDir);
185
- const harDir = await computeHarDir(clientInfo, this.config.runId);
185
+ const harDir = await computeHarDir(this.config, clientInfo, this.config.runId);
186
186
  this._userDataDirs.add(userDataDir);
187
187
  (0, import_log.testDebug)("lock user data dir", userDataDir);
188
188
  const browserType = playwright[this.config.browser.browserName];
@@ -309,11 +309,12 @@ async function computeTracesDir(config, clientInfo) {
309
309
  return;
310
310
  return await (0, import_config.outputFile)(config, clientInfo, `traces`, { origin: "code", reason: "Collecting trace" });
311
311
  }
312
- async function computeHarDir(clientInfo, runId) {
312
+ async function computeHarDir(config, clientInfo, runId) {
313
313
  const finalRunId = runId || import_crypto.default.randomUUID();
314
- const harDir = import_path.default.join(import_os.default.homedir(), ".reverse-api", "runs", "har", finalRunId);
314
+ const baseDir = config.saveHarPath || import_path.default.join(import_os.default.homedir(), ".reverse-api", "runs", "har");
315
+ const harDir = import_path.default.join(baseDir, finalRunId);
315
316
  await import_fs.default.promises.mkdir(harDir, { recursive: true });
316
- const harPath = import_path.default.join(harDir, "network.har");
317
+ const harPath = import_path.default.join(harDir, "recording.har");
317
318
  console.error(`HAR recording enabled. HAR file will be saved to: ${harPath}`);
318
319
  return harDir;
319
320
  }
@@ -327,7 +328,7 @@ function browserContextOptionsFromConfig(config, harDir) {
327
328
  }
328
329
  if (harDir) {
329
330
  result.recordHar = {
330
- path: import_path.default.join(harDir, "network.har"),
331
+ path: import_path.default.join(harDir, "recording.har"),
331
332
  content: "attach",
332
333
  mode: "full"
333
334
  };
@@ -200,7 +200,8 @@ function configFromCLIOptions(cliOptions) {
200
200
  action: cliOptions.timeoutAction,
201
201
  navigation: cliOptions.timeoutNavigation
202
202
  },
203
- runId: cliOptions.runId
203
+ runId: cliOptions.runId,
204
+ saveHarPath: cliOptions.saveHarPath
204
205
  };
205
206
  return result;
206
207
  }
@@ -248,6 +249,7 @@ function configFromEnv() {
248
249
  options.userDataDir = envToString(process.env.PLAYWRIGHT_MCP_USER_DATA_DIR);
249
250
  options.viewportSize = resolutionParser("--viewport-size", process.env.PLAYWRIGHT_MCP_VIEWPORT_SIZE);
250
251
  options.runId = envToString(process.env.PLAYWRIGHT_MCP_RUN_ID);
252
+ options.saveHarPath = envToString(process.env.PLAYWRIGHT_MCP_SAVE_HAR_PATH);
251
253
  return configFromCLIOptions(options);
252
254
  }
253
255
  async function loadConfig(configFile) {
@@ -206,8 +206,10 @@ class Context {
206
206
  } else {
207
207
  const runId = this.config.runId;
208
208
  const finalRunId = runId || import_crypto.default.randomUUID();
209
- const harDir = import_path.default.join(import_os.default.homedir(), ".reverse-api", "runs", "har", finalRunId);
210
- this._harPath = import_path.default.join(harDir, "network.har");
209
+ const baseDir = this.config.saveHarPath || import_path.default.join(import_os.default.homedir(), ".reverse-api", "runs", "har");
210
+ const harDir = import_path.default.join(baseDir, finalRunId);
211
+ await import_fs.default.promises.mkdir(harDir, { recursive: true });
212
+ this._harPath = import_path.default.join(harDir, "recording.har");
211
213
  }
212
214
  await this._setupRequestInterception(browserContext);
213
215
  if (this.sessionLog)
@@ -41,7 +41,7 @@ var import_browserContextFactory = require("./browser/browserContextFactory");
41
41
  var import_browserServerBackend = require("./browser/browserServerBackend");
42
42
  var import_extensionContextFactory = require("./extension/extensionContextFactory");
43
43
  function decorateCommand(command, version) {
44
- command.option("--allowed-hosts <hosts...>", "comma-separated list of hosts this server is allowed to serve from. Defaults to the host the server is bound to. Pass '*' to disable the host check.", import_config.commaSeparatedList).option("--allowed-origins <origins>", "semicolon-separated list of TRUSTED origins to allow the browser to request. Default is to allow all.\nImportant: *does not* serve as a security boundary and *does not* affect redirects. ", import_config.semicolonSeparatedList).option("--blocked-origins <origins>", "semicolon-separated list of origins to block the browser from requesting. Blocklist is evaluated before allowlist. If used without the allowlist, requests not matching the blocklist are still allowed.\nImportant: *does not* serve as a security boundary and *does not* affect redirects.", import_config.semicolonSeparatedList).option("--block-service-workers", "block service workers").option("--browser <browser>", "browser or chrome channel to use, possible values: chrome, firefox, webkit, msedge.").option("--caps <caps>", "comma-separated list of additional capabilities to enable, possible values: vision, pdf.", import_config.commaSeparatedList).option("--cdp-endpoint <endpoint>", "CDP endpoint to connect to.").option("--cdp-header <headers...>", "CDP headers to send with the connect request, multiple can be specified.", import_config.headerParser).option("--config <path>", "path to the configuration file.").option("--console-level <level>", 'level of console messages to return: "error", "warning", "info", "debug". Each level includes the messages of more severe levels.', import_config.enumParser.bind(null, "--console-level", ["error", "warning", "info", "debug"])).option("--device <device>", 'device to emulate, for example: "iPhone 15"').option("--executable-path <path>", "path to the browser executable.").option("--extension", 'Connect to a running browser instance (Edge/Chrome only). Requires the "Playwright MCP Bridge" browser extension to be installed.').option("--grant-permissions <permissions...>", 'List of permissions to grant to the browser context, for example "geolocation", "clipboard-read", "clipboard-write".', import_config.commaSeparatedList).option("--headless", "run browser in headless mode, headed by default").option("--host <host>", "host to bind server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.").option("--ignore-https-errors", "ignore https errors").option("--init-page <path...>", "path to TypeScript file to evaluate on Playwright page object").option("--init-script <path...>", "path to JavaScript file to add as an initialization script. The script will be evaluated in every page before any of the page's scripts. Can be specified multiple times.").option("--isolated", "keep the browser profile in memory, do not save it to disk.").option("--image-responses <mode>", 'whether to send image responses to the client. Can be "allow" or "omit", Defaults to "allow".', import_config.enumParser.bind(null, "--image-responses", ["allow", "omit"])).option("--no-sandbox", "disable the sandbox for all process types that are normally sandboxed.").option("--output-dir <path>", "path to the directory for output files.").option("--port <port>", "port to listen on for SSE transport.").option("--proxy-bypass <bypass>", 'comma-separated domains to bypass proxy, for example ".com,chromium.org,.domain.com"').option("--proxy-server <proxy>", 'specify proxy server, for example "http://myproxy:3128" or "socks5://myproxy:8080"').option("--save-session", "Whether to save the Playwright MCP session into the output directory.").option("--save-trace", "Whether to save the Playwright Trace of the session into the output directory.").option("--save-video <size>", 'Whether to save the video of the session into the output directory. For example "--save-video=800x600"', import_config.resolutionParser.bind(null, "--save-video")).option("--secrets <path>", "path to a file containing secrets in the dotenv format", import_config.dotenvFileLoader).option("--shared-browser-context", "reuse the same browser context between all connected HTTP clients.").option("--snapshot-mode <mode>", 'when taking snapshots for responses, specifies the mode to use. Can be "incremental", "full", or "none". Default is incremental.').option("--storage-state <path>", "path to the storage state file for isolated sessions.").option("--test-id-attribute <attribute>", 'specify the attribute to use for test ids, defaults to "data-testid"').option("--timeout-action <timeout>", "specify action timeout in milliseconds, defaults to 5000ms", import_config.numberParser).option("--timeout-navigation <timeout>", "specify navigation timeout in milliseconds, defaults to 60000ms", import_config.numberParser).option("--user-agent <ua string>", "specify user agent string").option("--user-data-dir <path>", "path to the user data directory. If not specified, a temporary directory will be created.").option("--viewport-size <size>", 'specify browser viewport size in pixels, for example "1280x720"', import_config.resolutionParser.bind(null, "--viewport-size")).option("--run-id <id>", "External UUID to use for HAR directory. If not provided, a UUID will be generated.").addOption(new import_utilsBundle.ProgramOption("--vision", "Legacy option, use --caps=vision instead").hideHelp()).action(async (options) => {
44
+ command.option("--allowed-hosts <hosts...>", "comma-separated list of hosts this server is allowed to serve from. Defaults to the host the server is bound to. Pass '*' to disable the host check.", import_config.commaSeparatedList).option("--allowed-origins <origins>", "semicolon-separated list of TRUSTED origins to allow the browser to request. Default is to allow all.\nImportant: *does not* serve as a security boundary and *does not* affect redirects. ", import_config.semicolonSeparatedList).option("--blocked-origins <origins>", "semicolon-separated list of origins to block the browser from requesting. Blocklist is evaluated before allowlist. If used without the allowlist, requests not matching the blocklist are still allowed.\nImportant: *does not* serve as a security boundary and *does not* affect redirects.", import_config.semicolonSeparatedList).option("--block-service-workers", "block service workers").option("--browser <browser>", "browser or chrome channel to use, possible values: chrome, firefox, webkit, msedge.").option("--caps <caps>", "comma-separated list of additional capabilities to enable, possible values: vision, pdf.", import_config.commaSeparatedList).option("--cdp-endpoint <endpoint>", "CDP endpoint to connect to.").option("--cdp-header <headers...>", "CDP headers to send with the connect request, multiple can be specified.", import_config.headerParser).option("--config <path>", "path to the configuration file.").option("--console-level <level>", 'level of console messages to return: "error", "warning", "info", "debug". Each level includes the messages of more severe levels.', import_config.enumParser.bind(null, "--console-level", ["error", "warning", "info", "debug"])).option("--device <device>", 'device to emulate, for example: "iPhone 15"').option("--executable-path <path>", "path to the browser executable.").option("--extension", 'Connect to a running browser instance (Edge/Chrome only). Requires the "Playwright MCP Bridge" browser extension to be installed.').option("--grant-permissions <permissions...>", 'List of permissions to grant to the browser context, for example "geolocation", "clipboard-read", "clipboard-write".', import_config.commaSeparatedList).option("--headless", "run browser in headless mode, headed by default").option("--host <host>", "host to bind server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.").option("--ignore-https-errors", "ignore https errors").option("--init-page <path...>", "path to TypeScript file to evaluate on Playwright page object").option("--init-script <path...>", "path to JavaScript file to add as an initialization script. The script will be evaluated in every page before any of the page's scripts. Can be specified multiple times.").option("--isolated", "keep the browser profile in memory, do not save it to disk.").option("--image-responses <mode>", 'whether to send image responses to the client. Can be "allow" or "omit", Defaults to "allow".', import_config.enumParser.bind(null, "--image-responses", ["allow", "omit"])).option("--no-sandbox", "disable the sandbox for all process types that are normally sandboxed.").option("--output-dir <path>", "path to the directory for output files.").option("--port <port>", "port to listen on for SSE transport.").option("--proxy-bypass <bypass>", 'comma-separated domains to bypass proxy, for example ".com,chromium.org,.domain.com"').option("--proxy-server <proxy>", 'specify proxy server, for example "http://myproxy:3128" or "socks5://myproxy:8080"').option("--save-session", "Whether to save the Playwright MCP session into the output directory.").option("--save-trace", "Whether to save the Playwright Trace of the session into the output directory.").option("--save-video <size>", 'Whether to save the video of the session into the output directory. For example "--save-video=800x600"', import_config.resolutionParser.bind(null, "--save-video")).option("--secrets <path>", "path to a file containing secrets in the dotenv format", import_config.dotenvFileLoader).option("--shared-browser-context", "reuse the same browser context between all connected HTTP clients.").option("--snapshot-mode <mode>", 'when taking snapshots for responses, specifies the mode to use. Can be "incremental", "full", or "none". Default is incremental.').option("--storage-state <path>", "path to the storage state file for isolated sessions.").option("--test-id-attribute <attribute>", 'specify the attribute to use for test ids, defaults to "data-testid"').option("--timeout-action <timeout>", "specify action timeout in milliseconds, defaults to 5000ms", import_config.numberParser).option("--timeout-navigation <timeout>", "specify navigation timeout in milliseconds, defaults to 60000ms", import_config.numberParser).option("--user-agent <ua string>", "specify user agent string").option("--user-data-dir <path>", "path to the user data directory. If not specified, a temporary directory will be created.").option("--viewport-size <size>", 'specify browser viewport size in pixels, for example "1280x720"', import_config.resolutionParser.bind(null, "--viewport-size")).option("--run-id <id>", "External UUID to use for HAR directory. If not provided, a UUID will be generated.").option("--save-har-path <path>", "path to the directory where HAR files should be saved. HAR files will be saved to {path}/{run-id}/recording.har").addOption(new import_utilsBundle.ProgramOption("--vision", "Legacy option, use --caps=vision instead").hideHelp()).action(async (options) => {
45
45
  (0, import_watchdog.setupExitWatchdog)();
46
46
  if (options.vision) {
47
47
  console.error("The --vision option is deprecated, use --caps=vision instead");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rae-playwright-mcp",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "Rae Playwright MCP - Enhanced Playwright Tools for MCP",
5
5
  "mcpName": "com.microsoft/playwright-mcp",
6
6
  "repository": {
@@ -51,4 +51,4 @@
51
51
  "@playwright/test": "1.58.0-alpha-2025-12-29",
52
52
  "@types/node": "^24.3.0"
53
53
  }
54
- }
54
+ }