OAuth2 CLI and MCP server for the LinkedIn API

OAuth2 CLI and MCP server for the LinkedIn API.
What It Does
- Post content — text, images, video, documents, articles, multi-image carousels, and polls
- Comments & reactions — create, list, and delete comments and reactions on posts
- Organization support — post, comment, react, and view analytics as an organization
- Analytics — per-post, per-member, and per-organization statistics
- Media uploads — upload images, video, and documents to LinkedIn
- Draft posts — save posts as drafts before publishing
- OAuth 2.0 authentication with your own LinkedIn app
- Direct token passing for tokens obtained from other applications
- MCP server for AI assistant integration (Claude, Cursor, etc.)
- CLI for scriptable LinkedIn operations
Prerequisites
- Node.js >= 24
- A LinkedIn Developer App with appropriate permissions
Installation
npm install -g linkedctl
Or run directly:
npx linkedctl --help
Quick Start
- Create a LinkedIn app at linkedin.com/developers
- Configure OAuth 2.0 credentials
- Authenticate:
linkedctl auth login --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRET - Start using:
linkedctl post "Hello from LinkedCtl!"
See the OAuth Setup Guide for detailed step-by-step instructions.
MCP Integration
MCP Client Configuration
Claude Desktop
Add to your Claude Desktop configuration (claude_desktop_config.json):
{
"mcpServers": {
"linkedctl": {
"command": "npx",
"args": ["linkedctl", "mcp"]
}
}
}
Claude Code
claude mcp add linkedctl -- npx linkedctl mcp
Cursor
Add to .cursor/mcp.json in your project root:
{
"mcpServers": {
"linkedctl": {
"command": "npx",
"args": ["linkedctl", "mcp"]
}
}
}
Windsurf
Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"linkedctl": {
"command": "npx",
"args": ["linkedctl", "mcp"]
}
}
}
Available Tools
All tools accept an optional profile parameter to select a configuration profile.
Authentication
| Tool | Description |
|---|---|
whoami |
Show the current user's name, email, and profile picture URL |
auth_status |
Show authentication status for a profile |
auth_revoke |
Revoke the access token server-side and clear local credentials |
Posts
| Tool | Description |
|---|---|
post_create |
Create a post on LinkedIn with optional media, poll, or article attachment |
post_get |
Fetch a single post by URN |
post_list |
List posts with pagination (supports as_org for organization posts) |
post_update |
Update the commentary text of an existing post |
post_delete |
Delete a post by URN |
post_create supports rich content types:
| Parameter | Description |
|---|---|
text |
Post text content (required) |
visibility |
PUBLIC or CONNECTIONS (default PUBLIC) |
draft |
Save as draft instead of publishing |
image / image_file |
Attach a single image (URN or local file path) |
video / video_file |
Attach a video (URN or local file path) |
| `document |
Tools (8)
whoamiShow the current user's name, email, and profile picture URLauth_statusShow authentication status for a profileauth_revokeRevoke the access token server-side and clear local credentialspost_createCreate a post on LinkedIn with optional media, poll, or article attachmentpost_getFetch a single post by URNpost_listList posts with paginationpost_updateUpdate the commentary text of an existing postpost_deleteDelete a post by URNConfiguration
{"mcpServers": {"linkedctl": {"command": "npx", "args": ["linkedctl", "mcp"]}}}