This prevents conflicts when switching between browser modes. Session parameters
(browser mode, cdp_url, etc.) are set at creation time and cannot be changed.
Without this fix, an existing 'default' session using chromium mode would be
silently reused when the user specifies --cdp-url, causing the CDP connection
to be ignored.
The same issue would occur switching between any browser modes (e.g., --browser
chromium to --browser real), but CDP is the most common case where users expect
to connect to a specific existing browser instance.
The session remap is placed early in main() before any command handling (server,
sessions, close --all) so those commands also target the correct session.
Users can still override with explicit --session flag if needed.
This adds support for connecting to an existing browser instance via
Chrome DevTools Protocol (CDP) URL in the skill_cli commands.
## Why
The current skill_cli only supports three browser modes:
- chromium: Launches a new Playwright-managed Chromium
- real: Launches users Chrome with profile
- remote: Uses Browser-Use Cloud
However, many use cases require connecting to an already-running browser:
- Remote browser automation via SSH tunnels
- Connecting to browsers in Docker containers
- Reusing authenticated browser sessions
- Integration with Claude Code on remote servers
The BrowserSession class already supports cdp_url, but it was not
exposed through the skill_cli. The TUI mode has this option, but the
simple CLI commands did not.
## Changes
- main.py: Added --cdp-url argument and pass-through to server
- server.py: Accept and store cdp_url, pass to session registry
- sessions.py: Handle cdp_url in session creation (takes precedence)
## Usage
browser-use --cdp-url http://localhost:9222 open https://example.com
browser-use --cdp-url http://localhost:9222 state
browser-use --cdp-url http://localhost:9222 click 5
## Testing
Tested with Chrome remote debugging over SSH tunnel - successfully
controlled a local macOS Chrome browser from a remote Linux server.
Vibe coded with Claude Opus 4.5
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The CLI 'run' command now supports BROWSER_USE_API_KEY as an LLM option,
using ChatBrowserUse which is optimized for browser automation tasks.
This aligns the CLI behavior with the documented supported models at
https://docs.browser-use.com/supported-models which shows ChatBrowserUse
as a valid LLM option using BROWSER_USE_API_KEY.
Changes:
- Add ChatBrowserUse as first LLM option in get_llm() when BROWSER_USE_API_KEY is set
- Update error message to mention BROWSER_USE_API_KEY
- State command outputs same format that browser-use agents see
- Added aliases: bu, browser (all work the same)
- Headed mode now correctly shows browser window
- Change main entry point to 'browser-use'
- Move TUI to 'browser-use-tui'
- Add README with human instructions
- Update SKILL.md references
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>