linkedin-mcp
LinkedIn MCP
这个 MCP 服务器通过 DevTools 协议驱动一个真实的 Chrome 窗口,让 AI 助手能够搜索 LinkedIn 职位并读取 LinkedIn 个人资料。
它是只读的。这里没有任何工具可以建立连接、发送消息、表示认可、发布内容或申请职位——这不是靠某个设置,而是因为实现这些功能的代码根本不存在。这是刻意划出的一条界线:LinkedIn 对自动化写入的处理远比自动化读取严厉,而把两者混在一起正是账号遭到限制的原因。
工具
工具 | 返回内容 |
| 返回职位列表,包含标题、公司、地点、工作场所类型、发布时的薪资、发布时长和 |
| 一条完整的职位发布——公司、地点、LinkedIn 的职位洞察,以及展开“See more”折叠后的完整职位描述。 |
| 姓名、头衔、地点、关于文本、工作经历、教育背景和技能。 |
| 已保存的浏览器会话是否仍处于登录状态。 |
| 与 Chrome 断开连接,让窗口和会话保持原样。 |
Related MCP server: LinkedIn Sales & Navigator MCP Server
安装
需要 Python 3.12+、uv 和 Google Chrome。
git clone https://github.com/TSS99/linkedin-mcp.git
cd linkedin-mcp
uv sync登录一次。这会打开一个 Chrome 窗口,等待你手动登录——脚本绝不会输入凭据,因为 LinkedIn 会拦截脚本化的凭据输入:
uv run linkedin-mcp --login会话持久保存在 ~/.linkedin-mcp/chrome-profile 中。你可以随时用 uv run linkedin-mcp --check 检查它,或者用 uv run linkedin-mcp --logout 清除它。
它驱动哪个 Chrome 配置文件
默认情况下,服务器会打开一个属于它自己的一次性配置文件。那个窗口看起来是全新的——没有书签、没有扩展,除了 LinkedIn 之外没有登录任何东西。这正是关键所在:服务器只能看到 LinkedIn。
如果你更希望它驱动你日常使用的 Chrome,从而复用你已有的 LinkedIn 会话,并且不打开陌生的窗口,请设置:
LINKEDIN_MCP_PROFILE_DIR=system或者显式地把它指向任意配置文件目录。在 MCP 客户端配置中,这放在 env 块里:
{
"mcpServers": {
"linkedin": {
"command": "uv",
"args": ["--directory", "/path/to/linkedin-mcp", "run", "linkedin-mcp"],
"env": { "LINKEDIN_MCP_PROFILE_DIR": "system" }
}
}
}在这样做之前,有两件事需要明白:
你仍然需要重启一次 Chrome。 --remote-debugging-port 只在启动时生效;它无法对已经运行的进程开启。所以,无论配置文件怎么设置,当前已经打开的 Chrome 永远无法被附加。请彻底退出 Chrome(Cmd+Q,而不只是关闭窗口),然后让服务器来启动它,或者用 --login 打印出的命令自己启动它。
调试端口并非 LinkedIn 专属。 任何能够访问 127.0.0.1:9224 的东西,都可以驱动那个 Chrome 中的每一个标签页,并读取其中的每一个会话——你的邮件、你的银行、所有这一切——而不仅仅是 LinkedIn。在隔离的配置文件里,没有其他东西可被访问;在你日常使用的配置文件里,什么都可以被访问。只在你信任的机器上这样运行,并在用完后关闭调试 Chrome。
--logout 拒绝删除并非由它创建的配置文件,所以把它指向你真实的 Chrome,不会抹掉你的浏览器状态。
配置
添加到你的 MCP 客户端配置中(参见 mcp-config.example.json):
{
"mcpServers": {
"linkedin": {
"command": "uv",
"args": ["--directory", "/path/to/linkedin-mcp", "run", "linkedin-mcp"]
}
}
}对于 Claude Code:claude mcp add linkedin -- uv --directory /path/to/linkedin-mcp run linkedin-mcp
工作原理及其原因
CDP 对接真实 Chrome 配置文件,而不是启动的浏览器。 Playwright 自带的 Chromium 会在十几种 LinkedIn 会检查的方面暴露自己。附加到你亲自登录过的真实 Chrome 上,才能让浏览器指纹和 Cookie 保持真实可信。服务器运行在调试端口 9224 上,因此可以与 9222/9223 上其他由浏览器驱动的 MCP 服务器共存。
导航会控制节奏。 LinkedIn 的限流不仅看请求量,还看请求节奏,所以 goto 会强制一个带抖动的最小间隔。长时间的研究性运行会比本可以的速度更慢——这是故意的。
LinkedIn DOM 中的每个字符串都会出现两次——一次可见,一次在供屏幕阅读器使用的 visually-hidden span 中——因此原始的 innerText 读起来是“Acme Corp\nAcme Corp”。dedupe_lines 会折叠连续重复的内容;没有它,解析出的每个字段都会翻倍。
选择器是有序的回退列表。 LinkedIn 的类名经过混淆,而且经常改名。只要可能,解析器就会锚定在那些在类名变动中存活下来的东西上——data-occludable-job-id 属性、稳定的 div#experience 锚点 id——并在必要时退而根据卡片文本的行序进行解析,而不是依赖逐字段的钩子。
一次失败的抓取绝不会返回空结果。 每个工具都被包装过,因此当锚点缺失时,会返回 {"status": "error", "error_type": "stale_selector", ...},并指明选择器和 URL。如果把 [] 交给 LLM,它会满怀信心地报告“没有找到职位”;这可以让工具故障与真正的空结果区分开来。
测试
uv run pytest测试覆盖纯解析器——URL/筛选条件构造、卡片解析、个人资料条目解析、行去重——针对的是与 LinkedIn DOM 实际产出形状一致的 fixtures。它们不需要浏览器,也不需要网络。
当它出错时
它一定会出错。LinkedIn 会不断发布标记结构变更,而爬虫本质上是对别人 HTML 的一种猜测。你最终会遇到 stale_selector 错误;修复方法通常是在 tools/jobs.py 或 tools/profiles.py 的选择器列表中再加一项,并在 tests/test_parsers.py 中补充一个 fixture。
如果你遇到返回 auth_required 并带 checkpoint URL 的情况,说明 LinkedIn 需要真人:打开 Chrome 窗口,完成人机验证,然后重试。
关于使用条款
无论实现多么谨慎,自动化访问都违反 LinkedIn 的用户协议,而且 LinkedIn 确实会因此限制账号。这是一个个人研究工具;只读设计和有节奏的请求可以降低风险,但无法消除它,而你所指向的那个账号正是承担这一风险的账号。请自行判断。
许可证
Apache-2.0
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
- AlicenseAqualityAmaintenanceEnables AI assistants to interact with LinkedIn by scraping profiles, companies, job postings, and getting personalized job recommendations using authenticated browser automation.173,204Apache 2.0
- FlicenseAqualityNot gradedmaintenanceEnables AI assistants to interact with LinkedIn and LinkedIn Sales Navigator for searching profiles, managing leads, and handling messaging via cookie-based authentication. It supports professional networking tasks such as sending connection requests and retrieving account details through the Model Context Protocol.221
- AlicenseAqualityDmaintenanceEnables searching and scraping of LinkedIn for structured data on people, companies, and job listings. It allows AI clients to retrieve detailed profiles, experience, and activity sections using browser automation.7175MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to search, filter, and extract job listings from LinkedIn using an automated headless browser with semantic AI filtering and deduplication.15MIT
Related MCP Connectors
Give AI agents the LinkedIn tools to find, qualify, engage, and follow up with prospects.
Live LinkedIn data for AI agents: profiles, companies, jobs, posts, email finding. No account risk.
Run LinkedIn outreach from your AI chat: find leads, launch campaigns, send, and reply.
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/TSS99/linkedin-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server