A Model Context Protocol (MCP) server for YouTube API integration. Search videos, manage playlists, and interact with YouTube directly through Claude Desktop or other MCP clients.
- 🔍 Search YouTube videos
- 📋 Create and manage playlists
- ➕ Add videos to playlists
- 📝 List user playlists
- 🗑️ Delete playlists
- Node.js 18 or higher
- YouTube Data API v3 access
- Google Cloud Console account
npm install -g @a.ardeshir/youtube-mcp
git clone https://github.com/aardeshir/youtube-mcp.git
cd youtube-mcp
npm install
- Go to Google Cloud Console
- Create a new project or select existing one
- Note your Project ID
- In Google Cloud Console, go to "APIs & Services" > "Library"
- Search for "YouTube Data API v3"
- Click on it and press "Enable"
Common Issue: If you see "YouTube Data API v3 has not been used in project before or it is disabled", wait 2-3 minutes after enabling for it to propagate.
- Go to "APIs & Services" > "Credentials"
- Click "+ CREATE CREDENTIALS" > "OAuth client ID"
- If prompted, configure OAuth consent screen:
- Choose "External" (or "Internal" for Workspace)
- Fill required fields (app name, support email)
- Add your email as a test user
- For scopes, add:
https://www.googleapis.com/auth/youtube
- For Application type, select "Web application"
- Add authorized redirect URI:
http://localhost:8080/callback
- Save and note your Client ID and Client Secret
- Go to "APIs & Services" > "Credentials"
- Click "+ CREATE CREDENTIALS" > "API key"
- Restrict the key to YouTube Data API v3
Run the OAuth setup wizard:
If installed via npm:
youtube-mcp-setup
If installed from GitHub:
npm run auth-setup
This will:
- Prompt for your Client ID and Client Secret
- Open browser for Google authorization
- Generate refresh token automatically
- Create
.env
file with your credentials
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json
on Mac):
If installed via npm:
{
"mcpServers": {
"youtube-mcp": {
"command": "npx",
"args": ["-y", "@a.ardeshir/youtube-mcp"],
"env": {
"YOUTUBE_API_KEY": "your-api-key",
"YOUTUBE_CLIENT_ID": "your-client-id",
"YOUTUBE_CLIENT_SECRET": "your-client-secret",
"YOUTUBE_REFRESH_TOKEN": "your-refresh-token"
}
}
}
}
If installed from GitHub:
{
"mcpServers": {
"youtube-mcp": {
"command": "node",
"args": ["/path/to/youtube-mcp/index.js"],
"env": {
"YOUTUBE_API_KEY": "your-api-key",
"YOUTUBE_CLIENT_ID": "your-client-id",
"YOUTUBE_CLIENT_SECRET": "your-client-secret",
"YOUTUBE_REFRESH_TOKEN": "your-refresh-token"
}
}
}
}
Search YouTube for "piano tutorials"
Create a YouTube playlist called "My Favorites"
Show my YouTube playlists
- Ensure API is enabled in Google Cloud Console
- Wait 2-3 minutes for changes to propagate
- Check you're using correct project
- Verify OAuth consent screen is configured
- Ensure test user email is added
- Check redirect URI matches exactly:
http://localhost:8080/callback
- Check all environment variables are set
- Restart Claude Desktop after config changes
- Verify Node.js path is correct
- YouTube API has daily quotas
- Check Google Cloud Console for usage
- Consider requesting quota increase
- Never commit
.env
file to version control - Keep your refresh token secure
- Use OAuth for production, API key only for testing
- Regularly rotate credentials
Contributions welcome! Please:
- Fork the repository
- Create feature branch
- Submit pull request
MIT - See LICENSE file
For issues and questions:
Built with: