FarmerBob869/LinkedinMCP
If you are the rightful owner of LinkedinMCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A professional, lightweight MCP (Model Context Protocol) server for LinkedIn automation, designed for developers to enhance their LinkedIn presence through intelligent automation.
linkedin_login
Authenticate with LinkedIn
linkedin_post
Create a text post
linkedin_comment
Comment on a post
linkedin_analyze_trends
Analyze keyword trends
linkedin_status
Get server status
LinkedIn MCP Server
A professional, lightweight MCP (Model Context Protocol) server for LinkedIn automation. Built for developers who want to automate their LinkedIn presence with intelligent posting, community engagement, and trend analysis.
š Features
Core Automation
- Smart Login: Anti-detection browser automation with session persistence
- Content Posting: Text posts with hashtag support
- Community Engagement: Automated commenting on posts
- Trend Analysis: Keyword-based trend monitoring and engagement metrics
Professional Features
- Rate Limiting: Built-in protection against LinkedIn restrictions
- Session Management: Persistent sessions across restarts
- Anti-Detection: Realistic browser fingerprinting and human-like behavior
- Error Handling: Comprehensive error recovery and logging
- File-Based Storage: No external dependencies - everything runs locally
š Requirements
- Python: 3.11 or higher
- Memory: 512MB RAM minimum (1GB recommended)
- Storage: 1GB free space
- OS: Linux, macOS, or Windows
š Quick Start
1. Installation
# Clone the repository
git clone https://github.com/your-username/linkedin-mcp-server.git
cd linkedin-mcp-server
# Install dependencies
pip install -r requirements.txt
# Install Playwright browser
playwright install chromium
2. Configuration
# Copy environment template
cp .env.example .env
# Edit configuration (optional)
nano .env
3. Run the Server
# Direct execution
python -m src.linkedin_mcp_server.main
# Or with Docker
docker-compose up -d
šÆ Usage Examples
Basic MCP Client Usage
import asyncio
from mcp_client import MCPClient
async def main():
client = MCPClient("linkedin-mcp-server")
# Login to LinkedIn
await client.call_tool("linkedin_login", {
"email": "your-email@example.com",
"password": "your-password"
})
# Create a post
await client.call_tool("linkedin_post", {
"content": "š Just deployed my new FastAPI service with 40% better performance!",
"hashtags": ["FastAPI", "Python", "Performance", "Backend"]
})
# Analyze trends
trends = await client.call_tool("linkedin_analyze_trends", {
"keyword": "Python",
"max_posts": 20
})
print(trends)
if __name__ == "__main__":
asyncio.run(main())
Available Tools
Tool | Description | Parameters |
---|---|---|
linkedin_login | Authenticate with LinkedIn | email , password |
linkedin_post | Create a text post | content , hashtags (optional) |
linkedin_comment | Comment on a post | post_url , comment |
linkedin_analyze_trends | Analyze keyword trends | keyword , max_posts (optional) |
linkedin_status | Get server status | None |
āļø Configuration
Environment Variables
# Application Settings
LOG_LEVEL=INFO # Logging level
HEADLESS=true # Run browser in headless mode
DATA_DIR=./data # Data storage directory
# Rate Limiting (per hour)
RATE_LIMIT_POSTS=10 # Maximum posts per hour
RATE_LIMIT_COMMENTS=20 # Maximum comments per hour
RATE_LIMIT_SEARCHES=15 # Maximum searches per hour
# Browser Settings
BROWSER_TIMEOUT=30000 # Browser timeout in milliseconds
Rate Limiting
The server includes built-in rate limiting to comply with LinkedIn's usage policies:
- Posts: 10 per hour (default)
- Comments: 20 per hour (default)
- Searches: 15 per hour (default)
- Login Attempts: 3 per hour (default)
These limits reset every hour and are stored locally in files.
š³ Docker Deployment
Quick Deploy
# Build and run
docker-compose up -d
# View logs
docker-compose logs -f
# Stop
docker-compose down
Production Deployment
# Set environment variables
export LOG_LEVEL=WARNING
export RATE_LIMIT_POSTS=8
# Deploy with custom settings
docker-compose up -d
š Monitoring
Health Checks
# Check server status
curl -X POST localhost:8080 -d '{"tool": "linkedin_status", "arguments": {}}'
# View logs
tail -f logs/linkedin_mcp.log
# Monitor container resources
docker stats linkedin-mcp-server
Status Response
{
"server": "linkedin-mcp-server",
"version": "1.0.0",
"status": "healthy",
"logged_in": true,
"rate_limits": {
"post": 8,
"comment": 18,
"search": 12
},
"timestamp": "2024-01-15T10:30:00Z"
}
š Security Features
Anti-Detection
- Realistic user agents and browser fingerprinting
- Human-like typing delays and mouse movements
- Random delays between actions
- Proper browser context management
Data Protection
- Local file-based storage (no external databases)
- Session data encryption
- No credential logging
- Automatic cleanup of temporary data
Rate Limiting
- Hourly limits on all actions
- Automatic throttling
- LinkedIn ToS compliance
- Graceful degradation
šļø Architecture
linkedin-mcp-server/
āāā src/linkedin_mcp_server/
ā āāā main.py # MCP server implementation
ā āāā config.py # Configuration management
ā āāā models.py # Data models
ā āāā storage.py # File-based storage
ā āāā rate_limiter.py # Rate limiting logic
ā āāā browser.py # Browser management
ā āāā linkedin_client.py # LinkedIn automation
ā āāā utils.py # Utility functions
āāā data/ # Session and rate limit data
āāā logs/ # Application logs
āāā requirements.txt # Python dependencies
āāā Dockerfile # Container configuration
āāā docker-compose.yml # Service orchestration
š Performance
Resource Usage
- Memory: ~200-400MB during operation
- CPU: Low usage, spikes during browser operations
- Storage: ~50MB for application, variable for data
- Network: Minimal, only LinkedIn requests
Optimization Features
- Lazy browser initialization
- Efficient session management
- Memory-conscious data structures
- Automatic resource cleanup
š¤ Contributing
- 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
Development Guidelines
- Follow PEP 8 style guide
- Add type hints to all functions
- Write tests for new features
- Update documentation as needed
š License
This project is licensed under the MIT License - see the file for details.
ā ļø Disclaimer
This tool is for educational and personal use only. Users are responsible for complying with LinkedIn's Terms of Service and applicable laws. The authors are not responsible for any misuse or consequences resulting from the use of this software.
š Support
- Issues: GitHub Issues
- Documentation:
- Discussions: GitHub Discussions
š Acknowledgments
- MCP Protocol: Model Context Protocol
- Playwright: Microsoft Playwright
- LinkedIn: For providing the platform (use responsibly!)
Built with ā¤ļø for the developer community