LinkedIn Competitor Analysis MCP Server
Enables users to monitor and analyze competitor LinkedIn posts, extract insights, generate original post concepts, and create graphics-ready content with metadata.
README
LinkedIn Competitor Analysis MCP Server
Overview
A Model Context Protocol (MCP) server that helps you:
- š Monitor and analyze competitor LinkedIn posts
- š” Extract insights and trending ideas
- āļø Generate original post concepts for your company
- šØ Create graphics-ready content with metadata
Features
- Competitor Post Tracking: Fetch and store LinkedIn posts from competitor accounts
- AI-Powered Analysis: Analyze engagement, themes, and content strategies
- Content Generation: Create original post ideas inspired by competitor insights
- Graphics Integration: Export post concepts with metadata for design tools
- Trend Detection: Identify trending topics and content patterns
Tech Stack
- Language: Python 3.10+
- Framework: FastAPI
- LLM Integration: Anthropic Claude API
- LinkedIn API: Official LinkedIn REST APIs
- Database: PostgreSQL (optional, with SQLAlchemy)
- Task Queue: Celery (for async processing)
Project Structure
linkedin-mcp-server/
āāā app/
ā āāā __init__.py
ā āāā main.py # FastAPI application
ā āāā config.py # Configuration & environment
ā āāā auth/
ā ā āāā __init__.py
ā ā āāā linkedin_auth.py # LinkedIn OAuth2 flow
ā āāā services/
ā ā āāā __init__.py
ā ā āāā linkedin_service.py # LinkedIn API interactions
ā ā āāā analysis_service.py # AI analysis of posts
ā ā āāā content_service.py # Post generation & formatting
ā āāā models/
ā ā āāā __init__.py
ā ā āāā schemas.py # Pydantic models
ā āāā routes/
ā ā āāā __init__.py
ā ā āāā competitors.py # Competitor tracking
ā ā āāā posts.py # Post analysis
ā ā āāā generation.py # Content generation
ā āāā utils/
ā āāā __init__.py
ā āāā logger.py
āāā tests/
ā āāā __init__.py
ā āāā test_linkedin.py
ā āāā test_analysis.py
āāā .env.example
āāā requirements.txt
āāā docker-compose.yml
āāā Dockerfile
āāā README.md
Setup Instructions
Prerequisites
- Python 3.10+
- LinkedIn Developer Account (https://www.linkedin.com/developers/)
- Anthropic API Key (https://console.anthropic.com/)
- PostgreSQL (optional)
1. Clone & Install
git clone https://github.com/satvikjain012-cmyk/linkedin-mcp-server.git
cd linkedin-mcp-server
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
2. Environment Setup
cp .env.example .env
Edit .env with your credentials:
# LinkedIn OAuth
LINKEDIN_CLIENT_ID=your_client_id
LINKEDIN_CLIENT_SECRET=your_client_secret
LINKEDIN_REDIRECT_URI=http://localhost:8000/auth/callback
# Anthropic
ANTHROPIC_API_KEY=your_api_key
# Database (optional)
DATABASE_URL=postgresql://user:password@localhost/linkedin_mcp
# Server
SERVER_HOST=0.0.0.0
SERVER_PORT=8000
3. Run the Server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
Server will be available at http://localhost:8000
API Endpoints
Authentication
GET /auth/linkedin- Initiate LinkedIn OAuth flowGET /auth/callback- OAuth callback handlerPOST /auth/logout- Logout and revoke token
Competitors
POST /competitors- Add competitor to trackGET /competitors- List tracked competitorsDELETE /competitors/{id}- Remove competitor
Posts
GET /posts/competitor/{competitor_id}- Fetch competitor's recent postsPOST /posts/analyze- Analyze a post or set of postsGET /posts/trending- Get trending topics from competitor posts
Content Generation
POST /generate/post-idea- Generate original post based on competitorsPOST /generate/with-graphics-brief- Generate post with graphics specificationsGET /generate/history- View generation history
Usage Example
1. Add Competitors to Track
curl -X POST http://localhost:8000/competitors \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {token}" \
-d '{
"name": "Competitor Name",
"linkedin_url": "https://www.linkedin.com/company/competitor",
"industry": "Tech"
}'
2. Fetch & Analyze Their Posts
curl -X GET http://localhost:8000/posts/competitor/1 \
-H "Authorization: Bearer {token}"
3. Generate Original Content
curl -X POST http://localhost:8000/generate/post-idea \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {token}" \
-d '{
"competitor_ids": [1, 2, 3],
"topics": ["AI", "automation"],
"tone": "professional",
"company_context": "Our company specializes in..."
}'
4. Generate Post with Graphics Metadata
curl -X POST http://localhost:8000/generate/with-graphics-brief \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {token}" \
-d '{
"post_idea": "generated_post_id",
"design_preferences": {
"colors": ["#FF6B6B", "#4ECDC4"],
"style": "modern",
"include_stats": true
}
}'
Workflow
1. Authenticate with LinkedIn OAuth
ā
2. Add competitors you want to track
ā
3. Fetch their recent posts (manual or auto-sync)
ā
4. AI analyzes posts for:
- Engagement patterns
- Content themes
- Trending topics
- Audience sentiment
ā
5. Generate original post ideas inspired by insights
ā
6. Export with graphics specifications (colors, layout, stats)
ā
7. Share with design team or graphics tool
Configuration
See config.py for all available settings:
- API rate limiting
- Cache expiration
- LLM model selection
- Post analysis depth
Contributing
Pull requests welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a PR with tests
License
MIT
Support
For issues or questions, open a GitHub issue or contact the maintainer.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.