🐟 LinkedFish
Swift中的LinkedIn CLI+MCP服务器 --删除个人资料、搜索工作、创建帖子、发送消息等等!
   
✨ 特性
- 👤 轮廓报废 --获取详细的个人资料,包括经验、教育、技能和工作状态
- 🏢 公司情报 --提取公司信息、行业、总部、专业和员工数量
- 💼 求职 --通过位置过滤、薪资信息和轻松申请检测搜索职位
- 📝 岗位创建 --创建文本帖子、文章/URL共享和图像帖子
- 📸 图片上传 --将图片上传到LinkedIn以用于帖子
- 📬 收件箱和消息 --列出对话、阅读消息和发送直接消息
- 🤝 网络 --发送带有可选自定义消息的连接邀请
- 🔐 安全认证 --基于Cookie的身份验证安全存储在macOS Keychain中,具有自动浏览器提取功能
- 🤖 MCP服务器 --克劳德桌面/AI助手集成的12个工具
- 📦 Swift原生 --100%在Swift 6中构建,具有现代异步/等待和基于角色的并发性
- 🔄 智能回退 --当HTML抓取失败时,Peekaboo浏览器自动化+Gemini Vision
🚀 快速开始
安装
# Clone the repo
git clone https://github.com/RyanLisse/LinkedFish.git
cd LinkedFish
# Build release
swift build -c release
# Install CLI tools
cp .build/release/linkedin /usr/local/bin/
cp .build/release/linkedin-mcp /usr/local/bin/可选: 仅仅 A. justfile 包括常见任务。安装时使用 brew install just,然后运行 just (构建), just test, just install等等。
认证
# 🚀 EASIEST: Automatic browser extraction (recommended)
linkedin auth --browser safari
linkedin auth --browser chrome
linkedin auth --browser edge
linkedin auth --browser firefox
# List available browsers and profiles
linkedin auth --list-browsers
# Manual auth (if automatic extraction fails)
linkedin auth YOUR_LI_AT_COOKIE_HERE
# Interactive auth (shows detailed instructions)
linkedin auth
# Check authentication status
linkedin status备注:浏览器提取可能会提示:
- 游猎:系统设置中的全磁盘访问→ 隐私和安全
- Chrome/Edge:钥匙链访问(提示时允许)
📖 用法
CLI命令
# 👤 Get a profile
linkedin profile johndoe
linkedin profile "https://linkedin.com/in/johndoe" --json
linkedin profile johndoe --vision # Force Peekaboo vision
linkedin profile johndoe --no-fallback # Disable Peekaboo fallback
# 🏢 Get a company
linkedin company microsoft
linkedin company "https://linkedin.com/company/anthropic" --json
# 💼 Search jobs
linkedin jobs "Swift Developer" --location "Remote" --limit 10
# 📋 Get job details
linkedin job 1234567890 --json
# 📝 Create posts
linkedin post "Excited about our new release! 🚀"
linkedin post "Check this out" --url "https://example.com" --url-title "Great Article"
linkedin post "Screenshot of the day" --image ./screenshot.png
linkedin post "Connections only update" --visibility connections
linkedin post "Test message" --dry-run # Preview without posting
# 🤝 Send connection request
linkedin connect johndoe
linkedin connect johndoe --message "Great to meet you!"
linkedin connect johndoe --dry-run
linkedin connect johndoe --force # Skip confirmation
# ✉️ Send a message
linkedin send johndoe "Hey, thanks for connecting!"
linkedin send johndoe --message "Alternative syntax"
linkedin send johndoe "Hello" --dry-run
linkedin send johndoe "Hello" --force # Skip confirmation
# 📬 Inbox
linkedin inbox # List conversations
linkedin inbox --limit 5 # Limit results
linkedin inbox --unread-only # Only unread
linkedin inbox --browser-mode # Force Peekaboo/Safari
# 💬 Read messages
linkedin messages CONVERSATION_ID
linkedin messages CONVERSATION_ID --limit 50
linkedin messages CONVERSATION_ID --browser-mode
# 🔍 Auth management
linkedin auth --show # Show stored cookie
linkedin auth --clear # Clear stored auth
linkedin status --json # JSON status output全球旗帜 适用于所有命令: --json (JSON输出), --cookie (覆盖已存储的cookie)
MCP服务器设置
增添 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"linkedin": {
"command": "/usr/local/bin/linkedin-mcp",
"args": [],
"disabled": false
}
}
}12个MCP工具可用: linkedin_status, linkedin_configure, linkedin_get_profile, linkedin_get_company, linkedin_search_jobs, linkedin_get_job, linkedin_create_post, linkedin_upload_image, linkedin_list_conversations, linkedin_get_messages, linkedin_send_invite, linkedin_send_message
看 docs/MCP.md 查看完整的工具模式和示例。
🏗️ 建筑
┌──────────────────────────────────────────────────┐
│ User Interfaces │
│ • linkedin CLI (swift-argument-parser) │
│ • linkedin-mcp (MCP server) │
└────────────────┬─────────────────────────────────┘
│
┌────────────────▼─────────────────────────────────┐
│ LinkLion Core Library │
│ • LinkedInClient (actor) — Main API client │
│ • PeekabooClient — Browser automation fallback │
│ • GeminiVision — Vision-based parsing │
│ • ProfileParser / JobParser — HTML parsing │
│ • CredentialStore — Keychain authentication │
│ • BrowserCookieExtractor — Cookie extraction │
└────────────────┬─────────────────────────────────┘
│
┌────────────────▼─────────────────────────────────┐
│ External Services │
│ • LinkedIn.com (Voyager API + HTML scraping) │
│ • macOS Keychain (credential storage) │
│ • Peekaboo (browser automation) │
│ • Gemini Vision API (screenshot analysis) │
└──────────────────────────────────────────────────┘🛠️ 图书馆使用情况
import LinkLion
// Create and configure client
let client = await createClient(cookie: "your-li_at-cookie")
// Get profile
let profile = try await client.getProfile(username: "satya-nadella")
print("Name: \(profile.name)")
print("Headline: \(profile.headline ?? "N/A")")
print("Experiences: \(profile.experiences.count)")
// Search jobs
let jobs = try await client.searchJobs(query: "iOS Developer", location: "SF")
for job in jobs {
print(" \(job.title) @ \(job.company)")
}
// Create a post
let result = try await client.createTextPost(text: "Hello LinkedIn!", visibility: .public)
print("Posted: \(result.success)")
// List inbox
let conversations = try await client.listConversations(limit: 10)
for conv in conversations {
print("\(conv.participantNames.joined(separator: ", ")): \(conv.lastMessage ?? "")")
}
// Send a connection request
let urn = try await client.resolveURN(from: "johndoe")
try await client.sendInvite(profileUrn: urn, message: "Let's connect!")📚 文档
🔧 发展
# Build
swift build
# Run tests
swift test
# Release build
swift build -c release
# Run specific tests
swift test --filter LinkedInKitTests⚠️ 局限性
- 频繁请求时可能会出现速率限制
- Cookie过期约1年(身份验证失败时刷新)
- LinkedIn可能会更新HTML结构(解析器可能需要更新)
- 验证码挑战可能会阻止请求(Peekaboo回退有帮助)
- URN解析要求每个新用户名调用一个API(结果缓存在内存中)
📄 许可证
MIT许可证——见 许可证 了解详情。
🙏 学分
受...启发 linkedin mcp服务器 python
______________________________________________________________________
建于🐟 作者:RyanLisse
