DrissionPage MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone https://github.com/HyperClockUp/DrissionPageMCPServer_Modified.git
cd DrissionPageMCPServer_Modified
uv sync
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add drissionpage-mcp -- node "<FULL_PATH_TO_DRISSIONPAGEMCPSERVER_MODIFIED>/dist/index.js"

Replace <FULL_PATH_TO_DRISSIONPAGEMCPSERVER_MODIFIED>/dist/index.js with the actual folder you prepared in step 1.

README.md

Robust browser automation tools for AI assistants using DrissionPage

DrissionPageMCPServer_Modified

基于 DrissionPage-MCP-Server 二次开发的 MCP 服务,为 AI 助手提供强大的浏览器自动化能力。

🔗 原项目: https://github.com/persist-1/DrissionPage-MCP-Server

✨ 核心特性

🌐 浏览器自动化 - 页面导航、元素操作、截图等完整功能
🔧 MCP协议支持 - 与AI助手无缝集成的标准化接口
📸 截图与DOM - 页面分析、元素定位、结构获取
🚀 异步高性能 - 基于FastMCP框架的高效服务
🛠️ 17工具集 - 涵盖浏览器管理到文件处理的全方位功能

🚀 快速开始

安装

# 克隆项目
git clone https://github.com/YourUsername/DrissionPageMCPServer_Modified.git
cd DrissionPageMCPServer_Modified/

# 使用 uv 同步环境
uv sync

启动服务

# 启动MCP服务(STDIO模式)
drissionpage-mcp

在AI助手中配置

在 Trae AI IDE 中添加 MCP 服务配置:

{
   "mcpServers": {
      "drissionpage-mcp": {
         "command": "<YOUR_PATH>\\DrissionPageMCPServer_Modified\\.venv\\Scripts\\python.exe",
         "args": ["-m", "drissionpage_mcp.main"],
         "env": {
            "PYTHONPATH": "<YOUR_PATH>\\DrissionPageMCPServer_Modified\\src"
         }
      }
   }
}

MCP配置效果

📱 使用案例

网页自动化操作

复杂页面交互

基本使用示例

# 连接浏览器
result = await connect_browser(port=9222, headless=False)

# 导航并截图
result = await navigate("https://example.com")
result = await take_screenshot("page.png")

# 元素操作
result = await click_element("#submit-button")
result = await input_text("#username", "your_username")

🛠️ MCP 工具列表

分类 工具 功能描述
🌐 浏览器管理 1.connect_browser 连接/启动浏览器
2.new_tab 创建新标签页
3.navigate 页面导航
🎯 元素操作 4.click_element 点击元素
5.input_text 输入文本
6.get_element_text 获取元素文本内容
7.get_page_text 获取页面完整文本内容
📸 截图功能 8.take_screenshot 页面/元素截图
9.get_screenshot_data 获取截图数据
🌳 DOM操作 10.get_dom_tree 获取DOM树结构
11.find_elements 查找页面元素
🔍 网络监控 12.enable_network_monitoring 启用网络监控
13.get_network_logs 获取网络日志
📁 文件操作 14.save_page_source 保存页面源码
15.get_cookies 获取Cookies
高级功能 16.execute_javascript 执行JavaScript
17.run_cdp_command 执行CDP命令

🌐 浏览器支持

支持所有 Chromium 内核浏览器:

  • Chrome(推荐)- 自动检测系统安装
  • Edge - 作为备选自动检测
  • 其他 Chromium 浏览器 - 通过环境变量指定路径

项目会自动检测并使用系统中的 Chrome,如果未安装则使用 Edge。

⚙️ 环境配置

# 基本配置
export DRISSIONPAGE_MCP_LOG_LEVEL=INFO
export DRISSIONPAGE_MCP_HEADLESS=false
export DRISSIONPAGE_MCP_TIMEOUT=30

# 指定浏览器路径(可选,支持Chrome/Edge/其他Chromium浏览器)
export DRISSIONPAGE_MCP_BROWSER_PATH=/path/to/chrome

