youtube-hybrid-mcp
v1.1.0
Published
Hybrid YouTube MCP server using API and yt-dlp
Maintainers
Readme
YouTube Hybrid MCP Server
A Model Context Protocol (MCP) server that provides YouTube video tools using both the YouTube Data API and yt-dlp.
Features
- Get video metadata (title, description, views, likes, etc.)
- Retrieve video comments
- Extract video subtitles/transcripts
Prerequisites
- Node.js 18+
- YouTube Data API v3 key (see Getting API Key)
- yt-dlp (optional, required only for subtitles functionality - see Installing yt-dlp)
Installation
Via npx (after publishing)
npx youtube-hybrid-mcpLocal development
git clone <repository-url>
cd youtube-hybrid-mcp
npm install
npm run buildGetting YouTube API Key
To use this MCP server, you need a YouTube Data API v3 key. Follow these steps:
1. Create Google Cloud Project
- Go to Google Cloud Console
- Create a new project or select an existing one
2. Enable YouTube Data API v3
- In the Cloud Console, go to "APIs & Services" > "Library"
- Search for "YouTube Data API v3"
- Click on it and enable the API
3. Create API Credentials
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "API key"
- Copy the generated API key
4. Restrict the API Key (Recommended)
- Click on the created API key
- Under "Application restrictions":
- Select "HTTP referrers"
- Add your domain or leave unrestricted for development
- Under "API restrictions":
- Select "Restrict key"
- Choose "YouTube Data API v3"
- Save the changes
5. Set Environment Variable
export YOUTUBE_API_KEY=your_api_key_hereNote: Keep your API key secure and never commit it to version control.
Installing yt-dlp
yt-dlp is required only for the get_subtitles tool. If you don't need subtitles functionality, you can skip this step.
Windows
pip install yt-dlpmacOS
pip install yt-dlp
# or using Homebrew
brew install yt-dlpLinux
pip install yt-dlp
# or using package manager
# Ubuntu/Debian
sudo apt install yt-dlp
# Fedora
sudo dnf install yt-dlp
# Arch Linux
sudo pacman -S yt-dlpVerify Installation
After installation, verify yt-dlp is in your PATH:
yt-dlp --versionIf yt-dlp is not found, you may need to add Python Scripts to your PATH:
- Windows: Add
%USERPROFILE%\AppData\Roaming\Python\Python3X\Scriptsto PATH - macOS/Linux: Add
~/.local/binto PATH
Configuration
Environment Setup
Set your YouTube API key as an environment variable:
export YOUTUBE_API_KEY=your_api_key_hereEditor/IDE Configuration
VSCode (with KiloCode extension)
Add to your MCP settings (usually in settings.json or MCP configuration):
{
"mcpServers": {
"youtube": {
"command": "npx",
"args": ["-y", "youtube-hybrid-mcp"],
"env": {
"YOUTUBE_API_KEY": "your_api_key_here"
}
}
}
}Cursor
Add to your .cursorrules or MCP configuration:
{
"mcpServers": {
"youtube": {
"command": "npx",
"args": ["-y", "youtube-hybrid-mcp"],
"env": {
"YOUTUBE_API_KEY": "your_api_key_here"
}
}
}
}Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"youtube": {
"command": "npx",
"args": ["-y", "youtube-hybrid-mcp"],
"env": {
"YOUTUBE_API_KEY": "your_api_key_here"
}
}
}
}Other MCP-compatible editors
For any MCP-compatible editor, use this configuration:
{
"mcpServers": {
"youtube": {
"command": "npx",
"args": ["-y", "youtube-hybrid-mcp"],
"env": {
"YOUTUBE_API_KEY": "your_api_key_here"
}
}
}
}Usage
Run the server directly:
npm startOr via npx:
npx youtube-hybrid-mcpTools
get_video_meta
Retrieves metadata for a YouTube video.
Parameters:
videoId(string): YouTube video ID
get_comments
Retrieves comments for a YouTube video.
Parameters:
videoId(string): YouTube video IDmaxResults(number, optional): Maximum number of comments (default: 10)
get_subtitles
Extracts subtitles/transcript from a YouTube video.
Parameters:
videoId(string): YouTube video IDlanguage(string, optional): Language code (default: "en")
get_related_videos
Gets videos related to a specific video (shows other videos from the same channel).
Parameters:
videoId(string): YouTube video IDmaxResults(number, optional): Maximum number of related videos (default: 10)
get_channel_info
Gets information about a YouTube channel.
Parameters:
channelId(string): YouTube channel ID
search_videos
Searches for videos on YouTube.
Parameters:
query(string): Search querymaxResults(number, optional): Maximum number of results (default: 10)
get_video_thumbnails
Gets thumbnail information for a video.
Parameters:
videoId(string): YouTube video ID
MCP Integration
This server implements the Model Context Protocol and can be used with MCP-compatible clients.
License
MIT
