📌 1.导言
🤖 代理销售机器人:MCP驱动的潜在客户生成和外展系统
为满足客户需求而构建的全栈自主销售渠道 MCP驱动的潜在客户+外展 带回家的作业。它使用 模型上下文协议(MCP) 为了暴露工具, n8n 作为代理编排者,以及 溪流 用于实时监控。
______________________________________________________________________
📋 任务合规性矩阵
| 需求 | 实施细节 | 状态 |
|---|---|---|
1.潜在客户 python Faker 图书馆生成具有现实角色/行业的有效线索。通过种子繁殖。 | ✅ 完成 | |
| 2.丰富 | 混合动力系统: 脱机模式 (规则)& AI模式 (Groq Llama-3)用于疼痛点和信心评分。 | ✅ 完成 |
| 3.个性化 | 生成引用丰富数据的独特冷电子邮件和LinkedIn DM(A/B变体)。 | ✅ 完成 |
| 4.发送 | 支持 试运行 (模拟)和 现场跑步 (模拟SMTP服务器)具有速率限制。 | ✅ 完成 |
| 5.前端 | 溪流 显示漏斗指标、日志和队列状态的仪表板。 | ✅ 完成 |
| 6.编排 | n8n 工作流通过API调用MCP工具来协调整个管道。 | ✅ 完成 |
| 7.MCP | 快速API 服务器暴露 generate_leads, enrich_leads等,作为标准工具。 | ✅ 完成 |
______________________________________________________________________
🏗️ 系统架构
系统遵循要求 微型工具架构 其中n8n充当“大脑”(代理),Python充当“手”(工具)。
graph TD
User["User / Dashboard"] -->|Trigger| n8n["n8n Orchestrator (Agent)"]
n8n -->|HTTP Request| API["MCP Server (FastAPI)"]
subgraph "MCP Tools (Python)"
API -->|Tool| Gen[Lead Generator]
API -->|Tool| Enrich["Lead Enricher (Groq/Rules)"]
API -->|Tool| Draft[Message Drafter]
API -->|Tool| Send[Outreach Sender]
end
Gen --> DB[("SQLite Database")]
Enrich --> DB
Draft --> DB
Send --> DB
DB --> User______________________________________________________________________
📁 2.项目结构
该项目遵循 清洁微服务架构,分离后端服务、代理工具、自动化工作流和配置。
MCP-Powered Lead Gen+Enrichment+Outreach System/
│
├── app/ # Main Application Source Code
│ ├── api.py # MCP Server (FastAPI) - The entry point
│ ├── dashboard.py # Streamlit Frontend - The monitoring UI
│ ├── database.py # SQLite Connection Manager
│ ├── generate_leads.py # Tool: Generates dummy leads (Faker)
│ ├── enrich_leads.py # Tool: Enriches leads (Groq LLM / Rules)
│ ├── generate_messages.py # Tool: Drafts emails (LLM)
│ ├── send_messages.py # Tool: Sends emails (SMTP)
│ └── mock_server.py # SMTP Simulator for local testing
│
├── n8n/
│ └── pipeline_workflow.json # n8n Workflow Export File
│
├── requirements.txt # Python Dependencies
├── .env.example # Configuration Example
└── README.md # Project Documentation______________________________________________________________________
🧰 3.技术栈和免费资源
根据分配约束, 零付费工具 被使用。
| 组件 | 使用的工具 | 为什么选择此选项? |
|---|---|---|
| 语言 | Python 3.10+ | 人工智能/数据工程标准 |
| 后端 | FastAPI | 高性能,易于创建REST API。 |
| 前端 | Streamlit | 数据监控仪表板的快速开发。 |
| 数据库 | SQLite | 轻量级、无服务器、基于文件(零配置)。 |
| AI / LLM | 免费等级Llama-3模型的超快速推理速度。 | |
| 编排 | n8n(Docker) | 可视化工作流自动化(自托管/免费)。 |
| 测试 | 传真和模拟SMTP | 在本地安全生成数据和测试电子邮件。 |
______________________________________________________________________
⚙️ 4.安装与设置
先决条件
- 已安装Python 3.8+
- 已安装Docker桌面(适用于n8n)
步骤1:克隆存储库
git clone https://github.com/ARISTOTILE-GIT/MCP-Powered-Lead-Gen-Enrichment-Outreach-System-.git
cd MCP-Powered-Lead-Gen-Enrichment-Outreach-System-步骤2:安装依赖项
pip install -r requirements.txt步骤3:设置环境
在根目录中创建.env文件并添加Groq API密钥:
GROQ_API_KEY=gsk_your_actual_api_key_here______________________________________________________________________
▶️ 5.如何运行系统
*要查看整个管道的运行情况,您需要 3个终端窗口 同时运行。*
终端1:模拟SMTP服务器
在本地捕获电子邮件以确保安全测试(干式/实时模式)。
python app/mock_server.py终端2:后端MCP服务器
露出工具(generate, enrich, send)通过HTTP端点。
python app/api.py*服务器启动时间 http://localhost:8000*
终端3:前端仪表板
监控管道进度和日志。
streamlit run app/dashboard.py*仪表板在以下位置打开 http://localhost:8501*
______________________________________________________________________
🔄 6.编排:n8n工作流
编排逻辑由以下人员处理 n8n,履行 “代理人” 要求。
1.启动n8n(Docker)
docker run -it --rm --name n8n -p 5678:5678 --add-host=host.docker.internal:host-gateway n8nio/n8n:latest2.导入工作流:
- 打开
http://localhost:5678.
- *点击 “添加工作流” -> “从文件导入”.*
- 选择
n8n/sales_pipeline_workflow.json(包含在此回购中)。
3.执行:
- 点击“执行工作流”以触发代理循环。
______________________________________________________________________
📘 7.使用指南(模式)
仪表板允许您控制 “情报” 和 “安全” 通过交互式开关切换管道。
🎛️ 发送模式:模拟运行vs实时运行
🔹 试运行(仅测试)
- 模拟发送过程
- 将生成的内容记录到数据库/仪表板
- 不 与SMTP服务器交互
- 状态更新到:
SENT_DRY_RUN
🔹 实时运行(发送电子邮件)
- 实际连接到模拟SMTP服务器
- 在本地发送真实电子邮件
- 状态更新到:
SENT
______________________________________________________________________
🧠 丰富模式:人工智能vs离线
🔹 离线(规则-快速)
- 使用基于以下内容的启发式规则 行业/角色
- 指定标准痛点
- 速度极快
- 非常适合大批量测试
🔹 AI代理(希腊LLM)
- 呼叫 Groq API(Llama-3型)
- 深入分析主角角色
- 生成高度个性化的痛点和购买触发因素
- 输出速度较慢,但质量明显较高
______________________________________________________________________
📝 消息生成:人工智能与模板
🔹 人工智能一代
- 在以下情况下使用 AI Agent富集 已启用
- 使用AI生成的痛点起草独特的电子邮件
- 由...驱动 Llama-3
🔹 模板回退
- 在以下情况下使用 线下丰富 被选中
- 使用结构化模板
- 确保消息一致性,无需LLM调用
______________________________________________________________________
🌟 8.已实施的奖励功能
除了核心要求外,以下内容 “很高兴有” 添加了以下功能:
💾 CSV导出
- 下载所有生成的潜在客户
- 直接从仪表板导出消息日志
- 可用于外部分析和报告
______________________________________________________________________
🧹 日志管理
- 直接从UI中清除数据库
- 擦除应用程序日志文件
- 无需重新启动后端或仪表板服务器
______________________________________________________________________
📉 漏斗分析
- 视觉转换漏斗图
- 跟踪管道流量:
- New → Enriched → Messaged → Sent
- 帮助识别下降和瓶颈
______________________________________________________________________
📜 实时日志
- 仪表板中嵌入的实时日志查看器
- 观察AI生成的内容
- 有助于调试和透明度
______________________________________________________________________
📈 9.输出和工件
1.仪表板监控
*Streamlit仪表板提供了管道健康状况的全面视图。*
2.潜在客户数据示例(JSON)
{
"id": "lead_550e8400-e29b-41d4-a716-446655440000",
"created_at": "2023-10-27T10:00:00Z",
"status": "SENT",
"basic_info": {
"full_name": "Sarah Connor",
"role": "Chief Technology Officer",
"company_name": "SkyNet Systems",
"industry": "Technology",
"email": "sarah.connor@skynetsystems.com",
"linkedin_url": "https://www.linkedin.com/in/sarah-connor-tech",
"website": "https://www.skynetsystems.com",
"country": "United States"
},
"enrichment_data": {
"company_size": "Enterprise (1000+ employees)",
"persona_tag": "Technical Decision Maker",
"confidence_score": 92,
"pain_points": [
"Struggling with high cloud infrastructure costs and AWS bill shock.",
"Technical debt slowing down new feature release cycles.",
"Difficulty hiring and retaining senior DevOps engineers."
],
"buying_triggers": [
"Recently raised Series C funding.",
"Posted 5 new job openings for 'Cloud Architect' last week."
]
},
"generated_outreach": {
"email_subject": "Scaling SkyNet's tech without the cloud cost bloat",
"email_body": "Hi Sarah,\n\nI noticed SkyNet Systems is scaling rapidly after your recent Series C. Congrats! As a CTO, balancing speed with spiraling cloud costs is often the biggest headache.\n\nOur AI-driven infrastructure tool helps engineering leaders like you slash AWS bills by 20% while automating technical debt reduction. \n\nWorth a 15-minute chat to see how we can optimize your roadmap?",
"linkedin_dm": "Hi Sarah, saw SkyNet's growth. Impressive! If cloud costs or tech debt are slowing down your new releases, our AI tool helps CTOs reclaim engineering time. Open to a quick chat?",
"sent_at": "2023-10-27T10:05:30Z"
}
}3.生成的电子邮件示例
Subject: Scaling Tech Debt at SkyNet Systems?
Hi Sarah,
I noticed SkyNet is scaling rapidly. As a CTO, dealing with cloud costs and technical debt usually becomes a bottleneck.
Our automated optimization tool helps engineering leaders reclaim 20% of their roadmap...______________________________________________________________________
🪪 10.许可证
该项目是为代理人工智能实习技术评估而创建的。
