YouTube Trending MCP Server
Collect YouTube trending videos without web scraping via yt-dlp MCP server. No API keys required, supports category filtering and daily rankings.
README
YouTube Trending MCP Server
Collect trending YouTube videos without web scraping! This MCP server provides stable, API-based YouTube data collection using yt-dlp. No web scraping, no API keys required, no quotas!
Features
- No Web Scraping - Uses yt-dlp's stable API access
- No API Keys - Completely free forever
- No Quotas - Unlimited data collection
- Category Filtering - Any topic: Music, Gaming, Cooking, Tech, etc.
- Daily Rankings - Track trending videos over time
- RSS Fallback - Alternative data source
- SQLite Storage - Built-in database support
Installation
pip install youtube-trending-mcp
Or install from source:
git clone https://github.com/AIKONG2024/youtube-trending-mcp.git
cd youtube-trending-mcp
pip install -e .
Quick Start
Claude Code
Add to your MCP config:
{
"mcpServers": {
"youtube-trending": {
"command": "python",
"args": ["-m", "youtube_trending_mcp"],
"env": {
"DATA_DIR": "/path/to/data"
}
}
}
}
Cursor
Add to ~/.cursor/mcp.json:
{
"mcpServers": {
"youtube-trending": {
"command": "python",
"args": ["-m", "youtube_trending_mcp"]
}
}
}
OpenAI Codex
{
"mcpServers": {
"youtube-trending": {
"command": "python",
"args": ["-m", "youtube_trending_mcp"],
"env": {
"DATA_DIR": "./data"
}
}
}
}
LLM Tool Reference
Tools Overview
| Tool | Description |
|---|---|
search_trending_videos |
Search trending videos by category |
search_custom_videos |
Search any topic with custom query |
get_video_metadata |
Get detailed metadata for a video |
collect_daily_ranking |
Collect and save daily rankings |
get_youtube_rss_feed |
Fetch RSS feed from channel/playlist |
filter_videos |
Filter videos by views, likes, duration |
search_trending_videos
Parameters:
category: string (default: "all") - "all", "pets", "music", "gaming", "entertainment", or any topic
max_results: int (default: 20, range: 1-100)
region: string (default: "US") - Country code
Returns: { success, count, category, videos: [VideoObject] }
search_custom_videos
Parameters:
query: string (required) - Any search term
max_results: int (default: 20)
min_views: int (default: 0) - Filter by minimum views
sort_by: string (default: "relevance") - "relevance", "views", "date"
Returns: { success, query, count, videos: [VideoObject] }
get_video_metadata
Parameters:
video_id: string (required) - YouTube video ID (11 chars)
Returns: { success, video: VideoObject }
collect_daily_ranking
Parameters:
category: string (default: "all")
max_results: int (default: 50)
save_to_db: bool (default: true)
save_to_json: bool (default: true)
Returns: { success, count, output_paths: [...] }
get_youtube_rss_feed
Parameters:
channel_id: string - Channel ID (starts with "UC...")
playlist_id: string - Playlist ID
(At least one required)
Returns: { success, count, feed_type, videos: [VideoObject] }
filter_videos
Parameters:
videos: array (required) - List of VideoObjects
min_views: int - Minimum view count
min_likes: int - Minimum like count
max_duration: int - Max duration in seconds
exclude_keywords: array - Keywords to exclude
Returns: { success, original_count, filtered_count, videos: [VideoObject] }
VideoObject Schema
{
"video_id": "dQw4w9WgXcQ",
"title": "Video Title",
"channel": "Channel Name",
"channel_id": "UCuAXFkgsw1L7xaCfnd5JJOw",
"views": 1500000000,
"likes": 16000000,
"upload_date": "20091025",
"duration": 212,
"description": "Description (max 1000 chars)",
"categories": ["Music"],
"tags": ["tag1", "tag2"],
"thumbnail": "https://i.ytimg.com/vi/.../maxresdefault.jpg",
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
Common Workflows
# Find popular videos on any topic
search_custom_videos(query="machine learning", max_results=30, sort_by="views")
# Get trending by category
search_trending_videos(category="gaming", max_results=50, region="KR")
# Filter results
videos = search_custom_videos(query="cooking", max_results=100)
filter_videos(videos=videos, min_views=50000, max_duration=600)
# Save daily rankings
collect_daily_ranking(category="music", max_results=100)
Notes
- Video IDs: 11 characters (e.g.,
dQw4w9WgXcQ) - Channel IDs: Start with
UC+ 22 characters - Duration: In seconds
- Upload date:
YYYYMMDDformat
Why yt-dlp Instead of Web Scraping?
| Web Scraping | yt-dlp Approach |
|---|---|
| Requires Playwright (heavy) | No browser needed |
| Breaks with site changes | Stable internal APIs |
| Anti-bot protection issues | Community maintained (143k+ stars) |
| Legal concerns (ToS) | Weekly updates |
| High maintenance | Reliable & fast |
Development
git clone https://github.com/AIKONG2024/youtube-trending-mcp.git
cd youtube-trending-mcp
pip install -e ".[dev]"
pytest tests/ -v
Related Projects
- yt-dlp-mcp - Download videos and transcripts via MCP
License
MIT License - see LICENSE file for details.
Made with love by AIKONG2024
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。