# Scrapling Mcp

> Scrapling MCP Server — 基于 Scrapling 开源的通用 Web 抓取 MCP 服务器。三引擎架构(get/fetch/stealthy_fetch)覆盖静态页面到 Cloudflare 保护。

- **Type:** MCP server
- **Install:** `agentstack add mcp-you922-scrapling-mcp`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [you922](https://agentstack.voostack.com/s/you922)
- **Installs:** 0
- **Category:** [Cloud & Infrastructure](https://agentstack.voostack.com/c/cloud-infrastructure)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [you922](https://github.com/you922)
- **Source:** https://github.com/you922/scrapling-mcp
- **Website:** https://github.com/D4Vinci/Scrapling

## Install

```sh
agentstack add mcp-you922-scrapling-mcp
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

---

# Scrapling MCP Server

> **Scrapling MCP** — 基于 [Scrapling](https://github.com/D4Vinci/Scrapling) 开源的通用 Web 抓取 MCP 服务器。三引擎架构覆盖从静态页面到 Cloudflare 保护站点的所有场景，支持 JS 渲染、反爬绕过、cookie 注入、2FA TOTP 自动化。

[](https://github.com/D4Vinci/Scrapling)
[](https://modelcontextprotocol.io)
[](LICENSE)
[](https://www.python.org/downloads/)
[](https://docs.astral.sh/uv/)

---

## 🔥 热门推荐

| # | 标题 | 关键词 |
|---|---|---|
| 01 | **AI 时代最強 Web 抓取工具？Scrapling MCP 完整评测** | AI, Scraping, MCP |
| 02 | **Claude Code 直接抓取任意网页！MCP 协议实战** | Claude Code, MCP |
| 03 | **告别被屏蔽！Scrapling 三引擎绕过 Cloudflare Turnstile** | Cloudflare, 反爬 |
| 04 | **ChatGPT / Claude 如何实时抓取网页内容？MCP 服务器详解** | ChatGPT, Claude, MCP |
| 05 | **2026 年最值得关注的 Python 开源爬虫框架：Scrapling** | Python, 爬虫, 开源 |
| 06 | **从零搭建 AI 爬虫：Scrapling MCP Server 完整教程** | 教程, 爬虫, AI |
| 07 | **还在用 BeautifulSoup？Scrapling 快 774 倍的秘密** | BeautifulSoup, 性能 |
| 08 | **绕过 Cloudflare 验证码的终极方案（无需付费 API）** | Cloudflare, 免费 |
| 09 | **x.com (Twitter) 数据抓取实战：Cookie 注入 + 浏览器渲染** | x.com, 数据抓取 |
| 10 | **OpenCode / Codex CLI / Claude Code 三端 MCP 配置指南** | OpenCode, Codex, Claude |
| 11 | **Selenium 已死？Scrapling 隐身浏览器模式实测对比** | Selenium, 对比 |
| 12 | **语雀 / Notion / 知乎 SPA 页面抓取方案** | 语雀, SPA, JS渲染 |
| 13 | **reCAPTCHA v3 Enterprise 绕过实战：StealthyFetcher 配置** | reCAPTCHA, 反检测 |
| 14 | **Web Scraping 避坑指南：2026 年反爬技术全景** | 反爬, 技术分析 |
| 15 | **2FA TOTP 自动验证：pyotp + Scrapling 登录自动化** | 2FA, TOTP, 自动化 |
| 16 | **端到端加密网页（WhatsApp/Signal）如何自动化抓取** | E2EE, WhatsApp, Signal |
| 17 | **uvx vs pip：Python 包管理新时代的选择** | uv, pip, Python |
| 18 | **AI Agent 必备：MCP 协议实现 Web 抓取能力** | AI Agent, MCP |
| 19 | **爬虫工程师的瑞士军刀：Scrapling MCP 全场景测试报告** | 爬虫, 测试 |
| 20 | **从 HTTP 到隐身浏览器：Scrapling 三层引擎设计哲学** | 架构, 设计 |

> 💡 以上标题均可直接在知乎、掘金、V2EX、开源中国、CSDN 等平台发布引流

---

## 📋 概述

Scrapling MCP Server 将 Scrapling 的 Web 抓取能力以 MCP (Model Context Protocol) 标准接口暴露给 AI 客户端（Claude Code、OpenCode、Codex CLI 等），使 AI 能够直接抓取和提取任意网页内容。

### 核心特性

| 特性 | 说明 |
|---|---|
| **三引擎架构** | `get` (静态) → `fetch` (浏览器) → `stealthy_fetch` (隐身) |
| **Cloudflare 绕过** | 自动解 Turnstile / Interstitial 验证码 |
| **JS 动态渲染** | 基于 Playwright Chromium，完整执行 JavaScript |
| **CSS 精准提取** | 支持 CSS 选择器，只返回目标元素 |
| **批量并行** | `bulk_get` / `bulk_fetch` / `bulk_stealthy_fetch` 多 URL 并发 |
| **反指纹检测** | TLS 指纹伪装、Canvas 噪声、WebRTC 屏蔽 |
| **Cookie 注入** | 支持从 Chrome 提取已登录 cookie |
| **多格式输出** | HTML / Markdown / 纯文本三种输出格式 |
| **代理支持** | HTTP 代理 + DNS-over-HTTPS 防泄漏 |
| **广告拦截** | 内置 3500+ 广告域名拦截 |

---

## 🔧 快速开始

### 前置条件

- Python 3.10+
- [uv](https://docs.astral.sh/uv/)（推荐）或 pip
- 可选：Google Chrome（用于 `--real-chrome` 模式）

### 安装

```bash
# 1. 安装 Scrapling（含 MCP 和浏览器依赖）
pip install "scrapling[ai]"  # 或 uv pip install "scrapling[ai]"

# 2. 下载浏览器依赖（首次）
scrapling install --force
```

### MCP 配置

在 AI 客户端的 MCP 配置文件中添加：

```json
{
  "mcpServers": {
    "scrapling": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "--from",
        "scrapling[ai]",
        "scrapling",
        "mcp"
      ]
    }
  }
}
```

> **注意：** 必须使用 `scrapling[ai]`（带 extras），否则缺少 `click` 和 `mcp` 依赖导致连接失败。

### 各客户端配置路径

| 客户端 | 配置文件路径 |
|---|---|
| **Claude Desktop** | `~/Library/Application Support/Claude/claude_desktop_config.json` |
| **Claude Code** | `.claude/settings.local.json` + 项目 `.mcp.json` |
| **OpenCode** | `opencode mcp add scrapling -- uvx --from "scrapling[ai]" scrapling mcp` |
| **Codex CLI** | `codex mcp add scrapling -- uvx --from "scrapling[ai]" scrapling mcp` |
| **Cursor** | 项目 `.cursor/mcp.json` |
| **Windsurf** | 项目 `.windsurf/mcp.json` |

---

## 🚀 使用指南

### 通过 AI 对话（MCP 协议）

在 AI 对话中直接描述需求，AI 会自动选择合适的工具：

```
帮我抓取 https://example.com 的内容，转成 Markdown
→ AI 调用 get()

绕过 Cloudflare 抓取 https://blocked-site.com
→ AI 调用 stealthy_fetch(solve_cloudflare: true)

用浏览器渲染后抓取这个 SPA 页面
→ AI 调用 fetch()
```

### 通过 CLI

```bash
# 静态页面
scrapling extract get --ai-targeted "https://example.com" output.md

# 浏览器渲染
scrapling extract fetch --headless --network-idle "https://spa-site.com" output.md

# Cloudflare 绕过
scrapling extract stealthy-fetch --solve-cloudflare "https://cf-site.com" output.md

# CSS 精准提取
scrapling extract get -s "article.content" "https://example.com" output.html

# POST 请求
scrapling extract post -j '{"key":"value"}' "https://api.example.com" output.md
```

### 通过 Python API

```python
from scrapling.fetchers import DynamicFetcher

result = DynamicFetcher.fetch(
    "https://example.com",
    headless=True,
    network_idle=True,
    main_content_only=True,
    timeout=60000,
)
print(result.text)
```

---

## 📚 工具详解

### 第一层：`get` — 静态 HTTP

基于 `curl_cffi`，模拟浏览器 TLS 指纹 + HTTP 头。

| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| `url` | string | — | 目标 URL（必填） |
| `css_selector` | string | — | CSS 选择器 |
| `extraction_type` | string | `markdown` | `markdown` / `html` / `text` |
| `main_content_only` | bool | `false` | 只提取正文 |
| `timeout` | int | `30` | 超时秒数 |
| `impersonate` | string | `chrome` | 浏览器指纹 |
| `proxy` | string | — | HTTP 代理 |
| `headers` | object | — | 自定义请求头 |
| `cookies` | string | — | Cookie 字符串 |

### 第二层：`fetch` — 动态浏览器

基于 Playwright Chromium，完整 JS 执行。

| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| `url` | string | — | 目标 URL |
| `wait_selector` | string | — | 等待元素出现 |
| `network_idle` | bool | `false` | 等待网络空闲 |
| `block_ads` | bool | `false` | 拦截广告 |
| `disable_resources` | bool | `false` | 禁用图片字体 |
| `real_chrome` | bool | `false` | 用系统 Chrome |
| `locale` | string | — | 浏览器语言 |

### 第三层：`stealthy_fetch` — 隐身浏览器

基于 StealthyFetcher，增加反检测能力。

| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| `solve_cloudflare` | bool | `false` | ⭐ 解 Cloudflare 验证码 |
| `block_webrtc` | bool | `false` | 屏蔽 WebRTC |
| `hide_canvas` | bool | `false` | Canvas 指纹噪声 |
| `allow_webgl` | bool | `true` | WebGL 控制 |

### Bulk 系列

| 工具 | 说明 |
|---|---|
| `bulk_get` | 并行 HTTP 抓取多个 URL |
| `bulk_fetch` | 并行浏览器渲染多个 URL |
| `bulk_stealthy_fetch` | 并行隐身抓取多个 URL |

---

## 🔥 高级场景

### x.com (Twitter) 抓取

```python
import browser_cookie3
from scrapling.fetchers import DynamicFetcher

