| .. | ||
| pyproject.toml | ||
| README.md | ||
| server.py | ||
| setup.sh | ||
Social Media MCP Server
A Model Context Protocol (MCP) server for obtaining media content from YouTube, LinkedIn, Facebook, and Instagram.
Features
YouTube (5 tools)
youtube_get_video_info- Get video metadata (title, description, views, likes)youtube_get_transcript- Extract subtitles/transcripts using yt-dlpyoutube_search_videos- Search for videosyoutube_get_channel_info- Get channel informationyoutube_get_channel_videos- Get recent videos from a channel
LinkedIn (4 tools)
linkedin_get_profile- Scrape LinkedIn profile (unofficial API)linkedin_get_company- Get company page infolinkedin_search_jobs- Search job listingslinkedin_get_feed_posts- Get posts from your feed
Warning
: LinkedIn tools use unofficial methods and may violate LinkedIn's Terms of Service.
Facebook (4 tools)
facebook_get_page_posts- Get posts from a Facebook Pagefacebook_get_post_comments- Get comments on a postfacebook_post_to_page- Publish a post to a Pagefacebook_reply_to_comment- Reply to comments
Instagram (5 tools)
instagram_get_profile_info- Get Business profile infoinstagram_get_media_posts- Get recent media postsinstagram_get_media_insights- Get post analyticsinstagram_publish_media- Publish imagesinstagram_get_comments- Get comments on posts
Note
: Instagram tools require a Business Account connected to Facebook.
Installation
Quick Setup
# Navigate to the server directory
cd mcp_servers/social_media
# Run the setup script
./setup.sh
Manual Installation
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -e .
# Install yt-dlp (for YouTube transcripts)
brew install yt-dlp # macOS
# or
pip install yt-dlp
Configuration
Create a .env file or set environment variables:
# YouTube (optional - falls back to yt-dlp)
YOUTUBE_API_KEY=your_youtube_api_key
# LinkedIn (choose one method)
LINKEDIN_COOKIE=your_li_at_cookie_value
# or
LINKEDIN_EMAIL=your_email
LINKEDIN_PASSWORD=your_password
# Facebook
FACEBOOK_ACCESS_TOKEN=your_page_access_token
FACEBOOK_PAGE_ID=your_page_id
# Instagram
INSTAGRAM_ACCESS_TOKEN=your_instagram_access_token
INSTAGRAM_BUSINESS_ACCOUNT_ID=your_business_account_id
Getting API Credentials
YouTube API Key
- Go to Google Cloud Console
- Create a new project (or select existing)
- Enable "YouTube Data API v3"
- Create credentials → API Key
- Copy the API key
LinkedIn Cookie (li_at)
- Log into LinkedIn in your browser
- Open Developer Tools (F12)
- Go to Application → Cookies → linkedin.com
- Find the
li_atcookie and copy its value
Facebook Page Access Token
- Go to Facebook Developer Console
- Create an App (Business type)
- Add "Facebook Login" and "Pages API" products
- Generate a Page Access Token with permissions:
pages_show_listpages_read_engagementpages_manage_posts(for posting)pages_manage_comments(for replying)
Instagram Business Account
- Convert your Instagram account to a Business Account
- Connect it to a Facebook Page
- Use the Facebook Graph API to get your Instagram Business Account ID
- Generate an access token with permissions:
instagram_basicinstagram_content_publish(for posting)instagram_manage_commentsinstagram_manage_insights
Usage with OpenCode
Add to your OpenCode configuration (.opencode/config.json):
{
"mcpServers": {
"social-media": {
"command": "uv",
"args": [
"--directory",
"/path/to/glam/mcp_servers/social_media",
"run",
"python",
"server.py"
],
"env": {
"YOUTUBE_API_KEY": "your_key",
"LINKEDIN_COOKIE": "your_cookie",
"FACEBOOK_ACCESS_TOKEN": "your_token",
"FACEBOOK_PAGE_ID": "your_page_id",
"INSTAGRAM_ACCESS_TOKEN": "your_token",
"INSTAGRAM_BUSINESS_ACCOUNT_ID": "your_account_id"
}
}
}
}
Usage with Claude Desktop
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"social-media": {
"command": "/path/to/glam/mcp_servers/social_media/.venv/bin/python",
"args": ["/path/to/glam/mcp_servers/social_media/server.py"],
"env": {
"YOUTUBE_API_KEY": "your_key"
}
}
}
}
Examples
Get YouTube Video Info
Get info about this YouTube video: https://www.youtube.com/watch?v=dQw4w9WgXcQ
Get Video Transcript
Get the transcript of this video: dQw4w9WgXcQ
Search LinkedIn Jobs
Search for software engineer jobs in San Francisco
Get Instagram Posts
Get my recent Instagram posts
API Methods Used
| Platform | Method | Authentication |
|---|---|---|
| YouTube | YouTube Data API v3 | API Key |
| YouTube | yt-dlp (fallback) | None |
| Voyager API (unofficial) | Session Cookie | |
| Graph API | Page Access Token | |
| Graph API (via Facebook) | Access Token |
Rate Limits
- YouTube: 10,000 quota units/day (search costs 100, video info costs 1)
- LinkedIn: Unofficial API - use sparingly to avoid account restrictions
- Facebook/Instagram: 200 calls/user/hour for most endpoints
Troubleshooting
YouTube: "API key not configured"
- Set
YOUTUBE_API_KEYor installyt-dlpfor fallback
LinkedIn: "Session expired"
- Get a fresh
li_atcookie from your browser
Facebook/Instagram: "Invalid access token"
- Tokens expire after ~60 days; generate a new one
yt-dlp: "Command not found"
brew install yt-dlp # macOS
pip install yt-dlp # All platforms
License
MIT License - See project root for details.
References
This server was built by studying these open-source MCP implementations: