feat: add runtime permission granting tools and --grant-all-permissions flag

New tools for managing browser permissions at runtime (no restart needed):
- browser_grant_permissions: Grant specific or ALL permissions at runtime
  - Supports `all: true` to grant all common permissions at once
- browser_clear_permissions: Revoke all granted permissions
- browser_set_geolocation: Set geolocation coordinates at runtime

New CLI flag:
- --grant-all-permissions: Start with all permissions pre-granted
- PLAYWRIGHT_MCP_GRANT_ALL_PERMISSIONS env var support

Permissions granted with `all: true` or --grant-all-permissions:
- geolocation, notifications, camera, microphone
- clipboard-read, clipboard-write
- accelerometer, gyroscope, magnetometer
- midi, background-sync, ambient-light-sensor
- accessibility-events
This commit is contained in:
Ryan Malloy 2026-01-12 21:01:48 -07:00
parent 5e5123d1ac
commit 0031d17f32
4 changed files with 225 additions and 0 deletions

View file

@ -46,6 +46,7 @@ program
.option('--ignore-https-errors', 'ignore https errors')
.option('--isolated', 'keep the browser profile in memory, do not save it to disk. This is the default.')
.option('--no-isolated', 'use a persistent browser profile. Enables features like Push API that require non-incognito mode.')
.option('--grant-all-permissions', 'grant all browser permissions (geolocation, camera, microphone, clipboard, etc.) at startup.')
.option('--image-responses <mode>', 'whether to send image responses to the client. Can be "allow" or "omit", Defaults to "allow".')
.option('--no-snapshots', 'disable automatic page snapshots after interactive operations like clicks. Use browser_snapshot tool for explicit snapshots.')
.option('--max-snapshot-tokens <tokens>', 'maximum number of tokens allowed in page snapshots before truncation. Use 0 to disable truncation. Default is 10000.', parseInt)