So bekommt Claude Code ein Web-Scraping-Werkzeug mit Crawl4AI via MCP
Coding-Agenten stoßen beim Lesen echter Webseiten an Grenzen. Der Open-Source-Crawler Crawl4AI verwandelt Websites in sauberes, LLM-freundliches Markdown und liefert einen MCP-Server, mit dem Claude Code selbstständig crawlen, extrahieren und suchen kann. Eine Anleitung zeigt beide Wege zur Einrichtung.

Veröffentlicht am 25. Oktober • Zuerst erschienen auf dedupedai.com
Coding-Agents sind großartig in der Recherche, bis sie eine echte Webseite lesen müssen. Crawl4AI ist ein Open-Source-Crawler und -Scraper, der Websites in sauberes, LLM-taugliches Markdown umwandelt, und er wird mit einem MCP-Server ausgeliefert, sodass Claude Code selbstständig Seiten abrufen, Daten extrahieren und suchen kann.
Dieser Leitfaden behandelt beide Wege zur Nutzung: den gehosteten MCP-Server (ein einziger Befehl in Claude Code) und die kostenlose Open-Source-Bibliothek, die man selbst betreibt.
Registriere dich auf crawl4ai.com und bestätige deine E-Mail-Adresse. Laut README umfasst der kostenlose Tarif 1.000 Credits pro Monat, 10 Anfragen pro Minute und 2 gleichzeitige Anfragen, ganz ohne Kreditkarte. Bezahlte Pläne beginnen bei 10 Dollar im Monat (120 Anfragen pro Minute, 10 gleichzeitig). Gehostete Anfragen werden gegen deinen Key abgerechnet, halte CRAWL4AI_KEY daher aus gemeinsam genutzten Skripten heraus.
export CRAWL4AI_KEY = "your-key-here" Vollbildmodus öffnen Vollbildmodus schließen Füge den MCP-Server hinzu claude mcp add --transport http crawl4ai https://api.crawl4ai.com/mcp \ --header "Authorization: Bearer $CRAWL4AI_KEY " Vollbildmodus öffnen Vollbildmodus schließen Das README verweist auch auf Einrichtungsanleitungen für Codex, Cursor und OpenCode.
Starte Claude Code und frage eine Seite in einfacher Sprache an:
Verwende crawl4ai, um https://docs.crawl4ai.com zu scrapen und fasse die Installationsoptionen als Tabelle zusammen. Vollbildmodus öffnen Vollbildmodus schließen Derselbe Key bietet dir /scrape (Seite zu Markdown), /extract (Seite zu JSON, ohne dass du einen eigenen LLM-Key brauchst), /search (Websuche), /serp (Googles Ergebnisseite als Daten, im Beta-Stadium) und /answer (eine direkte Antwort mit Quellen, experimentell). JavaScript-lastige Seiten und Bot-Schutzmaßnahmen werden auf der gehosteten Seite für dich behandelt.
curl -s https://api.crawl4ai.com/scrape \ -H "Authorization: Bearer $CRAWL4AI_KEY " \ -H "Content-Type: application/json" \ -d '{"url": "https://news.ycombinator.com"}' | jq -r.markdown Vollbildmodus öffnen Vollbildmodus schließen Option 2: Selbst betreiben, kostenlos Die gehostete API ist optional. Der Open-Source-Crawler läuft kostenlos auf deinem eigenen Rechner.
pip install -U crawl4ai crawl4ai-setup # installiert und richtet den Browser ein crawl4ai-doctor # prüft die Installation Vollbildmodus öffnen Vollbildmodus schließen Falls die Browser-Einrichtung fehlschlägt, installiere Chromium manuell mit python -m playwright install --with-deps chromium.
import asyncio from crawl4ai import AsyncWebCrawler async def main (): async with AsyncWebCrawler () as crawler: result = await crawler. arun ( url = " https://news.ycombinator.com " ) print ( result. markdown ) asyncio. run ( main ()) Vollbildmodus öffnen Vollbildmodus schließen Speichere result.markdown pro Seite ab und du hast saubere Eingabedaten für einen RAG-Index. Für eine kompaktere Ausgabe entfernen die „Fit Markdown“-Filter ( PruningContentFilterLXML, BM25ContentFilter, LLMContentFilter ) Menüs, Fußzeilen und Boilerplate.
crwl https://news.ycombinator.com -o markdown crwl https://docs.crawl4ai.com --deep-crawl bfs --max-pages 10 Vollbildmodus öffnen Vollbildmodus schließen Selbst gehosteter MCP mit Docker Wenn du MCP ohne die gehostete API nutzen möchtest, betreibe deinen eigenen Server. Er benötigt ein Token; ohne eines antwortet er nur innerhalb seines Containers.
export CRAWL4AI_API_TOKEN = " $( openssl rand -hex 32 ) " docker run -d -p 11235:11235 --name crawl4ai --shm-size = 1g \ -e CRAWL4AI_API_TOKEN = " $CRAWL4AI_API_TOKEN " \ unclecode/crawl4ai:latest Vollbildmodus öffnen Vollbildmodus schreiben Gib dem Server etwa 10 Sekunden zum Starten und teste dann:
curl -s http://localhost:11235/md \ -H "Authorization: Bearer $CRAWL4AI_API_TOKEN " \ -H "Content-Type: application/json" \ -d '{"url": "https://news.ycombinator.com"}' | jq -r.markdown Vollbildmodus öffnen Vollbildmodus schließen Der Server stellt /md, /html, /crawl, /screenshot, /pdf und /execute_js bereit, dazu ein Dashboard unter http://localhost:11235/dashboard und einen Playground unter /playground. Laut README unterstützt der selbst gehostete Server ebenfalls MCP für Claude Code und andere Agents; die genauen Verbindungsschritte findest du im Self-Hosting-Leitfaden.
Welchen Weg du auch wählst: Beachte bei dem Crawling die Nutzungsbedingungen und Robots-Regeln der jeweiligen Websites.
Erhalte jede Woche montags eine E-Mail mit den angesagtesten KI-Repositorien und einer genauen Anleitung zu deren Nutzung: abonniere kostenlos auf dedupedai.com
Automatisch übersetzt. Das Original auf Englisch ist unten aufklappbar.
Original (Englisch) anzeigen
Posted on Oct 25 • Originally published at dedupedai.com
Coding agents are great at research until they need to read a real web page. Crawl4AI is an open-source crawler and scraper that turns websites into clean, LLM-ready Markdown, and it ships an MCP server so Claude Code can scrape, extract and search on its own.
This guide covers both ways to use it: the hosted MCP server (one command in Claude Code) and the free open-source library you run yourself.
Sign up at crawl4ai.com and verify your email. Per the README, the free tier is 1,000 credits every month, 10 requests a minute and 2 at a time, with no card. Paid plans start at $10 a month (120 a minute, 10 at a time). Hosted requests are billed against your key, so keep CRAWL4AI_KEY out of shared scripts.
export CRAWL4AI_KEY = "your-key-here" Enter fullscreen mode Exit fullscreen mode Add the MCP server claude mcp add --transport http crawl4ai https://api.crawl4ai.com/mcp \ --header "Authorization: Bearer $CRAWL4AI_KEY " Enter fullscreen mode Exit fullscreen mode The README links setup for Codex, Cursor and OpenCode too.
Start Claude Code and ask for a page in plain language:
Use crawl4ai to scrape https://docs.crawl4ai.com and summarize the installation options as a table. Enter fullscreen mode Exit fullscreen mode The same key gives you /scrape (page to Markdown), /extract (page to JSON, no LLM key of your own needed), /search (web search), /serp (Google's results page as data, in beta) and /answer (a direct answer with sources, experimental). JS-heavy pages and bot walls are handled for you on the hosted side.
curl -s https://api.crawl4ai.com/scrape \ -H "Authorization: Bearer $CRAWL4AI_KEY " \ -H "Content-Type: application/json" \ -d '{"url": "https://news.ycombinator.com"}' | jq -r.markdown Enter fullscreen mode Exit fullscreen mode Option 2: run it yourself for free The hosted API is optional. The open-source crawler runs free on your machine.
pip install -U crawl4ai crawl4ai-setup # installs and sets up the browser crawl4ai-doctor # checks the installation Enter fullscreen mode Exit fullscreen mode If the browser setup fails, install Chromium by hand with python -m playwright install --with-deps chromium.
import asyncio from crawl4ai import AsyncWebCrawler async def main (): async with AsyncWebCrawler () as crawler: result = await crawler. arun ( url = " https://news.ycombinator.com " ) print ( result. markdown ) asyncio. run ( main ()) Enter fullscreen mode Exit fullscreen mode Save result.markdown per page and you have clean input for a RAG index. For tighter output, the "fit Markdown" filters ( PruningContentFilterLXML, BM25ContentFilter, LLMContentFilter ) strip menus, footers and boilerplate.
crwl https://news.ycombinator.com -o markdown crwl https://docs.crawl4ai.com --deep-crawl bfs --max-pages 10 Enter fullscreen mode Exit fullscreen mode Self-hosted MCP with Docker If you want MCP without the hosted API, run your own server. It needs a token; without one it only answers inside its container.
export CRAWL4AI_API_TOKEN = " $( openssl rand -hex 32 ) " docker run -d -p 11235:11235 --name crawl4ai --shm-size = 1g \ -e CRAWL4AI_API_TOKEN = " $CRAWL4AI_API_TOKEN " \ unclecode/crawl4ai:latest Enter fullscreen mode Exit fullscreen mode Allow about 10 seconds for it to start, then test:
curl -s http://localhost:11235/md \ -H "Authorization: Bearer $CRAWL4AI_API_TOKEN " \ -H "Content-Type: application/json" \ -d '{"url": "https://news.ycombinator.com"}' | jq -r.markdown Enter fullscreen mode Exit fullscreen mode The server exposes /md, /html, /crawl, /screenshot, /pdf and /execute_js, plus a dashboard at http://localhost:11235/dashboard and a playground at /playground. The README says the self-hosted server also supports MCP for Claude Code and other agents; the exact connection steps are in the self-hosting guide.
Whichever you choose, respect each site's terms and robots rules when crawling.
Get one email every Monday with the week's hottest AI repos and exactly how to use them: subscribe free at dedupedai.com