这是一个基于 FastMCP 的服务器,借助浏览器自动化技术,可用于 LinkedIn 的自动化操作和数据提取。该服务器提供了一系列工具,能让你与 LinkedIn 进行程序化交互,同时严格遵守 LinkedIn 的服务条款和速率限制。
此服务器允许你使用浏览器自动化与 LinkedIn 进行交互,同时遵守 LinkedIn 的服务条款和速率限制。以下是启动服务器并开始使用所需的步骤。
git clone [仓库地址]
cd mcp-linkedin-server
python -m venv env
source env/bin/activate # 在 Windows 上:env\Scripts\activate
pip install -r requirements.txt
playwright install chromium
.env
文件,内容如下:LINKEDIN_USERNAME=your_email@example.com
LINKEDIN_PASSWORD=your_password
COOKIE_ENCRYPTION_KEY=your_encryption_key # 可选:如果未提供将自动生成
from fastmcp import FastMCP
# 初始化客户端
client = FastMCP.connect("http://localhost:8000")
# 登录
result = await client.login_linkedin_secure()
print(result)
# 搜索个人资料
profiles = await client.search_linkedin_profiles(
query="software engineer",
count=5
)
print(profiles)
# 查看个人资料
profile_data = await client.view_linkedin_profile(
profile_url="https://www.linkedin.com/in/username"
)
print(profile_data)
python linkedin_browser_mcp.py
login_linkedin_secure
:使用环境凭据安全登录browse_linkedin_feed
:浏览和提取 feed 中的帖子search_linkedin_profiles
:搜索符合标准的个人资料view_linkedin_profile
:查看并提取特定个人资料的数据interact_with_linkedin_post
: liking、评论或阅读帖子服务器实现了防止过多请求的功能:
全面的错误处理针对:
MIT
⚠️ 重要提示
此工具仅用于教育目的。在使用此软件时,请确保符合 LinkedIn 的服务条款和速率限制指南。