Spicrawl funktioniert jetzt mit dem OpenAI Agents SDK, LangChain, Codex, Claude Code und mehr.Integrationen ansehen
Zum Inhalt springen

Web Scraping in Claude Code

Füge den Spicrawl-MCP-Server zu Claude Code hinzu. Claude kann dann Webseiten als sauberes Markdown lesen.

Einrichten

Drei Schritte geben Claude Code die Tools, das Know-how zum Schreiben von Spicrawl-Code und Regeln für beides. Oder erledige alle drei mit spicrawl init --client claude.

  1. Setze deinen API-Schlüssel:

    bash
    export SPICRAWL_API_KEY=spicrawl_live_...   # add to your shell profile
  2. Füge den MCP-Server hinzu. Deine Shell trägt den Schlüssel ein, und Claude Code speichert ihn in ~/.claude.json, außerhalb des Repositorys. Füge --scope user hinzu, um ihn in jedem Projekt zu nutzen.

    bash
    claude mcp add --transport http spicrawl https://mcp.spicrawl.com/mcp \
      --header "Authorization: Bearer $SPICRAWL_API_KEY"

    Für ein Team committe stattdessen .mcp.json im Projektstamm. Claude Code liest den eigenen Schlüssel jeder Person aus deren Umgebung:

    .mcp.json
    {
      "mcpServers": {
        "spicrawl": {
          "type": "http",
          "url": "https://mcp.spicrawl.com/mcp",
          "headers": { "Authorization": "Bearer ${SPICRAWL_API_KEY}" }
        }
      }
    }
  3. Installiere den Skill. Claude lädt ihn, wenn eine Aufgabe Webdaten betrifft oder wenn du /spicrawl eingibst:

    bash
    mkdir -p .claude/skills/spicrawl
    curl -fsSL https://app.spicrawl.com/skill.md -o .claude/skills/spicrawl/SKILL.md
  4. Füge diesen Abschnitt in CLAUDE.md im Projektstamm ein:

    CLAUDE.md
    ## Web data (Spicrawl)
    
    Use Spicrawl to read web pages: the spicrawl_* MCP tools in chat, or
    POST https://api.spicrawl.com/v1/scrape with `Authorization: Bearer $SPICRAWL_API_KEY` in code.
    Docs: https://docs.spicrawl.com/llms.txt (append .md to any page URL for Markdown).
    
    - Ask for markdown: `response_format: "markdown"` (API default is html); on spicrawl_scrape, `format: "markdown"`.
    - Check the site's status, not only the HTTP status: `X-Target-Status` header, or `status`
      in the JSON envelope (spicrawl_scrape with `format: "json"`). 200 is the page; 404/410
      mean it does not exist; 403/429/503 mean the site refused, so escalate.
    - On an error, switch on `code`. Retry only when `retryable` is true, after
      `retry_after_seconds`. Read `diagnostics.hint` and change what it names first.
      Never retry ERR::REQUEST::*, ERR::AUTH::* or ERR::LIMIT::QUOTA_EXCEEDED.
    - Escalate one step at a time and stop at the first that works:
      plain fetch (1 credit) -> `js_render: true` (3) -> add the user's own `proxy`
      if they have one. Empty or skeleton content means render; ERR::UPSTREAM::CHALLENGE
      or a 403 target status means retry once, then the user's own proxy.
    - Set `max_cost` on every request to the price of the step you intend.
    - Keep the cache on (default). Set `cache: false` only for prices, stock or other live data.
    - Trim tokens with `main_content_only` (on by default for markdown), `include_tags`, `exclude_tags`.
    - For more than 20 URLs, use a batch job (spicrawl_batch_submit / POST /v1/batch).
      Batch items return html, markdown or text (spicrawl_batch_submit defaults to markdown,
      POST /v1/batch to html). Extraction, screenshots, actions and sessions are refused
      with a 400 before anything is charged: scrape those URLs one by one.
    - Never print or commit SPICRAWL_API_KEY. Log `X-Request-Id` for failures.
  5. Prüfe es mit claude mcp list oder /mcp in einer Session. Du solltest 25 spicrawl_*-Tools sehen.

Lieber ein Plugin? Es bündelt den MCP-Server und den Skill, du kannst also die Schritte 2 und 3 überspringen. Claude Code fragt nach deinem Schlüssel, wenn du es aktivierst:

