chameleon
MCP server for agent-friendly web scraping with adaptive anti-bot bypass, dynamic rendering, and structured data extraction via 12 tools.
README
Chameleon 🦎
面向真实世界反爬、动态渲染、异常容错的 AI Agent 爬虫工具。提供 MCP Server + REST API + CLI 三套 Agent 友好接口,核心理念:分层对抗、自适应降级、Agent 友好输出。
核心能力
- 6 级反爬自动升级:裸请求 → UA/Header 伪装 → 代理轮换 → TLS 指纹模拟 → 浏览器渲染 → 行为模拟/验证码,逐级升级,全程可观测
- 三引擎架构:HTTP 引擎(httpx/curl_cffi)、浏览器引擎(Playwright + stealth + 行为模拟)、API 逆向引擎
- 处理管线:HTML 清洗 → Markdown 转换(token 预算裁剪)→ 结构化提取(CSS/XPath/LLM/Hybrid/表格)→ 动态 Pydantic 校验
- 深度爬取:BFS/DFS/Adaptive 策略、每域名限速、ETag 增量采集、断点续爬、robots.txt 合规
- Agent 原生:MCP 12 工具自动发现、统一结构化输出(status/content/metadata)、SSRF 防护 + 审计日志
接口形态
| 形态 | 说明 |
|---|---|
| MCP Server | stdio 传输,12 个工具,SSRF 防护 + 输出截断 |
| REST API | FastAPI,与 MCP 工具一一对应,API Key 认证 + WebSocket 进度 |
| CLI | chameleon scrape/crawl/extract/map/search ...,退出码语义化 |
| Python SDK | Chameleon 服务门面,scrape/crawl/extract/batch/search 全覆盖 |
快速开始
uv sync
uv run chameleon scrape https://example.com -o markdown # CLI
uv run python -m chameleon.interfaces.mcp_server # MCP (stdio)
uv run uvicorn chameleon.interfaces.rest_api:app --port 8000 # REST API
MCP 配置(Claude Code / opencode)
{
"mcpServers": {
"chameleon": {
"command": "uv",
"args": ["run", "python", "-m", "chameleon.interfaces.mcp_server"]
}
}
}
Agent 自动发现工具后可直接说:"抓取 https://example.com/products 的所有产品名称和价格,输出 JSON"。
架构一览
Agent → MCP/REST/CLI → Chameleon 门面
├─ SmartRouter(L0-L6 升级链 + 策略记忆)
├─ Pipeline(清洗 → Markdown → 提取 → 校验)
└─ DeepCrawler + Scheduler(策略遍历/限速/断点)
测试
uv run pytest # 99 个测试(含 Playwright 真实渲染、反爬模拟站对抗)
uv run ruff check src tests
uv run mypy src
测试
uv run pytest # 229 个测试(含 Playwright 真实渲染、反爬模拟站对抗)
uv run ruff check src tests
uv run mypy src
边界与声明
反爬对抗是持续的军备竞赛,本工具不保证对任何站点必然成功:
- 持续演进的验证码(滑块/设备指纹/风控评分)可能击败任何自动化手段
- 内置升级链全程透明可观测——结果中记录实际使用的引擎与升级层级,Agent 可据此判断可信度
- 住宅代理与打码服务为第三方付费依赖,请按预算使用
- 仅在获得授权的范围内使用:遵守 robots.txt、站点服务条款、当地法律(GDPR/个保法)与限速要求。滥用造成的后果由使用者自行承担
文档
开源
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.