Skip to content

CrawlForge TeamEngineering Team

10 min read

How to Scrape Websites with GitHub Copilot Agents in VS Code

GitHub Copilot's agent mode in VS Code can read your repo, run terminal commands, and edit files -- but it cannot fetch live web pages reliably. Add CrawlForge MCP and Copilot gains 31 scraping tools, from fetch_url to deep_research.

Jsonc
// .vscode/mcp.json
{
  "servers": {
    "crawlforge": {
      "type": "stdio",
      "command": "crawlforge-mcp-server",
      "env": { "CRAWLFORGE_API_KEY": "cf_live_your_key" }
    }
  }
}

This guide walks through enabling web scraping in GitHub Copilot agents step by step, with working TypeScript examples and troubleshooting for the common gotchas.

Table of Contents

The Problem: Copilot's Limited Web Access

Copilot Chat has a @web participant but it rewrites your query into Bing search -- no raw page access, no structured extraction, no anti-bot bypass. In agent mode, Copilot can run shell commands, so you could pipe curl | pandoc through a tool call, but that misses JavaScript-rendered pages and trips anti-bot systems within minutes.

MCP solves this. Since VS Code 1.102 shipped general-availability MCP support in mid-2025, Copilot agents can call any MCP server you register. CrawlForge exposes 31 scraping tools as MCP, so scraping becomes a first-class agent action.

Prerequisites

  • VS Code 1.102+ -- code --version
  • GitHub Copilot subscription (Individual, Business, or Enterprise) with agent mode enabled
  • Node.js 18+
  • CrawlForge account -- free at crawlforge.dev/signup

Step 1: Install CrawlForge MCP

Bash
npm install -g crawlforge-mcp-server
crawlforge-mcp-server --version
# crawlforge-mcp-server 4.8.1

Step 2: Enable Copilot Agent Mode

  1. Open VS Code settings (Cmd+, / Ctrl+,).
  2. Search for chat.agent.enabled and toggle it on.
  3. Open Copilot Chat (Ctrl+Alt+I / Cmd+Ctrl+I) and switch the mode dropdown from "Ask" to "Agent."

Agent mode is what enables MCP tool calls. In "Ask" or "Edit" modes, Copilot ignores registered MCP servers.

Step 3: Register the MCP Server

VS Code supports MCP at two scopes:

  • Workspace -- .vscode/mcp.json in the repo root (team-shared via git)
  • User -- editable via "MCP: Add Server" command palette (personal)

For team scraping, use the workspace config:

Jsonc
// .vscode/mcp.json
{
  "servers": {
    "crawlforge": {
      "type": "stdio",
      "command": "crawlforge-mcp-server",
      "env": {
        "CRAWLFORGE_API_KEY": "${env:CRAWLFORGE_API_KEY}"
      }
    }
  }
}

Then export the key in your shell (do not commit it):

Bash
export CRAWLFORGE_API_KEY="cf_live_your_key_here"

Or use ${input:apiKey} and VS Code will prompt once per workspace.

Step 4: Verify Tools Are Available

  1. Open Copilot Chat.
  2. Click the tool icon in the chat header.
  3. Confirm crawlforge is listed with 31 tools. Uncheck any you want to hide.

If the list is empty, jump to Troubleshooting.

Step 5: Your First Scrape

In Copilot Chat (agent mode), paste:

#crawlforge Fetch https://news.ycombinator.com and list the top 5 story titles with their URLs.

The #crawlforge hint nudges Copilot toward the right tool. Copilot calls fetch_url (1 credit), receives HTML, parses titles, and returns them inline.

Full Example: Generate a REST Client from Live Docs

Here is a concrete workflow: auto-generate a typed Stripe client from the live documentation.

Prompt Copilot agent:

#crawlforge Use extract_content on https://docs.stripe.com/api/charges/create. Then in src/clients/stripe-charges.ts, write a typed function createCharge(params) that calls the Stripe API with the exact fields documented on that page. Add a Zod schema for params.

Copilot issues this MCP call:

Typescript
// What Copilot sends via MCP to CrawlForge
{
  "tool": "extract_content",
  "arguments": {
    "url": "https://docs.stripe.com/api/charges/create",
    "options": { "format": "markdown" }
  }
}
// Response: clean markdown of the endpoint docs

Copilot reads the markdown and writes:

Typescript
// src/clients/stripe-charges.ts
import { z } from 'zod';

export const CreateChargeParams = z.object({
  amount: z.number().int().positive(),
  currency: z.string().length(3),
  source: z.string().optional(),
  customer: z.string().optional(),
  description: z.string().max(500).optional(),
  receipt_email: z.string().email().optional(),
  statement_descriptor: z.string().max(22).optional(),
});

