ScavioScavio
ProductPricingDocs
Sign InGet Started
  1. Home
  2. Tutorials
  3. How to Build a Local Lead List in Claude Code with Scavio MCP
Tutorial

How to Build a Local Lead List in Claude Code with Scavio MCP

Add Scavio's hosted MCP to Claude Code, prompt the agent to pull "<trade> in <city>", loop cities, dedupe by domain, and export a CSV lead list.

Get Free API KeyAPI Docs

Building a local business lead list usually takes longer than the outreach. Here's the fast path: add Scavio's hosted MCP server to Claude Code, then prompt the agent to search "<trade> in <city>" across your target cities. Scavio runs a real Google search per query and returns the business name, website, and snippet. Tell the agent to loop the cities, dedupe by domain, and write a CSV. You get the discovery layer in minutes instead of an afternoon of copy-paste. One honest note up front: this gives you names and sites, not verified emails or phone numbers. Enrichment is a separate step, covered at the end.

Prerequisites

  • A Scavio API key (sign up free, 50 credits included)
  • Claude Code installed, or any MCP client (Cursor, VS Code, Windsurf, opencode)
  • Python 3.9+ or Node 18+ if you want the automated REST loop

Walkthrough

Step 1: Add the Scavio MCP server to Claude Code

Open your Claude Code MCP config and register Scavio's hosted server. It authenticates with your API key in the x-api-key header. No local install, no Docker. Once saved, restart Claude Code and the Scavio search tools show up in the agent's toolset.

JSON
{
  "mcpServers": {
    "scavio": {
      "url": "https://mcp.scavio.dev/mcp",
      "headers": {
        "x-api-key": "YOUR_SCAVIO_API_KEY"
      }
    }
  }
}

Step 2: Prompt the agent to pull one trade in one city

Start with a single query to confirm the wiring. Ask Claude Code in plain English. The agent calls Scavio's Google tool, which returns organic results including local business listings: name, link, and snippet. Verify the shape before you scale up.

Text
Prompt to Claude Code:

"Use the Scavio MCP to search Google for
'plumbers in Austin' with light_request false.
List each result's business name, website, and snippet."

Step 3: Loop across all your target cities

Now give the agent the full list. It runs one search per city, collecting every business it finds. Keep light_request false so you get full organic results with local listings. Each query costs 2 credits.

Text
Prompt to Claude Code:

"Run the Scavio Google search for 'plumbers in <city>'
for each of: Austin, Dallas, Houston, San Antonio, Fort Worth.
Collect business name, website, and snippet from every result."

Step 4: Dedupe by domain and export a CSV

The same chain or directory often shows up in multiple cities. Tell the agent to collapse rows that share a website domain, then write the result to a file. You end up with a clean, one-row-per-business lead list.

Text
Prompt to Claude Code:

"Dedupe the results by website domain, keeping the first
occurrence. Write a CSV called leads.csv with columns:
business_name, website, city, snippet."

Step 5: Run it headless with the REST API

For a repeatable job (nightly refresh, larger city list), skip the chat and hit the REST endpoint directly. Same data, scriptable. The Python and Node examples below loop cities, dedupe by domain, and write the CSV without an agent in the loop.

Bash
curl -X POST https://api.scavio.dev/api/v1/google \
  -H "Authorization: Bearer $SCAVIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"plumbers in Austin","light_request":false}'

Step 6: Enrich: turn sites into contactable leads

