Fetching latest headlines…

Dev

How I Built a Safe, Anti-Ban LinkedIn MCP Server for AI Agents (Claude & Cursor)

Dev.toUnited States · NORTH AMERICA

How I Built a Safe, Anti-Ban LinkedIn MCP Server for AI Agents When developers want an AI assistant like Claude, Cursor, or Antigravity to help them with real-world professional tasks on LinkedIn, t...

1 views0 likes0 comments

How I Built a Safe, Anti-Ban LinkedIn MCP Server for AI Agents

When developers want an AI assistant like Claude, Cursor, or Antigravity to help them with real-world professional tasks on LinkedIn, they hit a hard wall: there is no official LinkedIn Model Context Protocol (MCP) server.

Because of that, community alternatives usually fall into two categories:

  1. Official OAuth API tools: Extremely restricted. You can publish plain text posts, but you cannot search jobs, read user profiles, or send messages.
  2. Raw Scraper tools: High capability, but dangerous. They require you to manually copy-paste sensitive session cookies (li_at) into configuration files, and they fire requests in millisecond bursts, triggering LinkedIn's security filters and account restrictions.

I built LinkedIn Guardrail MCP to solve both problems: high capability paired with strict account safety.

🛡️ The Architecture: Safety & Security First

Connecting an autonomous agent to a platform with strict anti-bot detection requires an architecture that mirrors real human behavior:

1. Zero Credential Leaks (No Cookie Pasting)

Instead of extracting and injecting secret session cookies, the server launches an interactive Chromium window once. You log in naturally using your credentials and 2-Factor Authentication (2FA). The browser profile persists on your machine locally. Zero passwords or session tokens are stored in the codebase or logged.

2. Stealth Bot Evasion

By integrating playwright-extra with puppeteer-extra-plugin-stealth, the browser driver removes automated flags (navigator.webdriver = false, normalized WebGL/Canvas footprints, and realistic viewport scaling).

3. Human Pacing & Random Jitter

Outbound actions (direct messaging, invitations) never execute in rapid bursts. Outbound requests are throttled with randomized human delays (30s to 90s) and simulate natural reading behavior.

4. Hard Daily Safety Quotas

The engine tracks daily interaction volume and automatically caps activity:

  • Maximum 50 profile views / day
  • Maximum 15 connection requests / day
  • Maximum 15 direct messages / day
  • Maximum 3 posts / day

⚡ What Features Does It Provide?

The server registers 6 core tools compliant with the Model Context Protocol:

  • linkedin_get_safety_status: Inspect daily quotas, health status, and active queues.
  • linkedin_search_jobs: Query LinkedIn job openings with keywords, location, and date filters.
  • linkedin_get_profile: Safely inspect public profile headlines, experience, and summaries.
  • linkedin_schedule_post: Draft and publish feed updates.
  • linkedin_send_message: Automatically resolve a contact by name and deliver a direct message.
  • linkedin_queue_connection_invite: Queue connection invites with personalized notes.

🔌 Universal AI Compatibility

Because it uses standard MCP JSON-RPC over stdio, you can plug it into any MCP client:

Claude Desktop Configuration

Add to %APPDATA%\Claude\claude_desktop_config.json:

{
  "mcpServers": {
    "linkedin": {
      "command": "node",
      "args": ["B:\\AI_Projects\\linkedin-mcp-agent\\dist\\index.js"]
    }
  }
}

Cursor Configuration

Under Settings → Features → MCP Servers → Add New MCP Server:

  • Name: linkedin
  • Type: command
  • Command: node B:\AI_Projects\linkedin-mcp-agent\dist\index.js

🔗 Open Source Repository

The entire codebase is open source under the MIT license:
👉 github.com/rahulagarwal18/Linkedin_MCP

Comments (0)

Sign in to join the discussion

Be the first to comment!