export type CreateChargeParams = z.infer<typeof CreateChargeParams>;

export async function createCharge(params: CreateChargeParams) {
  const validated = CreateChargeParams.parse(params);
  const body = new URLSearchParams();
  for (const [key, value] of Object.entries(validated)) {
    if (value !== undefined) body.append(key, String(value));
  }

  const response = await fetch('https://api.stripe.com/v1/charges', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.STRIPE_SECRET_KEY}`,
      'Content-Type': 'application/x-www-form-urlencoded',
    },
    body,
  });

  if (!response.ok) {
    const error = await response.json();
    throw new Error(`Stripe error: ${error.error?.message ?? response.statusText}`);
  }

  return response.json();
}

Cost: 2 credits (one extract_content call). Repeat for every Stripe endpoint and you have a full typed client derived from live docs.

Advanced: Multi-Tool Workflows

Copilot agents excel at chaining tools. Example prompt:

#crawlforge 1) search_web for "OpenTelemetry Node.js auto-instrumentation 2026" 2) extract_content from the top 3 results 3) Summarize the differences into docs/otel-options.md with a decision matrix.

Copilot runs the three MCP calls sequentially, feeds results forward, and writes the markdown. Total cost: ~11 credits (5 + 2 + 2 + 2).

Credit Quick Reference

TaskToolCredits
Static HTML fetchfetch_url1
Clean article textextract_content2
CSS-selector fieldsscrape_structured2
Discover URLsmap_site2
Web searchsearch_web5
Anti-bot bypassstealth_mode5
Deep researchdeep_research10

Troubleshooting

Tools list is empty -- Agent mode is off. Enable chat.agent.enabled in settings and switch chat mode to "Agent."

"Spawn ENOENT: crawlforge-mcp-server" -- VS Code cannot find the binary. Use an absolute path in .vscode/mcp.json: "command": "/usr/local/bin/crawlforge-mcp-server".

Copilot ignores the MCP server -- Prefix your prompt with #crawlforge or explicitly name a tool: "Use fetch_url to...". Copilot sometimes picks built-in tools by default.

401 Unauthorized -- The env var is not reaching the server. Check echo $CRAWLFORGE_API_KEY in the same shell that launched VS Code. On macOS, GUI-launched VS Code does not inherit shell env -- launch via code . from the terminal.

Workspace MCP config not loading -- VS Code does not auto-trust .vscode/mcp.json. Open the file, click the "Trust" notification, then reload the window.

Next Steps

Start free with 1,000 credits at crawlforge.dev/signup.

Try this yourself — no signup needed

Explore all 31 CrawlForge scraping and extraction tools in the playground, then start free with 1,000 credits.

1,000 free credits • One-time • No credit card required

Tags

  • GitHub-Copilot
  • VS-Code
  • web-scraping
  • MCP
  • tutorial
  • agent-mode
  • AI-agents

About the Author

CrawlForge Team

Engineering Team

Building the most comprehensive web scraping MCP server. We create tools that help developers extract, analyze, and transform web data for AI applications.

Newsletter

Stay updated with the latest insights

Get tutorials, product updates, and web scraping tips delivered to your inbox.

No spam. Unsubscribe anytime.

FAQ

Frequently asked questions

01Does GitHub Copilot support MCP servers?

Yes, as of VS Code 1.102 (mid-2025). MCP servers work in Copilot Chat when you switch to Agent mode. Configuration lives in .vscode/mcp.json (workspace) or via the "MCP: Add Server" command palette (user scope).

02Do I need a paid Copilot subscription to use CrawlForge MCP?

You need a Copilot subscription (Individual, Business, or Enterprise) to access agent mode and MCP tool calls. CrawlForge itself has a free tier with a one-time 1,000 credits -- no credit card required.

03Why does Copilot ignore my CrawlForge tools?

Two common causes: chat mode is set to Ask or Edit instead of Agent, or Copilot picked a built-in tool. Switch to Agent mode in the chat dropdown and explicitly reference #crawlforge or a specific tool name like scrape_structured in your prompt.

04How do I share MCP config with my team?

Commit .vscode/mcp.json to your repo. Use ${env:CRAWLFORGE_API_KEY} or ${input:apiKey} so individual keys stay out of version control. Teammates run the same export CRAWLFORGE_API_KEY=... once, then Copilot picks up the shared config automatically.

05What is the difference between @web and a CrawlForge MCP tool?

@web asks Bing a question and returns a summarized answer -- no raw page access, no structured extraction, no control over which URLs are fetched. CrawlForge MCP tools give Copilot direct access to 31 scraping primitives: fetch raw HTML, CSS-select specific fields, bypass anti-bot, and run multi-source research with citations.

Keep reading

Related Articles