网页爬虫维护工具

一个通过智能浏览器检查、选择器生成和代码更新来自动化网页爬虫维护的全面模型上下文协议(MCP)服务器。

  • by fuahyo
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 fuahyo/mcp-scraper-inspect

使用说明

数据抓取器维护 MCP

一个全面的模型上下文协议(MCP)服务器,通过智能浏览器检查、选择器生成和代码更新来自动化网页抓取器的维护。

📁 项目结构

mcp/
├── src/                    # TypeScript source files
│   ├── server.ts          # Main MCP server implementation
│   ├── browser-manager.ts # Browser automation and management
│   ├── selector-generator.ts # Selector generation and scoring
│   └── types.ts           # Type definitions
├── dist/                   # Compiled JavaScript files
│   ├── server.js          # Main MCP server (executable)
│   ├── browser-manager.js # Browser automation
│   ├── selector-generator.js # Selector intelligence
│   └── types.js           # Type definitions
├── config/                 # Configuration files
│   ├── test-config.json   # Test configuration
│   ├── claude-desktop-config.json # Claude Desktop setup
│   └── *.json             # Various scraper configurations
├── examples/               # Usage examples and documentation
├── docs/                   # Documentation files
├── scripts/                # Build and utility scripts
├── package.json           # Project configuration
└── tsconfig.json          # TypeScript configuration

🚀 快速入门

安装依赖项

cd mcp
npm install

2. 构建项目

npm run build

3. 运行服务器

npm start

🛠️ 可用的MCP工具

配置管理

  • load_scraper_config 加载爬虫配置文件
  • update_config 更新配置,使用新的选择器映射

浏览器操作

  • initialize_browser - 启动浏览器(无头/可见模式)
  • navigate_to_page 导航至目标网址
  • take_screenshot 捕获调试截图
  • close_browser 清理浏览器资源

元素检查

  • inspect_field_manually 交互式视觉元素选择
  • auto_detect_field AI驱动的自动元素检测
  • validate_selectors 测试选择器的可靠性和性能
  • generate_selectors 创建多个带有评分的选项器变体
  • test_extraction 使用当前选择器进行测试数据提取

维护与代码生成

  • run_maintenance_check 全面的抓取器健康分析
  • generate_extractor_code 多语言代码生成

📖 使用方法

为Claude Desktop

添加到您的Claude桌面配置中:

{
  "mcpServers": {
    "scraper-maintenance": {
      "command": "node",
      "args": ["/path/to/mcp/dist/server.js"],
      "env": {
        "NODE_ENV": "production"
      }
    }
  }
}

对于Cursor

添加到你的Cursor MCP配置中:

{
  "mcpServers": {
    "scraper-maintenance": {
      "command": "node",
      "args": ["/path/to/mcp/dist/server.js"],
      "env": {
        "NODE_ENV": "production"
      }
    }
  }
}

🔧 开发

构建

npm run build

开发模式

npm run dev

测试

npm test

📚 文档