crawl-mcp: Instructions file for Claude Code

CLAUDE.md

crawl-mcp CLAUDE.md is an instructions file for Claude Code from gqy20/crawl-mcp. It costs 2,206 tokens per session, scanned A, original, MIT.

Repository-specific instructions for developing crawl-mcp, an MCP server for fetching web pages and returning Markdown. MCP is a standard way for AI tools to call external services; these instructions also explain its automatic switch from quick extraction to browser-based loading.

In plain words
What is it for?
Use them when developing or testing crawl-mcp, running individual tests, checking code style, or starting its HTTP or standard-input server.
Why use it?
They collect the installation, testing, formatting, and server-running commands in one place, while explaining how the crawler handles simple pages and JavaScript-heavy pages.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions Claude Code.

This is gqy20/crawl-mcp's own configuration. It tells Claude Code how to work on crawl-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything crawl-mcp configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/gqy20/crawl-mcp/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/gqy20/crawl-mcp

Made for: Claude Code.

Wrote 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.

agentmods badge for crawl-mcp CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/gqy20/crawl-mcp/claude-md/github.svg)](https://agentmods.dev/instructions/gqy20/crawl-mcp/claude-md)
Your own site
<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.

agentmods 80×15 button for crawl-mcp CLAUDE.md

Your own site · 80×15
<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>
Per session 2,206 This file is loaded in full into every session.
When invoked 2,206 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 8d ago against content hash 0aff6440ee76, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

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.

CLAUDE.md · 195 lines

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 插件

本项目定位为专业网页爬取工具,内置「快速提取 → 浏览器渲染」自动降级策略:

  1. 阶段 0:快速提取(~0.3-0.6s)— 基于 ddgs.extract(),适用于静态页面
  2. 阶段 1:浏览器降级(~15-23s)— 快速提取失败或内容不足时自动切换到 Playwright
  3. 阶段 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_batch Phase 1 使用 ThreadPoolExecutor 并行内部 Searcher.extract_url
  • 浏览器爬取并发:Phase 2 使用 SemaphoreDispatcherconcurrent 参数)
  • LLM 并发:批量 LLM 处理使用 concurrent.futures.ThreadPoolExecutorllm_concurrent 参数)
  • 图片分析并发search_images 使用 asyncio.Semaphoreanalyze_concurrent 参数)

LLM 配置格式(实验性功能)

llm_config 参数支持三种格式:

  1. 字典{"instruction": "提取产品信息", "schema": {...}}
  2. JSON 字符串'{"instruction": "总结"}'
  3. 纯文本"总结页面内容"(自动作为 instruction

Read the full file on GitHub · 195 lines

Changes

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.

  1. 8d ago First seen · 195 lines · 2,206 tokens per session scan A 0aff6440ee76

Subscribe to this mod's changes

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.

Related

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.

vercel/next.js · 7,296 tokens

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.

openai/codex · 5,153 tokens

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).

microsoft/vscode · 6,785 tokens

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).

microsoft/vscode · 5,001 tokens

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.

langchain-ai/langchain · 4,469 tokens

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.

github/spec-kit · 7,104 tokens