Skip to main content
Glama
MCP-Undetected-Chromedriver

MCP-Undetected-Chromedriver

by dragons96

MCP-未检测到-Chrome驱动程序

铁匠徽章

基于未检测到的 chromedriver 构建的 MCP 服务,提供全面的界面,用于自动化 Chrome 浏览器控制,同时绕过反机器人检测。

中文詳細

安装

要通过Smithery自动为 Claude Desktop 安装 MCP-Undetected-Chromedriver:

npx -y @smithery/cli install @dragons96/mcp-undetected-chromedriver --client claude

Related MCP server: web-scraper-server

配置使用未检测到的 Chromedriver 服务器

以下是使用 Undetected-chromedriver 服务器的 Claude Desktop 配置:

{
  "mcpServers": {
    "mcp-undetected-chromedriver": {
      "command": "npx",
      "args": [
        "-y",
        "@smithery/cli@latest",
        "run",
        "@dragons96/mcp-undetected-chromedriver",
        "--config",
        "{}"
      ]
    }
  }
}

要求

  • Python >= 3.11

  • Chrome 浏览器

紫外线安装

# Create virtual environment
uv venv

# Activate virtual environment
# Windows
.venv\Scripts\activate
# Linux/MacOS
source .venv/bin/activate

# Install dependencies
uv pip install -e .

项目介绍

MCP-Undetected-Chromedriver 是一个 MCP(多通道协议)服务,它将 undetected-chromedriver 库的功能封装成一系列易于使用的 API。该项目特别适用于需要在自动化测试、数据抓取或 Web 自动化脚本中绕过现代网站反机器人检测机制的场景。

主要特点

  • 基于undetected-chromedriver,有效绕过网站反机器人检测

  • 提供丰富的浏览器操作API接口

  • 支持截图、PDF导出等功能

  • 支持点击、填表、拖拽等复杂的页面交互操作。

  • 与 MCP 生态系统中的其他工具无缝集成

待办事项列表

  • [ ] 优化浏览器驱动管理,处理驱动中断

  • [ ] 扩展API功能

  • [ ] 添加更全面的错误处理和日志记录

  • [ ] 改进文档,增加更多使用示例

  • [ ] 添加对浏览器配置文件和扩展的支持

用法

启动服务

mcp-server-undetected-chromedriver

可用的 API

该服务提供以下主要API接口:

  • browser_navigate :导航到指定的 URL

  • browser_screenshot :截取当前页面的屏幕截图

  • browser_click :点击页面元素

  • browser_iframe_click :点击 iframe 内的元素

  • browser_fill :在输入字段中填充内容

  • browser_select :在下拉选择框中选择选项

  • browser_hover :将鼠标悬停在元素上

  • browser_evalute :执行 JavaScript 代码

  • browser_close :关闭浏览器

  • browser_get_visible_text :获取页面上可见的文本

  • browser_get_visible_html :获取页面上可见的 HTML

  • browser_go_back :在浏览器历史记录中向后导航

  • browser_go_forward :在浏览器历史记录中向前导航

  • browser_drag :拖动元素

  • browser_press_key :模拟按键

  • browser_save_as_pdf :将页面保存为 PDF

代码示例

from mcp.client import Client

# Create MCP client
client = Client()
client.start("undetected-chromedriver-mcp-server")

# Navigate to website
response = client.call("browser_navigate", {"url": "https://example.com"})
print(response)

# Take a screenshot
response = client.call("browser_screenshot", {"name": "example"})
print(response)

# Get page text
response = client.call("browser_get_visible_text")
print(response.content[0].text)

# Close the browser
client.call("browser_close")

工作原理

此服务使用 undetected-chromedriver 库创建专用的 Chrome 浏览器实例,可有效规避常见的反机器人检测机制。该服务通过 MCP 协议封装了这些功能,提供了易于使用的 API 接口,使自动化测试和网页抓取更加便捷。

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

贡献指南

欢迎在 GitHub Issues 页面上提交 Bug 报告和功能请求。如果您想贡献代码,请先创建 Issue 来讨论您的想法。

常问问题

问:为什么选择 undetected-chromedriver 而不是标准的 selenium webdriver?

答:undetected-chromedriver 专门设计用于绕过现代网站的反机器人检测机制,例如 Cloudflare、Distil Networks 等,使其对于数据抓取和自动化测试场景更加可靠。

问:该服务如何处理浏览器实例?

答:该服务维护一个全局浏览器实例,该实例会在首次调用需要浏览器的 API 时自动创建。您可以使用browser_close API 显式关闭浏览器。

问:如何处理 iframe 内的元素?

A: browser_iframe_click API可以直接操作iframe内的元素,不需要手动切换框架上下文。

Available Tools

16 tools
browser_clickC

