Browser Use Server
浏览器使用服务器
一个使用 Python 脚本实现浏览器自动化的模型上下文协议服务器。可与 Cline 配合使用
特征
浏览器操作
screenshot:捕获网页截图(整页或视口)get_html:检索网页的 HTML 内容execute_js网页上的 JavaScriptget_console_logs:从网页获取控制台日志
所有操作都支持页面加载后自定义交互步骤(例如点击元素、滚动)。
Related MCP server: Playwright MCP Server for Security
先决条件
(可选但推荐)安装 Xvfb 以实现无头浏览器自动化:
# Ubuntu/Debian
sudo apt-get install xvfb
# CentOS/RHEL
sudo yum install xorg-x11-server-Xvfb
# Arch Linux
sudo pacman -S xorg-server-xvfbXvfb(X 虚拟帧缓冲区)创建虚拟显示器,允许浏览器自动化运行,而不会被检测为机器人程序。点击此处了解更多关于 Xvfb 的信息。
安装 Miniconda 或 Anaconda
创建 Conda 环境:
conda create -n browser-use python=3.11
conda activate browser-use
pip install -r requirements.txt设置 LLM 配置:
该服务器支持多个 LLM 提供程序。您可以使用以下任意 API 密钥:
# Required: Set at least one of these API keys
export GLHF_API_KEY=your_api_key
export GROQ_API_KEY=your_api_key
export OPENAI_API_KEY=your_api_key
export OPENROUTER_API_KEY=your_api_key
export GITHUB_API_KEY=your_api_key
export DEEPSEEK_API_KEY=your_api_key
export GEMINI_API_KEY=your_api_key
export OLLAMA_API_KEY=your_api_key
# Optional: Override default configuration
export MODEL=your_preferred_model # Override the default model
export BASE_URL=your_custom_url # Override the default API endpoint
export USE_VISION=false # Enable/disable vision capabilities (default: false)服务器将自动使用找到的第一个可用的 API 密钥。您可以选择使用环境变量为任何提供程序自定义模型和基本 URL。
安装
通过 Smithery 安装
要通过Smithery自动安装 Claude Desktop 的浏览器使用服务器:
npx -y @smithery/cli install @ztobs/cline-browser-use-mcp --client claude将此存储库克隆到
/home/YOUR_HOME/Documents/Cline/目录安装依赖项:
npm install构建服务器:
npm run buildMCP 配置
将以下配置添加到您的 Cline MCP 设置:
"browser-use": {
"command": "node",
"args": [
"/home/YOUR_HOME/Documents/Cline/MCP/browser-use-server/build/index.js"
],
"env": {
// Required: Set at least one API key
"GLHF_API_KEY": "your_api_key",
"GROQ_API_KEY": "your_api_key",
"OPENAI_API_KEY": "your_api_key",
"OPENROUTER_API_KEY": "your_api_key",
"GITHUB_API_KEY": "your_api_key",
"DEEPSEEK_API_KEY": "your_api_key",
"GEMINI_API_KEY": "your_api_key",
"OLLAMA_API_KEY": "your_api_key",
// Optional: Configuration overrides
"MODEL": "your_preferred_model",
"BASE_URL": "your_custom_url",
"USE_VISION": "false"
},
"disabled": false,
"autoApprove": []
}代替:
YOUR_HOME替换为您的实际主目录名称your_api_key替换为您的实际 API 密钥
用法
运行服务器:
node build/index.js该服务器将在 stdio 上可用并支持以下操作:
截屏
参数:
url:网页URL(必填)
full_page:是否捕获整个页面或仅捕获视口(可选,默认值:false)
步骤:以逗号分隔的操作或句子,描述页面加载后要采取的步骤(可选)
获取 HTML
参数:
url:网页URL(必填)
步骤:以逗号分隔的操作或句子,描述页面加载后要采取的步骤(可选)
执行 JavaScript
参数:
url:网页URL(必填)
script:要执行的 JavaScript 代码(必需)
步骤:以逗号分隔的操作或句子,描述页面加载后要采取的步骤(可选)
获取控制台日志
参数:
url:网页URL(必填)
步骤:以逗号分隔的操作或句子,描述页面加载后要采取的步骤(可选)
Cline 使用示例
以下是使用 Cline 的浏览器服务器可以完成的一些示例任务:
在开发过程中修改网页元素
要更改需要身份验证的页面上的标题颜色:
Change the colour of the headline with the text "Alle Foren im Überblick." to deep blue on https://localhost:3000/foren/ page
To check/see the page, use browser-use MCP server to:
Open https://localhost:3000/auth,
Login with ztobs:Password123,
Navigate to https://localhost:3000/foren/,
Accept cookies if required
hint: execute all browser actions in one command with multiple comma-separated steps此任务演示:
使用逗号分隔的步骤实现多步骤浏览器自动化
身份验证处理
接受 Cookie
DOM 操作
CSS 样式更改
服务器将按顺序执行这些步骤,并处理过程中所需的任何交互。
配置
LLM 配置
该服务器支持多个 LLM 提供程序及其默认配置:
GLHF:使用 deepseek-ai/DeepSeek-V3 模型
Ollama:使用 qwen2.5:32b-instruct-q4_K_M 模型和 32k 上下文窗口
Groq:使用 deepseek-r1-distill-llama-70b 模型
OpenAI:使用gpt-4o-mini模型
Openrouter:使用 deepseek/deepseek-chat 模型
Github:使用 gpt-4o-mini 模型
DeepSeek:使用 deepseek-chat 模型
Gemini:使用 gemini-2.0-flash-exp 模型
您可以使用环境变量覆盖这些默认值:
MODEL:为任何提供商设置自定义模型名称BASE_URL:设置自定义 API 端点 URL(如果提供商支持)
视觉支持
服务器通过 USE_VISION 环境变量支持视觉功能:
设置 USE_VISION=true 以启用浏览器操作的视觉功能
默认值为 false,以便在不需要视觉时优化性能
对于需要视觉理解网页内容的任务很有用
Xvfb 支持
服务器会自动检测 Xvfb 是否已安装并且:
在可用时使用 xvfb-run,实现更好的浏览器自动化,无需机器人检测
当未安装 Xvfb 时,回退到直接执行
相应地设置 RUNNING_UNDER_XVFB 环境变量
暂停
默认超时时间为 5 分钟(300000 毫秒)。修改build/index.js中的 TIMEOUT 常量即可更改此设置。
错误处理
服务器提供以下详细的错误消息:
Python 脚本执行失败
浏览器操作超时
参数无效
调试
使用 MCP Inspector 进行调试:
npm run inspector用途
执照
麻省理工学院
Available Tools
4 toolsexecute_jsC
Execute JavaScript code on a webpage
Inputs: url (required), script (required), steps.
get_console_logsC
Get the console logs of a webpage
Inputs: url (required), steps.
get_htmlC
Get the HTML content of a webpage
Inputs: url (required), steps.
screenshotC
Take a screenshot of a webpage
Inputs: url (required), full_page, steps.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: execute_js runs code, get_console_logs retrieves logs, get_html fetches content, and screenshot captures visual output. There is no overlap or ambiguity between these functions.
All tool names follow a consistent verb_noun pattern with snake_case (e.g., execute_js, get_console_logs, get_html, screenshot). The naming is predictable and readable throughout.
With 4 tools, this server is well-scoped for browser automation, covering key operations like executing scripts, retrieving logs, getting content, and taking screenshots. Each tool earns its place without being excessive or insufficient.
The tool set covers essential browser interactions for the domain, including execution, logging, content retrieval, and visualization. A minor gap exists in navigation or page manipulation tools (e.g., navigate, click), but core workflows are well-supported.
Maintenance
Related MCP Connectors
Web scraping, browser automation, screenshots and AI data extraction for AI agents via MCP.
Control a real browser from AI agents: navigate, click, type, screenshot, read the page.
Hosted browser for agents: open pages, search the web, extract data, read PDFs and take screenshots.
A real browser for your agent: screenshots, page checks, Markdown and PDFs.
Related MCP Servers
- AlicenseBqualityNot gradedmaintenanceEnables browser automation and web scraping through Playwright, supporting navigation, screenshots, element interaction, form filling, JavaScript execution, and content extraction.8Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to perform browser automation tasks including web scraping, taking screenshots, and executing JavaScript using Playwright. It facilitates real-time interaction with web pages and the generation of automated test code.27 npmMIT
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to control a browser for web automation tasks like navigation, typing, clicking, and taking screenshots.Apache 2.0
- AlicenseBqualityDmaintenanceEnables browser automation using Playwright, including navigation, screenshots, clicking, form filling, and JavaScript execution.8Apache 2.0