linkedin-mcp-server

linkedin-mcp-server

Enables Claude Desktop to manage your LinkedIn profile and company pages, including posting, reading posts, and fetching profile information.

Category
访问服务器

README

LinkedIn MCP Server

A Model Context Protocol (MCP) server that enables Claude Desktop to interact with your LinkedIn profile and company pages. Connect your LinkedIn account to Claude AI and manage your professional presence directly through conversations.

🎯 Features

✅ Fully Supported (Standard API Access)

Personal Profile

  • Fetch your profile information
  • Create and publish posts
  • Read your posts
  • Delete posts

Company Pages

  • Publish posts on behalf of your company page
  • Read company page information
  • Get company posts

⚠️ Limited or Requires Special Access

Company Analytics

  • ⚠️ Requires Marketing Developer Platform access
  • Not available with standard API permissions

Job Search

  • ❌ LinkedIn deprecated the public job search API
  • Feature code exists but is not functional

Messaging

  • ❌ Requires additional LinkedIn API permissions
  • Not available with standard API access
  • Feature code exists but is not functional

🚀 Quick Start

Prerequisites

  1. Node.js 18+ installed on your system
  2. A LinkedIn application - Create one here
  3. Claude Desktop - Download here

Installation Steps

1. Clone and install dependencies

git clone <your-repo-url>
cd linkedin-mcp-server
npm install

2. Create a LinkedIn Application

  1. Go to LinkedIn Developers
  2. Create a new app with these settings:
    • App name: Choose any name (e.g., "My LinkedIn MCP Server")
    • LinkedIn Page: Select your company page or create one
    • App logo: Optional
  3. In the Auth tab:
    • Add redirect URL: http://localhost:3000/auth/callback
    • Copy your Client ID and Client Secret
  4. In the Products tab, request access to:
    • "Sign In with LinkedIn using OpenID Connect"
    • "Share on LinkedIn"

3. Configure environment variables

cp .env.example .env

Edit .env and add your credentials:

LINKEDIN_CLIENT_ID=your_client_id_here
LINKEDIN_CLIENT_SECRET=your_client_secret_here
LINKEDIN_REDIRECT_URI=http://localhost:3000/auth/callback
LINKEDIN_COMPANY_ID=your_company_id_here  # Optional, for company page features

4. Build the project

npm run build

5. Authenticate with LinkedIn (one-time setup)

npm start

This step is only needed once to obtain your LinkedIn OAuth token:

  • Starts a temporary HTTP server on port 3000
  • Opens your browser to LinkedIn authentication
  • Saves your access tokens to ~/.linkedin-mcp-tokens.json (in your home directory)
  • The server will automatically close after authentication

Note: After this initial authentication, you don't need to run npm start again. Claude Desktop will use the saved token automatically.

🔧 Claude Desktop Configuration

After building and authenticating, configure Claude Desktop to use your MCP server:

Add this configuration to your Claude Desktop config file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "linkedin": {
      "command": "node",
      "args": [
        "/ABSOLUTE/PATH/TO/linkedin-mcp-server/dist/index.js"
      ]
    }
  }
}

Important: Replace /ABSOLUTE/PATH/TO/linkedin-mcp-server with the actual path to your project directory.

To get the absolute path:

# On macOS/Linux
pwd

# On Windows (PowerShell)
Get-Location

Then restart Claude Desktop completely (quit and reopen).

How it works: Claude Desktop will automatically launch the MCP server (via dist/index.js) when needed. You don't need to run npm start - that was only for the initial OAuth authentication.

🎯 Usage

Once configured, you can ask Claude Desktop:

Personal Profile

"Get my LinkedIn profile information"
"Show me my LinkedIn profile"

Publishing Posts

"Post on LinkedIn: Just learned about MCP servers, amazing technology!"
"Show me my last 5 LinkedIn posts"
"Delete my last LinkedIn post"

Company Page (if configured)

