YouTube视频下载工具
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"mcp-ytdlp": {
"command": "mcp-ytdlp"
}
}
}
服务介绍
mcp-ytdlp
An MCP (Model Context Protocol) server that provides tools for downloading YouTube videos. This server integrates with yt-dlp to enable video downloads through the MCP protocol, making it easy for AI assistants to access YouTube content programmatically.
The server automatically handles yt-dlp installation and management, requiring no manual setup from users. It provides a clean, standardized interface for downloading videos while abstracting away the complexity of yt-dlp deployment.
Features
- MCP Tool:
download_youtube_video- Download YouTube videos with customizable output directory and format - Cross-Platform: Works on Windows, macOS, and Linux
- Auto-Install yt-dlp: Automatically detects and installs yt-dlp if not present
- Safe Communication: Uses stdio-based MCP protocol for secure communication
- URL Validation: Ensures only valid http/https URLs are processed
- Automatic Directory Creation: Creates output directories as needed
Installation
Install the package via pip:
pip install mcp-ytdlp
Usage
Starting the Server
Run the MCP server using Python module:
python -m mcp_ytdlp
Or use the installed command:
mcp-ytdlp
Connecting from MCP Clients
To use this server with an MCP client (such as Claude Desktop), add it to your MCP configuration:
{
"mcpServers": {
"mcp-ytdlp": {
"command": "mcp-ytdlp"
}
}
}
The server communicates via stdio and will automatically handle yt-dlp installation on first use.
Tool Schema
download_youtube_video
Download a YouTube video to a specified location.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
url |
string | Yes | YouTube video URL to download |
output_dir |
string | No | Directory to save the downloaded video (default: "./downloads") |
format |
string | No | Video format preference (default: "best") |
Example Request:
{
"name": "download_youtube_video",
"arguments": {
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"output_dir": "./downloads",
"format": "mp4"
}
}
Example Response:
{
"success": true,
"file_path": "./downloads/Video Title.mp4",
"message": "Download completed successfully"
}
Error Response:
{
"success": false,
"file_path": null,
"message": "Invalid URL scheme: ftp. URL must start with http:// or https://"
}
Legal Notice
This server uses yt-dlp, a third-party tool for downloading videos from YouTube and other platforms. By using this MCP server, you agree to:
- Comply with YouTube Terms of Service: Ensure that any content you download complies with YouTube's Terms of Service and applicable laws.
- Respect Copyright: Only download content you have the right to access. Respect copyright laws and intellectual property rights.
- Use Responsibly: Do not use this tool for unauthorized distribution, commercial exploitation, or any other prohibited purposes.
- Verify Legality: You are responsible for verifying that downloading specific content is legal in your jurisdiction.
The authors of this MCP server are not responsible for any misuse of this tool. Use at your own risk and ensure compliance with all applicable laws and platform policies.
License
MIT License - see LICENSE for details.