Scraper Maintenance MCP
# 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
Scored across 13 tools
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.
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.
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.
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.