Skip to main content
Glama
AriOliv
by AriOliv

LinkedIn MCP

非官方的 Model Context Protocol 服务器,用于 LinkedIn —— 从任何 MCP 客户端(Claude 等)读取你的个人资料、人脉网络和联系人、搜索人和职位,并发送消息。

它有两种运行模式:

  • HTTP + OAuth 2.1(推荐)—— 服务器是 MCP 客户端的 OAuth 2.1 授权服务器,并桥接到 LinkedIn 真正的三方 OAuth 同意界面。每个用户在 linkedin.com 上登录;服务器永远不会看到他们的密码。

  • stdio —— 一个本地服务器,从环境中读取 LINKEDIN_ACCESS_TOKEN。适合单个用户或快速测试。

这镜像了 @aol/ifood-mcp@aol/uber-mcp 的认证架构,将它们的逆向工程登录替换为 LinkedIn 的一流 OAuth。


工具

工具

LinkedIn 端点

说明

linkedin_me

GET /v2/userinfo

使用默认的 openid profile email 作用域即可工作。

linkedin_network_stats

GET /v2/networkSizes/{urn}

需要 r_1st_connections_size

linkedin_connections

GET /v2/connections

需要已批准的联系人产品。

linkedin_get_profile

GET /v2/people/{id}

需要已批准的个人资料产品。

linkedin_search_people

GET /v2/search/people

需要已批准的搜索产品。

linkedin_search_jobs

GET /v2/jobs/search

需要已批准的职位产品。

linkedin_send_message

POST /v2/messages

需要 w_member_social(消息)。

LinkedIn API 访问权限。 开箱即用时,标准 LinkedIn 应用仅授予 OpenID Connect 作用域(openid profile email),因此 linkedin_me 可以 立即工作。其他工具调用的端点受 LinkedIn 已批准产品(Sign In、Marketing、Talent Solutions 等)的门控。 在你的应用获得这些产品批准之前,这些工具将返回 403 —— 这是 LinkedIn 平台限制,而非 bug。一旦获得批准,将授予的作用域添加到 LINKEDIN_SCOPES 中。


Related MCP server: Linkd MCP Server

快速开始(HTTP + OAuth)

1. 创建 LinkedIn 应用

  1. 前往 https://www.linkedin.com/developers/appsCreate app

  2. Auth 下,复制 Client IDClient Secret

  3. Authorized redirect URLs 下添加你的回调地址: http://localhost:3000/login/callback(或 PUBLIC_URL + /login/callback)。

  4. Products 下,添加 Sign In with LinkedIn using OpenID Connect(以及你需要的其他产品)。

2. 配置

cp .env.example .env
# then edit .env:
#   MCP_JWT_SECRET=$(openssl rand -hex 32)
#   LINKEDIN_CLIENT_ID=...
#   LINKEDIN_CLIENT_SECRET=...
#   PUBLIC_URL=http://localhost:3000

3. 运行

npm install
npm run build
npm run start:http      # or: npm run dev  (tsx watch)

将你的 MCP 客户端指向 http://localhost:3000/mcp。首次连接时,它会运行 OAuth 2.1 流程,将你重定向到 LinkedIn 登录,然后代表你调用工具。


快速开始(stdio)

cp .env.example .env
# set LINKEDIN_ACCESS_TOKEN=... (e.g. from the LinkedIn developer console token generator)
npm install && npm run build
npm start

MCP 客户端配置:

{
  "mcpServers": {
    "linkedin": {
      "command": "node",
      "args": ["/absolute/path/to/linkedin-mcpserver/build/index.js"],
      "env": { "LINKEDIN_ACCESS_TOKEN": "AQV..." }
    }
  }
}

OAuth 桥接的工作原理

MCP client ──/authorize──▶ this server ──302──▶ /login ──▶ /login/start
                                                              │
                                                    302 ▼ linkedin.com/oauth/v2/authorization
                                              user signs in on LinkedIn
                                                              │
      /login/callback ◀──302 code&state──────────────────────┘
            │  exchange code → LinkedIn access + refresh token
            │  fetch /v2/userinfo → stable member id (sub)
            │  store tokens per‑user, mint an MCP auth code
            ▼
MCP client ──/token──▶ this server ──▶ HS256 JWT (audience‑bound to /mcp)
MCP client ──/mcp (Bearer JWT)──▶ tools call LinkedIn with the member's token
  • MCP 访问令牌是使用 MCP_JWT_SECRET 签名的短期 HS256 JWT, 受众绑定到 /mcp 资源(RFC 8707),并带有轮换的刷新令牌。

  • 当应用获得刷新令牌批准时,下游 LinkedIn 令牌会透明地刷新;否则用户需要重新认证。

  • 所有状态都在内存中(单进程)。将 src/http/store.ts 中的存储替换为 Redis/DB 即可水平扩展。


环境变量

变量

必需

默认值

用途

PORT

3000

HTTP 端口。

PUBLIC_URL

HTTP

http://localhost:PORT

客户端和 LinkedIn 看到的 URL。

MCP_JWT_SECRET

HTTP

HS256 密钥(≥32 字符)。openssl rand -hex 32

LINKEDIN_CLIENT_ID

HTTP

LinkedIn 应用客户端 ID。

LINKEDIN_CLIENT_SECRET

HTTP

LinkedIn 应用客户端密钥。

LINKEDIN_SCOPES

openid profile email

要请求的 OAuth 作用域。

LINKEDIN_REDIRECT_URI

PUBLIC_URL/login/callback

OAuth 回调覆盖。

LINKEDIN_ACCESS_TOKEN

stdio

stdio 模式的令牌。

LINKEDIN_API_BASE

https://api.linkedin.com

API 主机覆盖。

LINKEDIN_VERSION

/restLinkedIn-Version 请求头(YYYYMM)。


目录结构

src/
  index.ts                 stdio server + tool catalog + executeTool + TokenProvider
  http-server.ts           remote MCP server (Streamable HTTP + OAuth 2.1)
  http/
    provider.ts            LinkedInOAuthProvider (OAuthServerProvider, HS256 JWTs)
    login-router.ts        /login → LinkedIn consent → /login/callback
    linkedin-auth.ts       LinkedIn OAuth client (authorize / token / userinfo)
    session-provider.ts    per-user token lookup + transparent refresh
    store.ts               in-memory OAuth + downstream token stores

脚本

脚本

操作

npm run build

编译到 build/

npm run start:http

运行 HTTP/OAuth 服务器。

npm start

运行 stdio 服务器。

npm run dev

tsx watch HTTP 服务器。

npm run dev:stdio

tsx watch stdio 服务器。

npm run typecheck

tsc --noEmit

许可证

MIT。参见 LICENSE

Install Server
A
license - permissive license
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • F
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that enables seamless interaction with LinkedIn for job applications, profile retrieval, feed browsing, and resume analysis through natural language commands.
    31
  • A
    license
    A
    quality
    D
    maintenance
    An unofficial Model Context Protocol server that enables programmatic access to LinkedIn data through tools like user search, company search, profile enrichment, and contact retrieval.
    8
    7
    17
    3
    ISC
  • F
    license
    Not graded
    quality
    D
    maintenance
    A comprehensive Model Context Protocol server that enables AI assistants to interact with LinkedIn APIs for profile management, content creation, networking, messaging, and analytics.
    2
  • A
    license
    A
    quality
    F
    maintenance
    An unofficial Model Context Protocol server that provides LinkedIn tools for searching users, enriching profiles, retrieving contact information, and conducting deep research through natural language interfaces.
    5
    13
    5
    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/AriOliv/linkedin-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server