一个使用browser-use控制网络浏览器的MCP服务器。
</div>🌐 想要浏览网页? 开源的人工智能驱动的网络浏览器 - Vibe 浏览器。
🔗 管理多个MCP服务器? 使用 agent-browser 简化你的开发流程。
# 安装预备条件
curl -LsSf https://astral.sh/uv/install.sh | sh
uv tool install mcp-proxy
uv tool update-shell
创建一个.env文件:
OPENAI_API_KEY=your-api-key
CHROME_PATH=optional/path/to/chrome
PATIENT=false # 如果需要等待任务完成再返回API调用结果,请设置为true
# 安装依赖
uv sync
uv pip install playwright
uv run playwright install --with-deps --no-shell chromium
# 直接从源运行
uv run server --port 8000
# 1. 构建并全局安装
uv build
uv tool uninstall browser-use-mcp-server 2>/dev/null || true
uv tool install dist/browser_use_mcp_server-*.whl
# 2. 使用标准输入输出传输运行
browser-use-mcp-server run server --port 8000 --stdio --proxy-port 9000
{
"mcpServers": {
"browser-use-mcp-server": {
"url": "http://localhost:8000/sse"
}
}
}
{
"mcpServers": {
"browser-server": {
"command": "browser-use-mcp-server",
"args": [
"run",
"server",
"--port",
"8000",
"--stdio",
"--proxy-port",
"9000"
],
"env": {
"OPENAI_API_KEY": "your-api-key"
}
}
}
}
| 客户端 | 配置路径 |
|---|---|
| Cursor | ./.cursor/mcp.json |
| Windsurf | ~/.codeium/windsurf/mcp_config.json |
| Claude (Mac) | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Claude (Windows) | %APPDATA%\Claude\claude_desktop_config.json |
为了在本地开发和测试该包:
构建可分发的wheel文件:
# 在项目根目录下
uv build
作为全局工具安装它:
uv tool uninstall browser-use-mcp-server 2>/dev/null || true
uv tool install dist/browser_use_mcp_server-*.whl
从任意目录运行:
# 设置当前会话的OpenAI API密钥
export OPENAI_API_KEY=your-api-key-here
# 或者提供一次性的密钥
OPENAI_API_KEY=your-api-key-here browser-use-mcp-server run server --port 8000 --stdio --proxy-port 9000
修改后重新构建和安装:
uv build
uv tool uninstall browser-use-mcp-server
uv tool install dist/browser_use_mcp_server-*.whl
使用Docker可以提供一致且隔离的环境来运行服务器。
# 构建Docker镜像
docker build -t browser-use-mcp-server .
# 运行容器,默认VNC密码为"browser-use"
# --rm 确保容器停止时自动删除
# -p 8000:8000 映射服务器端口
# -p 5900:5900 映射VNC端口
docker run --rm -p8000:8000 -p5900:5900 browser-use-mcp-server
# 使用自定义VNC密码运行
# 创建一个文件(例如,vnc_password.txt)仅包含你的密码
echo "your-secure-password" > vnc_password.txt
# 将密码文件挂载为容器内的秘密
docker run --rm -p8000:8000 -p5900:5900 \
-v $(pwd)/vnc_password.txt:/run/secrets/vnc_password:ro \
browser-use-mcp-server
注意:卷挂载中的:ro标志使容器内密码文件为只读,以增加安全性。
# 基于浏览器的查看器
git clone https://github.com/novnc/noVNC
cd noVNC
./utils/novnc_proxy --vnc localhost:5900
默认密码:browser-use(除非使用自定义密码方法覆盖)
尝试询问你的AI:
打开 https://news.ycombinator.com 并返回排名最高的文章
对于问题或咨询:cobrowser.xyz