287 Commits

Author SHA1 Message Date
7de63b5bab feat: add console output file option for debugging and monitoring
Add comprehensive console logging to file functionality:
- CLI option --console-output-file to specify output file path
- Environment variable PLAYWRIGHT_MCP_CONSOLE_OUTPUT_FILE support
- Session configuration via browser_configure_snapshots tool
- Real-time structured logging with timestamp, session ID, and URL
- Automatic directory creation and graceful error handling
- Captures all console message types (log, error, warn, page errors)

Useful for debugging browser interactions and monitoring console activity
during automated sessions.
2025-08-24 14:12:00 -06:00
ec8b0c24b5 feat: add image size validation to screenshot tool to prevent API errors
Implements automatic validation of screenshot dimensions to prevent
"image dimensions exceed max allowed size: 8000 pixels" API errors.

New features:
 **Automatic size validation** - Rejects images > 8000px by default
 **allowLargeImages flag** - Override validation when needed
 **Smart error messages** - Helpful solutions when validation fails
 **Image dimension parsing** - Supports PNG and JPEG format detection
 **Updated tool description** - Documents size limits and flag usage

Error message provides actionable solutions:
1. Use viewport screenshot (remove fullPage: true)
2. Allow large images (add allowLargeImages: true)
3. Reduce viewport size (browser_configure)
4. Screenshot specific elements (element + ref)

Usage examples:
```json
// Safe viewport screenshot
{"filename": "safe.png"}

// Full page with validation
{"fullPage": true, "filename": "page.png"}

// Override validation for large images
{"fullPage": true, "allowLargeImages": true, "filename": "large.png"}
```

This prevents the frustrating API error: "At least one of the image
dimensions exceed max allowed size: 8000 pixels" by catching oversized
images before they reach the API and providing clear solutions.

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-22 08:52:17 -06:00
88cf3f8f81 fix: apply snapshot configuration to remaining interactive tools
Fixes massive token overflow in browser_wait_for (284K tokens) and other
interactive tools by applying existing snapshot configuration system.

Updated tools with session-configurable snapshots:
- browser_wait_for (was generating 284,335 tokens\!)
- browser_handle_dialog
- browser_evaluate
- browser_file_upload
- browser_tab_select, browser_tab_new, browser_tab_close

All tools now:
 Respect browser_configure_snapshots settings
 Include updated descriptions mentioning session configurability
 Apply size limits, truncation, and differential modes automatically
 Can be controlled dynamically during sessions

This completes the comprehensive snapshot overflow solution covering
all interactive tools that generate accessibility snapshots.

Added SNAPSHOT_OVERFLOW_SOLUTION.md with complete usage guide and
quick fixes for token-constrained workflows.

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-22 08:40:56 -06:00
2fe8b9355c feat: add session-configurable snapshot settings via browser_configure_snapshots
Implements dynamic snapshot configuration that MCP clients can control during
sessions without requiring server restarts or CLI changes.

New tool: browser_configure_snapshots
- Configure includeSnapshots, maxSnapshotTokens, differentialSnapshots at runtime
- Changes take effect immediately for subsequent tool calls
- Shows current settings when called with no parameters
- Provides helpful tips and usage guidance

Key improvements:
1. **Runtime Configuration**: Update snapshot behavior during active sessions
2. **Client Control**: MCP clients can adapt to different workflows dynamically
3. **Immediate Effect**: No server restart required - changes apply instantly
4. **State Tracking**: Context maintains current session configuration
5. **User Friendly**: Clear feedback on current settings and changes

Updated tool descriptions:
- All interactive tools now mention "configurable via browser_configure_snapshots"
- Removed references to CLI-only configuration
- Enhanced browser_snapshot description for explicit snapshots

Benefits for users:
🔄 Dynamic configuration without restarts
🎛️ Client-controlled snapshot behavior
📊 View current settings anytime
 Instant configuration changes
🎯 Adapt settings per workflow/task

Example usage:
```json
{
  "includeSnapshots": false,
  "maxSnapshotTokens": 25000,
  "differentialSnapshots": true
}
```

