āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā š browser-use/integration/browser-automation-mcp ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
The MCP (Model Context Protocol) Server allows you to expose browser-use's browser automation capabilities to AI assistants like Claude Desktop, Cline, and other MCP-compatible clients. This enables AI assistants to perform web automation tasks directly through browser-use.
uvx browser-use --mcp
The server will start in stdio mode, ready to accept MCP connections.
The most common use case is integrating with Claude Desktop. Add this configuration to your Claude Desktop config file:
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"browser-use": {
"command": "uvx",
"args": ["browser-use", "--mcp"],
"env": {
"OPENAI_API_KEY": "your-openai-api-key-here"
}
}
}
}
Edit %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"browser-use": {
"command": "uvx",
"args": ["browser-use", "--mcp"],
"env": {
"OPENAI_API_KEY": "your-openai-api-key-here"
}
}
}
}
You can configure browser-use through environment variables:
OPENAI_API_KEY - Your OpenAI API key (required)ANTHROPIC_API_KEY - Your Anthropic API key (alternative to OpenAI)BROWSER_USE_HEADLESS - Set to false to show browser windowBROWSER_USE_DISABLE_SECURITY - Set to true to disable browser security featuresThe MCP server exposes these browser automation tools:
retry_with_browser_use_agent - Run a complete browser automation task with an AI agent (use as last resort when direct control fails)browser_navigate - Navigate to a URLbrowser_click - Click on an element by indexbrowser_type - Type text into an elementbrowser_get_state - Get current page state and interactive elementsbrowser_scroll - Scroll the pagebrowser_go_back - Go back in browser historybrowser_list_tabs - List all open browser tabsbrowser_switch_tab - Switch to a specific tabbrowser_close_tab - Close a tabbrowser_extract_content - Extract structured content from the current pagebrowser_list_sessions - List all active browser sessions with detailsbrowser_close_session - Close a specific browser session by IDbrowser_close_all - Close all active browser sessionsOnce configured with Claude Desktop, you can ask Claude to perform browser automation tasks:
Claude will use the MCP server to execute these tasks through browser-use.
You can also connect to the MCP server programmatically:
import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
async def use_browser_mcp():
# Connect to browser-use MCP server
server_params = StdioServerParameters(
command="uvx",
args=["browser-use", "--mcp"]
)
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
# Navigate to a website
result = await session.call_tool(
"browser_navigate",
arguments={"url": "https://example.com"}
)
print(result.content[0].text)
# Get page state
result = await session.call_tool(
"browser_get_state",
arguments={"include_screenshot": True}
)
print("Page state retrieved!")
asyncio.run(use_browser_mcp())
MCP SDK is required Error
uv pip install 'browser-use'
Browser doesn't start
BROWSER_USE_HEADLESS=false to see browser windowAPI Key Issues
OPENAI_API_KEY is set correctlyANTHROPIC_API_KEY as an alternativeConnection Issues in Claude Desktop
Enable debug logging by setting:
export BROWSER_USE_LOG_LEVEL=DEBUG
uvx browser-use --mcp
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā