A Model Context Protocol (MCP) server that provides YouTube Data API v3 integration for content discovery and management. This server enables AI assistants to search for YouTube videos, channels, and perform various content-related operations.
YouTube Content Management MCP Server
A Model Context Protocol (MCP) server that provides YouTube Data API v3 integration for content discovery and management. This server enables AI assistants to search for YouTube videos, channels, and perform various content-related operations.
Features
Current Tools
- 🎥 search_videos: Search YouTube for videos with advanced filtering options
- 📺 search_channels: Find YouTube channels based on search queries
- 📋 More tools coming soon: Playlist management, video analytics, comment retrieval, and more!
Planned Features
- Video analytics and statistics
- Playlist creation and management
- Comment retrieval and analysis
- Channel analytics
- Video upload and management (with proper authentication)
- Trending videos by region
- Video transcription access
Prerequisites
- Python 3.8 or higher
- YouTube Data API v3 key
- VSCode with MCP extension (for VSCode usage)
Getting Your YouTube API Key
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the YouTube Data API v3:
- Navigate to "APIs & Services" > "Library"
- Search for "YouTube Data API v3"
- Click on it and press "Enable"
- Create credentials:
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "API Key"
- Copy the generated API key
- (Recommended) Restrict the API key:
- Click on the API key to edit it
- Under "API restrictions", select "Restrict key"
- Choose "YouTube Data API v3"
- Save the changes
Installation
-
Clone or download this repository
git clone https://github.com/NastyRunner13/youtube-content-management-mcp cd youtube-content-management-mcp
-
Install dependencies
pip install -r requirements.txt
Or if using
uv
:uv install
-
Set up your environment (Optional) Create a
.env
file in the project root:YOUTUBE_API_KEY=your_youtube_api_key_here
Usage
With VSCode (Recommended)
-
Install the MCP extension in VSCode
-
Configure the MCP server by adding this to your VSCode
settings.json
:{ "mcp.servers": { "youtube-content-management": { "command": "python", "args": [ "/path/to/youtube-content-management-mcp/main.py" ], "env": { "YOUTUBE_API_KEY": "your_youtube_api_key_here" } } } }
Alternative using uv:
{ "mcp.servers": { "youtube-content-management": { "command": "uv", "args": [ "--directory", "/path/to/youtube-content-management-mcp", "run", "main.py" ], "env": { "YOUTUBE_API_KEY": "your_youtube_api_key_here" } } } }
-
Restart VSCode or reload the window
-
Use the tools through the MCP panel or by asking your AI assistant
With Claude Desktop
Add this configuration to your Claude Desktop config file:
Windows: %APPDATA%/Claude/claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"youtube-content-management": {
"command": "python",
"args": ["/path/to/youtube-content-management-mcp/main.py"],
"env": {
"YOUTUBE_API_KEY": "your_youtube_api_key_here"
}
}
}
}
With Other MCP Clients
The server implements the standard MCP protocol and should work with any compatible MCP client. Refer to your client's documentation for configuration instructions.
Available Tools
search_videos
Search YouTube for videos with advanced filtering options.
Parameters:
query
(string, required): Search querymax_results
(integer, optional): Maximum number of results (1-50, default: 25)order
(string, optional): Sort order - "relevance", "date", "rating", "viewCount" (default: "relevance")duration
(string, optional): Video duration - "any", "short", "medium", "long" (default: "any")published_after
(string, optional): RFC 3339 timestamp (e.g., "2023-01-01T00:00:00Z")
Example usage:
Search for Python tutorials uploaded in the last year, sorted by view count
search_channels
Find YouTube channels based on search queries.
Parameters:
query
(string, required): Search query for channelsmax_results
(integer, optional): Maximum number of results (1-50, default: 25)order
(string, optional): Sort order - "relevance", "viewCount", "date" (default: "relevance")
Example usage:
Find coding tutorial channels
Example Interactions
Once the MCP server is configured, you can interact with it through your AI assistant:
Video Search:
"Search for machine learning tutorials from the last 6 months, sorted by popularity"
Channel Discovery:
"Find top cooking channels on YouTube"
Advanced Filtering:
"Show me short Python tutorials (under 4 minutes) uploaded this year"
Security Notes
- Never commit your API key to version control
- Consider using environment variables instead of hardcoding API keys
- Regularly rotate your API keys
- Monitor your API usage in Google Cloud Console
- Set up API key restrictions to limit usage to YouTube Data API v3
Troubleshooting
Common Issues
-
"YouTube API key is not set"
- Ensure your API key is properly configured in the environment variables
- Check that the key is valid and has YouTube Data API v3 enabled
-
"quotaExceeded" errors
- You've hit your daily API quota limit
- Wait until the quota resets (daily) or increase your quota in Google Cloud Console
-
"keyInvalid" errors
- Your API key is invalid or has been revoked
- Generate a new API key and update your configuration
-
MCP server not starting
- Check that all dependencies are installed
- Verify the Python path in your configuration is correct
- Check the MCP extension logs for detailed error messages
Debug Mode
To enable debug logging, add this to your environment:
"env": {
"YOUTUBE_API_KEY": "your_key_here",
"DEBUG": "true"
}
Contributing
We welcome contributions! Areas where you can help:
- Additional YouTube API endpoints (comments, playlists, analytics)
- Better error handling and validation
- Performance optimizations
- Documentation improvements
- Testing and bug reports
API Limits
- YouTube Data API v3: 10,000 units per day (default)
- Search operations: 100 units per request
- Rate limiting: Be mindful of making too many requests in quick succession
Support
- Create an issue for bugs or feature requests
- Check the YouTube Data API documentation for API-specific questions
- Review MCP protocol documentation for integration issues