This transforms snapshot configuration from static CLI options into a flexible
session management system that adapts to client needs in real-time.

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-22 08:28:36 -06:00
574fdc4959 feat: add snapshot size limits and optional snapshots to fix token overflow
Implements comprehensive solution for browser_click and other interactive tools
returning massive responses (37K+ tokens) due to full page snapshots.

Features implemented:
1. **Snapshot size limits** (--max-snapshot-tokens, default 10k)
   - Automatically truncates large snapshots with helpful messages
   - Preserves essential info (URL, title, errors) when truncating
   - Shows exact token counts and configuration suggestions

2. **Optional snapshots** (--no-snapshots)
   - Disables automatic snapshots after interactive operations
   - browser_snapshot tool always works for explicit snapshots
   - Maintains backward compatibility (snapshots enabled by default)

3. **Differential snapshots** (--differential-snapshots)
   - Shows only changes since last snapshot instead of full page
   - Tracks URL, title, DOM structure, and console activity
   - Significantly reduces token usage for incremental operations

4. **Enhanced tool descriptions**
   - All interactive tools now document snapshot behavior
   - Clear guidance on when snapshots are included/excluded
   - Helpful suggestions for users experiencing token limits

Configuration options:
- CLI: --no-snapshots, --max-snapshot-tokens N, --differential-snapshots
- ENV: PLAYWRIGHT_MCP_INCLUDE_SNAPSHOTS, PLAYWRIGHT_MCP_MAX_SNAPSHOT_TOKENS, etc.
- Config file: includeSnapshots, maxSnapshotTokens, differentialSnapshots

Fixes token overflow errors while providing users full control over
snapshot behavior and response sizes.

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-22 07:54:36 -06:00
7d97fc3e3b test: add react-devtools-demo extension artifacts from testing session
Generated during browser_install_popular_extension testing to verify
Chrome extension functionality works correctly.

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-22 00:03:28 -06:00
b480bc9328 feat: add browser_install_popular_extension for automatic extension downloads
- Add new tool to automatically download and install popular Chrome extensions
- Support for react-devtools, vue-devtools, redux-devtools, and more
- Works around Chrome channel limitations by creating functional demo extensions
- Extensions include proper detection logic and visual indicators
- Auto-generates manifests, content scripts, and popup interfaces
- Registry-based approach for easy extension additions
- Session-specific download directories for isolation
- Updated README with new tool documentation

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-21 15:48:58 -06:00
b3dbe55a9d feat: add Chrome extension support with session-based isolation
- Add browser_install_extension, browser_list_extensions, browser_uninstall_extension tools
- Support session-based extension isolation between MCP clients
- Extensions loaded via --load-extension Chrome flags at browser startup
- Browser auto-restarts when extensions are added/removed
- Validation ensures extensions only work with Chromium browser
- Warning system for Chrome channel vs pure Chromium compatibility
- Extension management persists across page navigations within session
- Updated README with complete extension tool documentation

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-21 15:02:00 -06:00
d8202f6694 feat: implement centralized artifact storage with session isolation
Add comprehensive artifact storage system with session-specific directories:

- Add --artifact-dir CLI option and PLAYWRIGHT_MCP_ARTIFACT_DIR env var
- Create ArtifactManager class for session-specific artifact organization
- Implement ArtifactManagerRegistry for multi-session support
- Add tool call logging with JSON persistence in tool-calls.json
- Update screenshot, video, and PDF tools to use centralized storage
- Add browser_configure_artifacts tool for per-session control
- Support dynamic enable/disable without server restart
- Maintain backward compatibility when artifact storage not configured

Directory structure: {artifactDir}/{sessionId}/[artifacts, videos/, tool-calls.json]

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-15 06:42:16 -06:00
ecedcc48d6 feat: implement MCP client session persistence for browser contexts
Add session persistence system to maintain browser contexts across MCP tool calls:

- SessionManager: Global persistent context management keyed by session ID
- BrowserServerBackend: Modified to use session persistence and reuse contexts
- Context: Enhanced to support environment introspection and session ID override
- MCP Roots: Added educational tool descriptions for workspace-aware automation
- Environment Detection: System file introspection for display/GPU/project detection

