ytmusic-mcp
Allows searching YouTube Music, managing playlists, and reading listening history.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ytmusic-mcpsearch for 'Bohemian Rhapsody' on YouTube Music"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ytmusic-mcp
An MCP server that wraps ytmusicapi so Claude (or any MCP client) can search YouTube Music, manage your playlists, and read your listening history.
Tools
Tool | Description |
| Search YouTube Music. |
| List your library playlists. |
| Get the tracks in a playlist. |
| Create a new private playlist, returns its ID. |
| Add a track to a playlist. |
| Get your recent play history. |
Not included (v1): BPM-based recommendations. YouTube Music doesn't expose tempo data, so this would need a second data source (e.g. an audio analysis API) — a stretch goal for a future version, not part of this build.
Related MCP server: mcp-server-youtube
Setup
1. Install dependencies
python3 -m venv .venv
source .venv/bin/activate
pip install -e .2. Authenticate
There's no official YouTube Music API, so ytmusicapi authenticates by reusing headers from your logged-in browser session.
Open music.youtube.com in Firefox (recommended — its raw-header copy is more reliable than Chrome's) while logged in.
Open DevTools (
Cmd+Option+I/F12) → Network tab → filter bybrowse.Click into a playlist, or reload the page, to trigger a
browsePOST request.Click that request → Headers tab → toggle Raw headers → select and copy the whole block.
Paste it into a new file named
raw_headers.txtin the project root and save.Run:
python scripts/setup_auth_from_file.pyThis writes
headers_auth.jsonand deletesraw_headers.txt.
Alternatively, python scripts/setup_auth.py does the same thing via an interactive terminal prompt instead of a file, if you prefer to paste directly.
headers_auth.json is equivalent to your logged-in session — never commit it or share it. It's already gitignored.
Verify auth works before going further:
python scripts/test_search.pyThese headers expire/rotate periodically. If tools start failing with an auth error, redo this step.
3. Add to Claude Code
claude mcp add ytmusic -s user \
-e YTMUSIC_AUTH_PATH="$(pwd)/headers_auth.json" \
-- "$(pwd)/.venv/bin/python" "$(pwd)/server.py"-s user makes it available in any Claude Code session, not just this directory. Use absolute paths for the python interpreter, server.py, and YTMUSIC_AUTH_PATH since the server can be launched from any working directory.
For other MCP clients (Claude Desktop, etc.), point them at the same command and env var using their respective config format.
Error handling
Tool calls translate common failure modes into clear messages instead of raw tracebacks:
Missing/expired/malformed auth → tells you to rerun
scripts/setup_auth_from_file.py.Rate limiting (HTTP 429) → tells you to wait and retry.
Gated/restricted content → reported as unavailable rather than crashing.
Network errors → reported directly.
License
MIT — see LICENSE.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceEnables users to search the YouTube Music catalog and manage playlists using natural language. It provides tools for searching songs, albums, and artists, as well as performing playlist operations like creating, adding, and deleting tracks.
- Alicense-qualityCmaintenanceEnables AI assistants to search videos, read channels, browse playlists, fetch comments, and get transcripts from YouTube using the YouTube Data API v3 and InnerTube API for captions.2GPL 3.0
- Flicense-qualityCmaintenanceEnables AI assistants to search videos, channels, and playlists, retrieve video metadata, transcripts, and comments via the YouTube Data API v3.73
- Flicense-qualityFmaintenanceEnables AI assistants to search YouTube Music, manage playlists, and create smart recommendations using natural language.10
Related MCP Connectors
YouTube MCP — wraps the YouTube Data API v3 (BYO API key)
Provide token-optimized, structured YouTube data to enhance your LLM applications. Access efficien…
YouTube transcripts, subtitles, and video metadata as structured JSON via an Apify Actor.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/umsachde/ytmusic-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server