My Actor 6 avatar

My Actor 6

Under maintenance

Pricing

Pay per usage

Go to Apify Store
My Actor 6

My Actor 6

Under maintenance

Pricing

Pay per usage

Rating

0.0

(0)

Developer

AutomateLab

AutomateLab

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

5 days ago

Last modified

Share

B2B Lead Gen Suite MCP

Apify Actor License: MIT Node

Comprehensive B2B lead generation suite for scraping company info, contacts, and generating qualified leads from LinkedIn, company websites, and business directories.

๐ŸŽฏ Overview

B2B Lead Gen Suite MCP is an AI-agent-optimized actor that provides enterprise-grade lead generation capabilities with Pay-Per-Event (PPE) pricing. It implements handleRunFunction with four core operations: scrapeCompanies, scrapeContacts, generateLeads, and exportCSV.

Key Features

  • Multi-Source Scraping: LinkedIn, company websites, business directories
  • PPE (Pay-Per-Event) Pricing: Only pay for successful extractions
  • handleRunFunction API: Simple operation dispatcher for AI agents
  • ERROR_RETRY Handling: Exponential backoff with 3 retry attempts
  • Agent Handshake: <5 second smoke test with FREE compute
  • CSV/JSON Export: Flexible export formats for CRM integration

โšก Quick Start

1. Installation

# Navigate to project directory
cd ~/Projects/apify-actors/b2b-lead-gen-suite-mcp
# Install dependencies
npm install

2. Local Development

# Run locally with Apify SDK
apify run
# Or set input via environment
APIFY_INPUT_DEFAULT={"operation":"generateLeads","queries":["Software Engineer at Google"],"maxResults":5} npx apify run

3. Push to Apify

$apify push

๐Ÿ“‹ Input Schema

Core Parameters

ParameterTypeDescriptionDefault
operationstringOperation to perform: scrapeCompanies, scrapeContacts, generateLeads, exportCSVgenerateLeads
sourcesarraySources to scrape: linkedin, company_websites, business_directories, all["linkedin"]
queriesarraySearch terms for lead generation["Tech companies in San Francisco"]
maxResultsintegerMaximum results per operation (1-1000)10
companyDomainsarrayList of company domains (e.g., ["google.com", "microsoft.com"])[]
linkedInUrlsarrayLinkedIn profile URLs for contact scraping[]
exportFormatstringExport format: csv, json, xlsxcsv
includeHeadersbooleanInclude column headers in CSV exporttrue
proxyTypestringProxy type: DATACENTER, RESIDENTIALDATACENTER
debugModebooleanEnable minimal extraction for testing (300s max)false
checkOnlyboolean5-second handshake test (FREE compute)false

Example Input

{
"operation": "generateLeads",
"sources": ["linkedin", "company_websites"],
"queries": ["Software Engineer at Google", "Product Manager at Microsoft"],
"maxResults": 20,
"companyDomains": ["google.com", "microsoft.com"],
"exportFormat": "csv",
"includeHeaders": true,
"proxyType": "RESIDENTIAL",
"debugMode": false,
"checkOnly": false
}

๐Ÿ”ง handleRunFunction API

The handleRunFunction provides a simple dispatcher for all operations:

Operations

1. scrapeCompanies

Extract company information from multiple sources.

{
"operation": "scrapeCompanies",
"sources": ["linkedin", "company_websites", "business_directories"],
"companyDomains": ["google.com", "apple.com"],
"maxResults": 50
}

Returns: Array of company objects with id, name, domain, industry, size, location, linkedinUrl, source, scrapedAt.

2. scrapeContacts

Extract contact information from LinkedIn profiles.

{
"operation": "scrapeContacts",
"linkedInUrls": [
"https://www.linkedin.com/in/johndoe",
"https://www.linkedin.com/in/janesmith"
],
"maxResults": 25
}

Returns: Array of contact objects with id, fullName, jobTitle, company, email, phone, linkedinUrl, location, source, scrapedAt.

3. generateLeads

Generate qualified B2B leads from multiple sources.

{
"operation": "generateLeads",
"sources": ["linkedin", "company_websites"],
"queries": ["Software Engineer at Google", "Data Scientist at Meta"],
"maxResults": 100,
"companyDomains": ["google.com", "meta.com"]
}

Returns: Array of lead objects with id, fullName, jobTitle, company, email, linkedinUrl, source, quality, generatedAt.

4. exportCSV

Export results to CSV or JSON format.

{
"operation": "exportCSV",
"results": [], // Uses generateLeads if empty
"exportFormat": "csv",
"includeHeaders": true,
"queries": ["Tech companies"],
"maxResults": 50
}

Returns: Export file with filename, format, recordCount, exportedAt.

๐Ÿ’ฐ PPE Pricing

This actor uses Pay-Per-Event (PPE) pricing model. You only pay for successful extractions:

EventFREE TierBRONZESILVERGOLD
Actor Start$0.00005$0.00005$0.00005$0.00005
Company Scraped$0.05$0.035$0.02$0.01
Contact Scraped$0.08$0.055$0.03$0.015
Lead Generated$0.10$0.075$0.04$0.02
CSV Exported$0.02$0.02$0.02$0.02

Zero-Result Guard

PPE charging only occurs when actual data is extracted. If no results are found, no charges are applied.

๐Ÿ”„ ERROR_RETRY Handling

The actor implements robust error handling with exponential backoff:

async function withRetry(fn, maxRetries = 3, baseDelayMs = 1000) {
for (let attempt = 1; attempt <= maxRetries; attempt++) {
try {
return await fn();
} catch (error) {
if (attempt < maxRetries) {
const delay = baseDelayMs * Math.pow(2, attempt - 1);
await sleep(delay);
}
}
}
throw lastError;
}

Retry Conditions

  • Network timeouts
  • Rate limiting (429 responses)
  • Temporary server errors (5xx)
  • CAPTCHA detection with fallback

๐Ÿค– AI Agent Integration

5-Second Handshake

For AI agent smoke tests, use checkOnly: true:

{
"checkOnly": true,
"maxResults": 10
}

Returns readiness status in <5 seconds with FREE compute.

handleRunFunction Example

const result = await handleRunFunction({
operation: 'generateLeads',
sources: ['linkedin'],
queries: ['Software Engineer at Google'],
maxResults: 50,
proxyType: 'RESIDENTIAL'
});

๐Ÿ“Š Output Schema

All operations return:

{
"success": true,
"operation": "generateLeads",
"results": [...],
"resultsCount": 50,
"exportedFile": "",
"charges": [],
"scrapedAt": "2026-05-19T21:00:00.000Z",
"durationMs": 2500
}

Result Objects

Company:

{
"id": "lead_123456_abc123",
"name": "Google",
"domain": "google.com",
"linkedinUrl": "https://linkedin.com/company/google",
"industry": "Technology",
"size": "10000+",
"location": "Mountain View, CA",
"source": "linkedin",
"scrapedAt": "2026-05-19T21:00:00.000Z"
}

Contact:

{
"id": "lead_123456_def456",
"fullName": "John Doe",
"jobTitle": "Software Engineer",
"company": "Google",
"email": "john.doe@example.com",
"phone": "+1-555-0100",
"linkedinUrl": "https://linkedin.com/in/johndoe",
"location": "San Francisco, CA",
"source": "linkedin",
"scrapedAt": "2026-05-19T21:00:00.000Z"
}

Lead:

{
"id": "lead_123456_ghi789",
"fullName": "Jane Smith",
"jobTitle": "Product Manager",
"company": "Microsoft",
"email": "jane.smith@example.com",
"linkedinUrl": "https://linkedin.com/in/janesmith",
"source": "google_serp_linkedin",
"quality": "high",
"generatedAt": "2026-05-19T21:00:00.000Z"
}

๐Ÿš€ Usage Examples

Basic Lead Generation

apify run -c '{
"operation": "generateLeads",
"queries": ["Software Engineer at Google"],
"maxResults": 10
}'

Scrape Multiple Companies

{
"operation": "scrapeCompanies",
"sources": ["linkedin", "company_websites"],
"companyDomains": ["google.com", "microsoft.com", "apple.com"],
"maxResults": 50,
"proxyType": "RESIDENTIAL"
}

Contact Discovery

{
"operation": "scrapeContacts",
"linkedInUrls": [
"https://www.linkedin.com/in/johndoe",
"https://www.linkedin.com/in/janesmith",
"https://www.linkedin.com/in/bobwilson"
],
"maxResults": 25
}

Export to CSV

{
"operation": "exportCSV",
"results": [], // Uses generateLeads if empty
"exportFormat": "csv",
"includeHeaders": true,
"queries": ["Tech companies in San Francisco"],
"maxResults": 100
}

๐Ÿ› ๏ธ Configuration

Proxy Configuration

TypeUse CaseCost
DATACENTERGeneral web scraping, fasterLower
RESIDENTIALHigh-security targets (LinkedIn)Higher

Debug Mode

Enable debugMode: true for:

  • Minimal extraction (max 2 results)
  • Faster proxy (DATACENTER)
  • 300-second timeout compliance
  • Health check verification

๐Ÿ“ Error Handling

ErrorCauseSolution
EXTRACTION_ERRORProfile blocked/privateUse RESIDENTIAL proxy
RATE_LIMIT_ERRORToo many requestsReduce concurrency, wait
NETWORK_ERRORConnectivity issueCheck connection, retry
CAPTCHA_BLOCKEDGoogle/LinkedIn CAPTCHAUse RESIDENTIAL proxies
AUTH_WALLLinkedIn login requiredUse Google SERP fallback

Data Source: LinkedIn, company websites, business directories

Terms of Service: This actor is for legitimate data collection only. Users must comply with target platform ToS and applicable laws.

Privacy: All extracted data is processed per applicable privacy laws. Do not use for unauthorized collection.

Attribution: Comply with data source attribution requirements.

๐Ÿ“„ License

MIT License - see LICENSE file for details.


Built with ๐Ÿ› ๏ธ by seed โ€ข Apify Actor