Get the FREE Ultimate OpenClaw Setup Guide →

linkedin

A comprehensive Model Context Protocol (MCP) server for LinkedIn API - manage profiles, posts, connections, skills, education, certifications, and more through AI agents

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio pegasusheavy-linkedin-mcp npx -y @pegasusheavy/linkedin-mcp \
  --env LINKEDIN_CLIENT_ID="your_client_id_here" \
  --env LINKEDIN_CLIENT_SECRET="your_client_secret_here"

How to use

This LinkedIn MCP server provides a comprehensive integration with the LinkedIn API, enabling AI agents to manage profiles, create and fetch posts with engagement metrics, handle connections, and search for people. It supports OpenID Connect authentication via LinkedIn, with in-session token caching and automatic token refresh. Use it as an MCP backend to empower tools like Claude, ChatGPT, or your own agents to interact with LinkedIn data through a structured set of tools such as profile management, posting, and network management. The server is built with TypeScript, uses strict type checking, and includes a robust test suite to validate input and behavior. To get started, configure your MCP client to pass environment variables for OAuth credentials or an existing access token, then run the MCP server through the recommended command (npx -y @pegasusheavy/linkedin-mcp) in your MCP client configuration.

Once running, you can authorize the application in your browser (for OAuth flows) the first time you use LinkedIn tools. The token is kept in memory for the session and automatically refreshed as needed. Subsequent sessions will require re-authorization, ensuring tokens are never stored on disk. This setup supports both automatic OAuth (recommended) and manual access token usage, giving you flexibility depending on your workflow.

How to install

Prerequisites:

  • Node.js v18.0.0 or higher
  • npm, pnpm, or yarn (as you prefer)
  • A LinkedIn Developer App (Client ID & Client Secret) or an existing access token
  1. Install Node.js if you haven’t already. Visit https://nodejs.org/ and install the LTS release that supports your OS.

  2. Install the MCP package from npm (example shown for a local project; adapt as needed):

# Using npm (recommended if you prefer npm)
npm install @pegasusheavy/linkedin-mcp

# Or using pnpm
pnpm add @pegasusheavy/linkedin-mcp

# Or using yarn
yarn add @pegasusheavy/linkedin-mcp
  1. Prepare your MCP client configuration (example provided in the README).

  2. Run the server through your MCP client configuration. The recommended command is:

npx -y @pegasusheavy/linkedin-mcp
  1. Follow the OAuth flow to authorize the application on first use (if using automatic OAuth). If you prefer to provide an existing token, set LINKEDIN_ACCESS_TOKEN in your mcp.json file as described in the documentation.

  2. Verify installation by invoking LinkedIn-related tools via your MCP client or by checking the server logs for successful authentication and API access.

Additional notes

Tips and notes:

  • Environment variables: you can either use OAuth (CLIENT_ID/CLIENT_SECRET) or supply an existing token via LINKEDIN_ACCESS_TOKEN. You can also adjust LOG_LEVEL for more verbose logs during debugging.
  • Security: tokens are kept in memory for the session and are not written to disk. Each new MCP client session requires re-authorization when using the OAuth flow.
  • Debugging: ensure your LinkedIn app has the necessary products enabled (Sign In with LinkedIn using OpenID Connect and Share on LinkedIn) and that the redirect URI matches the one configured in your app settings.
  • Compatibility: the server uses OpenID Connect and is designed to work with modern MCP SDKs and TypeScript tooling. Ensure your environment uses compatible Node.js versions and package manager versions.
  • Networking: if you are behind a proxy or firewall, ensure outbound access to LinkedIn APIs is allowed and that your redirect URI (default http://localhost:50001/callback) is accessible to the OAuth flow.

Related MCP Servers

Sponsor this space

Reach thousands of developers