LinkedIn Lead Automation MCP Server

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.

Category
Visit Server

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

  1. Create a Neon PostgreSQL database (or use any PostgreSQL 14+)
  2. 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 CDP
  • setup_session: Authenticate LinkedIn session
  • search_leads: Search for LinkedIn leads
  • analyze_profile: Extract profile data
  • score_lead: AI-powered lead scoring
  • generate_message: Generate personalized messages
  • send_message: Send messages to profiles
  • create_followup_sequence: Create automated sequences
  • generate_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

  1. Connect Repository to Vercel:

    # Install Vercel CLI
    npm i -g vercel
    
    # Login and deploy
    vercel login
    vercel --prod
    
  2. Set Environment Variables in Vercel Dashboard:

    • DATABASE_URL: Your Neon PostgreSQL connection string
    • GCP_PROJECT_ID: Your Google Cloud project ID
    • GCP_LOCATION: Location (default: global)
    • ANTHROPIC_MODEL_ID: Model ID (default: claude-sonnet-4-5)
  3. 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_CREDENTIALS env var
    • Update src/ai.js to use service account auth

    Option B: Use API Key (Alternative)

    • Generate a Vertex AI API key
    • Set as VERTEX_AI_API_KEY environment variable

Deploy with PM2 (Self-Hosted)

  1. Set up PostgreSQL database (recommended: Neon)
  2. Configure environment variables
  3. Run database schema
  4. 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 .env files - 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.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured