LinkedIn MCP服务

一个基于Python的服务器,通过MCP(消息控制协议)使用`linkedin-api`和`fastmcp`库提供LinkedIn功能,包括认证、个人信息检索、帖子获取、职位搜索等功能。

  • by Idk507
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 Idk507/linkedin_mcp_server

使用说明

LinkedIn MCP服务器

一个基于Python的服务器,通过MCP(消息控制协议)使用 linkedin-api 和 fastmcp 图书馆。

该项目允许用户:

  • 通过LinkedIn进行身份验证
  • 检索个人资料信息
  • 获取帖子
  • 搜索职位并获取职位详细信息
  • 搜索人员
  • 检索连接

📁 项目结构


linkedin\_mcp/
├── config/
│   └── linkedin\_config.py
├── services/
│   ├── **init**.py
│   ├── linkedin\_client.py
│   ├── profile\_service.py
│   ├── posts\_service.py
│   ├── jobs\_service.py
│   ├── people\_service.py
│   └── connections\_service.py
├── tools/
│   ├── **init**.py
│   ├── auth\_tools.py
│   ├── profile\_tools.py
│   ├── posts\_tools.py
│   ├── jobs\_tools.py
│   ├── people\_tools.py
│   ├── connections\_tools.py
│   └── status\_tools.py
├── main.py
├── requirements.txt
└── README.md

文件夹描述

  • config/:包含配置和日志记录设置。
  • services/:领英的核心功能分为逻辑服务类。
  • tools/:与服务接口的MCP工具定义。
  • main.py:运行服务器或测试模式的入口点。
  • requirements.txt:列出所需的Python包。

🚀 特性

  • 认证:使用电子邮件和密码与LinkedIn进行身份验证。
  • 档案检索:获取特定或经过身份验证的用户的配置文件信息。
  • 岗位检索:从LinkedIn个人资料中获取帖子。
  • 求职:搜索职位发布(可选位置筛选器)。
  • 作业详细信息:检索有关特定作业的详细信息。
  • 人员搜索:使用关键字在LinkedIn上搜索人员。
  • 连接:检索配置文件的连接。
  • 状态检查:检查当前身份验证状态。

📦 安装

  1. 克隆存储库或提取项目文件。
  2. 确保已安装Python 3.6+。
  3. 安装依赖项:
    pip install -r requirements.txt
    

### (Optional) Set up a virtual environment

```bash
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
```

---

## ⚙️ Usage

### Running the Server

```bash
python main.py
```

This starts the MCP server to listen for client connections.

### Test Mode

```bash
python main.py test
```

This will display available tools and sample usage like:

```python
authenticate_linkedin('your_email@example.com', 'your_password')
search_linkedin_jobs('python developer', 'San Francisco')
get_profile_info()
```

---

## 🛠️ Available Tools

```python
authenticate_linkedin(email, password)               # Authenticate with LinkedIn
get_profile_info(profile_id=None)                    # Get profile information
get_profile_posts(profile_id=None, limit=10)         # Retrieve posts from a profile
search_linkedin_jobs(keywords, location=None, limit=25)  # Search for jobs
get_job_details(job_id)                              # Get job details
search_linkedin_people(keywords, limit=10)           # Search for people
get_linkedin_connections(urn_id=None, limit=50)      # Retrieve connections
get_authentication_status()                          # Check auth status
```

---

## 📋 Requirements

* Python 3.6+
* Packages listed in `requirements.txt`:

  * `fastmcp`
  * `linkedin-api`

---

## 🔐 Notes

* Ensure you have valid LinkedIn credentials for authentication.
* The `linkedin-api` library may enforce rate limits or permissions.
* All operations require prior authentication via `authenticate_linkedin`.
* Project is modular: services handle core logic, tools expose MCP interfaces.

---

## 📄 License

This project is licensed under the [MIT License](LICENSE).


```