crawlforge-mcp
CLAUDE.md6 starsChanged 33 days agoMITView on GitHub
Guidance for Claude Code when working in this repository. File-specific detail lives in path-scoped rules under .claude/rules/ (tool registration and billing, search tools, stealth engines, security guards); they load when matching files are read. These bias toward caution over speed; for trivial tasks, use judgment. CrawlForge MCP Server — an MCP server providing 31 web scraping, crawling and content-processing tools (6 inline in server.js + 25 advanced). Node ESM, MCP SDK v2 (@modelcontextprotocol/server), Zod. The version lives in package.json. server.js…
- Reads credentials
- Installs packages
In this repository10 other files it gives its agents.
- agent-creatorSkill
- api-documenterSkill
- deployment-managerSkill
- mcp-implementationSkill
- next-phaseSkill
- performance-monitorSkill
- project-managerSkill
- security-auditorSkill
- testing-validationSkill
- docsSkill
The file
We split this CLAUDE.md into the rules it gives an agent
11 rules. About 0 are common, 9 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Think before coding: Don't assume, and don't hide confusion.
- Distinctive: line 11
If several interpretations exist, present them rather than picking one silently.
- Distinctive: line 12
If a simpler approach exists, say so, and push back when warranted.
- Distinctive: line 13
Simplicity first: Write the minimum code that solves the problem.
- Distinctive: line 14
No features, abstractions, configurability or error handling beyond what was asked or what can actually happen.
- Distinctive: line 15
If 200 lines could be 50, rewrite it.
- Distinctive: line 17
Don't "improve" adjacent code, comments or formatting, and don't refactor what isn't broken.
- Distinctive: line 18
Remove imports, variables and functions your change made unused.
- Distinctive: line 19
Every changed line should trace to the request.
- Very specific: line 118
Put all documentation .md files in docs/.
- Very specific: line 119
When a phase completes: run npm run test:unit and npm test and fix all failures, update docs/PRODUCTION_READINESS.md, then push all changes …
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
Guidance for Claude Code when working in this repository. File-specific detail lives in path-scoped rules under .claude/rules/ (tool registration and billing, search tools, stealth engines, security guards); they load when matching files are read.
Working guidelines
These bias toward caution over speed; for trivial tasks, use judgment.
- Think before coding. Don't assume, and don't hide confusion.
- State your assumptions. If uncertain, ask.
- If several interpretations exist, present them rather than picking one silently.
- If a simpler approach exists, say so, and push back when warranted.
- Simplicity first. Write the minimum code that solves the problem.
- No features, abstractions, configurability or error handling beyond what was asked or what can actually happen.
- If 200 lines could be 50, rewrite it.
- Surgical changes. Touch only what you must.
- Don't "improve" adjacent code, comments or formatting, and don't refactor what isn't broken. Match the existing style.
- Remove imports, variables and functions your change made unused. Mention pre-existing dead code; don't delete it unless asked.
- Every changed line should trace to the request.
- Goal-driven execution. Turn the task into a check you can run, and loop until it passes: "fix the bug" → a test that reproduces it, then make it pass; "refactor X" → tests pass before and after. For multi-step work, state a brief plan with a verification step for each item.
Project overview
CrawlForge MCP Server — an MCP server providing 31 web scraping, crawling and content-processing tools (6 inline in server.js + 25 advanced). Node ESM, MCP SDK v2 (@modelcontextprotocol/server), Zod. The version lives in package.json.
Development commands
npm install
npm run setup # first run, users only; or export CRAWLFORGE_API_KEY=...
npm start # stdio server
npm run start:http # HTTP transport
npm run dev # verbose logging
npm run test:unit # node:test over tests/unit/**, no live network
npm test # MCP protocol compliance
npm run test:integration
node test-tools.js # functional test of every tool
node test-real-world.js # real-world scenarios
npm run docker:build # also docker:dev, docker:prod- Single test file:
node --test --test-force-exit tests/unit/<file>.test.js. The flag must come before the path (after it, it is silently ignored). Without it, the Playwright handle thatStealthBrowserManagerleaves open hangs the runner after all tests pass;npm run test:unitalready sets it. - Phase D regressions (agent hard stops, unified scrape, map_site ranking):
tests/unit/phaseD-regressions.test.js. - CLI (
crawlforge --help):init,scrape,batch,install-skills, … — full reference indocs/cli-guide.md.
Debugging
- stdout is reserved for the MCP JSON-RPC stream and CLI
--jsonoutput. All diagnostics (Winston logs, status banners) go to stderr. NODE_ENV=developmentfor verbose logging and memory monitoring (logs every 60s above 200MB);node --expose-gc server.jsfor memory profiling.- Cached responses are in
cache/; application logs inlogs/.
Architecture
server.js is the entry point: loads .env early (creator mode), sets up AuthManager, registers every tool through withAuth() for credit tracking, connects the stdio transport, and cleans up browsers and job managers on graceful shutdown.
Core (src/core/)
- AuthManager — API-key validation, credit tracking, usage reporting;
getToolCostis the source of truth for prices. - AgentOrchestrator — powers
agent: NL prompt → PLAN→GATHER→ACT→DECIDE→SHAPE loop. Its three hard stops (maxSteps ≤10, maxUrls ≤20, wall-clock) are enforced by the orchestrator, never delegated to the LLM; has a degraded no-LLM-key path. - ResearchOrchestrator — multi-stage research with query expansion and synthesis.
- StealthBrowserManager — anti-detection scraping, Chromium or Camoufox (see
.claude/rules/stealth.md). - ActionExecutor — Playwright browser automation for
scrape_with_actions. - JobManager / WebhookDispatcher — async jobs for batch operations and their completion callbacks.
- PerformanceManager, LocalizationManager, ChangeTracker, SnapshotManager.
- MCP features: ResourceRegistry (
crawlforge://resources), PromptRegistry (src/prompts/, 5 workflow prompts), SamplingClient (with Ollama fallback), ElicitationHelper (user confirmation on expensive operations). - endpointGuard — allowlist for the server's own backend calls.
Tools (src/tools/)
| Directory | Tools |
basic/ | fetchUrl, extractText, extractLinks, extractMetadata, scrapeStructured |
scrape/ | unifiedScrape — scrape: one fetch, one cheerio load, a formats array, per-format warnings[] |
agent/ | agent (AgentOrchestrator) |
advanced/ | BatchScrapeTool, ScrapeWithActionsTool, BrowserSessionTool |
crawl/ | crawlDeep, mapSite (optional search= ranks URLs into ranked_urls) |
extract/ | analyzeContent, extractContent, extractStructured, extractWithLlm, listOllamaModels, processDocument, summarizeContent |
research/ | deepResearch |
result/ | readResult — search/slice/lines/json_path over a stored over-threshold result by result_handle |
search/ | searchWeb (proxied through the CrawlForge.dev API), serpRank (DataForSEO), redditSearch (community archives) — see .claude/rules/search-tools.md |
templates/ | ScrapeTemplateTool (10 site templates) |
tracking/ | trackChanges |
llmstxt/ | generateLLMsTxt |
The 31 MCP tools. Inline (6): fetch_url, extract_text, extract_links, extract_metadata, extract_embedded_state, scrape_structured. Advanced (25): search_web, serp_rank, reddit_search, crawl_deep, map_site, extract_content, process_document, summarize_content, analyze_content, extract_structured, extract_with_llm, list_ollama_models, batch_scrape, get_batch_results, scrape_with_actions, deep_research, track_changes, generate_llms_txt, stealth_mode, localization, scrape_template, scrape, agent, read_result, browser_session.
Adding or changing a tool: .claude/rules/tool-registration.md.
Configuration
Defaults and validation: src/constants/config.js. User auth is stored in ~/.crawlforge/config.json; development env in .env.
CRAWLFORGE_API_KEY=your_api_key_here
MAX_WORKERS=10
QUEUE_CONCURRENCY=10
CACHE_TTL=3600000
RATE_LIMIT_REQUESTS_PER_SECOND=10
MAX_CRAWL_DEPTH=5
MAX_PAGES_PER_CRAWL=100
RESPECT_ROBOTS_TXT=true- Stealth variables (
CRAWLFORGE_STEALTH_ENGINE,CRAWLFORGE_STEALTH_PROXIES,CRAWLFORGE_IMPIT,CRAWLFORGE_CLEARANCE_JAR):.claude/rules/stealth.md. - Robots, blocklist and Web Bot Auth signing variables:
.claude/rules/security-guards.md. OPENAI_API_KEY/ANTHROPIC_API_KEYare optional and only affectdeep_research: set, it synthesizes the report itself; unset, it returns raw evidence for the calling LLM to synthesize.
Security
- SSRF is enforced on every live fetch path through
ssrfGuard()/safeFetch(); never callfetchdirectly on a user-supplied URL. - References:
docs/sandboxing-and-approvals.md(canonical),docs/security-audit-report.md,docs/SECURITY.md; CI checks in.github/workflows/ci.ymland.github/workflows/security.yml. Runnpm auditlocally.
Project management rules
- Delegate to a sub-agent only for a genuinely independent, parallelizable track — not for work finishable in a few tool calls, and never to verify your own output (Claude 5 models over-delegate when told to parallelize).
- Put all documentation
.mdfiles indocs/. - When a phase completes: run
npm run test:unitandnpm testand fix all failures, updatedocs/PRODUCTION_READINESS.md, then push all changes to GitHub.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

