Skip to main content
Glama
ahmedekramalsada

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 UI

Related MCP server: LinkedIn MCP Server

设置指南

1. 创建 LinkedIn 应用

  1. 前往 LinkedIn 开发者平台

  2. 点击 Create App (创建应用)

  3. 填写:应用名称、LinkedIn 页面、Logo

  4. Auth (身份验证) 选项卡下 → 添加 Authorized redirect URLs (授权重定向 URL):

    http://YOUR_EC2_IP:3000/auth/callback

    (或者如果你使用 nginx,则填写你的域名)

  5. Products (产品) 选项卡下 → 申请:

    • Share on LinkedIn (提供 w_member_social 权限范围)

    • Sign In with LinkedIn using OpenID Connect (提供 openid profile email 权限范围)

  6. 复制你的 Client IDClient 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.service

systemd 服务文件:

[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. 验证 LinkedIn 身份

  1. 打开:http://YOUR_EC2_IP:3000

  2. 点击 Connect LinkedIn (连接 LinkedIn)

  3. 在 LinkedIn 上授权该应用

  4. 你将被重定向回原页面 —— 状态显示为 ✅ 已连接

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"]
    }
  }
}

可用工具

工具

描述

linkedin_get_profile

获取你的姓名、头衔、邮箱、头像

linkedin_create_post

发布文本、文章、链接

linkedin_get_my_posts

列出你最近的动态

linkedin_delete_post

通过 URN 删除动态

linkedin_get_post_analytics

获取点赞/评论/转发数据

linkedin_like_post

点赞任意动态

linkedin_comment_on_post

评论任意动态

linkedin_get_connections

列出你的社交网络

linkedin_search_people

通过关键词搜索人员

linkedin_get_auth_status

检查是否已通过身份验证


智能体提示词示例

"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

获取联系人

⚠️ 需要权限

需要 r_network_size 权限

搜索人员

❌ 受限

需要合作伙伴 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

A
license - permissive license
Not graded
quality - not tested
C
maintenance

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

  • A
    license
    A
    quality
    D
    maintenance
    Enables 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.
    17
    11
    MIT
  • A
    license
    B
    quality
    C
    maintenance
    Enables AI agents to manage LinkedIn profiles, posts, connections, skills, education, and certifications through the LinkedIn API.
    18
    176
    64
    MIT
  • A
    license
    B
    quality
    A
    maintenance
    Enables AI agents with read/write access to LinkedIn API, including profile, posts, media, organizations, comments, reactions, and analytics.
    20
    14
    MIT

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

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