Content
# LinkedIn Automation MCP Server
A complete end-to-end Model Context Protocol (MCP) server for LinkedIn automation tasks. This server provides tools for automating various LinkedIn activities including login, search, connection requests, messaging, posting, and data extraction.
## Features
- **Authentication**: Secure LinkedIn login with session management
- **People Search**: Search for LinkedIn users with various filters
- **Connection Management**: Send connection requests with custom messages
- **Messaging**: Send direct messages to connections
- **Content Creation**: Create and publish LinkedIn posts
- **Engagement**: Like and comment on posts
- **Data Extraction**: Extract profile and company information
- **Rate Limiting**: Built-in rate limiting to avoid detection
- **Error Handling**: Comprehensive error handling and logging
## Installation
### Prerequisites
- Python 3.8 or higher
- Chrome browser installed
- LinkedIn account
### Setup
1. **Clone or download the project files**
2. **Install dependencies**:
```bash
pip install -r requirements.txt
```
3. **Install Chrome WebDriver** (automatically handled by webdriver-manager)
## Usage
### Starting the Server
```bash
python linkedin_mcp_server.py
```
### Available Tools
#### 1. LinkedIn Login
```json
{
"name": "linkedin_login",
"arguments": {
"email": "your-email@example.com",
"password": "your-password",
"headless": false
}
}
```
#### 2. Search People
```json
{
"name": "linkedin_search_people",
"arguments": {
"keywords": "software engineer",
"location": "San Francisco",
"company": "Google",
"max_results": 50
}
}
```
#### 3. Send Connection Request
```json
{
"name": "linkedin_connect_with_person",
"arguments": {
"profile_url": "https://www.linkedin.com/in/username/",
"message": "Hi, I'd like to connect!",
"note": "I saw your profile and thought we could connect."
}
}
```
#### 4. Send Message
```json
{
"name": "linkedin_send_message",
"arguments": {
"profile_url": "https://www.linkedin.com/in/username/",
"message": "Hello! How are you?",
"subject": "Greeting"
}
}
```
#### 5. Create Post
```json
{
"name": "linkedin_post_content",
"arguments": {
"content": "Excited to share my latest project!",
"visibility": "public",
"hashtags": ["automation", "linkedin", "networking"]
}
}
```
#### 6. Like Post
```json
{
"name": "linkedin_like_post",
"arguments": {
"post_url": "https://www.linkedin.com/posts/activity-123"
}
}
```
#### 7. Comment on Post
```json
{
"name": "linkedin_comment_on_post",
"arguments": {
"post_url": "https://www.linkedin.com/posts/activity-123",
"comment": "Great post! Thanks for sharing."
}
}
```
#### 8. Extract Profile Information
```json
{
"name": "linkedin_get_profile_info",
"arguments": {
"profile_url": "https://www.linkedin.com/in/username/"
}
}
```
#### 9. Extract Company Information
```json
{
"name": "linkedin_scrape_company_info",
"arguments": {
"company_url": "https://www.linkedin.com/company/company-name/"
}
}
```
#### 10. Logout
```json
{
"name": "linkedin_logout",
"arguments": {}
}
```
## Configuration
The server uses `config.json` for configuration settings:
- **Browser Settings**: Headless mode, user agent, window size
- **Automation Settings**: Delays, retries, rate limiting
- **LinkedIn URLs**: Various LinkedIn page URLs
- **CSS Selectors**: Element selectors for automation
## Security and Best Practices
### Rate Limiting
- Built-in rate limiting to avoid LinkedIn's detection
- Configurable delays between actions
- Maximum requests per minute setting
### Session Management
- Secure login handling
- Automatic session cleanup on logout
- Browser instance management
### Error Handling
- Comprehensive error catching and reporting
- Graceful failure handling
- Detailed logging for debugging
## Troubleshooting
### Common Issues
1. **Login Failed**
- Check credentials
- Ensure 2FA is disabled or handled
- Try headless mode
2. **Element Not Found**
- LinkedIn may have updated their UI
- Check selectors in config.json
- Add delays between actions
3. **Rate Limiting**
- Reduce request frequency
- Increase delays between actions
- Use headless mode
4. **Browser Issues**
- Update Chrome browser
- Clear browser cache
- Check ChromeDriver compatibility
### Debug Mode
Enable debug logging by modifying the logging level in the code:
```python
logging.basicConfig(level=logging.DEBUG)
```
## Legal and Ethical Considerations
⚠️ **Important**: This tool is for educational and legitimate business purposes only.
- Respect LinkedIn's Terms of Service
- Don't spam or harass users
- Use reasonable delays between actions
- Don't exceed LinkedIn's rate limits
- Respect user privacy and consent
## Contributing
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Submit a pull request
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Support
For issues and questions:
1. Check the troubleshooting section
2. Review the logs for error details
3. Create an issue with detailed information
## Changelog
### Version 1.0.0
- Initial release
- Complete LinkedIn automation functionality
- MCP server implementation
- Comprehensive tool set
- Configuration management
Connection Info
You Might Also Like
cc-switch
All-in-One Assistant for Claude Code, Codex & Gemini CLI across platforms.
awesome-mcp-servers
A collection of MCP servers.
git
A Model Context Protocol server for Git automation and interaction.
oh-my-opencode
Background agents · Curated agents like oracle, librarians, frontend...
TrendRadar
TrendRadar: Your hotspot assistant for real news in just 30 seconds.
Appwrite
Build like a team of hundreds