bash
claude plugin marketplace add OfficialSpicrawl/agent-plugins
claude plugin install spicrawl@spicrawl-plugins

Eine erste Aufgabe zum Ausprobieren

Starte claude im Projekt und frage:

Prompt
Use Spicrawl to read https://example.com/pricing as markdown. List each plan with its monthly price.
If the page comes back empty, retry with rendering. Tell me how many credits it cost.

Claude ruft spicrawl_scrape auf. Um die Kosten zu melden, braucht es format: "json", weil dieser Umschlag credits enthält. Eine vollständige Anleitung findest du in wie du eine Website mit Claude Code scrapst.

Was es kann

Der Server gibt dem Agenten 25 spicrawl_*-Tools. Jeder Aufruf läuft unter deinem API-Schlüssel, mit denselben Limits und Credits wie ein direkter API-Aufruf.

  • Eine Seite lesen: spicrawl_scrape liefert Markdown (Standard), Text, HTML, JSON oder PDF.
  • Viele Seiten lesen: spicrawl_batch_submit stellt bis zu 10.000 URLs in die Warteschlange. Danach folgen spicrawl_batch_status und spicrawl_batch_results.
  • Seiten hinter einem Login: spicrawl_session_create behält Cookies und Storage über Aufrufe hinweg.
  • Einen Fehler debuggen: spicrawl_requests_list und spicrawl_request_get.
  • Nutzung prüfen: spicrawl_usage_summary und die anderen Nutzungs-Tools. Dafür brauchst du einen Schlüssel mit dem Scope read.
  • Dinge nachschlagen: spicrawl_docs_search und spicrawl_docs_read durchsuchen und lesen die Spicrawl-Docs.

Ein Tool, spicrawl_browser_connect_url, ist aufgeführt, kommt aber bald. Bei spicrawl_scrape heißt das Rendering-Argument render, nicht js_render wie bei der API.

Gut zu wissen

  • Kein Crawling. Spicrawl folgt keinen Links und findet keine Seiten. Gib dem Agenten die URLs.
  • Credits pro Anfrage. Ein einfacher Abruf kostet 1 Credit. JavaScript-Rendering kostet 3. Rendering im vollen Browser kostet 8.
  • Fehler sind kostenlos. Eine fehlgeschlagene Anfrage kostet 0 Credits.
  • Der Cache spart Zeit, keine Credits. Ein Cache-Treffer kostet genauso viel wie der Abruf, der ihn gespeichert hat.
  • Begrenze jeden Aufruf. Setze max_cost, und eine Anfrage, die mehr kosten könnte, wird abgelehnt, bevor sie läuft.
  • Kommt bald: verwaltete Proxys, Stealth-Modus, ein Remote-Browser und KI-Extraktion aus einem Prompt in einfacher Sprache. Heute kannst du deinen eigenen Proxy mitbringen.

Häufig gestellte Fragen

Wie füge ich Spicrawl zu Claude Code hinzu?

Exportiere SPICRAWL_API_KEY und führe dann claude mcp add --transport http spicrawl https://mcp.spicrawl.com/mcp --header "Authorization: Bearer $SPICRAWL_API_KEY" aus. Prüfe es mit claude mcp list.

Wie teile ich das Setup mit meinem Team?

Commit .mcp.json at the project root with the header "Bearer ${SPICRAWL_API_KEY}". Claude Code fills in each person’s own key from their environment when it starts.

Gibt es ein Claude-Code-Plugin?

Ja. Führe claude plugin marketplace add OfficialSpicrawl/agent-plugins aus und dann claude plugin install spicrawl@spicrawl-plugins. Es bündelt den MCP-Server und den Skill und fragt nach deinem Schlüssel, wenn du es aktivierst.

Warum bekommt Claude einen Fehler "unknown argument" für js_render?

Beim Tool spicrawl_scrape heißt das Argument render. js_render ist der Name in der HTTP-API.

Was kostet jede Seite?

Ein einfacher Abruf kostet 1 Credit, JavaScript-Rendering 3 und Rendering im vollen Browser 8. Fehlgeschlagene Anfragen kosten 0. Ein Cache-Treffer kostet so viel wie der Abruf, der ihn gespeichert hat. Lass den Agenten bei jeder Anfrage max_cost setzen, damit er nie mehr ausgibt als erwartet.