# 其他路径配置(可选)
export DRISSIONPAGE_MCP_DOWNLOAD_PATH=/path/to/downloads
export DRISSIONPAGE_MCP_SCREENSHOT_PATH=/path/to/screenshots

🏗️ 项目架构

DrissionPageMCPServer_Modified/
├── .github/                    # GitHub 配置
├── docs/                       # VitePress 文档站点
├── src/drissionpage_mcp/       # 源代码
│   ├── config/                 # 配置模块
│   ├── core/                   # 核心功能(浏览器、元素、网络)
│   ├── services/               # 服务层(CDP、DOM、截图)
│   ├── utils/                  # 工具模块
│   └── main.py                 # MCP 服务入口
├── tests/                      # 测试
├── pyproject.toml              # 项目配置
├── requirements.txt            # 依赖
└── uv.lock                     # 依赖锁定

📚 文档

🔧 故障排除

问题 解决方案
🌐 浏览器连接失败 确保Chrome已安装,检查调试端口配置
🎯 元素找不到 检查选择器,等待页面加载,使用更具体选择器
📸 截图失败 检查磁盘空间、文件权限、截图目录
🔍 网络监控无数据 确保已启用监控,检查过滤条件
# 启用调试日志
drissionpage-mcp --log-level DEBUG

🤝 贡献

欢迎提交 Issue 和 Pull Request!

  1. Fork 项目 → 2. 创建分支 → 3. 提交更改 → 4. 推送分支 → 5. 创建 PR

📄 许可证

MIT License - 详见 LICENSE 文件

📖 参考项目

📧 联系方式

如有问题或建议,请联系:cfx_software@163.com


⭐ 如果这个项目对你有帮助,请给个 Star!

Tools (16)

connect_browserConnects to or starts a browser instance.
new_tabCreates a new browser tab.
navigateNavigates the browser to a specific URL.
click_elementClicks on a specified web element.
input_textInputs text into a specified web element.
get_element_textRetrieves the text content of a specific element.
get_page_textRetrieves the full text content of the current page.
take_screenshotCaptures a screenshot of the page or a specific element.
get_dom_treeRetrieves the DOM tree structure of the current page.
find_elementsSearches for elements on the page based on a selector.
enable_network_monitoringEnables monitoring of network traffic.
get_network_logsRetrieves captured network logs.
save_page_sourceSaves the current page source code to a file.
get_cookiesRetrieves cookies from the current session.
execute_javascriptExecutes custom JavaScript code in the browser context.
run_cdp_commandExecutes a raw Chrome DevTools Protocol command.

Environment Variables

DRISSIONPAGE_MCP_LOG_LEVELSets the logging level (e.g., INFO, DEBUG).
DRISSIONPAGE_MCP_HEADLESSWhether to run the browser in headless mode.
DRISSIONPAGE_MCP_BROWSER_PATHPath to the Chromium-based browser executable.

Configuration

claude_desktop_config.json
{"mcpServers": {"drissionpage-mcp": {"command": "python", "args": ["-m", "drissionpage_mcp.main"]}}}

Try it

Navigate to https://example.com and extract the main heading text.
Take a screenshot of the current page and save it as landing_page.png.
Find the login button on the page and click it.
Enable network monitoring and list all requests made during the page load.
Execute a JavaScript snippet to get the current page title.

Frequently Asked Questions

What are the key features of DrissionPage MCP Server?

Full browser navigation and element interaction capabilities. Standardized MCP interface for AI assistant integration. Advanced DOM analysis and structure retrieval. Built-in network monitoring and logging. Support for custom JavaScript execution and CDP commands.

What can I use DrissionPage MCP Server for?

Automating repetitive web-based data entry tasks. Scraping dynamic content from complex web applications. Testing web UI interactions through AI-driven scripts. Monitoring network requests for debugging web performance. Capturing visual snapshots of web pages for documentation.

How do I install DrissionPage MCP Server?

Install DrissionPage MCP Server by running: git clone https://github.com/HyperClockUp/DrissionPageMCPServer_Modified.git && cd DrissionPageMCPServer_Modified && uv sync

What MCP clients work with DrissionPage MCP Server?

DrissionPage MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep DrissionPage MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare