yt-dlp-mcp
v1.3.0
Published
MCP Server for YouTube - Download videos and audio using yt-dlp with automatic setup
Maintainers
Readme
YouTube MCP Server
A Model Context Protocol (MCP) server for downloading YouTube videos and audio.
⚠️ Legal Notice
This tool is intended for legitimate use only. Users are responsible for ensuring they have the right to download content and comply with all applicable laws and YouTube's Terms of Service. Unauthorized downloading of copyrighted content is prohibited.
Features
- Download YouTube videos in MP4 or WebM format
- Extract audio in MP3, M4A, or Opus format
- Validate YouTube URLs
- Check yt-dlp installation
- Security limits:
- Maximum video duration: 2 hours
- Playlist downloads are not supported
- Download timeout: 5 minutes
Requirements
- Node.js >= 18
- yt-dlp installed and available in PATH
- npm
Quick Start with ModelScope (魔搭)
One-Click Configuration
Install yt-dlp (if not already installed):
# Windows choco install yt-dlp # macOS brew install yt-dlp # Linux sudo apt install yt-dlpCopy the following JSON configuration to your MCP client (e.g., Cherry Studio, Claude Desktop, etc.):
{ "mcpServers": { "youtube-mcp": { "command": "npx", "args": [ "youtube-mcp-server@latest" ] } } }That's it! The MCP server will be automatically downloaded and started.
Manual Installation
- Clone or download this repository
- Install dependencies:
npm install - Build the project:
npm run build
Usage
Running the Server
npm startOr directly with Node.js:
node dist/index.jsUsing with uvx (Python users)
uvx youtube-mcp-server@latestAvailable Tools
check_ytdlp
Check if yt-dlp is installed and get its version.
Parameters: None
validate_youtube_url
Validate if a URL is a valid YouTube URL.
Parameters:
url(string, required): The URL to validate
download_youtube_video
Download a YouTube video to the downloads directory.
Parameters:
url(string, required): The YouTube video URL to downloadformat(string, optional): Video format -mp4orwebm(default:mp4)resolution(string, optional): Video resolution -best,720p, or1080p(default:best)
Security Limits:
- Maximum duration: 2 hours
- Playlists are not supported
- Download timeout: 5 minutes
download_youtube_audio
Download audio from a YouTube video to the downloads directory.
Parameters:
url(string, required): The YouTube video URL to extract audio fromaudio_format(string, optional): Audio format -mp3,m4a, oropus(default:mp3)
Security Limits:
- Maximum duration: 2 hours
- Playlists are not supported
- Download timeout: 5 minutes
Development
Build
npm run buildWatch Mode
npm run devProject Structure
mcp_youtobe_new/
├── src/
│ ├── index.ts # Main MCP server entry point
│ └── utils/
│ └── validators.ts # URL validation utilities
├── dist/ # Compiled JavaScript output
├── downloads/ # Downloaded files directory
├── package.json
├── tsconfig.json
├── mcp.config.example.json
└── README.mdLicense
ISC
Disclaimer
This project is provided as-is for educational and legitimate use purposes. The developers are not responsible for any misuse of this software. Users must comply with all applicable laws and YouTube's Terms of Service.
