Skip to main content

Model Context Protocol (MCP) server for LinkedIn - enabling AI agents to interact with LinkedIn's professional network

Project description

LinkedIn MCP Server

PyPI version Python 3.10+ License: MIT

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

  1. Visit LinkedIn Developer Portal
  2. Create a new app
  3. Request access to:
    • "Sign In with LinkedIn using OpenID Connect"
    • "Share on LinkedIn"
  4. Add redirect URL: http://localhost:8000
  5. Note your Client ID and Client 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

  1. In Claude Desktop, ask: "Generate LinkedIn login URL"
  2. Open the provided URL in your browser
  3. Authorize the application
  4. Copy the code parameter from the redirect URL
  5. 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:

  1. Check .env file exists with correct credentials
  2. Verify LINKEDIN_CLIENT_ID and LINKEDIN_CLIENT_SECRET are set
  3. 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 .env files 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:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Credits

Built with:

Author

SARAM ALI Email: saramali15792@gmail.com GitHub: @SARAMALI15792


Made with โค๏ธ for the AI and LinkedIn communities

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

linkedin_mcp_server-1.0.0.tar.gz (138.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linkedin_mcp_server-1.0.0-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

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

Hashes for linkedin_mcp_server-1.0.0.tar.gz
Algorithm Hash digest
SHA256 73e0687a47f03810112644fa393884497743da93067bda9c5fdf15f18519721f
MD5 c8adcf992437804f6acdfa6bba8a8f29
BLAKE2b-256 4d6dda630a54ac3488c1e5da49b35c372561743c5ac75846fd5d9735dd42822f

See more details on using hashes here.

File details

Details for the file linkedin_mcp_server-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for linkedin_mcp_server-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b6c0e76747a8e516afb6929eff1c9061d2672209df7555e70eaf73e5a7fe753b
MD5 7c3922b15894f92b059bf2187a418d01
BLAKE2b-256 d2d88a30f874479d146a8a5fd19c005170f6240d982e3e55ecf9572829074cef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page