linkedin-mcp
The first and only LinkedIn MCP server built in Rust. Publish posts to LinkedIn from AI agents (Claude Code, Claude Desktop, or any MCP-compatible client) using the official MCP Rust SDK (rmcp).
Why Rust?
Most MCP servers are written in TypeScript (Bun/Node.js). That works fine for a single agent, but in multi-agent environments — where dozens of MCP servers run simultaneously across multiple Claude Code sessions — the resource overhead adds up fast:
In a real-world scenario with 5 Claude Code sessions, each running 4–6 MCP servers, TypeScript runtimes can consume 3–8 GB of RAM just for MCP infrastructure — leaving less for the actual work. We experienced this firsthand: orphaned Bun processes from a Telegram MCP plugin consumed 8 CPU cores and forced fan noise on a MacBook Pro.
Rust MCP servers are single static binaries with no runtime, no garbage collector, and no dependency on Node/Bun/npm. They start instantly, use minimal memory, and disappear cleanly when the session ends.
Features
- Text posts — publish text-only posts (up to 3000 chars)
- URL/link sharing — share a URL with a rich preview card (thumbnail, title, description)
- Image posts — upload a local image and publish it with text
- Video posts — upload a local video and publish it with text
- Profile info — retrieve the authenticated user's name, email, and LinkedIn ID
- Auth status — check token validity and expiration
- Automatic token refresh — access tokens (60 days) and refresh tokens (365 days)
- stdio transport — works with Claude Code, Claude Desktop, and any MCP-compatible client
Installation
Option A: Download pre-built binary (recommended)
Download the latest release for your platform from GitHub Releases:
# Example for macOS Apple Silicon:
curl -L https://github.com/gohyperdev/linkedin-mcp/releases/latest/download/linkedin-mcp-aarch64-apple-darwin.tar.gz | tar xz
chmod +x linkedin-mcp
sudo mv linkedin-mcp /usr/local/bin/
Option B: Build from source
Requires Rust 1.75+.
git clone https://github.com/gohyperdev/linkedin-mcp.git
cd linkedin-mcp
cargo build --release
# Binary at: target/release/linkedin-mcp
LinkedIn App Setup
Before using this MCP server, you need a LinkedIn Developer App with two products enabled.
- Create an app — follow LinkedIn's official guide: Getting Access to LinkedIn APIs
- Add required products in the Products tab (Managing Your Application):
- Share on LinkedIn — grants
w_member_socialscope (required for posting) - Sign In with LinkedIn using OpenID Connect — grants
openid profile emailscopes (required for profile info)
- Share on LinkedIn — grants
- Configure OAuth in the Auth tab:
- Copy your Client ID and Client Secret
- Add
http://localhost:3000/callbackunder Authorized redirect URLs
For full details on LinkedIn OAuth 2.0, see: Authorization Code Flow
Security
Your Client ID and Client Secret are sensitive credentials. Never commit them to git.
- Pass credentials via environment variables only:
LINKEDIN_CLIENT_IDandLINKEDIN_CLIENT_SECRET - The
.envfile is in.gitignore— use it for local development - OAuth tokens are stored locally at
~/.config/linkedin-mcp/tokens.json— this file contains your access token, treat it as a secret - The MCP server reads credentials from environment variables at runtime, never from source code
Authentication (One-Time Setup)
Before the MCP tools can post to LinkedIn, you need to authorize the app once. Run the included setup script:
LINKEDIN_CLIENT_ID=your_client_id \
LINKEDIN_CLIENT_SECRET=your_client_secret \
./auth-cli.sh
This will:
- Print an OAuth authorization URL — open it in your browser
- You'll see LinkedIn's consent screen — click Allow
- LinkedIn redirects to
localhost:3000/callback— the script catches it - Access token is saved to
~/.config/linkedin-mcp/tokens.json
That's it. The token is valid for 60 days and auto-refreshes (refresh token valid 365 days). You only need to re-run auth-cli.sh if both tokens expire.
Usage with Claude Code
claude mcp add linkedin-mcp -s user -- \
env LINKEDIN_CLIENT_ID=your_client_id \
LINKEDIN_CLIENT_SECRET=your_client_secret \
/usr/local/bin/linkedin-mcp
Or for a specific project only (-s project):
claude mcp add linkedin-mcp -s project -- \
env LINKEDIN_CLIENT_ID=your_client_id \
LINKEDIN_CLIENT_SECRET=your_client_secret \
/path/to/linkedin-mcp
Usage with Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"linkedin": {
"command": "/usr/local/bin/linkedin-mcp",
"env": {
"LINKEDIN_CLIENT_ID": "your_client_id",
"LINKEDIN_CLIENT_SECRET": "your_client_secret"
}
}
}
}
Restart Claude Desktop after saving.
MCP Tools
Visibility options: PUBLIC (default) or CONNECTIONS (1st-degree only).
Limitations
- Personal profile only. Company Page posting requires the "Community Management API" product which must be the only product on the app (separate LinkedIn app needed).
- No native LinkedIn articles. The LinkedIn API does not support creating long-form articles (the ones at
linkedin.com/pulse/...with rich-text formatting). Theshare_articletool shares a URL with a preview card — it's a regular feed post, not a native article. - No LinkedIn Newsletter editions. Newsletter content can only be created through the LinkedIn web UI.
- No draft posts. The "Share on LinkedIn" API only supports
lifecycleState: PUBLISHED. Draft support requires the Community Management API. - Rate limits: 150 requests/day per member, 100,000/day per application.
Environment Variables
Token Storage
Tokens are stored at ~/.config/linkedin-mcp/tokens.json:
{
"access_token": "AQV...",
"refresh_token": null,
"expires_at": "2026-06-05T01:06:11Z",
"linkedin_id": "sIhlYJw_ja",
"email": "[email protected]"
}
To revoke access, delete this file and remove the app from LinkedIn Settings > Permitted services.
License
MIT — see LICENSE.