Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
Your own AI agent, running 24/7 with QwikClaw logoYour own AI agent, running 24/7 with QwikClaw

QwikClaw sets up and runs an always-on OpenClaw agent for you. One click, no config files, no server setup.

Deploy now
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 47,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

MCP server for LinkedIn, enabling posting, liking, commenting, and profile retrieval via official OAuth 2.0. Features CLI, HTTP admin, and optional Telegram bot.

README.md

linkedin-mcp

0 Trust · 100% Control | 0 Magic · 100% Transparency | 0 Hardcoding · 100% Flexibility

A Model Context Protocol (MCP) server for LinkedIn — official OAuth 2.0, intent-first tool surface, three-level admin (CLI · HTTP · Telegram). Designed for the KpihX homelab stack; deployment-ready with Docker + Traefik.

Repos: GitHub · GitLab

---

Why this exists

LinkedIn has no general-purpose developer API for personal accounts. The official OAuth surface (openid profile email w_member_social) covers everything an individual power-user needs:

  • Post, delete, like, comment on content
  • Read own profile and auth status
  • Guide agents through the flow with linkedin_guide

This MCP wraps that surface with full operational visibility: a CLI admin, an HTTP admin API, and an optional Telegram bot — the same architecture as whats-mcp, tick-mcp, mail-mcp.

---

Architecture