Scavio's Google search gives you the discovery layer: business name and website. It does not return verified emails or phone deliverability. That's a separate enrichment step (scrape the site's contact page, run an email finder, verify deliverability). If you need rich fields like ratings, hours, and review counts in one shot, a Google Maps scraper returns more per row, but it costs more and risks IP bans. For most lead-list jobs, Scavio's discovery plus a cheap enrichment pass is enough.

Text
# Enrichment is a separate pass, e.g.:
# 1. For each website, fetch /contact
# 2. Extract emails with a regex or finder API
# 3. Verify deliverability before outreach

Python Example

Python
import csv
import os
from urllib.parse import urlparse
import requests

API_KEY = os.environ["SCAVIO_API_KEY"]
CITIES = ["Austin", "Dallas", "Houston", "San Antonio", "Fort Worth"]
TRADE = "plumbers"

def search(query):
    r = requests.post(
        "https://api.scavio.dev/api/v1/google",
        headers={"Authorization": f"Bearer {API_KEY}"},
        json={"query": query, "light_request": False},
        timeout=60,
    )
    r.raise_for_status()
    return r.json().get("organic", [])

def domain(url):
    return urlparse(url).netloc.lower().replace("www.", "")

seen = set()
rows = []
for city in CITIES:
    for item in search(f"{TRADE} in {city}"):
        link = item.get("link", "")
        d = domain(link)
        if not d or d in seen:
            continue
        seen.add(d)
        rows.append({
            "business_name": item.get("title", ""),
            "website": link,
            "city": city,
            "snippet": item.get("snippet", ""),
        })

with open("leads.csv", "w", newline="", encoding="utf-8") as f:
    w = csv.DictWriter(f, fieldnames=["business_name", "website", "city", "snippet"])
    w.writeheader()
    w.writerows(rows)

print(f"Wrote {len(rows)} leads to leads.csv")

JavaScript Example

JavaScript
import fs from "node:fs";

const API_KEY = process.env.SCAVIO_API_KEY;
const CITIES = ["Austin", "Dallas", "Houston", "San Antonio", "Fort Worth"];
const TRADE = "plumbers";

async function search(query) {
  const res = await fetch("https://api.scavio.dev/api/v1/google", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ query, light_request: false }),
  });
  if (!res.ok) throw new Error(`HTTP ${res.status}`);
  const data = await res.json();
  return data.organic || [];
}

function domain(url) {
  try {
    return new URL(url).hostname.toLowerCase().replace("www.", "");
  } catch {
    return "";
  }
}

const seen = new Set();
const rows = [];
for (const city of CITIES) {
  const results = await search(`${TRADE} in ${city}`);
  for (const item of results) {
    const link = item.link || "";
    const d = domain(link);
    if (!d || seen.has(d)) continue;
    seen.add(d);
    rows.push({ business_name: item.title || "", website: link, city, snippet: item.snippet || "" });
  }
}

const header = "business_name,website,city,snippet\n";
const body = rows
  .map((r) => [r.business_name, r.website, r.city, r.snippet].map((v) => `"${String(v).replace(/"/g, '""')}"`).join(","))
  .join("\n");
fs.writeFileSync("leads.csv", header + body);
console.log(`Wrote ${rows.length} leads to leads.csv`);

Expected Output

JSON
business_name,website,city,snippet
Daniel's Plumbing & Air Conditioning,https://danielsaustin.com,Austin,"24/7 plumbing repair and water heater installation in Austin, TX."
Reliant Plumbing,https://reliantplumbing.com,Austin,"Same-day plumbers serving Austin and surrounding areas."
Baker Brothers Plumbing,https://bakerbrothersplumbing.com,Dallas,"Licensed plumbers in Dallas-Fort Worth since 1945."
Abacus Plumbing,https://abacusplumbing.net,Houston,"Award-winning plumbing, AC, and electrical in Houston."

Wrote 47 leads to leads.csv

Related Tutorials

    Frequently Asked Questions

    Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

    A Scavio API key (sign up free, 50 credits included). Claude Code installed, or any MCP client (Cursor, VS Code, Windsurf, opencode). Python 3.9+ or Node 18+ if you want the automated REST loop. A Scavio API key gives you 50 free credits on signup.

    Yes. The free tier includes 50 credits on signup, which is more than enough to complete this tutorial and prototype a working solution.

    Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

    Related Resources

    Use Case

    MCP Custom Search Server

    Read more
    Use Case

    Google Maps Local Lead Gen

    Read more
    Best Of

    Best Search API for Claude Code in 2026

    Read more
    Best Of

    Best Google Maps API for Lead Extraction in 2026

    Read more
    Comparison

    Google Maps Scraper vs Search API (SERP-based local results)

    Read more
    Workflow

    Claude Code Web Search via Scavio MCP

    Read more

    Start Building

    Add Scavio's hosted MCP to Claude Code, prompt the agent to pull "<trade> in <city>", loop cities, dedupe by domain, and export a CSV lead list.

    Get Free API KeyRead the Docs
    ScavioScavio

    Real-time search API for AI agents. Search every platform, not just Google.

    Product

    • Features
    • Pricing
    • Dashboard
    • Affiliates

    Developers

    • Documentation
    • API Reference
    • Quickstart
    • MCP Integration
    • Python SDK

    Alternatives

    • Tavily Alternative
    • SerpAPI Alternative
    • Firecrawl Alternative
    • Exa Alternative

    Tools

    • JSON Formatter
    • cURL to Code
    • Token Counter
    • All Tools

    © 2026 Scavio. All rights reserved.

    Featured on TAAFT
    Terms of ServicePrivacy Policy