How to Build a Lead Generation Pipeline with Claude Code
If you’re building a lead generation tool or automating prospecting for your own business, Claude Code can now handle the full pipeline: finding businesses with Maps, researching them with search, and sending outreach via email. AgentPatch connects all of those tools through a single MCP config.
Why This Matters
Lead generation workflows are repetitive and structured — exactly the kind of task an agent handles well. The problem is that they usually require several separate services: a business directory, a search tool, and an email client. Managing credentials and API keys for each adds friction.
AgentPatch consolidates that. One connection gives Claude Code access to Maps, search, and email. You describe the workflow; Claude Code executes it.
Setup
Install the AgentPatch CLI (zero dependencies, Python 3.10+):
pip install agentpatch
Set your API key:
export AGENTPATCH_API_KEY=your_api_key
Then use it:
ap search "web search"
ap run agentpatch google-search --input '{"query": "test"}'
Get your API key from the AgentPatch dashboard.
Run this command to add AgentPatch as an MCP server:
claude mcp add -s user --transport http agentpatch https://agentpatch.ai/mcp \
--header "Authorization: Bearer YOUR_API_KEY"
Replace YOUR_API_KEY with your actual key from the AgentPatch dashboard. Claude Code discovers all AgentPatch tools automatically.
Example
You’re building a prospecting tool for a freelance dev business. You want to test the pipeline end-to-end with a real run. You tell Claude Code:
“Run a test prospecting pass. Find 3 small law firms in Phoenix, look them up online to check their tech presence, draft personalized outreach emails, and send them to my test inbox.”
Claude Code runs the pipeline:
Searching Google Maps for "law firm Phoenix AZ" and filtering for smaller firms...
Candidates:
1. Hendricks & Lowe — 4.2★, 18 reviews
2. Sutton Family Law — 4.0★, 11 reviews
3. Premier Legal Group — 3.8★, 9 reviews
Searching Google for each firm's website and tech stack...
Hendricks & Lowe: WordPress site, no HTTPS, contact form broken.
Sutton Family Law: No website found, Avvo profile only.
Premier Legal Group: Squarespace site, not mobile-responsive.
Drafting outreach emails...
Email drafts complete. All three personalized to the specific issue found.
Sending to [email protected]...
Sending to [email protected]...
Sending to [email protected]...
All sent. Check your inbox to verify formatting.
That’s a full prospecting run — find, research, personalize, send — executed in one Claude Code session. Now you can turn that into a repeatable tool.
Wrapping Up
Connecting AgentPatch to Claude Code gives it a complete lead generation capability: Maps for discovery, Search for research, and Email for outreach. Those are three tools on the marketplace; the same connection also unlocks news, trends, image generation, and more. Explore at agentpatch.ai.