YouTube MCP Server
A Model Context Protocol (MCP) server implementation for YouTube, enabling AI language models to interact with YouTube content through a standardized interface.
Features
Video Information
- Get video details (title, description, duration, etc.)
- List channel videos
- Get video statistics (views, likes, comments)
- Search videos across YouTube
Transcript Management
- Retrieve video transcripts
- Support for multiple languages
- Get timestamped captions
- Search within transcripts
Channel Management
- Get channel details
- List channel playlists
- Get channel statistics
- Search within channel content
Playlist Management
- List playlist items
- Get playlist details
- Search within playlists
- Get playlist video transcripts
Installation
Installing via Smithery
To install YouTube MCP Server for Claude Desktop automatically via Smithery:
1npx -y @smithery/cli install @ZubeidHendricks/youtube --client claude
Manual Installation
1npm install @modelcontextprotocol/server-youtube
Configuration
Set the following environment variables:
YOUTUBE_API_KEY
: Your YouTube Data API keyYOUTUBE_TRANSCRIPT_LANG
: Default language for transcripts (optional, defaults to 'en')
Using with MCP Client
Add this to your MCP client configuration (e.g. Claude Desktop):
1{ 2 "mcpServers": { 3 "youtube": { 4 "command": "npx", 5 "args": ["-y", "@modelcontextprotocol/server-youtube"], 6 "env": { 7 "YOUTUBE_API_KEY": "<YOUR_API_KEY>" 8 } 9 } 10 } 11}
YouTube API Setup
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the YouTube Data API v3
- Create API credentials (API key)
- Copy the API key for configuration
Examples
Managing Videos
1// Get video details 2const video = await youtube.videos.getVideo({ 3 videoId: "video-id" 4}); 5 6// Get video transcript 7const transcript = await youtube.transcripts.getTranscript({ 8 videoId: "video-id", 9 language: "en" 10}); 11 12// Search videos 13const searchResults = await youtube.videos.searchVideos({ 14 query: "search term", 15 maxResults: 10 16});
Managing Channels
1// Get channel details 2const channel = await youtube.channels.getChannel({ 3 channelId: "channel-id" 4}); 5 6// List channel videos 7const videos = await youtube.channels.listVideos({ 8 channelId: "channel-id", 9 maxResults: 50 10});
Managing Playlists
1// Get playlist items 2const playlistItems = await youtube.playlists.getPlaylistItems({ 3 playlistId: "playlist-id", 4 maxResults: 50 5}); 6 7// Get playlist details 8const playlist = await youtube.playlists.getPlaylist({ 9 playlistId: "playlist-id" 10});
Development
1# Install dependencies 2npm install 3 4# Run tests 5npm test 6 7# Build 8npm run build 9 10# Lint 11npm run lint
Contributing
See CONTRIBUTING.md for information about contributing to this repository.
License
This project is licensed under the MIT License - see the LICENSE file for details.# YouTube MCP Server
A YouTube API integration using the Model Context Protocol.
Setup
- Clone the repository
- Install dependencies:
1npm install
- Copy
.env.example
to.env
:1cp .env.example .env
- Edit
.env
and add your YouTube API key - Start the server:
1npm start
Environment Variables
YOUTUBE_API_KEY
: Your YouTube Data API v3 key (get it from Google Cloud Console)
Development
- To run in development mode with auto-reload:
1npm run dev
- To build:
1npm run build
Security Note
Always keep your API keys secure and never commit them to version control.