Skip to main content
Glama
fuahyo

Scraper Maintenance MCP

by fuahyo
README.md
# Scraper Maintenance MCP

A comprehensive Model Context Protocol (MCP) server for automating web scraper maintenance through intelligent browser inspection, selector generation, and code updates.

## šŸ“ Project Structure

```
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
```

## šŸš€ Quick Start

### 1. Install Dependencies

```bash
cd mcp
npm install
```

### 2. Build the Project

```bash
npm run build
```

### 3. Run the Server

```bash
npm start
```

## šŸ› ļø Available MCP Tools

### Configuration Management
- `load_scraper_config` - Load scraper configuration files
- `update_config` - Update configurations with new selector mappings

### Browser Operations  
- `initialize_browser` - Launch browser (headless/visible mode)
- `navigate_to_page` - Navigate to target URLs
- `take_screenshot` - Capture debugging screenshots
- `close_browser` - Cleanup browser resources

### Element Inspection
- `inspect_field_manually` - Interactive visual element selection
- `auto_detect_field` - AI-powered automatic element detection
- `validate_selectors` - Test selector reliability and performance
- `generate_selectors` - Create multiple selector variations with scoring
- `test_extraction` - Test data extraction using current selectors

### Maintenance & Code Generation
- `run_maintenance_check` - Comprehensive scraper health analysis
- `generate_extractor_code` - Multi-language code generation

## šŸ“– Usage

### For Claude Desktop

Add to your Claude Desktop configuration:

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

### For Cursor

Add to your Cursor MCP configuration:

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

## šŸ”§ Development

### Build

```bash
npm run build
```

### Development Mode

```bash
npm run dev
```

### Test

```bash
npm test
```

## šŸ“š Documentation

- [Setup Guide](docs/SETUP.md)
- [Implementation Guide](docs/CURSOR_IMPLEMENTATION.md)
- [Workflow Examples](examples/workflow-example.md)
- [Advanced Usage](examples/advanced-usage.md)

TDQS

A3.6/5.0

Scored across 13 tools

Disambiguation5/5

Each tool has a distinct purpose: browser lifecycle (initialize, navigate, close), config management (load, update), field inspection (manual vs. auto), selector operations (validate, generate), and testing/maintenance (test, audit, code generation). Even similar tools like inspect_field_manually and auto_detect_field are clearly differentiated by manual vs. automatic methodology.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern (e.g., load_scraper_config, navigate_to_page, generate_selectors). No mixed conventions or vague verbs; each name clearly indicates its action and target.

Tool Count5/5

With 13 tools, the server is well-scoped for scraper maintenance. Every tool supports the core workflow without redundancy, and the count falls comfortably within the ideal 3-15 range.

Completeness5/5

The tool set covers the full maintenance lifecycle: load configuration, inspect and detect fields, validate/generate selectors, test extraction, update config, run comprehensive checks, and generate final code. Minor features like exporting configs or handling pagination are absent, but the core workflow has no dead ends.

Maintenance

ActivityInactive
ResponsivenessNo issues