"Post on my company page: We're hiring a Senior Developer!"
"Show posts from my company page"
"Get information about my company page"

Note: Job search and messaging features are not available with standard LinkedIn API access. See the Features section for details.

🏢 Getting Your Company ID (Optional)

To publish on your company page, you need to find your Company ID:

Method 1: Use the provided script

npm run get-company-id

This will authenticate and show all company pages you administrate.

Method 2: From LinkedIn URL

  1. Go to your company page on LinkedIn
  2. Look at the URL: linkedin.com/company/your-company-name/
  3. Use browser developer tools to find the numeric ID in the page source

Add the Company ID to your .env file:

LINKEDIN_COMPANY_ID=123456789

Note: You must be an administrator of the company page to post on its behalf.

📁 Project Architecture

Built with Clean Architecture principles:

src/
├── domain/              # Business entities
│   ├── entities/       # LinkedIn entities
│   └── interfaces/     # Contracts & interfaces
├── application/        # Use cases
│   └── use-cases/     # Business logic
├── infrastructure/     # External services
│   ├── linkedin/      # LinkedIn API client
│   └── storage/       # Token storage
├── presentation/       # MCP layer
│   └── tools/         # Exposed MCP tools
└── index.ts           # Entry point

🔐 Security

  • ⚠️ NEVER commit your .env file
  • ⚠️ OAuth tokens are stored locally in ~/.linkedin-mcp-tokens.json (in your home directory)
  • ⚠️ Keep .env in .gitignore
  • ⚠️ Tokens are automatically refreshed when needed
  • ⚠️ You can customize the token storage path with the TOKEN_STORAGE_PATH environment variable

🛠️ Development

# Build TypeScript (required before using with Claude Desktop)
npm run build

# Development mode with auto-reload (for testing changes)
npm run dev

# Authenticate with LinkedIn (one-time setup only)
npm start

# Get your company ID (for posting on company pages)
npm run get-company-id

Important:

  • npm run build is required before using the MCP server with Claude Desktop
  • npm start is only needed once for OAuth authentication
  • After authentication, Claude Desktop launches the server automatically via the config file

📚 Resources

🐛 Troubleshooting

"Invalid environment variables"

Check that your .env file contains valid values (not placeholders like your_client_id_here)

"Authentication failed"

  1. Verify your Redirect URI matches exactly: http://localhost:3000/auth/callback
  2. Check that you've requested access to required Products in LinkedIn Developer Portal
  3. Delete ~/.linkedin-mcp-tokens.json and try authenticating again

MCP server not starting in Claude Desktop

  1. Verify the path in claude_desktop_config.json is absolute and correct
  2. Ensure npm run build completed successfully
  3. Check Claude Desktop logs:
    • macOS: ~/Library/Logs/Claude/mcp*.log
    • Windows: %APPDATA%\Claude\logs\mcp*.log

"Company not found"

Make sure you're an administrator of the company page on LinkedIn

"Failed to retrieve LinkedIn posts" or rate limit errors

LinkedIn API has strict rate limits and restrictions:

  • Personal posts (get_my_posts): May be limited or require additional permissions
  • Company posts (get_company_posts): May require Marketing Developer Platform access
  • Try reducing the number of posts requested (use a smaller limit)
  • Check your LinkedIn app's permissions and products in the Developer Portal
  • Some endpoints may not be available with standard API access

MCP protocol errors or "broken pipe"

If you see errors in Claude Desktop logs about the MCP protocol:

  • This has been fixed in recent versions - ensure you have the latest code
  • All logging now goes to stderr (not stdout) to avoid interfering with the MCP protocol
  • Restart Claude Desktop after updating

📝 License

MIT

👤 Author

Created with ❤️ by Grégory Dernaucourt

🤝 Contributing

Contributions, issues, and feature requests are welcome!

⭐ Show your support

Give a ⭐️ if this project helped you connect your LinkedIn to Claude AI!

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选