Spicrawl artık OpenAI Agents SDK, LangChain, Codex, Claude Code ve daha fazlasıyla çalışıyor.Entegrasyonları görün
İçeriğe geç

VS Code’da Copilot ile web scraping

Spicrawl MCP sunucusunu VS Code’a ekleyin. Agent modundaki Copilot böylece web sayfalarını temiz Markdown olarak okuyabilir.

Kurun

Üç adım Copilot’a araçları, Spicrawl kodu yazma bilgisini ve ikisini kullanma kurallarını verir. spicrawl init --client vscode ilk ikisini sizin için yapar.

  1. Projede .vscode/mcp.json oluşturun. VS Code mcpServers değil, servers anahtarını kullanır. Parola girişi VS Code’un anahtarınızı bir kez sormasını ve saklamasını sağlar, böylece dosyayı commit etmek güvenlidir:

    .vscode/mcp.json
    {
      "inputs": [
        {
          "type": "promptString",
          "id": "spicrawl-api-key",
          "description": "Spicrawl API key",
          "password": true
        }
      ],
      "servers": {
        "spicrawl": {
          "type": "http",
          "url": "https://mcp.spicrawl.com/mcp",
          "headers": { "Authorization": "Bearer ${input:spicrawl-api-key}" }
        }
      }
    }
  2. Komut Paleti’nden MCP: List Servers çalıştırın ve spicrawl sunucusunu başlatın. İstendiğinde anahtarınızı girin.

  3. Skill’i kurun ve commit edin:

    bash
    spicrawl skill install --client vscode
    
    # Without the CLI:
    mkdir -p .github/skills/spicrawl
    curl -fsSL https://app.spicrawl.com/skill.md -o .github/skills/spicrawl/SKILL.md
  4. Bunu .github/copilot-instructions.md olarak kaydedin veya zaten sahip olduğunuz dosyaya ekleyin:

    .github/copilot-instructions.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. Chat görünümünü açın, Agent moduna geçin ve araç seçiciyi açın. spicrawl 25 spicrawl_* aracını listeler.

Copilot CLI ve Copilot cloud agent her biri kendi MCP yapılandırmasını okur. doküman sayfası ikisini de kapsar.

Deneyebileceğiniz ilk görev

Copilot Chat’i Agent modunda açın ve sorun:

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

Agent, spicrawl_scrape aracını format: "markdown" ile çağırmalıdır. render: true değerini yalnızca ilk sonuç boşsa eklemelidir.

Neler yapabilir

Sunucu agent’a 25 spicrawl_* aracı verir. Her çağrı API anahtarınızla çalışır; doğrudan bir API çağrısıyla aynı limitler ve kredilerle.

  • Tek bir sayfayı okuyun: spicrawl_scrape Markdown (varsayılan), metin, HTML, JSON veya PDF döndürür.
  • Birçok sayfayı okuyun: spicrawl_batch_submit en fazla 10.000 URL’yi kuyruğa alır. Ardından spicrawl_batch_status ve spicrawl_batch_results kullanın.
  • Giriş arkasındaki sayfalar: spicrawl_session_create çerezleri ve depolamayı çağrılar arasında korur.
  • Bir hatayı ayıklayın: spicrawl_requests_list ve spicrawl_request_get.
  • Kullanımı kontrol edin: spicrawl_usage_summary ve diğer kullanım araçları. Bunlar için read kapsamına sahip bir anahtar gerekir.
  • Bir şeye bakın: spicrawl_docs_search ve spicrawl_docs_read, Spicrawl dokümanlarında arama yapar ve onları okur.

Bir araç, spicrawl_browser_connect_url, listelenmiş ancak yakında geliyor. spicrawl_scrape üzerinde işleme argümanı API’deki js_render değil, render olarak geçer.

Bilmekte fayda var

  • Crawl yok. Spicrawl bağlantıları izlemez veya sayfa bulmaz. Agent’a URL’leri verin.
  • İstek başına kredi. Düz bir fetch 1 kredidir. JavaScript işleme 3, tam tarayıcı işleme 8 kredidir.
  • Hatalar ücretsizdir. Başarısız bir istek 0 kredi tutar.
  • Önbellek zaman kazandırır, kredi kazandırmaz. Önbellek zaman kazandırır, kredi kazandırmaz.
  • Her çağrıyı sınırlayın. max_cost ayarlayın; daha pahalıya mal olabilecek bir istek çalışmadan önce reddedilir.
  • Yakında: yönetilen proxy’ler, gizli mod, uzak tarayıcı ve düz dilde bir prompt’tan yapay zeka ile çıkarma. Bugün kendi proxy’nizi getirebilirsiniz.

Sık sorulan sorular

VS Code neden "mcpServers" yerine "servers" kullanıyor?

Bu VS Code’un kendi formatıdır. Bu sayfadaki örnekte olduğu gibi .vscode/mcp.json içinde servers anahtarını kullanın.

Anahtarım nerede saklanır?

The inputs entry with password: true makes VS Code ask for the key once and store it. The file only holds ${input:spicrawl-api-key}, so you can commit it.

Copilot CLI ve bulut agent’ıyla çalışır mı?

Evet, ama her biri kendi MCP yapılandırmasını okur. Copilot CLI copilot mcp add kullanır. Bulut agent’ı bir depo yöneticisi tarafından Settings → Copilot → MCP servers altında kurulur. Doküman sayfası ikisini de kapsar.

spicrawl init --client vscode ne yazar?

.vscode/mcp.json dosyasını ve skill’i .github/skills/spicrawl/SKILL.md konumuna yazar. Talimat dosyasını veya Copilot CLI ya da bulut agent yapılandırmasını yazmaz.

Her sayfa ne kadara mal olur?

Düz fetch 1 kredi, JavaScript işleme 3, tam tarayıcı işleme 8 tutar. Başarısız istekler 0 kredi tutar. Önbellek isabeti, onu depolayan fetch ile aynı maliyettedir. Agent’a, beklediğinizden fazla harcamaması için her istekte max_cost ayarlamasını söyleyin.