MCP CDP Scraper

MCP CDP Scraper

Enables AI agents to scrape web pages, fill forms, take screenshots, and extract structured data via Chrome DevTools Protocol with zero external dependencies.

Category
访问服务器

README

MCP CDP Scraper — Web Scraping via Chrome DevTools Protocol for AI Agents

An MCP (Model Context Protocol) server that gives AI agents the ability to scrape web pages, fill forms, take screenshots, and extract structured data — all through Chrome DevTools Protocol with zero external dependencies.

Why This Exists

Most web scraping MCP servers wrap Playwright or Puppeteer — heavy dependencies that break in Docker, require npm, and add 200MB+ to your image. This server uses raw CDP over WebSockets with Python stdlib only. It connects to any Chrome/Chromium instance running with --remote-debugging-port and gives your AI agent 12 scraping tools.

No Playwright. No Selenium. No Puppeteer. No npm. Just Python stdlib + a running Chrome.

Features

  • 12 MCP Tools: list_tabs, scrape_page, extract_text, extract_links, extract_images, extract_table, fill_form, click_element, screenshot, get_html, wait_for, scroll_to
  • Zero dependencies — pure Python stdlib (socket, json, urllib, base64, struct)
  • React/Vue compatible form filling — uses native setters + synthetic events
  • STDIO JSON-RPC mode — drop-in for any MCP-compatible client (Claude Desktop, Hermes, etc.)
  • Structured extraction — title, meta, headings, paragraphs, lists, links, images in one call
  • Screenshot capture — base64 PNG or save to file
  • Form automation — fill fields, click submit, wait for dynamic content

Quick Start

1. Launch Chrome with remote debugging

# Linux
google-chrome --remote-debugging-port=9222 --headless=new &

# macOS
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 &

# Docker
docker run -d -p 9222:9222 chromedp/chrome --remote-debugging-port=9222 --headless

2. Run the MCP server

# STDIO mode (for MCP clients)
python -m src.server --stdio

# Or print the manifest
python -m src.server --manifest

3. Use as a library

from src.server import MCPCDPScraperServer

server = MCPCDPScraperServer()

# Scrape a page
result = server.handle_tool_call("scrape_page", {"url": "https://news.ycombinator.com"})
import json
data = json.loads(result)
print(data["structured"]["title"])
print(f"Found {data['link_count']} links")

# Fill a form
result = server.handle_tool_call("fill_form", {
    "fields": {
        "#email": "user@example.com",
        "#password": "secret123"
    },
    "submit": "#login-button"
})

MCP Tool Reference

Tool Description Required Params
list_tabs List open browser tabs —
scrape_page Navigate + extract everything url
extract_text Get text from element selector
extract_links Get all links —
extract_images Get all images —
extract_table Get table as 2D array selector
fill_form Fill form fields (React-safe) fields
click_element Click by selector selector
screenshot Capture screenshot —
get_html Get element HTML selector
wait_for Wait for selector selector
scroll_to Scroll to element/coords —

Integration with MCP Clients

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "cdp-scraper": {
      "command": "python",
      "args": ["-m", "src.server", "--stdio"],
      "cwd": "/path/to/mcp-cdp-scraper"
    }
  }
}

Hermes Agent (config.yaml)

mcp:
  servers:
    cdp-scraper:
      command: python
      args: ["-m", "src.server", "--stdio"]
      cwd: /path/to/mcp-cdp-scraper

Demo

# Requires Chrome running on port 9222
python demo.py

Tests

python -m pytest tests/ -v

Docker

docker build -t mcp-cdp-scraper .
docker run -p 9222:9222 mcp-cdp-scraper

Architecture

MCP Client (Claude/Hermes/any)
    │  JSON-RPC over STDIO
    ▼
MCPCDPScraperServer (src/server.py)
    │  Tool dispatch + schema
    ▼
CDPScraper (src/cdp_scrape.py)
    │  Raw WebSocket CDP commands
    ▼
Chrome/Chromium (--remote-debugging-port=9222)
    │
    ▼
Web Page → Structured Data

Use Cases

  • AI agent web scraping — Let your agent browse and extract data from any page
  • Form automation — Login flows, signups, search submissions
  • Content monitoring — Scrape and diff pages on a schedule
  • Data extraction pipelines — Tables, product listings, article content
  • Screenshot generation — Visual capture for QA or documentation
  • Anti-bot bypass — Real Chrome instance avoids headless detection

License

MIT

Author

aaameobius-crypto — github.com/aaameobius-crypto

Freelance portfolio: https://ameobius-space.github.io/kwork-portfolio/

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选