Click an element on the page

Args:
    selector: The selector of the element to click - required

Inputs: selector (required).

browser_closeA

Close the browser and release all resources

Inputs: no named parameters.

browser_dragC

Drag an element to another element

Args:
    sourceSelector: The selector for the element to drag - required
    targetSelector: The selector for the target location - required

Inputs: sourceSelector (required), targetSelector (required).

browser_evaluteC

Evaluate a JavaScript expression in the browser console

Args:
    script: The JavaScript expression to evaluate - required

Inputs: script (required).

browser_fillC

fill out an input field

Args:
    selector: CSS selector for input field - required
    value: The value to fill - required

Inputs: selector (required), value (required).

browser_get_visible_htmlB

Get the HTML of the current page

Inputs: no named parameters.

browser_get_visible_textB

Get the visible text of the current page

Inputs: no named parameters.

browser_go_backA

Navigate back in browser history

Inputs: no named parameters.

browser_go_forwardB

Navigate forward in browser history

Inputs: no named parameters.

browser_hoverC

Hover over an element on the page

Args:
    selector: CSS selector for element to hover over - required

Inputs: selector (required).

browser_iframe_clickB

Click an element inside an iframe on the page

Args:
    iframeSelector: The selector of the iframe - required
    selector: The selector of the element to click - required

Inputs: iframeSelector (required), selector (required).

browser_navigateC

Navigate to a URL

Args:
    url: The URL to navigate to - required
    timeout: The timeout for the navigation - optional, default is 30000

Inputs: url (required), timeout.

browser_press_keyB

Press a key on the keyboard

Args:
    key: The key to press - required, (e.g. 'Enter', 'ArrowDown', 'a')
    selector: Optional CSS selector to focus on before pressing the key - optional

Inputs: key (required), selector.

browser_save_as_pdfB

Save the current page as a PDF

Args:
    outputPath: The path to save the PDF to - required
    filename: The name of the PDF file - optional, default is "page.pdf"
    format: The format of the PDF - optional, default is "A4" (e.g. "A4", "LETTER", "LEGAL", "TABLOID")
    printBackground: Whether to print the background - optional, default is True
    margin: The margin of the PDF - optional, default is None (e.g. {"top": "1cm", "right": "1cm", "bottom": "1cm", "left": "1cm"})

Inputs: outputPath (required), filename, format, margin, +1 more.

browser_screenshotC

Take a screenshot of the current page or a specific element

Args:
    name: The name of the screenshot - required, default is "screenshot"
    storeBase64: Whether to store the screenshot as a base64 string - optional, default is True
    downloadsDir: The directory to save the screenshot to - optional, default is the user's Downloads directory

Inputs: name (required), downloadsDir, storeBase64.

browser_selectC

Select an element on the page with Select tag

Args:
    selector: CSS selector for element to select - required
    value: The value to select - required

Inputs: selector (required), value (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 16 tools

    Disambiguation4/5

    Most tools have distinct purposes targeting specific browser automation tasks like navigation, interaction, and content extraction. However, some overlap exists between browser_click and browser_iframe_click, where the latter is essentially a specialized version of the former for iframes, which could cause minor confusion.

    Naming Consistency5/5

    All tools follow a consistent snake_case naming pattern with a clear 'browser_' prefix followed by a verb_noun structure (e.g., browser_click, browser_navigate, browser_screenshot). This uniformity makes the tool set predictable and easy to understand.

    Tool Count4/5

    With 16 tools, the count is slightly high but reasonable for a browser automation server, covering a wide range of common web interaction tasks. It might feel a bit heavy, but each tool appears to serve a specific function without obvious redundancy.

    Completeness4/5

    The tool set provides comprehensive coverage for core browser automation, including navigation, clicking, typing, hovering, and content extraction. Minor gaps exist, such as no explicit tool for handling cookies, managing tabs, or waiting for elements, but agents can likely work around these using existing tools like browser_evalute or timeouts.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      C
      maintenance
      An MCP server for stealth browser automation that uses human-like interaction patterns to bypass bot detection via the Chrome DevTools Protocol. It enables users to navigate, interact with elements, and capture data from websites using undetectable behaviors like Bezier mouse movements and Gaussian typing delays.
      11
      2
      MIT
    • A
      license
      C
      quality
      D
      maintenance
      Provides browser automation and web scraping as MCP tools, enabling autonomous URL ingestion, crawling, extraction, and anti-bot handling with interactive browser control.
      62
      6
      MIT
    • A
      license
      C
      quality
      B
      maintenance
      MCP server for agent-piloted browser automation that clears Cloudflare, providing multi-session parallel Chromes, persistent profiles, stealth features, credential vault, and vision-first clicking.
      89
      40 PyPI
      9
      Apache 2.0