linkedin-mcp/
├── src/
│   ├── main.js          ← entry: serve (stdio) | serve-http
│   ├── admin.js         ← entry: CLI admin (linkedin-admin)
│   ├── config.js        ← loadConfig() — deep merge defaults → config.json → env
│   ├── token.js         ← save / load / clear / summary  (~/.mcps/linkedin/token.json)
│   ├── client.js        ← LinkedInClient — official REST API calls
│   ├── server.js        ← createMcpServer() — MCP SDK wiring
│   ├── http_app.js      ← Express HTTP app: /health /admin/* /mcp
│   ├── .env.example     ← required secrets template
│   └── admin/
│       ├── cli.js       ← Commander CLI (auth / status / logout / logs / health / urls
│       │                               / client-id / client-secret / token)
│       ├── service.js   ← unified admin kernel — single source of truth for all surfaces
│       ├── oauth.js     ← LinkedIn OAuth 2.0 + OIDC flow (configurable callback port)
│       └── telegram.js  ← optional Telegram bot admin (15 commands)
├── tools/
│   ├── registry.js      ← listTools() + callTool()
│   ├── guide.js         ← linkedin_guide
│   ├── profile.js       ← linkedin_get_profile, linkedin_auth_status
│   ├── posts.js         ← linkedin_create_post, linkedin_create_image_post, linkedin_delete_post
│   └── social.js        ← linkedin_like_post, linkedin_create_comment
├── tests/               ← bun test (61 tests, 0 deps on live API)
├── deploy/
│   ├── docker-compose.yml
│   └── docker-compose.override.example.yml
├── Dockerfile
├── .gitlab-ci.yml
└── config.json          ← non-secret defaults (port 8095, OAuth port 3001, state dir, scopes)

Transport strategy:

Agent / Claude / Gemini / Codex / Copilot / Vibe
         │
         ├─── HTTP (homelab) ──→  https://linkedin.kpihx-labs.com/mcp   (primary)
         └─── stdio (local)  ──→  ~/.bun/bin/linkedin-mcp serve         (fallback)

---

Tools (8)

| Tool | Description | |------|-------------| | linkedin_guide | Orientation — all tools, auth flow, quick start | | linkedin_auth_status | Token presence, validity, days remaining, profile | | linkedin_get_profile | Fetch own LinkedIn profile (name, email, sub) | | linkedin_create_post | Create a text post (PUBLIC or CONNECTIONS) | | linkedin_create_image_post | Create a post with an attached image | | linkedin_delete_post | Delete a post by URN | | linkedin_like_post | Like a post by URN | | linkedin_create_comment | Add a comment to a post by URN |

---

Admin interfaces

CLI (linkedin-admin)

# Authentication
linkedin-admin auth [--port N]     # OAuth flow — opens browser, saves token (default port 3001)
linkedin-admin token set <value>   # Set access token directly (fetches profile, no browser)
linkedin-admin token unset         # Clear stored token (same as logout)
linkedin-admin logout              # Clear stored token

# Credential management (stored in admin env file)
linkedin-admin client-id set <v>   # Set LINKEDIN_CLIENT_ID
linkedin-admin client-id unset     # Clear LINKEDIN_CLIENT_ID
linkedin-admin client-secret set <v>
linkedin-admin client-secret unset

# Status & observability
linkedin-admin status              # Credentials table + token summary
linkedin-admin status --json       # Machine-readable JSON
linkedin-admin logs [--lines 50]   # Tail admin log
linkedin-admin health              # HTTP server reachability
linkedin-admin urls                # All public/private endpoints

HTTP admin

| Endpoint | Method | Description | |----------|--------|-------------| | /health | GET | Liveness probe | | /admin/status | GET | Full runtime status (token + Telegram state) | | /admin/help | GET | All commands reference | | /admin/logs?lines=50 | GET | Recent admin log tail | | /admin/client-id/set | POST | Body: { "value": "..." } | | /admin/client-id/unset | POST | Clear LINKEDIN_CLIENT_ID | | /admin/client-secret/set | POST | Body: { "value": "..." } | | /admin/client-secret/unset | POST | Clear LINKEDIN_CLIENT_SECRET | | /admin/token/set | POST | Body: { "value": "..." } — sets token + fetches profile | | /admin/token/unset | POST | Clear stored token | | /mcp | POST/GET/DELETE | MCP Streamable HTTP transport |

Telegram bot (optional)

Set TELEGRAM_LINKEDIN_HOMELAB_TOKEN + TELEGRAM_CHAT_IDS — server polls every 5 s.

| Command | Action | |---------|--------| | /start /help | Full command reference | | /status | Credentials + token status | | /health | HTTP server health | | /urls | Endpoint map | | /logs [n] | Last n admin log lines (default 20) | | /token_set <value> | Set access token (fetches profile) | | /token_unset | Clear stored token | | /client_id_set <value> | Set LINKEDIN_CLIENT_ID | | /client_id_unset | Clear LINKEDIN_CLIENT_ID | | /client_secret_set <value> | Set LINKEDIN_CLIENT_SECRET | | /client_secret_unset | Clear LINKEDIN_CLIENT_SECRET |

---

Quick start

1. LinkedIn App setup

  1. Go to LinkedIn Developer Portal
  2. Create an app → add products: "Sign In with LinkedIn using OpenID Connect" + "Share on LinkedIn"
  3. Set redirect URI: http://localhost:3001/callback
  4. Note Client ID and Client Secret

2. Configure secrets

# Option A — via admin CLI (written to admin env file)
linkedin-admin client-id set <your_client_id>
linkedin-admin client-secret set <your_client_secret>

# Option B — via .env file
cp src/.env.example src/.env
# Fill in LINKEDIN_CLIENT_ID and LINKEDIN_CLIENT_SECRET

# Option C — via bw-env / kshrc (injected at login shell)

3. Install & authenticate

bun install
bun link              # editable install: ~/.bun/bin/linkedin-mcp + linkedin-admin

# Full OAuth flow (browser consent)
linkedin-admin auth   # default port 3001
linkedin-admin auth --port 3002  # if 3001 is busy

# Or set access token directly (server/headless contexts)
linkedin-admin token set <your_access_token>

linkedin-admin status # verify credentials and token

4. Start MCP server

# stdio (for agent config)
linkedin-mcp serve

# HTTP (for homelab deployment)
linkedin-mcp serve-http

---

Docker / Homelab deployment

cd deploy
cp docker-compose.override.example.yml docker-compose.override.yml
# Edit override with your secrets (or rely on CI env injection)

docker compose up -d

Traefik labels in deploy/docker-compose.yml expose:

  • https://linkedin.kpihx-labs.com (primary private trusted route)
  • https://linkedin.homelab (fallback)

The container persists all state in /data (Docker volume):

  • /data/state/token.json — OAuth token
  • /data/linkedin-admin.env — credentials written by token set / client-id set

---

Agent registration

Claude Code (~/.claude.json)

"linkedin-mcp": {
  "type": "http",
  "url": "https://linkedin.kpihx-labs.com/mcp"
},
"linkedin-mcp--fallback": {
  "command": "/home/kpihx/.bun/bin/linkedin-mcp",
  "args": ["serve"]
}

Gemini (~/.gemini/extensions/linkedin_mcp/gemini-extension.json)

{
  "name": "linkedin-mcp",
  "version": "0.2.1",
  "mcpServers": {
    "linkedin-mcp": { "httpUrl": "https://linkedin.kpihx-labs.com/mcp" },
    "linkedin-mcp--fallback": {
      "command": "/home/kpihx/.bun/bin/linkedin-mcp",
      "args": ["serve"]
    }
  }
}

Codex (~/.codex/config.toml)

[mcp_servers.linkedin_mcp]
url = "https://linkedin.kpihx-labs.com/mcp"

[mcp_servers.linkedin_mcp_fallback]
command = "/home/kpihx/.bun/bin/linkedin-mcp"
args = ["serve"]

Copilot (~/.copilot/mcp-config.json)

"linkedin_mcp": { "type": "http", "url": "https://linkedin.kpihx-labs.com/mcp" },
"linkedin_mcp_fallback": {
  "type": "stdio",
  "command": "/home/kpihx/.bun/bin/linkedin-mcp",
  "args": ["serve"]
}

Vibe (~/.vibe/config.toml)

[[mcp_servers]]
name = "linkedin"
transport = "http"
url = "https://linkedin.kpihx-labs.com/mcp"

[[mcp_servers]]
name = "linkedin_fallback"
transport = "stdio"
command = "/home/kpihx/.bun/bin/linkedin-mcp"
args = ["serve"]

---

Tests

bun test           # 61 tests, 5 files, 0 live API calls
bun test --watch   # watch mode

All tests use mocked fetch and temp directories — no credentials needed.

---

Token lifecycle

LinkedIn personal OAuth tokens expire in 60 days. There is no refresh token for non-Partner apps.

Day 0   →  linkedin-admin auth          (OAuth flow, browser consent)
           OR  linkedin-admin token set  (direct token, headless/server)
Day 55+ →  linkedin-admin status        (shows days_left)
Day 60  →  token invalid, re-run auth

Both flows produce a complete token.json with member_id populated — required for all posting tools.

---

License

MIT — see LICENSE.

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use Communication servers.