LinkedIn MCP Server

LinkedIn MCP Server

Fully featured MCP server that provides automation tools for LinkedIn, supporting browser-based scraping and API-based operations for content management, media uploads, and reactions.

Category
访问服务器

README

LinkedIn MCP Server

License: MIT Python 3.12+ LinkedIn API

Complete LinkedIn automation toolkit. Scrape profiles, manage posts, read any LinkedIn content, and automate interactions via MCP (Model Context Protocol).


📘 Table of Contents


Overview

linkedin-mcp is a fully featured MCP server that provides automation tools for LinkedIn.
It supports browser-based scraping and API-based operations for content management, media uploads, and reactions.

Repository: Linkedin MCP Server


Features

🔍 Scraping (Browser-Based)

  • Extract full LinkedIn profiles
  • Scrape company pages
  • Read job listings
  • Read ANY LinkedIn post
  • Extract images, videos, engagement metrics

📝 API-Based Post Management

  • Create, update, delete LinkedIn posts
  • Add or remove reactions
  • Upload images and documents
  • Supports all official LinkedIn REST API features

🧩 MCP Integration

  • Works with Claude Desktop and any MCP-compatible client
  • 17 total tools included

🧪 Testing

  • 50+ tests
  • Covers scraping, API, and MCP tools

Quickstart

Install

git clone https://github.com/selvin-paul-raj/Linkedin-MCP-Server.git
cd Linkedin-MCP-Server

# create environment config
cp .env.example .env

# install dependencies
pip install -e .

Run

# Standard MCP server
uv run linkedin-mcp

# Debug mode (shows browser)
uv run main.py --debug --no-headless --no-lazy-init

# HTTP mode
uv run main.py --transport streamable-http

Authentication

1. Scraping (LinkedIn Cookie)

Get your li_at cookie:

  1. Log in to LinkedIn in Chrome
  2. Press F12
  3. Application → Cookies → https://www.linkedin.com
  4. Copy the li_at cookie value
  5. Add to .env:
LINKEDIN_COOKIE=li_at=YOUR_COOKIE_VALUE

2. API (OAuth Access Token)

Add these fields to .env:

LINKEDIN_CLIENT_ID=your_id
LINKEDIN_CLIENT_SECRET=your_secret
LINKEDIN_ACCESS_TOKEN=your_access_token
LINKEDIN_API_VERSION=202510

Quick OAuth Link

https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&scope=w_member_social%20r_liteprofile%20r_emailaddress

Exchange auth code:

curl -X POST https://www.linkedin.com/oauth/v2/accessToken \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=authorization_code" \
  -d "code=YOUR_CODE" \
  -d "redirect_uri=YOUR_REDIRECT_URI" \
  -d "client_id=YOUR_CLIENT_ID" \
  -d "client_secret=YOUR_CLIENT_SECRET"

Usage

Read any LinkedIn post

{
  "tool": "read_linkedin_post",
  "input": "https://www.linkedin.com/posts/...activity-123456..."
}

Create a post

{
  "tool": "create_linkedin_post",
  "input": {
    "text": "Excited to announce our new product launch! 🚀",
    "visibility": "PUBLIC"
  }
}

Upload image

{
  "tool": "upload_linkedin_image",
  "input": { "image_url": "https://example.com/image.jpg" }
}

Claude Desktop Integration

Add this to claude_desktop_config.json:

{
  "mcpServers": {
    "linkedin": {
      "command": "uv",
      "args": [
        "--directory",
        "D:\\MCP\\linkedin-mcp",
        "run",
        "linkedin-mcp"
      ],
      "env": {
        "LINKEDIN_COOKIE": "li_at=YOUR_COOKIE",
        "LINKEDIN_ACCESS_TOKEN": "YOUR_TOKEN"
      }
    }
  }
}

Available Tools

📖 Content Reading

  • read_linkedin_post

🌐 Scraping

  • get_person_profile
  • get_company_profile
  • get_job_details
  • search_jobs
  • search_recommended_jobs
  • close_session

📝 Post Management

  • create_linkedin_post
  • update_linkedin_post
  • delete_linkedin_post

🖼️ Media

  • upload_linkedin_image
  • get_linkedin_image

💙 Reactions

  • add_linkedin_reaction
  • remove_linkedin_reaction
  • get_linkedin_reactions

👤 Profile & Auth

  • get_linkedin_profile
  • validate_linkedin_credentials

More details. See TOOLS_REFERENCE.md.


Project Structure

linkedin-mcp/
├── linkedin_mcp_server/
│   ├── server.py
│   ├── cli.py
│   ├── config/
│   ├── drivers/
│   └── tools/
├── tests/
│   ├── unit/
│   ├── integration/
├── scripts/
├── .env.example
├── pyproject.toml
├── README.md
└── TOOLS_REFERENCE.md

Testing

# unit tests
uv run pytest tests/unit -v

# integration tests
uv run pytest tests/integration -v

# all tests
uv run pytest tests/ -v

Quick API test:

uv run python scripts/test_api.py

Troubleshooting

❌ "426 Client Error: Upgrade Required"

Fix:

LINKEDIN_API_VERSION=202510

❌ "LINKEDIN_COOKIE required"

Get fresh cookie from Chrome.

❌ "401 Unauthorized"

Generate a new access token.

ChromeDriver issues

pip install --upgrade selenium webdriver-manager

API Versioning

Current default:

202510

Check latest: https://learn.microsoft.com/en-us/linkedin/marketing/versioning

Update:

LINKEDIN_API_VERSION=202511

Restart the server.


Contributing

git clone https://github.com/selvin-paul-raj/Linkedin-MCP-Server.git
cd Linkedin-MCP-Server
uv sync
uv run pytest tests/ -v
uv run ruff format .
uv run pre-commit run --all-files

Pull requests welcome.


License

MIT License. See the LICENSE file.


Disclaimer

This tool is for educational and automation purposes. Follow LinkedIn TOS, API terms, and usage limits. Use responsibly.


Built with ❤️ for LinkedIn automation

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选