Skip to main content
Glama
selvin-paul-raj

LinkedIn MCP Server

README.md

# LinkedIn MCP Server

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
[![LinkedIn API](https://img.shields.io/badge/LinkedIn-API%20v202510-blue)](https://learn.microsoft.com/en-us/linkedin/)

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

---

## ๐Ÿ“˜ Table of Contents
- [Overview](#overview)
- [Features](#features)
- [Quickstart](#quickstart)
- [Authentication](#authentication)
- [Usage](#usage)
- [Claude Desktop Integration](#claude-desktop-integration)
- [Available Tools](#available-tools)
- [Project Structure](#project-structure)
- [Testing](#testing)
- [Troubleshooting](#troubleshooting)
- [API Versioning](#api-versioning)
- [Contributing](#contributing)
- [License](#license)
- [Disclaimer](#disclaimer)
- [Changelog](#changelog)

---

# 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](https://github.com/selvin-paul-raj/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

```bash
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

```bash
# 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](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:

```bash
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

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

### Create a post

```json
{
  "tool": "create_linkedin_post",
  "input": {
    "text": "Excited to announce our new product launch! ๐Ÿš€",
    "visibility": "PUBLIC"
  }
}
```

### Upload image

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

---

# Claude Desktop Integration

Add this to `claude_desktop_config.json`:

```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

```bash
# 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:

```bash
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

```bash
pip install --upgrade selenium webdriver-manager
```

---

# API Versioning

Current default:

```
202510
```

Check latest:
[https://learn.microsoft.com/en-us/linkedin/marketing/versioning](https://learn.microsoft.com/en-us/linkedin/marketing/versioning)

Update:

```
LINKEDIN_API_VERSION=202511
```

Restart the server.

---

# Contributing

```bash
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**

TDQS

A3.8/5.0

Scored across 6 tools

Disambiguation5/5

Each tool has a clear, distinct purpose: session management, company profiles, person profiles, job details, recommended jobs, and job search. No two tools overlap in functionality.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in snake_case (e.g., get_company_profile, search_jobs), making them predictable and easy to understand.

Tool Count5/5

With 6 tools, the set is well-scoped for a LinkedIn-focused server covering profiles and jobs without being overwhelming or sparse.

Completeness3/5

The tool surface covers basic read operations (profiles, jobs) but lacks common interaction capabilities like sending messages, posting updates, or managing connections, leaving notable gaps.

Maintenance

ActivityInactive
ResponsivenessNo issues