LinkedIn Lead Automation MCP Server
Enables automated LinkedIn lead generation and outreach through profile search, AI-powered lead scoring, personalized message generation, and automated follow-up sequences. Includes API key management with tier-based usage limits and PostgreSQL-backed tracking.
README
LinkedIn Lead Automation MCP Server
Production-grade LinkedIn Lead Automation MCP (Model Context Protocol) Server with real-time search, analysis, scoring, messaging, and automated follow-up sequences.
Features
- 🔍 Lead Discovery: Search LinkedIn profiles by keywords, location, and filters
- 📊 Profile Analysis: Extract and analyze complete LinkedIn profile data
- 🎯 AI-Powered Scoring: Intelligent lead scoring (0-100) based on profile data
- 💬 Message Generation: Hyper-personalized message generation using AI
- 📨 Automated Messaging: Send connection requests and direct messages
- 🔄 Follow-up Sequences: Automated multi-stage follow-up campaigns
- 🔐 API Key Management: Secure tier-based access control
- 📈 Usage Tracking: Monitor API usage and enforce tier limits
- 🗄️ PostgreSQL Support: Built with Neon PostgreSQL for production use
Architecture
- MCP Server (
src/index.js): Stdio-based MCP protocol server - HTTP API (
src/http-server.js): RESTful HTTP API wrapper - Background Worker (
src/worker.js): Automated follow-up sequence processor - Database (
src/database-pg.js): PostgreSQL database layer - LinkedIn Automation (
src/linkedin.js): Chrome DevTools Protocol integration - AI Service (
src/ai.js): Anthropic Claude on Vertex AI (Google Cloud) integration for scoring and messaging
Prerequisites
- Node.js 18+
- PostgreSQL (Neon or any PostgreSQL 14+)
- Chrome/Chromium browser with remote debugging enabled
- Google Cloud SDK with gcloud CLI (for Vertex AI authentication)
- GCP Project with Vertex AI API enabled
Installation
# Clone the repository
git clone https://github.com/vikram-agentic/linkedin-mcp.git
cd linkedin-mcp
# Install dependencies
npm install
# Create .env file
cp .env.example .env
Configuration
Create a .env file with the following variables:
# Database (Neon PostgreSQL)
DATABASE_URL=postgresql://user:password@host/database?sslmode=require
# Google Cloud / Vertex AI Configuration
GCP_PROJECT_ID=amgn-app
GCP_LOCATION=global
ANTHROPIC_MODEL_ID=claude-sonnet-4-5
# Server Configuration
PORT=3001
# Chrome DevTools Protocol (optional, for browser automation)
CDP_URL=http://localhost:9222
Database Setup
- Create a Neon PostgreSQL database (or use any PostgreSQL 14+)
- Run the schema in Neon SQL Editor:
# Use schema-neon.sql for Neon PostgreSQL
cat database/schema-neon.sql
Copy and paste the SQL from database/schema-neon.sql into Neon SQL Editor and execute it.
Usage
Start MCP Server (Stdio)
npm start
This starts the MCP server using stdio transport. Connect via MCP clients like Claude Desktop.
Start HTTP API Server
npm run http
This starts the HTTP API server on port 3001 (or PORT from .env).
Start Background Worker
npm run worker
This starts the automated follow-up sequence processor.
API Endpoints
Health Check
GET /health
Generate API Key
POST /api/generate-key
Body: { "tier": "starter" | "professional" | "agency" | "enterprise" }
Connect Browser
POST /api/browser/connect
Body: { "cdp_url": "http://localhost:9222" }
Setup LinkedIn Session
POST /api/session/setup
Body: { "api_key": "...", "li_at_cookie": "..." }
Search Leads
POST /api/leads/search
Body: { "api_key": "...", "keywords": "...", "location": "...", "limit": 25 }
Analyze Profile
POST /api/leads/analyze
Body: { "api_key": "...", "profile_url": "..." }
Score Lead
POST /api/leads/score
Body: { "api_key": "...", "profile_url": "..." }
Generate Message
POST /api/messages/generate
Body: {
"api_key": "...",
"profile_url": "...",
"value_proposition": "...",
"message_type": "connection" | "direct"
}
Send Message
POST /api/messages/send
Body: {
"api_key": "...",
"profile_url": "...",
"message": "...",
"is_connection_request": false
}
Create Follow-up Sequence
POST /api/sequences/create
Body: {
"api_key": "...",
"profile_url": "...",
"initial_message": "...",
"num_followups": 3
}
Get Leads
GET /api/leads?api_key=...
Get Usage Stats
GET /api/usage?api_key=...
MCP Tools
When using as an MCP server, the following tools are available:
connect_browser: Connect to Chrome via CDPsetup_session: Authenticate LinkedIn sessionsearch_leads: Search for LinkedIn leadsanalyze_profile: Extract profile datascore_lead: AI-powered lead scoringgenerate_message: Generate personalized messagessend_message: Send messages to profilescreate_followup_sequence: Create automated sequencesgenerate_api_key: Generate API keys
Tier Limits
| Tier | Profiles | Messages | Sequences |
|---|---|---|---|
| Starter | 500/month | 200/month | 2 active |
| Professional | 2,000/month | 1,000/month | 10 active |
| Agency | 10,000/month | 5,000/month | Unlimited |
| Enterprise | Unlimited | Unlimited | Unlimited |
Development
# Generate a test API key
npm run generate-key
# Run in development mode
npm start
Production Deployment
Deploy to Vercel
-
Connect Repository to Vercel:
# Install Vercel CLI npm i -g vercel # Login and deploy vercel login vercel --prod -
Set Environment Variables in Vercel Dashboard:
DATABASE_URL: Your Neon PostgreSQL connection stringGCP_PROJECT_ID: Your Google Cloud project IDGCP_LOCATION: Location (default:global)ANTHROPIC_MODEL_ID: Model ID (default:claude-sonnet-4-5)
-
For GCP Authentication: Since Vercel doesn't support
gcloud auth, you have two options:Option A: Use Service Account (Recommended)
- Create a GCP Service Account with Vertex AI permissions
- Download the JSON key file
- Convert to base64 and set as
GOOGLE_APPLICATION_CREDENTIALSenv var - Update
src/ai.jsto use service account auth
Option B: Use API Key (Alternative)
- Generate a Vertex AI API key
- Set as
VERTEX_AI_API_KEYenvironment variable
Deploy with PM2 (Self-Hosted)
- Set up PostgreSQL database (recommended: Neon)
- Configure environment variables
- Run database schema
- Deploy using PM2:
pm2 start src/http-server.js --name linkedin-mcp-api
pm2 start src/worker.js --name linkedin-mcp-worker
Security Notes
- ⚠️ Never commit
.envfiles - they contain sensitive credentials - 🔐 API keys are hashed using bcrypt
- 🔒 All database queries use parameterized statements
- 🛡️ CORS is configured for production use
License
MIT License - see LICENSE file for details
Author
Agentic AI AMRO Ltd
Support
For issues and feature requests, please open an issue on GitHub.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。