linkedin-mcp-server
LinkedIn MCP 服务器
一个生产就绪的 模型上下文协议 (MCP) 服务器,将 AI 代理(Google Gemini Spark、OpenAI Codex、Claude Desktop、Cursor、Windsurf)连接到官方的 LinkedIn REST API。
使 AI 代理能够自主撰写和发布文本更新、分享丰富的链接预览、上传图片、创建互动投票、管理现有帖子,以及参与反应和线程评论。
https://github.com/user-attachments/assets/cda965be-d6a2-4a37-8d3c-29a68a9959e1
功能
双模式 MCP 传输:
服务器发送事件 (SSE) 通过
GET /mcp和POST /messages,适用于 Google Gemini Spark 和 Claude 等客户端。可流式 HTTP 通过
POST /mcp,适用于 OpenAI Codex (rmcp) 等现代命令行和代理运行时。
12 个全面工具:
内容创作:文本更新、文章链接预览卡片、二进制图片上传(3 步流程)和多选项投票。
内容管理:按 URN 删除帖子、获取互动统计(点赞、评论、分享)以及验证账户资料连接。
社交互动:添加反应(
LIKE、CELEBRATE、LOVE、INSIGHTFUL、FUNNY、EMPATHY)、删除反应、添加评论、在线程中回复以及删除评论。
强大的验证:所有工具输入参数均使用 Zod 模式驱动。
企业级就绪:自动化单元和集成测试套件,覆盖 100% 的端点。
Related MCP server: @isteam/linkedin-mcp
工具参考
工具 | 类别 | 描述 | 参数 |
| 内容 | 向您的 LinkedIn 动态发布标准文本帖子 |
|
| 内容 | 发布带有可点击预览卡的帖子 |
|
| 内容 | 从 URL 下载图片,上传到 LinkedIn 并发布 |
|
| 内容 | 创建具有可自定义持续时间的投票 |
|
| 管理 | 使用帖子 URN 删除帖子 |
|
| 管理 | 检索已验证的资料详情(姓名、会员 ID) | 无 |
| 管理 | 获取互动指标(点赞、评论、分享) |
|
| 互动 | 为帖子添加反应 |
|
| 互动 | 移除您对帖子的反应 |
|
| 互动 | 在帖子上添加顶级评论 |
|
| 互动 | 删除您发表的评论 |
|
| 互动 | 对现有评论发布线程回复 |
|
设置与身份验证
1. LinkedIn 开发者门户设置
在 LinkedIn 开发者门户 中创建一个 LinkedIn 应用程序。
在 产品 选项卡下,请求访问:
在 LinkedIn 上分享(提供
w_member_social权限)使用 OpenID Connect 通过 LinkedIn 登录(提供
openid和profile权限)
在 身份验证 选项卡中,添加一个重定向 URL(例如
https://httpbin.org/get或您的域名)。
2. 生成用户访问令牌
在浏览器中构造授权 URL:
https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&scope=openid%20profile%20w_member_social授权应用程序并从重定向 URL 复制
code查询参数。将代码交换为 60 天访问令牌:
curl -X POST https://www.linkedin.com/oauth/v2/accessToken \ -d "grant_type=authorization_code" \ -d "code=YOUR_AUTHORIZATION_CODE" \ -d "client_id=YOUR_CLIENT_ID" \ -d "client_secret=YOUR_CLIENT_SECRET" \ -d "redirect_uri=YOUR_REDIRECT_URI"获取您的会员 ID:
curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" https://api.linkedin.com/v2/userinfosub字段是您的会员标识符(例如urn:li:person:<sub_id>)。
配置
复制示例环境文件:
cp .env.example .env配置您的 .env 变量:
LINKEDIN_ACCESS_TOKEN=your_oauth2_access_token
LINKEDIN_AUTHOR_URN=urn:li:person:your_member_sub_id
PORT=3000本地运行
# Install dependencies
npm install
# Run unit and integration tests
npm test
# Start the server
npm start
# Start in development mode (with live reload)
npm run dev客户端集成
OpenAI Codex CLI
使用 Codex CLI 添加服务器:
codex mcp add linkedin --url https://your-server-domain.com/mcp或直接将其添加到 ~/.codex/config.toml:
[mcp_servers.linkedin]
url = "https://your-server-domain.com/mcp"Claude Desktop
添加到您的 claude_desktop_config.json:
{
"mcpServers": {
"linkedin": {
"command": "node",
"args": ["/path/to/linkedin-mcp-server/server.js"],
"env": {
"LINKEDIN_ACCESS_TOKEN": "your_access_token",
"LINKEDIN_AUTHOR_URN": "urn:li:person:your_sub_id"
}
}
}
}Google Gemini Spark
在您的 Gemini Spark 自定义应用程序设置中,输入您的公共 SSE 端点 URL:
https://your-server-domain.com/mcp部署
部署到 Railway
安装 Railway CLI:
npm i -g @railway/cli链接或创建一个项目:
railway init railway up设置环境变量:
railway variable set LINKEDIN_ACCESS_TOKEN="your_token" LINKEDIN_AUTHOR_URN="urn:li:person:your_sub_id"生成公共域名:
railway domain
开发与测试
测试套件包括 62 个自动化单元和集成测试,涵盖 LinkedIn API 客户端、所有 12 个工具注册和执行处理程序,以及 SSE / 可流式 HTTP 传输。
# Run tests once
npm test
# Run tests in watch mode
npm run test:watch许可证
本项目采用 MIT 许可证。
This server cannot be installed
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
- AlicenseAqualityCmaintenanceFully featured MCP server that provides automation tools for LinkedIn, supporting browser-based scraping and API-based operations for content management, media uploads, and reactions.63MIT
- AlicenseAqualityDmaintenanceMCP server for LinkedIn that enables AI agents to post, comment, like, and manage content on LinkedIn.1061MIT
- AlicenseAqualityDmaintenanceHigh-performance autonomous MCP server that turns LinkedIn into an API for AI workflows, enabling profile management, job search, content posting, and document generation.141MIT
- Alicense-qualityCmaintenanceAI-powered LinkedIn automation server for content generation, profile/company data extraction, and connection request automation, integrating with MCP clients like Claude Desktop.MIT
Related MCP Connectors
Managed LinkedIn MCP server for AI agents: search, connect, message and enrich on accounts you own.
MCP server for LeadDelta — manage LinkedIn connections and CRM data via AI assistants.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
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/vahabcore/linkedin-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server