linkedincli
从您的终端进行完整的LinkedIn平台管理。43个命令,用于配置文件、帖子、消息、连接、搜索、订阅源、参与度等,由cookie会话身份验证提供支持。
作为一个 命令行界面 和a MCP服务器 (适用于Claude Code、Cursor、Windsurf和其他AI代理)。
安装
# Install globally
npm install -g @bcharleson/linkedincli
# This installs the `linkedin` command:
linkedin --help
# Or run without installing
npx @bcharleson/linkedincli --help注: npm包是@bcharleson/linkedincli但是CLI命令只是
快速开始
1.获取您的Cookie
在浏览器中打开LinkedIn→ DevTools(F12) → 应用→ Cookie→ linkedin.com
复制这两个值:
li_at--您的会话令牌(以开头的长字符串AQED...)JSESSIONID--您的会话ID(以开头ajax:)
2.登录
linkedin login
# Paste your li_at and JSESSIONID when prompted或非交互式:
linkedin login --li-at "AQEDxxxxxxx" --jsessionid "ajax:1234567890"3.使用它
# View your profile
linkedin profile me --pretty
# Create a post
linkedin posts create --text "Hello LinkedIn! Posted from my terminal."
# Search for people
linkedin search people --keywords "software engineer" --network F --pretty
# Check your messages
linkedin messaging conversations --pretty
# React to a post
linkedin engage react 7123456789 --type LIKE所有命令
配置文件(9个命令)
linkedin profile me # Your own profile
linkedin profile view
# View any profile
linkedin profile contact-info
# Email, phone, websites
linkedin profile skills
# List skills
linkedin profile network
# Connections, followers, distance
linkedin profile badges
# Premium, influencer, etc.
linkedin profile privacy
# Privacy settings
linkedin profile posts # Recent posts by a user
linkedin profile disconnect
# Remove a connection帖子(3个命令)
linkedin posts create --text "My post" # Text post
linkedin posts create --text "With image" --image ./pic.jpg # Image post
linkedin posts create --text "Inner circle" --visibility connections
linkedin posts edit --text "Updated text" # Edit a post
linkedin posts delete # Delete a post馈送(3个命令)
linkedin feed view # Your feed (chronological)
linkedin feed view --count 50 # More items
linkedin feed user
# Someone's activity
linkedin feed company # Company updates交战(5个命令)
linkedin engage react
--type LIKE # Like
linkedin engage react
--type PRAISE # Celebrate
linkedin engage react
--type EMPATHY # Love
linkedin engage react
--type INTEREST # Insightful
linkedin engage react
--type ENTERTAINMENT # Funny
linkedin engage react
--type APPRECIATION # Support
linkedin engage comment
--text "Great post!"
linkedin engage comments-list
linkedin engage reactions
linkedin engage share --text "Worth reading"连接(7个命令)
linkedin connections send
# Send request
linkedin connections send
-m "Let's connect!" # With message
linkedin connections received # Pending received
linkedin connections sent # Pending sent
linkedin connections accept --secret # Accept
linkedin connections reject --secret # Reject
linkedin connections withdraw # Withdraw sent
linkedin connections remove
# Unfriend消息传递(6个命令)
linkedin messaging conversations # All conversations
linkedin messaging conversation-with
# With specific person
linkedin messaging messages # Read messages
linkedin messaging send -t "Hello!" # Reply
linkedin messaging send-new -r , -t "Hi!" # New conversation
linkedin messaging mark-read # Mark as read搜索(4个命令)
linkedin search people --keywords "CTO" --network F # 1st connections
linkedin search people --keywords "engineer" --company 1035 # At a company
linkedin search people --title "VP Sales" --geo 103644278 # By region
linkedin search companies --keywords "AI startups"
linkedin search jobs --keywords "engineer" --remote --experience 4
linkedin search posts --keywords "AI trends"公司(3个指挥部)
linkedin companies view # Company info
linkedin companies follow # Follow
linkedin companies unfollow # Unfollow作业(2个命令)
linkedin jobs view # Job details
linkedin jobs skills # Skill match insights分析(1个命令)
linkedin analytics profile-views # Who viewed your profile全局选项
每个命令都支持这些标志:
| 标志 | 描述 |
|---|---|
--li-at | 覆盖li_at cookie |
--jsessionid | 覆盖JSESSIONID cookie |
--output pretty | 打印精美的JSON |
--pretty | 速记为 --output pretty |
--quiet | 无输出,仅退出代码 |
| `--fields | |
| ` | 要包含的逗号分隔字段 |
环境变量
export LINKEDIN_LI_AT="your_li_at_cookie"
export LINKEDIN_JSESSIONID="your_jsessionid_cookie"身份验证解析顺序: --li-at/--jsessionid 旗帜→ 环境变量→ ~/.linkedin-cli/config.json
MCP服务器(AI代理)
所有43个命令都可以作为MCP工具用于Claude Code、Cursor、Windsurf和其他AI代理。
克劳德代码/光标/风帆
添加到MCP配置中:
{
"mcpServers": {
"linkedin": {
"command": "linkedin",
"args": ["mcp"],
"env": {
"LINKEDIN_LI_AT": "your_li_at_cookie",
"LINKEDIN_JSESSIONID": "your_jsessionid_cookie"
}
}
}
}或者如果使用 npx:
{
"mcpServers": {
"linkedin": {
"command": "npx",
"args": ["-y", "@bcharleson/linkedincli", "mcp"]
}
}
}然后,你的AI代理可以管理你的整个LinkedIn状态——创建帖子、回复消息、管理连接、搜索人员等等。
Cookie过期
领英 li_at Cookie会定期过期(通常每几周一次)。当您的会话到期时:
linkedin status # Check if session is valid
linkedin login # Re-authenticate with new cookies免责声明
该工具通过cookie会话身份验证使用LinkedIn的内部Voyager API。它不隶属于LinkedIn或得到LinkedIn的认可。负责任地使用并遵守LinkedIn的服务条款。作者不对自动使用可能导致的任何帐户限制负责。
许可证
麻省理工学院
