LinkedIn MCP Server
Enables AI agents to interact with LinkedIn for posting, commenting, liking, and managing connections via OAuth2 authentication.
README
LinkedIn MCP Server
Full-stack MCP server that lets your AI agent (batabeto/OpenClaw) control LinkedIn as you — post, comment, like, manage your network.
Architecture
AI Agent (batabeto) ──MCP/HTTP──► LinkedIn MCP Server ──REST──► LinkedIn API
│
OAuth2 + Token Store
│
Dashboard UI
Setup Guide
1. Create a LinkedIn App
- Go to LinkedIn Developers
- Click Create App
- Fill in: App Name, LinkedIn Page, Logo
- Under Auth tab → Add
Authorized redirect URLs:
(or your domain if using nginx)http://YOUR_EC2_IP:3000/auth/callback - Under Products tab → Request:
- Share on LinkedIn (gives
w_member_socialscope) - Sign In with LinkedIn using OpenID Connect (gives
openid profile email)
- Share on LinkedIn (gives
- Copy your Client ID and Client Secret
2. Install & Configure
git clone <your-repo> linkedin-mcp
cd linkedin-mcp
npm install
cp .env.example .env
nano .env
Fill in .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. Run the Server
# Production
npm start
# Development (auto-restart)
npm run dev
# As a systemd service (recommended for EC2)
sudo nano /etc/systemd/system/linkedin-mcp.service
systemd service file:
[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.target
sudo systemctl enable linkedin-mcp
sudo systemctl start linkedin-mcp
sudo systemctl status linkedin-mcp
4. Authenticate LinkedIn
- Open:
http://YOUR_EC2_IP:3000 - Click Connect LinkedIn
- Authorize the app on LinkedIn
- You'll be redirected back — status shows ✅ Connected
5. Connect to Your AI Agent
For OpenClaw (batabeto):
Add to your agent's MCP config:
{
"mcpServers": {
"linkedin": {
"url": "http://YOUR_EC2_IP:3000/mcp",
"transport": "http",
"headers": {
"Authorization": "Bearer YOUR_MCP_SECRET_KEY"
}
}
}
}
For Claude Desktop:
{
"mcpServers": {
"linkedin": {
"command": "npx",
"args": ["mcp-remote", "http://YOUR_EC2_IP:3000/mcp", "--header", "Authorization: Bearer YOUR_MCP_SECRET_KEY"]
}
}
}
Available Tools
| Tool | Description |
|---|---|
linkedin_get_profile |
Get your name, headline, email, photo |
linkedin_create_post |
Post text, articles, links |
linkedin_get_my_posts |
List your recent posts |
linkedin_delete_post |
Delete a post by URN |
linkedin_get_post_analytics |
Get likes/comments/shares |
linkedin_like_post |
Like any post |
linkedin_comment_on_post |
Comment on a post |
linkedin_get_connections |
List your network |
linkedin_search_people |
Search people by keywords |
linkedin_get_auth_status |
Check if authenticated |
Example Agent Prompts
"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 Limitations (LinkedIn)
LinkedIn's public API is restricted. Here's what works vs what doesn't:
| Feature | Status | Notes |
|---|---|---|
| Create posts | ✅ Works | Text, articles, links |
| Delete posts | ✅ Works | Your posts only |
| Like posts | ✅ Works | Any visible post |
| Comment | ✅ Works | Any visible post |
| Get your posts | ✅ Works | Via UGC Posts API |
| Get connections | ⚠️ Needs scope | r_network_size required |
| Search people | ❌ Restricted | Needs Partner API |
| Send messages | ❌ Restricted | Needs Partner Program |
| Image posts | 🔜 Possible | Needs media upload flow |
Security
- The MCP endpoint is protected by
MCP_SECRET_KEY— keep it secret - OAuth tokens are stored locally in
data/tokens.json— don't commit this file - LinkedIn tokens expire in 60 days; refresh tokens last 365 days
- The server auto-refreshes tokens when < 5 days remain
Open EC2 Port
# In AWS Security Group, allow inbound:
# Port 3000, TCP, from your agent's IP (or 0.0.0.0/0 for testing)
Or use nginx to proxy yourdomain.com/mcp → localhost:3000/mcp.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。