youtube-mcp-download
Provides tools to download YouTube videos and playlists asynchronously, with job tracking and metadata storage via a SQLite database, enabling library management through natural language.
README
YouTube Video Downloader
A comprehensive collection of Python tools for downloading YouTube content using yt-dlp, including both simple scripts and an advanced MCP server.
Tools
1. Simple Scripts
Single Video Downloader (youtube_downloader.py)
Downloads individual YouTube videos with progress tracking.
Playlist Downloader (playlist_downloader.py)
Downloads entire YouTube playlists with organization.
2. MCP Server (youtube_mcp_server_fastmcp.py)
An advanced MCP (Model Context Protocol) server using FastMCP that provides:
- Asynchronous video and playlist downloads
- Job tracking and status monitoring
- SQLite database for metadata storage
- Comprehensive library management
- Claude Desktop integration
Features
Simple Scripts
Single Video Downloader
- ✅ Prompts user for YouTube URL
- ✅ Downloads the best quality video available
- ✅ Creates a
downloadsfolder for saved videos - ✅ Shows download progress
- ✅ Handles errors gracefully
- ✅ Auto-installs yt-dlp if not present
- ✅ No pytube dependency (as requested)
Playlist Downloader
- ✅ Prompts user for YouTube playlist URL
- ✅ Downloads entire playlists (up to 50 videos by default)
- ✅ Creates organized folders for each playlist
- ✅ Shows playlist information before downloading
- ✅ Downloads videos with playlist index numbers
- ✅ Auto-installs yt-dlp if not present
- ✅ Confirmation prompt before downloading large playlists
MCP Server Features
- ✅ Asynchronous Downloads: Start downloads and get job IDs for tracking
- ✅ Job Status Monitoring: Check download progress and status
- ✅ Metadata Database: SQLite database with video/playlists info
- ✅ Library Management: Browse all downloaded content
- ✅ Error Handling: Comprehensive error tracking and reporting
- ✅ Concurrent Downloads: Multiple downloads can run simultaneously
- ✅ Rich Metadata: Stores titles, descriptions, duration, file paths, etc.
Requirements
- Python 3.11+
- yt-dlp (automatically installed if missing)
- MCP SDK (automatically installed if missing)
Usage
Single Video Download
-
Run the single video downloader:
python3 youtube_downloader.py -
Enter a YouTube URL when prompted
-
The video will be downloaded to the
downloadsfolder
Playlist Download
-
Run the playlist downloader:
python3 playlist_downloader.py -
Enter a YouTube playlist URL when prompted
-
Review playlist information and confirm download
-
All videos will be downloaded to a playlist-specific folder
MCP Server Usage
The MCP server provides four main tools for asynchronous downloading and library management.
Using with uv (Recommended)
- Install dependencies and run:
cd /Users/granludo/code/testing/youtube_download uv sync uv run python start_server.py
Direct Python Usage
python3 youtube_mcp_server_fastmcp.py
Available MCP Tools
- download_video - Start async video download
- download_playlist - Start async playlist download
- get_download_status - Monitor download progress
- cancel_download - Cancel running downloads
- list_downloads - Browse all download jobs
- get_video_metadata - Get video info without downloading
Examples
Single Video Example
$ python3 youtube_downloader.py
==================================================
YouTube Video Downloader
==================================================
Enter YouTube URL: https://www.youtube.com/watch?v=dQw4w9WgXcQ
📥 Downloading video from: https://www.youtube.com/watch?v=dQw4w9WgXcQ
✓ Download completed!
📁 Files saved to: /path/to/downloads
Playlist Example
$ python3 playlist_downloader.py
==================================================
YouTube Playlist Downloader
==================================================
Enter YouTube Playlist URL: https://www.youtube.com/playlist?list=PLrAXtmRdnEQy5rhxJj7aKre_2qO5yQ5nI
📊 Analyzing playlist...
📋 Playlist name: My Music Playlist
🎥 Number of videos: 25
🔄 Download 25 videos? (y/N): y
📥 Downloading playlist: My Music Playlist
✓ Playlist download completed!
📁 All videos saved to: /path/to/playlists/My Music Playlist
MCP Server Examples
Using with uv
-
Install and run the server:
cd /Users/granludo/code/testing/youtube_download uv sync # Install dependencies uv run python start_server.py # Start server -
The server will start silently (no stdout output, as required by MCP protocol)
MCP Tool Examples
Tool 1: Download Single Video
{
"name": "download_video",
"arguments": {
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"output_dir": "downloads"
}
}
Response: "Download started successfully. Job ID: abc123-def456-ghi789"
Tool 2: Download Playlist
{
"name": "download_playlist",
"arguments": {
"url": "https://www.youtube.com/playlist?list=PLrAXtmRdnEQy5rhxJj7aKre_2qO5yQ5nI",
"output_dir": "playlists"
}
}
Response: "Playlist download started successfully. Job ID: def456-ghi789-jkl012"
Tool 3: Check Download Status
{
"name": "get_download_status",
"arguments": {
"job_id": "abc123-def456-ghi789"
}
}
Response: JSON object with job status, progress, and metadata
Tool 4: List Downloads
{
"name": "list_downloads",
"arguments": {}
}
Response:
📹 VIDEOS:
- Never Gonna Give You Up (ID: video-uuid-123)
Path: /downloads/Never Gonna Give You Up.mp4
Duration: 213s
📁 PLAYLISTS:
- Music Collection (ID: playlist-uuid-456)
Videos: 25
Path: /playlists/Music Collection
Complete Workflow Example
-
Configure Claude Desktop - Add the MCP server to your
claude_desktop_config.json:{ "mcpServers": { "youtube-mcp-tools": { "command": "/opt/homebrew/bin/uv", "args": [ "--directory", "/Users/granludo/code/testing/youtube_download", "run", "start_server.py" ] } } } -
Download a video in Claude:
"Download this YouTube video: https://www.youtube.com/watch?v=jNQXAC9IVRw"The server will start the download and return a job ID immediately.
-
Check download status:
"What's the status of that download?" -
List all downloads:
"Show me all my download jobs"
Notes
Simple Scripts
- Both scripts will automatically install yt-dlp if it's not found
- Videos are saved with their original titles
- Playlist videos are numbered by their position in the playlist
- The playlist downloader limits downloads to 50 videos by default (adjustable)
- Both scripts handle keyboard interrupts gracefully
- Downloads are organized in separate folders for videos vs playlists
MCP Server
- Uses FastMCP for simplified MCP server implementation
- Creates
youtube_library.dbSQLite database for metadata - Supports up to 3 concurrent downloads
- Job tracking with unique UUIDs for each download
- Rich metadata storage including titles, descriptions, duration, file paths
- Asynchronous downloads that return immediately with job IDs
- Comprehensive error handling and logging
- Compatible with Claude Desktop and other MCP clients
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。