This MCP server provides powerful lead generation capabilities using the MCP SDK and Crawl4AI for intelligent web crawling. It enables a complete lead lifecycle from discovery to enrichment with features like UUID-based tracking, multi-source aggregation, and enterprise-grade error handling.
Before installation, ensure you have:
export HUNTER_API_KEY="your_key"
export CLEARBIT_API_KEY="your_key"
export GOOGLE_CSE_ID="your_id"
export GOOGLE_API_KEY="your_key"
# Create virtual environment
python -m venv .venv && source .venv/activate
# Install required dependencies
pip install mcp crawl4ai[all] aiocache aiohttp uvloop
# Set up browser dependencies for scraping
python -m playwright install chromium
FROM python:3.10-slim
RUN apt-get update && apt-get install -y \
gcc \
libpython3-dev \
chromium \
&& rm -rf /var/lib/apt/lists/*
COPY . /app
WORKDIR /app
RUN pip install --no-cache-dir -r requirements.txt
CMD ["python", "-m", "mcp", "run", "lead_server.py"]
Create a config.yaml
file with your settings:
services:
hunter:
api_key: ${HUNTER_API_KEY}
rate_limit: 50/60s
clearbit:
api_key: ${CLEARBIT_API_KEY}
cache_ttl: 86400
scraping:
stealth_mode: true
headless: true
timeout: 30
max_retries: 3
cache:
backend: redis://localhost:6379/0
default_ttl: 3600
mcp dev lead_server.py --reload --port 8080
gunicorn -w 4 -k uvicorn.workers.UvicornWorker lead_server:app
docker build -t lead-server .
docker run -p 8080:8080 -e HUNTER_API_KEY=your_key lead-server
POST /tools/lead_generation
Content-Type: application/json
{
"search_terms": "OpenAI"
}
Response:
{
"lead_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "pending",
"estimated_time": 15
}
POST /tools/data_enrichment
Content-Type: application/json
{
"lead_id": "550e8400-e29b-41d4-a716-446655440000"
}
GET /tools/lead_maintenance
from mcp.client import Client
async with Client() as client:
# Generate lead
lead = await client.call_tool(
"lead_generation",
{"search_terms": "Anthropic"}
)
# Enrich with all services
enriched = await client.call_tool(
"data_enrichment",
{"lead_id": lead['lead_id']}
)
# Get full lead data
status = await client.call_tool(
"lead_status",
{"lead_id": lead['lead_id']}
)
# Generate lead
curl -X POST http://localhost:8080/tools/lead_generation \
-H "Content-Type: application/json" \
-d '{"search_terms": "Cohere AI"}'
from aiocache import Cache
# Configure Redis cluster
Cache.from_url(
"redis://cluster-node1:6379/0",
timeout=10,
retry=True,
retry_timeout=2
)
from mcp.server.middleware import RateLimiter
mcp.add_middleware(
RateLimiter(
rules={
"lead_generation": "100/1m",
"data_enrichment": "50/1m"
}
)
)
Error | Solution |
---|---|
403 Forbidden from Google |
Rotate IPs or use official CSE API |
429 Too Many Requests |
Implement exponential backoff |
Playwright Timeout |
Increase scraping.timeout in config |
Cache Miss |
Verify Redis connection and TTL settings |
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "inbound-lead-generation" '{"command":"python","args":["-m","mcp","run","lead_server.py"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"inbound-lead-generation": {
"command": "python",
"args": [
"-m",
"mcp",
"run",
"lead_server.py"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"inbound-lead-generation": {
"command": "python",
"args": [
"-m",
"mcp",
"run",
"lead_server.py"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect