My Actor 6
Under maintenancePricing
Pay per usage
My Actor 6
Under maintenancePricing
Pay per usage
Rating
0.0
(0)
Developer
AutomateLab
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
5 days ago
Last modified
Categories
Share
B2B Lead Gen Suite MCP
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 directorycd ~/Projects/apify-actors/b2b-lead-gen-suite-mcp# Install dependenciesnpm install
2. Local Development
# Run locally with Apify SDKapify run# Or set input via environmentAPIFY_INPUT_DEFAULT={"operation":"generateLeads","queries":["Software Engineer at Google"],"maxResults":5} npx apify run
3. Push to Apify
$apify push
๐ Input Schema
Core Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
operation | string | Operation to perform: scrapeCompanies, scrapeContacts, generateLeads, exportCSV | generateLeads |
sources | array | Sources to scrape: linkedin, company_websites, business_directories, all | ["linkedin"] |
queries | array | Search terms for lead generation | ["Tech companies in San Francisco"] |
maxResults | integer | Maximum results per operation (1-1000) | 10 |
companyDomains | array | List of company domains (e.g., ["google.com", "microsoft.com"]) | [] |
linkedInUrls | array | LinkedIn profile URLs for contact scraping | [] |
exportFormat | string | Export format: csv, json, xlsx | csv |
includeHeaders | boolean | Include column headers in CSV export | true |
proxyType | string | Proxy type: DATACENTER, RESIDENTIAL | DATACENTER |
debugMode | boolean | Enable minimal extraction for testing (300s max) | false |
checkOnly | boolean | 5-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:
| Event | FREE Tier | BRONZE | SILVER | GOLD |
|---|---|---|---|---|
| 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
| Type | Use Case | Cost |
|---|---|---|
DATACENTER | General web scraping, faster | Lower |
RESIDENTIAL | High-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
| Error | Cause | Solution |
|---|---|---|
EXTRACTION_ERROR | Profile blocked/private | Use RESIDENTIAL proxy |
RATE_LIMIT_ERROR | Too many requests | Reduce concurrency, wait |
NETWORK_ERROR | Connectivity issue | Check connection, retry |
CAPTCHA_BLOCKED | Google/LinkedIn CAPTCHA | Use RESIDENTIAL proxies |
AUTH_WALL | LinkedIn login required | Use Google SERP fallback |
๐ Legal & Compliance
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