CLI
Start using the Browser Use CLI
CLI Usage
The browser-use
command-line interface provides multiple modes of operation for browser automation.
Installation
Get started with browser-use immediately using uvx
:
Or install it globally:
Modes of Operation
1. Interactive TUI Mode (Default)
Launch an interactive terminal UI where you can chat with the browser automation agent:
This opens a chat interface where you can:
- Type natural language commands to control the browser
- See real-time feedback from the agent
- View browser state and actions being performed
2. One-Shot Mode
Execute a single task without entering interactive mode:
Options:
-p, --prompt
: The task to execute--headless
: Run browser in headless mode--model
: Specify LLM model (default: gpt-4o)
3. MCP Server Mode
Run browser-use as a Model Context Protocol server:
This mode exposes browser automation capabilities as MCP tools that can be used by:
- Claude Desktop
- Other MCP-compatible clients
- Custom applications using the MCP SDK
For MCP integration details, see:
Configuration
Browser-use can be configured through environment variables and a configuration file.
Configuration File Location
The default configuration file is located at:
~/.config/browseruse/config.json
You can override this location with:
BROWSER_USE_CONFIG_PATH
environment variableBROWSER_USE_CONFIG_DIR
environment variable (directory containing config.json)
Configuration File Format
The configuration uses a database-style format with UUID entries:
Each configuration type (browser_profile, llm, agent) can have multiple entries, with one marked as default: true
.
Environment Variables
Environment variables always override config.json values:
General Settings
BROWSER_USE_LOGGING_LEVEL
: Logging level (debug, info, warning, error)BROWSER_USE_CONFIG_PATH
: Full path to config.json fileBROWSER_USE_CONFIG_DIR
: Directory containing config.json
Browser Profile Settings
BROWSER_USE_HEADLESS
: Run browser in headless mode (true/false)BROWSER_USE_ALLOWED_DOMAINS
: Comma-separated list of allowed domainsBROWSER_USE_USER_DATA_DIR
: Chrome user data directory path
LLM Settings
OPENAI_API_KEY
: OpenAI API keyANTHROPIC_API_KEY
: Anthropic API keyBROWSER_USE_LLM_MODEL
: LLM model to use (e.g., gpt-4o, claude-3-opus)
MCP-Specific Settings
When running in MCP mode, these environment variables are particularly useful:
BROWSER_USE_HEADLESS
: Control browser visibilityOPENAI_API_KEY
: Required for agent-based tools
Browser Profiles Directory
Browser profiles are stored in:
Each profile directory contains Chrome user data, allowing you to:
- Maintain separate browser sessions
- Keep cookies and local storage isolated
- Use different extensions per profile
Examples
Basic Usage
With Configuration
MCP Server Usage
For Claude Desktop integration, add to your Claude Desktop config:
Troubleshooting
Common Issues
- Browser not launching: Ensure Chrome/Chromium is installed
- API key errors: Set appropriate API key environment variables
- Permission errors: Check file permissions in
~/.config/browseruse/
Debug Mode
Enable debug logging for troubleshooting: