RC

robertheadley/chrome-debug-mcp

浏览器自动化

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

45 stars 5 forks 质量 55 趋势 12NOASSERTION

一个MCP服务器,允许你用LLM调试网页

概览

一款用于使用 Playwright 浏览器自动化的模型上下文协议(MCP)实现,支持完整的 Greasemonkey API 。 - 浏览器启动和管理 - 支持多标签页,具创建/切换/关闭功能 - 页面导航与交互 - 截图捕捉 - GM_addStyle 用于 CSS 注入 - GM_getValue/GM_setValue 用于数据存储 - GM_deleteValue 用于存储清理 - GM_notification 用于桌面通知 - 用于剪贴板操作的 GM_setClipboard - GM_xmlhttpRequest 用于跨源请求 - 网络请求拦截 - 请求拦截、修改和日志记录 - 资源类型过滤 - 详细日志系统 - 日志文件组织 - 干净的接口输出 - 命令 - 详细的命令文档及示例- 完整的命令列表及使用示例可在 COMMANDS 中查阅。

概述(AI 翻译)

一款用于使用 Playwright 浏览器自动化的模型上下文协议(MCP)实现,支持完整的 Greasemonkey API 。

特色

核心浏览器功能

  • 浏览器启动与管理
  • 支持多标签页,具创建/切换/关闭功能
  • 页面导航与交互
  • 截图捕捉

Greasemonkey API 支持

  • GM_addStyle 用于 CSS 注入
  • GM_getValue/GM_setValue用于数据存储
  • 存储清理GM_deleteValue
  • GM_notification 桌面通知
  • GM_setClipboard 用于剪贴板操作
  • GM_xmlhttpRequest 用于交叉起始请求

资源管理

  • 网络请求拦截
  • 请求阻塞、修改和日志记录
  • 资源类型过滤

调试功能

  • 详细记录系统
  • 日志文件组织
  • 干净的接口输出

安装

快速启动

文献资料

  • 命令 - 详细的命令文档及示例
  • 完整的命令列表及使用示例,见 COMMANDS.md

核心功能

浏览器管理

Greasemonkey API

资源拦截

实现细节

日志系统

  • 所有调试输出重定向到日志文件
  • 带时间戳的条目

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

README

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

Chrome Debug MCP Playwright

A Model Context Protocol (MCP) implementation for browser automation using Playwright, with full Greasemonkey API support.

Features

Core Browser Features

  • Browser launch and management
  • Multi-tab support with create/switch/close capabilities
  • Page navigation and interaction
  • Screenshot capture

Greasemonkey API Support

  • GM_addStyle for CSS injection
  • GM_getValue/GM_setValue for data storage
  • GM_deleteValue for storage cleanup
  • GM_notification for desktop notifications
  • GM_setClipboard for clipboard operations
  • GM_xmlhttpRequest for cross-origin requests

Resource Management

  • Network request interception
  • Request blocking, modification, and logging
  • Resource type filtering

Debug Features

  • Detailed logging system
  • Log file organization
  • Clean interface output

Installation

npm install chrome-debug-mcp-playwright

Quick Start

// Launch browser
tool browser launch_browser --url "https://example.com" --browserType "chromium"

// Use GM functions
tool browser gm_setValue --key "setting" --value "test"
tool browser gm_getValue --key "setting"

// Intercept requests
tool browser intercept_requests --patterns ["*.jpg", "*.css"] --action "block"

Documentation

  • Commands - Detailed command documentation with examples
  • Full command list with usage examples available in COMMANDS.md

Core Features

Browser Management

// Launch browser
tool browser launch_browser --url "https://example.com"

// Create new tab
tool browser create_tab --url "https://example.com"

// Switch between tabs
tool browser switch_tab --index 1

Greasemonkey API

// Add custom styles
tool browser gm_addStyle --css "body { background: #f0f0f0; }"

// Store data
tool browser gm_setValue --key "setting" --value "test"

// Make cross-origin requests
tool browser gm_xmlhttpRequest --url "https://api.example.com/data" --method "GET"

Resource Interception

// Block image loading
tool browser intercept_requests --patterns ["*.jpg", "*.png"] --action "block"

// Log all CSS requests
tool browser intercept_requests --patterns ["*.css"] --action "log"

Implementation Details

Logging System

  • All debug output redirected to log files
  • Timestamped entries
  • Organized in logs directory
  • Clean interface output

Error Handling

  • Detailed error logging
  • Proper cleanup on errors
  • Resource management

Dependencies

  • Playwright: Browser automation
  • @modelcontextprotocol/sdk: MCP implementation

Development

Prerequisites

  • Node.js 16 or higher
  • npm 7 or higher

Setup

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "chrome-debug": { "command": "node", "args": ["path/to/chrome-debug-mcp/build/index.js"], "disabled": false, "alwaysAllow": [] } } }