An MCP Server for Linkedin API
claude mcp add --transport stdio fredericbarthelet-linkedin-mcp-server node server.js \ --env PORT="3001" \ --env JWT_SECRET="Your random secret string for JWT signing" \ --env LINKEDIN_CLIENT_ID="Your LinkedIn Client ID" \ --env LINKEDIN_REDIRECT_URI="http://localhost:3001/callback" \ --env LINKEDIN_CLIENT_SECRET="Your LinkedIn Client Secret"
How to use
This MCP server exposes tools to interact with LinkedIn's Community Management API. It uses the MCP over HTTP with SSE transport, enabling real-time stream-based communication with clients. The server implements the draft Third-Party Authorization Flow to delegate OAuth authorization to LinkedIn, so you can authorize and obtain access tokens to manage LinkedIn content programmatically. The available tools let you fetch information about the currently authenticated user and create new posts on LinkedIn. Use an MCP client to connect to the server’s /sse endpoint and subscribe to the data streams, then invoke the tools by sending the appropriate MCP messages (e.g., for user-info and create-post) as defined by the MCP protocol.
To begin, configure your MCP client to point at the server’s SSE endpoint (for example http://localhost:3001/sse). You’ll need to complete the LinkedIn OAuth flow so the server can obtain and refresh access tokens on your behalf. Once authorized, you can call:
- user-info to retrieve the current user’s name, headline, and profile picture.
- create-post to publish a new post on LinkedIn on your behalf. The server handles the authorization flow, so you don’t need to manage OAuth details in your client besides the initial consent.
How to install
Prerequisites:
- Node.js 22 (LTS)
- pnpm 10
- A LinkedIn Developer Client with Community Management API access and a redirect URI of http://localhost:3001/callback
Install and run locally:
# Install dependencies
pnpm install
# Create and configure environment
cp .env.template .env
# Edit .env to provide LinkedIn credentials and a random JWT secret
vi .env
# Start the server
pnpm run dev
Configure your MCP client to connect to this server after it’s running, for example by using:
{
"mcpServers": {
"linkedin": {
"url": "http://localhost:3001/sse"
}
}
}
Debugging tips:
- Run the MCP Inspector to trace messages:
pnpm run inspectorand open http://localhost:5173 - Ensure your LinkedIn app has the correct redirect URI registered and that the environment variables are set before starting the server.
Additional notes
Notes and tips:
- The Third-Party Authorization Flow is currently in draft; ensure you’re testing in a compatible environment and be prepared for potential changes in the authorization flow.
- JWT_SECRET must be a strong random string; never expose it publicly.
- The server assumes a local callback at http://localhost:3001/callback; update LINKEDIN_REDIRECT_URI if you run the server on a different host/port.
- If you encounter CORS or redirect issues during OAuth, verify that the LinkedIn app settings include http://localhost:3001/callback as an authorized redirect URL.
- When running behind a reverse proxy, ensure the forwarded host/port are correctly conveyed to the MCP server for token exchange and callback handling.
Related MCP Servers
iterm
A Model Context Protocol server that executes commands in the current iTerm session - useful for REPL and CLI assistance
mcp
Octopus Deploy Official MCP Server
furi
CLI & API for MCP management
editor
MCP Server for Phaser Editor
DoorDash
MCP server from JordanDalton/DoorDash-MCP-Server
mcp
MCP сервер для автоматического создания и развертывания приложений в Timeweb Cloud