mcp-leadgen-orchestrator

mcp-leadgen-orchestrator

Enables automated lead generation, AI enrichment, personalized messaging, and outreach orchestration through MCP tools and n8n workflows.

Category
访问服务器

README

MCP-Powered Lead Gen + Enrichment + Outreach System

A full-stack lead generation and outreach automation system built with Model Context Protocol (MCP), n8n orchestration, Groq AI, and a real-time monitoring dashboard.

🎯 Features

  • Lead Generation: Generate 200+ realistic leads with valid contact information
  • AI Enrichment: Enrich leads with company insights, personas, and pain points using Groq LLM
  • Message Personalization: Create personalized emails and LinkedIn DMs with A/B variations
  • Smart Outreach: Send messages with retry logic, rate limiting, and error handling
  • Real-time Monitoring: Track pipeline progress with a modern React dashboard
  • MCP Integration: Orchestrate workflow through Model Context Protocol
  • n8n Workflow: Visual workflow automation and orchestration

🏗️ Architecture

┌─────────────┐      ┌──────────────┐      ┌─────────────┐
│   n8n       │─────▶│  MCP Server  │─────▶│   Backend   │
│  Workflow   │      │   (Tools)    │      │  Services   │
└─────────────┘      └──────────────┘      └─────────────┘
                            │                      │
                            │                      ▼
                            │               ┌─────────────┐
                            │               │   SQLite    │
                            │               │   Database  │
                            │               └─────────────┘
                            ▼
                     ┌──────────────┐
                     │   Frontend   │
                     │  Dashboard   │
                     └──────────────┘

📋 Prerequisites

  • Python 3.10+
  • Node.js 18+
  • n8n (remote self-hosted instance)
  • Groq API key (free tier available at https://console.groq.com)
  • ngrok account (free tier available at https://ngrok.com)

🚀 Quick Start

1. Clone and Setup

cd e:\intern-assigment\linkind-mcp

2. Configure Environment

# Copy example environment file
cp .env.example .env

# Edit .env and add your Groq API key
# GROQ_API_KEY=your_key_here

3. Install Python Dependencies

# Create virtual environment
python -m venv venv

# Activate virtual environment
# Windows:
venv\Scripts\activate
# Linux/Mac:
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

4. Install Frontend Dependencies

npm install

5. Initialize Database

python backend/database.py

6. Start the Services

Terminal 1 - MCP Server:

python mcp_server/server.py

Terminal 2 - API Backend:

python backend/api.py

Terminal 3 - Frontend:

npm run dev

7. Access the Applications

  • Frontend Dashboard: http://localhost:3000
  • API Backend: http://localhost:8000
  • API Docs: http://localhost:8000/docs
  • n8n Editor: Your remote n8n instance URL

8. Setup ngrok Tunnel

To connect your local API with the remote n8n instance:

# In a new terminal, start ngrok
ngrok http 8000

Copy the ngrok URL (e.g., https://abc123.ngrok-free.app) and update your n8n workflow nodes to use this URL.

📁 Project Structure

linkind-mcp/
├── backend/              # Python backend services
│   ├── api.py           # FastAPI application
│   ├── database.py      # SQLite database setup
│   ├── lead_generator.py # Lead generation logic
│   ├── enrichment.py    # Lead enrichment service
│   ├── messaging.py     # Message generation
│   └── outreach.py      # Message sending
├── mcp_server/          # MCP server implementation
│   ├── server.py        # MCP server main
│   └── tools.py         # MCP tool definitions
├── frontend/            # Next.js React frontend
│   ├── pages/          # Next.js pages
│   ├── components/     # React components
│   └── styles/         # CSS styles
├── data/               # SQLite database storage
├── .env.example        # Environment template
└── README.md           # This file

🔧 Configuration

Dry Run vs Live Run

Toggle between modes in the frontend or set in .env:

DRY_RUN_MODE=true   # Logs messages without sending
DRY_RUN_MODE=false  # Actually sends messages

Rate Limiting

Configure in .env:

RATE_LIMIT_PER_MINUTE=10  # Max messages per minute
MAX_RETRIES=2             # Retry attempts for failed sends

Email Configuration

For live email sending, configure SMTP:

SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USERNAME=your_email@gmail.com
SMTP_PASSWORD=your_app_password  # Use Gmail App Password

🎮 Usage

How the System Works

The system now operates through automated triggers from external sources:

  1. Lead Capture:

    • Google Sheets: Add a new row with lead information
    • Facebook Lead Ads: User submits an instant form
  2. Automatic Processing:

    • n8n detects the new lead from trigger
    • Processes and normalizes the lead data
    • Sends to your local API via ngrok
    • API enriches the lead with AI insights
    • Generates personalized messages
    • Sends outreach (email/LinkedIn)
  3. Monitor Progress:

    • Open frontend dashboard at http://localhost:3000
    • View real-time metrics and lead status
    • Check enrichment data and generated messages

Pipeline Stages

  1. Process Lead → Receives and validates external lead data
  2. Enrich Lead → Adds AI-generated company insights and personas
  3. Generate Messages → Creates personalized email + LinkedIn DM
  4. Send Outreach → Delivers messages (or logs in dry-run mode)

Testing with Sample Data

Add a test lead to your Google Sheet with:

  • Name: John Smith
  • Email: john.smith@company.com
  • Phone: +1-555-0123
  • Job Title: VP of Sales
  • Company: TechCorp Solutions
  • Comments: Interested in improving team productivity and automation tools

The n8n workflow will automatically detect and process it, generating personalized messages based on the comments provided.

n8n Workflow Setup

  1. Access your n8n instance (remote self-hosted)
  2. Import the workflow: Navigate to n8n and import n8n/n8n-workflow.json
  3. Configure triggers:
    • Google Sheets Trigger: Connect your Google account and select the spreadsheet with lead data
      • Required columns: name, email, phone, job_title, company, comments
    • Facebook Lead Ads Trigger: Connect your Facebook account and select the form
      • Required fields: full_name, email, phone_number, job_title, company_name, comments
  4. Update API endpoints: Replace placeholder URLs in all HTTP Request nodes with your ngrok URL:
    • Run Pipeline: https://YOUR-NGROK-URL.ngrok-free.app/pipeline/run
    • Get Metrics: https://YOUR-NGROK-URL.ngrok-free.app/metrics
    • Get Leads: https://YOUR-NGROK-URL.ngrok-free.app/leads
  5. Activate the workflow

🧪 Testing

Test Lead Processing

python backend/lead_generator.py

Test API Endpoint

curl -X POST http://localhost:8000/pipeline/run \
  -H "Content-Type: application/json" \
  -d '{
    "dry_run": true,
    "enrichment_mode": "offline",
    "lead_count": 200,
    "channel": "both",
    "lead_data": {
      "name": "Jane Doe",
      "email": "jane@example.com",
      "phone": "+1-555-0199",
      "job_title": "CTO",
      "company": "Innovation Labs",
      "comments": "Looking for AI solutions to streamline operations",
      "source": "test"
    }
  }'

📊 Database Schema

Leads are tracked through these statuses:

  • NEW → Lead created
  • ENRICHED → Lead enriched with insights
  • MESSAGED → Messages generated
  • SENT → Outreach sent successfully
  • FAILED → Process failed

🆓 Free Resources Used

  • Groq: Free tier LLM API (100 requests/minute)
  • SQLite: Local database (no limits)
  • n8n: Self-hosted open-source (free)
  • ngrok: Free tier for tunneling (https://ngrok.com)
  • External Lead Sources: Facebook Lead Ads, Google Sheets
  • FastAPI: Python web framework
  • Next.js: React framework <<<<<<< HEAD

🔐 Security Notes

  • Keep your ngrok URL private - it exposes your local API
  • Rotate ngrok URLs regularly (free tier URLs change on restart)
  • Use environment variables for sensitive data
  • Enable authentication on n8n in production
  • Never commit .env files to version control

📝 License

MIT

🤝 Contributing

This is a take-home assignment project. For production use, consider adding:

  • Unit tests
  • WebSocket/SSE for real-time updates
  • Multi-tenant support
  • Export functionality
  • Advanced targeting rules
  • Mailhog (optional): Local SMTP testing server

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选