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

@ -181,6 +181,9 @@ Playwright MCP server supports following arguments. They can be provided in the
--no-isolated use a persistent browser profile. Enables
features like Push API that require
non-incognito mode.
--grant-all-permissions grant all browser permissions (geolocation,
camera, microphone, clipboard, etc.) at
startup.
--image-responses <mode> whether to send image responses to the client.
Can be "allow" or "omit", Defaults to "allow".
--no-snapshots disable automatic page snapshots after
@ -556,6 +559,14 @@ http.createServer(async (req, res) => {
<!-- NOTE: This has been generated via update-readme.js -->
- **browser_clear_permissions**
- Title: Clear all browser permissions
- Description: Revoke all previously granted permissions for the current browser context. Sites will need to request permissions again.
- Parameters: None
- Read-only: **false**
<!-- NOTE: This has been generated via update-readme.js -->
- **browser_clear_requests**
- Title: Clear captured requests
- Description: Clear all captured HTTP request data from memory. Useful for freeing up memory during long sessions or when starting fresh analysis.
@ -835,6 +846,39 @@ This is the FIRST conversational browser automation MCP server!
<!-- NOTE: This has been generated via update-readme.js -->
- **browser_grant_permissions**
- Title: Grant browser permissions at runtime
- Description: Grant browser permissions at runtime without restarting the browser. This is faster than using browser_configure which requires a browser restart.
**Quick option:** Use `all: true` to grant all common permissions at once!
**Available permissions:**
- geolocation - Access user location
- notifications - Show browser notifications
- camera - Access camera/webcam
- microphone - Access microphone
- clipboard-read - Read from clipboard
- clipboard-write - Write to clipboard
- accelerometer - Access motion sensors
- gyroscope - Access orientation sensors
- magnetometer - Access compass
- accessibility-events - Accessibility automation
- midi - MIDI device access
- midi-sysex - MIDI system exclusive messages
- background-sync - Background sync API
- ambient-light-sensor - Light sensor access
- payment-handler - Payment request API
- storage-access - Storage access API
**Note:** Some permissions may require user interaction (like camera/microphone device selection) even after being granted.
- Parameters:
- `permissions` (array, optional): List of permissions to grant (e.g., ["geolocation", "camera", "microphone"])
- `all` (boolean, optional): Grant ALL common permissions at once (geolocation, notifications, camera, microphone, clipboard, sensors, midi)
- `origin` (string, optional): Origin to grant permissions for (e.g., "https://example.com"). If not specified, grants for all origins.
- Read-only: **false**
<!-- NOTE: This has been generated via update-readme.js -->
- **browser_handle_dialog**
- Title: Handle a dialog
- Description: Handle a dialog. Returns page snapshot after handling dialog (configurable via browser_configure_snapshots).
@ -1101,6 +1145,17 @@ Full API: See MODEL-COLLABORATION-API.md
<!-- NOTE: This has been generated via update-readme.js -->
- **browser_set_geolocation**
- Title: Set geolocation at runtime
- Description: Set the browser's geolocation at runtime without restarting. Automatically grants geolocation permission.
- Parameters:
- `latitude` (number): Latitude coordinate (-90 to 90)
- `longitude` (number): Longitude coordinate (-180 to 180)
- `accuracy` (number, optional): Accuracy in meters (default: 100)
- Read-only: **false**
<!-- NOTE: This has been generated via update-readme.js -->
- **browser_set_offline**
- Title: Set browser offline mode
- Description: Toggle browser offline mode on/off (equivalent to DevTools offline checkbox)