codeRisshi25/youtubemusic-mcp
If you are the rightful owner of youtubemusic-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The YouTube Music MCP Server connects YouTube Music to AI assistants like Claude, enabling music library access and management through natural language conversations.
YouTube Music MCP Server
A powerful Model Context Protocol (MCP) server that connects YouTube Music to AI assistants like Claude. Access your music library, get recommendations, search for songs, create playlists, and discover new music through natural language conversations.
Features • Installation • Authentication • Usage • Tools
Features
7 powerful tools for music discovery and library management:
- 🎵 get_liked_songs_count - Get total count of liked songs
- 📊 get_library_stats - Comprehensive library statistics (songs, playlists, artists, albums)
- 🔍 search_music - Search for songs, artists, albums, or playlists
- 🎤 get_top_artists - Most played artists from listening history
- 🎧 find_similar_songs - Discover similar tracks
- ✨ get_recommendations - Personalized music recommendations
- 📝 create_playlist_from_songs - Create playlists from song queries
Installation
Prerequisites
- Python 3.10 or higher
- A YouTube Music account
- Browser developer tools access (for authentication)
Setup
- Clone the repository
git clone https://github.com/codeRisshi25/youtubemusic-mcp.git
cd youtubemusic-mcp
- Create virtual environment
python3 -m venv venv
source venv/bin/activate # Linux/macOS
# OR
venv\Scripts\activate # Windows
- Install dependencies
pip install -e .
Authentication
Choose one authentication method:
Option A: Browser Cookies (Recommended)
- Visit music.youtube.com and log in
- Open Developer Tools (
F12) - Go to Network tab and refresh the page
- Find any POST request to
music.youtube.com - Right-click → Copy → Copy as cURL
- Extract the cookie string
- Run setup:
python3 -c "
from ytmusicapi import setup
headers_raw = '''PASTE YOUR HEADERS HERE'''
setup(filepath='browser.json', headers_raw=headers_raw)
"
Note: Cookies may expire after 6-12 months. See for simple update instructions.
Option B: OAuth (Long-term)
See for complete OAuth setup instructions.
Usage
Test with MCP Inspector
npx @modelcontextprotocol/inspector venv/bin/python server.py
Opens web interface at http://localhost:6274 to test all tools.
Claude Desktop Integration
-
Config file location:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
- macOS:
-
Add configuration:
{
"mcpServers": {
"youtube-music": {
"command": "/path/to/venv/bin/python",
"args": ["/path/to/server.py"]
}
}
}
- Restart Claude Desktop
See for detailed instructions.
Available Tools
| Tool | Description |
|---|---|
get_liked_songs_count | Get total count of your liked songs |
get_library_stats | Comprehensive library statistics (songs, playlists, artists, albums) |
search_music | Search for songs, artists, albums, or playlists |
get_top_artists | Get your most played artists from listening history |
find_similar_songs | Discover songs similar to any track |
get_recommendations | Get personalized music recommendations |
create_playlist_from_songs | Create playlists from song queries |
Troubleshooting
Authentication Errors
If you get authentication errors after ~6 months:
- Your cookies have likely expired
- Follow the simple update process in
- You'll just need to paste fresh cookies from your browser
Server Not Detected in Claude
- Use absolute paths in
claude_desktop_config.json - Restart Claude Desktop after config changes
- Check logs in Claude → Help → View Logs
Import Errors
- Ensure virtual environment is activated
- Run
pip install -e .in the project directory
Server Crashes on Startup
- Verify
browser.jsonoroauth.jsonexists - Check file permissions
- See for detailed troubleshooting
Contributing
See for contribution guidelines.
License
MIT License - see
Copyright (c) 2025 Risshi Raj Sen
Links
Built with ytmusicapi • MCP
⭐ Star if useful!