Social Trends MCP
by caicai-yao
README.md
<div align="center">
# ๐ Social Trends MCP
**Real-time trending topics from X, TikTok, YouTube & Instagram โ as an MCP Server**
[](LICENSE)
[](https://python.org)
[](https://modelcontextprotocol.io)
Ask Claude *"What's trending on TikTok right now?"* and get real answers.
[Quick Start](#-quick-start) ยท [MCP Setup](#-mcp-setup) ยท [REST API](#-rest-api) ยท [Docker Deploy](#-docker-deployment) ยท [Contributing](#-contributing)
</div>
---
## What is this?
A social media trends aggregator that works in **two modes**:
1. **MCP Server** โ Plug into Claude Desktop, Cursor, or any MCP client. Ask trending questions in natural language.
2. **REST API** โ Self-hosted API service with auto-refresh every 6 hours, PostgreSQL storage, and WebSocket push.
### Supported Platforms
| Platform | Method | API Key Required? |
|----------|--------|-------------------|
| ๐ฌ YouTube | Data API v3 | โ
Free (10K units/day) |
| ๐ต TikTok | Creative Center API | โ No |
| ๐ฆ X (Twitter) | Web scraping fallback | โ No (API optional, $200/mo) |
| ๐ธ Instagram | Meta Graph API + fallback | โ No (API optional) |
> Every scraper has **multi-level fallback** โ if one method fails, it automatically tries the next.
---
## โก Quick Start
### Use as MCP Server (recommended)
**Claude Desktop** โ Add to `claude_desktop_config.json`:
```json
{
"mcpServers": {
"social-trends": {
"command": "uvx",
"args": ["social-trends-mcp"],
"env": {
"YOUTUBE_API_KEY": "your_youtube_api_key"
}
}
}
}
```
Then just ask:
- *"What's trending on YouTube right now?"*
- *"Show me TikTok trends"*
- *"Is AI trending on any social platform?"*
- *"Give me a full overview of what's trending globally"*
### Install from source
```bash
git clone https://github.com/YOUR_USERNAME/social-trends-mcp.git
cd social-trends-mcp
pip install -e .
python mcp_server.py
```
---
## ๐ง MCP Tools
| Tool | Description |
|------|-------------|
| `get_trends` | Get trending topics from a specific platform (twitter, tiktok, youtube, instagram) |
| `get_all_trends` | Get trends from ALL platforms at once |
| `search_trends` | Search for a keyword across all platform trends |
### Example: `get_trends`
```
Input: { "platform": "youtube", "limit": 10 }
Output: Ranked list of trending videos with view counts and URLs
```
### Example: `search_trends`
```
Input: { "query": "AI" }
Output: All trending topics mentioning "AI" across every platform
```
---
## ๐ REST API
For production use, deploy the full API service with PostgreSQL and auto-refresh.
| Method | Path | Description |
|--------|------|-------------|
| GET | `/api/v1/trends` | All platforms latest data |
| GET | `/api/v1/trends/{platform}` | Single platform trends |
| GET | `/api/v1/trends/history/{platform}` | Historical trends |
| POST | `/api/v1/refresh` | Manual refresh trigger |
| GET | `/api/v1/health` | Service health + stats |
| GET | `/docs` | Interactive Swagger UI |
| WS | `/ws/trends` | WebSocket real-time push |
---
## ๐ณ Docker Deployment
Full production stack in one command:
```bash
git clone https://github.com/YOUR_USERNAME/social-trends-mcp.git
cd social-trends-mcp
cp .env.example .env
# Edit .env โ at minimum set YOUTUBE_API_KEY
docker-compose up -d
```
This starts PostgreSQL + App (4 workers) + Nginx.
---
## โ๏ธ Configuration
| Variable | Required | Description |
|----------|----------|-------------|
| `YOUTUBE_API_KEY` | Recommended | [Get free](https://console.cloud.google.com/apis) โ 10K units/day |
| `TWITTER_BEARER_TOKEN` | Optional | [$200/mo](https://developer.x.com/) โ fallback works without it |
| `INSTAGRAM_ACCESS_TOKEN` | Optional | [Meta Developer](https://developers.facebook.com/) โ fallback works without it |
| `TIKTOK_PROXY` | Optional | Proxy URL if TikTok blocks your IP |
| `SCRAPE_INTERVAL_HOURS` | Optional | Auto-refresh interval (default: 6) |
**Zero-config is possible** โ every platform has fallback scrapers that work without API keys.
---
## ๐ค Contributing
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md).
**Easy wins:** Add a new platform (Threads, Bluesky...), improve scraper quality, add MCP tools, translations.
## ๐ License
[MIT](LICENSE)
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues