Borrowing it
Nothing to install: this file belongs to gqy20/crawl-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/gqy20/crawl-mcp/main/CLAUDE.mdgit clone --depth 1 https://github.com/gqy20/crawl-mcpWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/gqy20/crawl-mcp/claude-md)<a href="https://agentmods.dev/instructions/gqy20/crawl-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/gqy20/crawl-mcp/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/gqy20/crawl-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/gqy20/crawl-mcp/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.02206 | $0.02206 |
| Opus 5 | $0.01103 | $0.01103 |
| Sonnet 5 | $0.00441 | $0.00441 |
| Haiku 4.5 | $0.00221 | $0.00221 |
Grade A, and why
crawl-mcp CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 195 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
开发命令
# 安装依赖
uv sync
# 运行测试(所有测试)
uv run pytest
# 运行特定测试文件
uv run pytest tests/unit/test_crawler_v2.py
# 运行特定测试类/函数
uv run pytest tests/unit/test_unified_crawl.py::TestUnifiedCrawlSingleFallback::test_fast_path_returns_markdown_format
# 带覆盖率报告的测试
uv run pytest -v --cov=src/crawl4ai_mcp --cov-report=term-missing
# 代码检查和格式化
uv run ruff check .
uv run ruff format .
# 运行 MCP 服务器(开发调试,HTTP 模式)
uv run python -m crawl4ai_mcp.fastmcp_server --http
# 运行 MCP 服务器(生产模式,STDIO)
uv run crawl-mcp
项目架构
核心设计:自动降级爬取 + 可选 LLM 插件
本项目定位为专业网页爬取工具,内置「快速提取 → 浏览器渲染」自动降级策略:
- 阶段 0:快速提取(~0.3-0.6s)— 基于
ddgs.extract(),适用于静态页面 - 阶段 1:浏览器降级(~15-23s)— 快速提取失败或内容不足时自动切换到 Playwright
- 阶段 2:可选 LLM 插件 — 仅当提供
llm_config且配置了CRAWL_MCP_API_KEY时执行
设计原则:不配置 API Key 时,工具完全作为纯爬取工具使用,零依赖外部 LLM 服务。 用户拿到 Markdown 后可自行调用任何 LLM 处理。静态页享受 0.5s 速度,SPA 自动降级到浏览器。
模块职责
| 模块 | 职责 | 关键类/函数 |
|---|---|---|
crawler.py |
网页爬取核心(自动降级:快速提取→浏览器) | Crawler.crawl_single(), Crawler.crawl_batch() |
searcher.py |
搜索 + 内部快速提取(ddgs.extract,不作为 MCP 工具暴露) | Searcher.search_text(), Searcher.extract_url() |
llm_config.py |
LLM 配置管理 | get_default_llm_config(), LLMConfig |
fastmcp_server.py |
MCP 服务器入口,注册所有工具 | @mcp.tool 装饰器 |
异步处理模式
关键设计决策:使用 nest_asyncio 实现嵌套事件循环兼容
_run_async()辅助函数(在utils.py中统一提供)封装了异步调用- 允许在已有事件循环的环境(如 Jupyter、某些测试框架)中运行
- 底层爬取使用
AsyncWebCrawler.arun()和arun_many() - 快速提取路径(
ddgs.extract)通过ThreadPoolExecutor并行化
并发控制
- 快速提取并发:
crawl_batchPhase 1 使用ThreadPoolExecutor并行内部Searcher.extract_url - 浏览器爬取并发:Phase 2 使用
SemaphoreDispatcher(concurrent参数) - LLM 并发:批量 LLM 处理使用
concurrent.futures.ThreadPoolExecutor(llm_concurrent参数) - 图片分析并发:
search_images使用asyncio.Semaphore(analyze_concurrent参数)
LLM 配置格式(实验性功能)
llm_config 参数支持三种格式:
- 字典:
{"instruction": "提取产品信息", "schema": {...}} - JSON 字符串:
'{"instruction": "总结"}' - 纯文本:
"总结页面内容"(自动作为instruction)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 8d ago First seen · 195 lines · 2,206 tokens per session scan A 0aff6440ee76
crawl-mcp CLAUDE.md is an instructions file published in the GitHub repository gqy20/crawl-mcp (2 stars, last pushed 2mo ago), licensed MIT. It adds 2,206 tokens to every session, about $0.0110 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other instructions, from other repositories
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
spec-kit AGENTS.md
AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.