Model Context Protocol (MCP) server for LinkedIn - enabling AI agents to interact with LinkedIn's professional network
Project description
LinkedIn MCP Server
Empower your AI agents with professional networking capabilities.
A Model Context Protocol (MCP) server that enables Large Language Models (LLMs) like Claude to interact with LinkedIn's professional network. Built with FastMCP for high performance and reliability.
Features
- ๐ Secure OAuth 2.0 Authentication - Complete OAuth flow implementation
- ๐ Content Management - Create, update, and delete posts with text and images
- ๐ฌ Engagement Tools - Comment on posts and manage interactions
- ๐ฅ Profile Access - Retrieve your profile and member information
- ๐ข Company Intelligence - Search companies and access organization data
- ๐ผ Job Search - Find and explore job opportunities
- ๐ People Search - Discover professionals across LinkedIn
Installation
Using uvx (Recommended)
The easiest way to use the LinkedIn MCP server is with uvx:
uvx linkedin-mcp-server
Using pip
pip install linkedin-mcp-server
From Source
git clone https://github.com/SARAMALI15792/LinkedIn_mcp_custom_server.git
cd LinkedIn_mcp_custom_server
pip install -e .
Quick Start
1. Setup LinkedIn App Credentials
- Visit LinkedIn Developer Portal
- Create a new app
- Request access to:
- "Sign In with LinkedIn using OpenID Connect"
- "Share on LinkedIn"
- Add redirect URL:
http://localhost:8000 - Note your
Client IDandClient Secret
2. Configure Environment
Create a .env file in your working directory:
LINKEDIN_CLIENT_ID=your_client_id
LINKEDIN_CLIENT_SECRET=your_client_secret
LINKEDIN_REDIRECT_URI=http://localhost:8000
3. Configure Claude Desktop
Add to your Claude Desktop config file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"linkedin": {
"command": "uvx",
"args": ["linkedin-mcp-server"]
}
}
}
Alternative with pip installation:
{
"mcpServers": {
"linkedin": {
"command": "linkedin-mcp-server"
}
}
}
4. Authenticate
- In Claude Desktop, ask: "Generate LinkedIn login URL"
- Open the provided URL in your browser
- Authorize the application
- Copy the
codeparameter from the redirect URL - In Claude: "Exchange this code: [PASTE_CODE]"
You're now connected!
Usage Examples
Once authenticated, you can use natural language to interact with LinkedIn:
Creating Content
"Create a LinkedIn post: 'Excited to share my new MCP server project! ๐ #AI #LinkedIn'"
"Post this image with caption 'Team photo from the conference': C:/photos/team.jpg"
Engagement
"Show me comments on my latest post"
"Comment on post urn:li:share:123456789: 'Great insights, thanks for sharing!'"
Profile & Network
"What's my LinkedIn email address?"
"Search for Python developers in San Francisco"
"Get details for company urn:li:organization:1234567"
Job Search
"Find remote Senior Python Developer positions"
"Search for Machine Learning jobs in New York"
"Get details for job urn:li:job:123456789"
Available Tools
| Tool | Description |
|---|---|
linkedin_get_oauth_url |
Generate OAuth 2.0 authorization URL |
linkedin_exchange_code |
Exchange auth code for access token |
linkedin_get_my_profile |
Get authenticated user's profile |
linkedin_get_member_profile |
Get member profile by URN |
linkedin_create_post |
Create text post |
linkedin_create_image_post |
Create post with image |
linkedin_update_post |
Update existing post (recreates) |
linkedin_delete_post |
Delete post |
linkedin_get_recent_posts |
List recent posts (restricted) |
linkedin_create_comment |
Comment on content |
linkedin_get_post_comments |
Get comments on post |
linkedin_delete_comment |
Delete comment |
linkedin_get_company_profile |
Get company details |
linkedin_search_companies |
Search for companies |
linkedin_search_jobs |
Search job postings |
linkedin_get_job_details |
Get job details |
linkedin_search_people |
Search for people |
Architecture
linkedin-mcp-server/
โโโ linkedin_mcp_server/
โ โโโ __init__.py # Package initialization
โ โโโ __main__.py # CLI entry point
โ โโโ server.py # Main MCP server with tool definitions
โ โโโ config.py # Configuration management
โ โโโ utils.py # Shared utilities
โ โโโ tools/ # Tool implementations
โ โโโ auth.py # OAuth 2.0 flow
โ โโโ profile.py # Profile operations
โ โโโ post.py # Post & comment operations
โ โโโ company.py # Company operations
โ โโโ job.py # Job search operations
โ โโโ search.py # People search
โโโ pyproject.toml # Package metadata
โโโ README.md # This file
โโโ LICENSE # MIT License
API Permissions & Limitations
Granted Permissions
- โ
openid,profile,email- Basic profile access - โ
w_member_social- Create posts and comments
Restricted Permissions
Many LinkedIn API endpoints require additional permissions that are restricted:
- โ ๏ธ
r_member_social- Read user's posts (often unavailable) - โ ๏ธ People/Company search - May require Marketing API access
- โ ๏ธ Job search - May require Talent Solutions access
These limitations are imposed by LinkedIn, not this MCP server.
Development
Setup Development Environment
git clone https://github.com/SARAMALI15792/LinkedIn_mcp_custom_server.git
cd LinkedIn_mcp_custom_server
pip install -e ".[dev]"
Run Tests
pytest tests/
Code Quality
# Format code
black linkedin_mcp_server/
# Lint
ruff check linkedin_mcp_server/
# Type check
mypy linkedin_mcp_server/
Troubleshooting
Authentication Issues
Problem: "Unauthorized (401)" errors Solution: Your access token may have expired. Re-authenticate using the OAuth flow.
Problem: "Forbidden (403)" errors Solution: Your app lacks required permissions. Check your LinkedIn app settings.
Connection Issues
Problem: Server not starting Solution:
- Check
.envfile exists with correct credentials - Verify
LINKEDIN_CLIENT_IDandLINKEDIN_CLIENT_SECRETare set - Check Claude Desktop config is correct
Permission Errors
Problem: "r_member_social permission required" Solution: This permission is restricted by LinkedIn. Most third-party apps cannot access these endpoints.
Security Best Practices
- โ
Never commit
.envfiles with credentials - โ Use environment variables for sensitive data
- โ Regularly rotate access tokens
- โ Only request minimum required permissions
- โ Use HTTPS for redirect URIs in production
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- ๐ Report bugs: GitHub Issues
- ๐ Documentation: GitHub README
- ๐ฌ Questions: Open a GitHub Discussion
Credits
Built with:
- FastMCP - Fast MCP server framework
- Model Context Protocol - Protocol for LLM integrations
- LinkedIn API - LinkedIn's developer platform
Author
SARAM ALI Email: saramali15792@gmail.com GitHub: @SARAMALI15792
Made with โค๏ธ for the AI and LinkedIn communities
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file linkedin_mcp_server-1.0.0.tar.gz.
File metadata
- Download URL: linkedin_mcp_server-1.0.0.tar.gz
- Upload date:
- Size: 138.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73e0687a47f03810112644fa393884497743da93067bda9c5fdf15f18519721f
|
|
| MD5 |
c8adcf992437804f6acdfa6bba8a8f29
|
|
| BLAKE2b-256 |
4d6dda630a54ac3488c1e5da49b35c372561743c5ac75846fd5d9735dd42822f
|
File details
Details for the file linkedin_mcp_server-1.0.0-py3-none-any.whl.
File metadata
- Download URL: linkedin_mcp_server-1.0.0-py3-none-any.whl
- Upload date:
- Size: 26.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6c0e76747a8e516afb6929eff1c9061d2672209df7555e70eaf73e5a7fe753b
|
|
| MD5 |
7c3922b15894f92b059bf2187a418d01
|
|
| BLAKE2b-256 |
d2d88a30f874479d146a8a5fd19c005170f6240d982e3e55ecf9572829074cef
|