LinkedIn MCP Server
LinkedIn MCP 服务器
全栈 MCP 服务器,让你的 AI 智能体 (batabeto/OpenClaw) 能够像你一样控制 LinkedIn —— 发布动态、评论、点赞、管理你的社交网络。
架构
AI Agent (batabeto) ──MCP/HTTP──► LinkedIn MCP Server ──REST──► LinkedIn API
│
OAuth2 + Token Store
│
Dashboard UIRelated MCP server: LinkedIn MCP Server
设置指南
1. 创建 LinkedIn 应用
点击 Create App (创建应用)
填写:应用名称、LinkedIn 页面、Logo
在 Auth (身份验证) 选项卡下 → 添加
Authorized redirect URLs(授权重定向 URL):http://YOUR_EC2_IP:3000/auth/callback(或者如果你使用 nginx,则填写你的域名)
在 Products (产品) 选项卡下 → 申请:
Share on LinkedIn (提供
w_member_social权限范围)Sign In with LinkedIn using OpenID Connect (提供
openid profile email权限范围)
复制你的 Client ID 和 Client Secret
2. 安装与配置
git clone <your-repo> linkedin-mcp
cd linkedin-mcp
npm install
cp .env.example .env
nano .env填写 .env 文件:
LINKEDIN_CLIENT_ID=your_client_id
LINKEDIN_CLIENT_SECRET=your_client_secret
BASE_URL=http://YOUR_EC2_IP:3000
PORT=3000
MCP_SECRET_KEY=$(openssl rand -hex 32)3. 运行服务器
# Production
npm start
# Development (auto-restart)
npm run dev
# As a systemd service (recommended for EC2)
sudo nano /etc/systemd/system/linkedin-mcp.servicesystemd 服务文件:
[Unit]
Description=LinkedIn MCP Server
After=network.target
[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu/linkedin-mcp
ExecStart=/usr/bin/node server.js
Restart=always
RestartSec=5
EnvironmentFile=/home/ubuntu/linkedin-mcp/.env
[Install]
WantedBy=multi-user.targetsudo systemctl enable linkedin-mcp
sudo systemctl start linkedin-mcp
sudo systemctl status linkedin-mcp4. 验证 LinkedIn 身份
打开:
http://YOUR_EC2_IP:3000点击 Connect LinkedIn (连接 LinkedIn)
在 LinkedIn 上授权该应用
你将被重定向回原页面 —— 状态显示为 ✅ 已连接
5. 连接到你的 AI 智能体
对于 OpenClaw (batabeto):
添加到你的智能体 MCP 配置中:
{
"mcpServers": {
"linkedin": {
"url": "http://YOUR_EC2_IP:3000/mcp",
"transport": "http",
"headers": {
"Authorization": "Bearer YOUR_MCP_SECRET_KEY"
}
}
}
}对于 Claude Desktop:
{
"mcpServers": {
"linkedin": {
"command": "npx",
"args": ["mcp-remote", "http://YOUR_EC2_IP:3000/mcp", "--header", "Authorization: Bearer YOUR_MCP_SECRET_KEY"]
}
}
}可用工具
工具 | 描述 |
| 获取你的姓名、头衔、邮箱、头像 |
| 发布文本、文章、链接 |
| 列出你最近的动态 |
| 通过 URN 删除动态 |
| 获取点赞/评论/转发数据 |
| 点赞任意动态 |
| 评论任意动态 |
| 列出你的社交网络 |
| 通过关键词搜索人员 |
| 检查是否已通过身份验证 |
智能体提示词示例
"Post on LinkedIn: Excited to share that I just deployed a full Kubernetes cluster
with ArgoCD GitOps! #DevOps #Kubernetes"
"Get my last 5 LinkedIn posts"
"Delete my LinkedIn post with ID urn:li:ugcPost:1234567890"
"Comment 'Great insight!' on post urn:li:ugcPost:9876543210"
"Check my LinkedIn connection status"API 限制 (LinkedIn)
LinkedIn 的公共 API 受到限制。以下是功能支持情况:
功能 | 状态 | 备注 |
发布动态 | ✅ 可用 | 文本、文章、链接 |
删除动态 | ✅ 可用 | 仅限你自己的动态 |
点赞动态 | ✅ 可用 | 任意可见动态 |
评论动态 | ✅ 可用 | 任意可见动态 |
获取你的动态 | ✅ 可用 | 通过 UGC Posts API |
获取联系人 | ⚠️ 需要权限 | 需要 |
搜索人员 | ❌ 受限 | 需要合作伙伴 API |
发送消息 | ❌ 受限 | 需要合作伙伴计划 |
发布图片 | 🔜 可能 | 需要媒体上传流程 |
安全性
MCP 端点受
MCP_SECRET_KEY保护 —— 请妥善保管OAuth 令牌存储在本地
data/tokens.json中 —— 请勿将此文件提交到版本控制系统LinkedIn 令牌有效期为 60 天;刷新令牌有效期为 365 天
服务器会在令牌剩余有效期少于 5 天时自动刷新
开放 EC2 端口
# In AWS Security Group, allow inbound:
# Port 3000, TCP, from your agent's IP (or 0.0.0.0/0 for testing)或者使用 nginx 将 yourdomain.com/mcp 代理到 localhost:3000/mcp。
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI agents to manage professional networking on LinkedIn by providing tools for posting updates, searching for jobs, and analyzing profiles. It facilitates secure interaction with the LinkedIn platform through OAuth 2.0 authentication and the Model Context Protocol.1711MIT
- FlicenseAqualityDmaintenanceEnables LLMs and agents to interact with LinkedIn's REST API for managing profiles, creating posts, viewing connections, and overseeing organizations.52
- AlicenseBqualityCmaintenanceEnables AI agents to manage LinkedIn profiles, posts, connections, skills, education, and certifications through the LinkedIn API.1817664MIT
- AlicenseBqualityAmaintenanceEnables AI agents with read/write access to LinkedIn API, including profile, posts, media, organizations, comments, reactions, and analytics.2014MIT
Related MCP Connectors
Give AI agents the LinkedIn tools to find, qualify, engage, and follow up with prospects.
Let AI tools securely access your LinkedIn network and DMs
Managed LinkedIn MCP server for AI agents: search, connect, message and enrich on accounts you own.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ahmedekramalsada/linkedin-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server