# 从 Chrome 提取已登录的 x.com cookie
cj = browser_cookie3.chrome(domain_name="x.com")
cookies = [{"name": c.name, "value": c.value, "domain": ".x.com", "path": "/"} for c in cj]

result = DynamicFetcher.fetch(
    "https://x.com/elonmusk",
    headless=True,
    network_idle=True,
    timeout=180000,
    cookies=cookies,
    wait=5000,
)
```

### reCAPTCHA v3 Enterprise 绕过

```json
stealthy_fetch(
  url: "https://target.com",
  solve_cloudflare: true,
  block_webrtc: true,
  hide_canvas: true,
  allow_webgl: false,
  headless: false
)
```

### 2FA TOTP 自动生成

```python
import pyotp, base64, binascii

# hex 格式密钥
secret_hex = "你的32位hex密钥"
raw = binascii.unhexlify(secret_hex)
secret_b32 = base64.b32encode(raw).decode()
totp = pyotp.TOTP(secret_b32)
code = totp.now()  # → 6位验证码
```

### E2EE 应用 Session 持久化

```json
open_session(name: "whatsapp", headless: false)
// 首次扫码 → 之后全自动
```

---

## 🔧 故障排除

| 问题 | 原因 | 解决 |
|---|---|---|
| `Connection closed` | 缺少 `[ai]` extras | 用 `scrapling[ai]` 安装 |
| `ModuleNotFoundError: No module named 'click'` | 缺少 CLI 依赖 | `pip install "scrapling[fetchers]"` |
| Cloudflare 无法绕过 | 需要 `stealthy_fetch` | 用 `stealthy_fetch` 非 `get` |
| x.com 返回空 | 需要登录态 | 注入 Chrome cookie |
| 超时 | 网络/代理问题 | 增加 `timeout` / 检查代理 |

---

## 🙏 致谢

本项目基于 [Scrapling](https://github.com/D4Vinci/Scrapling) 开源项目改编，感谢原作者 [Karim Shoair (D4Vinci)](https://github.com/D4Vinci) 的杰出工作。

Scrapling 是一个功能强大的 Web 抓取框架：
- GitHub: https://github.com/D4Vinci/Scrapling
- 文档: https://scrapling.readthedocs.io/
- PyPI: https://pypi.org/project/scrapling/

---

## 📄 许可证

[MIT License](LICENSE) — 基于 Scrapling (BSD License) 改编

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [you922](https://github.com/you922)
- **Source:** [you922/scrapling-mcp](https://github.com/you922/scrapling-mcp)
- **License:** MIT
- **Homepage:** https://github.com/D4Vinci/Scrapling

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-you922-scrapling-mcp
- Seller: https://agentstack.voostack.com/s/you922
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
