ZC

ztobs/cline-browser-use-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

23 stars 3 forks 质量 53 趋势 10

Cline 浏览器-使用 MCP

概览

一个用于使用 Python 脚本进行浏览器自动化的模型上下文协议服务器。用于 Cline - 截图:截取网页截图(全页或视口)- get_html:检索网页的HTML内容 - execute_js:在网页上执行JavaScript - get_console_logs:从网页获取控制台日志 所有操作在页面加载后都支持自定义交互步骤(例如点击元素、滚动)。 1. (可选但推荐)安装 Xvfb 以实现无头浏览器自动化: Xvfb(X 虚拟帧缓冲区)创建虚拟显示,允许浏览器自动化且不会被发现为机器人。点击这里了解更多关于 Xvfb 的信息。 2. 安装迷你康达或蟒蛇 3.创建一个康达环境: 服务器支持多个LLM提供者。您可以使用以下任一API密钥: 服务器会自动使用它找到的第一个可用的API密钥。你可以选择使用环境变量自定义任何提供者的模型和基础URL。

概述(AI 翻译)

一个用于使用 Python 脚本进行浏览器自动化的模型上下文协议服务器。用于 Cline

特色

浏览器运营

  • screenshot:截取网页截图(全页或视口)
  • get_html:检索网页的HTML内容
  • execute_js:在网页上执行JavaScript
  • get_console_logs:从网页获取控制台日志

所有操作在页面加载后都支持自定义交互步骤(例如点击元素、滚动)。

先修条件

  1. (可选但推荐)安装 Xvfb 以实现无头浏览器自动化:

Xvfb(X 虚拟帧缓冲区)创建虚拟显示,允许浏览器自动化且不会被发现为机器人。点击这里了解更多关于 Xvfb 的信息。

  1. 安装迷你康达或蟒蛇

  2. 打造康达环境:

  3. 搭建LLM配置:

服务器支持多个LLM提供者。您可以使用以下任一API密钥:

服务器会自动使用它找到的第一个可用的API密钥。你可以选择使用环境变量自定义任何提供者的模型和基础URL。

安装

通过Smithery安装

要通过Smithery自动安装Claude Desktop浏览器使用服务器:

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Browser Use Server

A Model Context Protocol server for browser automation using Python scripts. For use with Cline

Features

Browser Operations

  • screenshot: Capture a screenshot of a webpage (full page or viewport)
  • get_html: Retrieve the HTML content of a webpage
  • execute_js: Execute JavaScript on a webpage
  • get_console_logs: Get console logs from a webpage

All operations support custom interaction steps (e.g., clicking elements, scrolling) after page load.

Prerequisites

  1. (Optional but recommended) Install Xvfb for headless browser automation:
# Ubuntu/Debian
sudo apt-get install xvfb

# CentOS/RHEL
sudo yum install xorg-x11-server-Xvfb

# Arch Linux
sudo pacman -S xorg-server-xvfb

Xvfb (X Virtual Frame Buffer) creates a virtual display, allowing browser automation without detection as a bot. Learn more about Xvfb here.

  1. Install Miniconda or Anaconda
  2. Create a Conda environment:
conda create -n browser-use python=3.11
conda activate browser-use
pip install -r requirements.txt
  1. Set up LLM configuration:

The server supports multiple LLM providers. You can use any of the following API keys:

# 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)

The server will automatically use the first available API key it finds. You can optionally customize the model and base URL for any provider using the environment variables.

Installation

Installing via Smithery

To install Browser Use Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @ztobs/cline-browser-use-mcp --client claude
  1. Clone this repository to /home/YOUR_HOME/Documents/Cline/ directory
  2. Install dependencies:
npm install
  1. Build the server:
npm run build

MCP Configuration

Add the following configuration to your Cline MCP settings:

"browser-use": {
  "command": "node",
  "args": [
    "/home/YOUR_HOME/Documents/Cline/MCP/browser-use-server/build/index.js"
  ],
  "env": {
在 GitHub 查看完整 README

安装

npx -y @smithery/cli install @ztobs/cline-browser-use-mcp --client claude
新手?先看 mcpskill.org 教程 →