Key features:
- Browser contexts survive between tool calls preserving cache, cookies, state
- Complete session isolation between different MCP clients
- Zero startup overhead for repeat connections
- Backward compatible with existing implementations
- Support for MCP roots workspace detection and environment adaptation

Tested and verified with real Claude Code client showing successful session
persistence across navigation calls with preserved browser state.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-12 12:22:46 -06:00
b2462593bc feat: add comprehensive device emulation with geolocation, locale, timezone, permissions, and colorScheme
- Added browser_list_devices tool to show 143+ available device profiles organized by category (iPhone, iPad, Pixel, Galaxy, Desktop, Other)
- Enhanced browser_configure tool with device emulation using Playwright's device descriptors database
- Added support for geolocation coordinates with accuracy settings
- Implemented locale and timezone configuration for internationalization testing
- Added colorScheme preference (light/dark/no-preference) for accessibility testing
- Included permissions management for various browser APIs (geolocation, notifications, camera, microphone)
- Device emulation properly overrides individual viewport/userAgent settings when specified
- All context options are properly applied and browser context is recreated with new settings

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 06:06:43 -06:00
4d13e72213 feat: enable isolated mode by default for better session isolation
Some checks failed
CI / lint (push) Has been cancelled
CI / test (macos-latest) (push) Has been cancelled
CI / test (ubuntu-latest) (push) Has been cancelled
CI / test (windows-latest) (push) Has been cancelled
CI / test_docker (push) Has been cancelled
- Set browser.isolated = true as default configuration
- Ensures each MCP session gets its own isolated browser context
- Prevents data sharing between different client sessions
- Combined with headed mode for optimal user experience

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 04:55:45 -06:00
ddff9975e2 merge: resolve conflicts and integrate headed mode default 2025-08-11 04:54:21 -06:00
543701d452 feat: default to headed mode across all platforms
- Change default headless setting from platform-dependent to false
- Browser now shows GUI windows by default on all platforms
- --headless flag still overrides to enable headless mode when needed
- Provides better user experience with visible browser interactions

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 04:53:16 -06:00
5b7a1e0452 fix: restore headed mode by using browser context factory
- Fix browser_configure tool to properly use browser context factory
- Remove bypass of browser context factory that was ignoring configuration changes
- Headed mode now works correctly when DISPLAY is available
- Browser windows properly appear when switching from headless to headed mode

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 04:36:39 -06:00
aa84278d36 feat: add browser configuration tool and fix STDIO mode
- Add browser_configure tool to change headless/headed mode, viewport, and user agent during session
- Fix STDIO entry point by preventing stdin close handlers in STDIO mode
- Fix headed mode default behavior when DISPLAY is available on Linux
- Add dynamic browser configuration update mechanism in Context class

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 03:39:24 -06:00
e846cd509c feat: add video recording tools for browser sessions
Add three new MCP tools for recording browser automation:
- browser_start_recording: Enable video recording with configurable size/filename
- browser_stop_recording: Stop recording and return video file paths
- browser_recording_status: Check recording status and configuration

Key features:
- Automatic video saving when pages/contexts close
- Configurable video size and output directory
- Enhanced LLM guidance with clear workflow instructions
- Integration with existing browser context management

Videos are saved as .webm files in {outputDir}/videos/ directory.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 18:27:54 -06:00
Pavel Feldman
e934d5e23e
chore: retain the source code from the underlying tools (#756) 2025-07-24 17:08:35 -07:00
Pavel Feldman
ecfa10448b
chore: extract loop tools into a separate folder (#755) 2025-07-24 16:22:03 -07:00
Yury Semikhatsky
e153ac3b7c
chore(extension): exit gracefully when waiting for extension connection (#754) 2025-07-24 16:02:02 -07:00
Pavel Feldman
e0fb748ccc
chore: wire one tool in-process (#753) 2025-07-24 15:25:32 -07:00
Pavel Feldman
c63b7823e1
chore: extract pure mcp server helpers (#751) 2025-07-24 12:57:01 -07:00
Yury Semikhatsky
bd34e9d7e9
chore(extension): page selector for MCP (#750) 2025-07-24 12:01:35 -07:00
Yury Semikhatsky
c72d0320f4
chore(extension): use free port (#735) 2025-07-24 10:25:13 -07:00
Pavel Feldman
da8a244f33
chore: one tool experiment (#746) 2025-07-24 10:09:01 -07:00
d1100bac8a feat: add video recording tools for browser sessions
Some checks are pending
CI / lint (push) Waiting to run
CI / test (macos-latest) (push) Waiting to run
CI / test (ubuntu-latest) (push) Waiting to run
CI / test (windows-latest) (push) Waiting to run
CI / test_docker (push) Waiting to run
Add three new MCP tools for recording browser automation:
- browser_start_recording: Enable video recording with configurable size/filename
- browser_stop_recording: Stop recording and return video file paths
- browser_recording_status: Check recording status and configuration

Key features:
- Automatic video saving when pages/contexts close
- Configurable video size and output directory
- Enhanced LLM guidance with clear workflow instructions
- Integration with existing browser context management

Videos are saved as .webm files in {outputDir}/videos/ directory.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-23 22:16:13 -06:00
Pavel Feldman
31a4fb3d07
chore: unify loops (#745) 2025-07-23 17:42:53 -07:00
Yury Semikhatsky
bc120baa78
chore: do not double close connection (#744) 2025-07-23 17:41:15 -07:00
Pavel Feldman
2c5eac89a8
chore: add eval script (#743) 2025-07-23 10:31:37 -07:00
christian-lms
288f1b863b
docs: Add LM Studio installation instructions (#688) 2025-07-23 08:22:13 -07:00
Yury Semikhatsky
53e3e37991
chore(extension): terminate all connections when tab closes (#741) 2025-07-22 22:23:00 -07:00
Pavel Feldman
b1a0f775cf
chore: save session log (#740) 2025-07-22 20:06:03 -07:00
Pavel Feldman
6320b08173
chore: follow up on tab snapshot capture (#739) 2025-07-22 17:43:42 -07:00
Pavel Feldman
601a74305c
chore: introduce response type (#738) 2025-07-22 16:36:21 -07:00
Yury Semikhatsky
c2b98dc70b
chore(extension): handle root session id in the relay (#737) 2025-07-22 13:49:39 -07:00
Yury Semikhatsky
70862ce456
chore(extension): propagate errors to the client (#736) 2025-07-22 13:13:27 -07:00
Pavel Feldman
468c84eb8f
chore: move state to tab, do not cache snapshot (#730) 2025-07-22 07:53:33 -07:00
Yury Semikhatsky
cfcca40b90
chore(extension): find installed chrome (#728) 2025-07-21 17:57:38 -07:00
Pavel Feldman
f1826b96b6
chore: align lint w/ playwright (#729) 2025-07-21 17:07:13 -07:00
Copilot
eeeab4f042
fix: browser_take_screenshot to not require snapshot unless element is specified (#725) 2025-07-21 10:52:06 -07:00
Copilot
efe3ff0c7c
Add test for browser_evaluate error handling (#719) 2025-07-19 20:12:32 -07:00
Yury Semikhatsky
e3df209b96
chore(extension): support running in http mode (#717) 2025-07-19 08:30:29 -07:00
Pavel Feldman
29711d07d3
chore: use streamable http by default (#716)
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
2025-07-18 18:31:00 -07:00
Copilot
b0be1ee256
chore: add GitHub Copilot agent YAML specification (#715) 2025-07-18 18:03:23 -07:00
Yury Semikhatsky
d3867affed
chore: add mcp chrome extension (#710) 2025-07-18 17:12:44 -07:00
Copilot
1eee30fd45
feat: add fullPage mode to browser_take_screenshot (#704) 2025-07-18 13:56:43 -07:00
Copilot
29ac29e6bb
fix: no-sandbox flag logic to only disable sandbox when explicitly passed (#709) 2025-07-18 13:56:01 -07:00
Adam Gastineau
9f8441daa5
chore(docs): make VSCode match other README sections (#706) 2025-07-18 11:21:29 -07:00
Pavel Feldman
64f950ae42
chore: mark v0.0.31 (#691) 2025-07-17 16:04:21 -07:00
Pavel Feldman
5bfff0a059
chore: include recent console logs in results (#689) 2025-07-17 14:58:44 -07:00