Skip to main content
Glama
youtube-music-mcp

youtube-music-mcp

by mathplayer31
README.md
# youtube-music-mcp

An MCP server that lets Claude search songs and edit your YouTube Music playlists.

It uses Google's official **YouTube Data API v3** with your own Google OAuth credentials. YouTube Music playlists are regular YouTube playlists, so everything you change here shows up in YouTube Music.

## Tools

| Tool | What it does | Quota cost |
|---|---|---|
| `search` | Search songs (YouTube Music category) | 100 |
| `list_playlists` | List your playlists | 1 per 50 playlists |
| `get_playlist` | List the tracks of a playlist | 1 per 50 tracks |
| `create_playlist` | Create a playlist (private by default) | 50 |
| `update_playlist` | Rename, change description or privacy | 51 |
| `delete_playlist` | Delete a playlist | 50 |
| `add_tracks` | Append tracks (ids or links) | 50 per track |
| `remove_tracks` | Remove tracks (ids or links) | 50 per track + reads |

Google gives each project **10,000 units per day** for free, which is about 100 searches or 200 track additions. The quota resets at midnight Pacific time.

Limits of the official API: search returns YouTube videos, so a result can be a music video rather than the album version. YouTube Music features such as "Liked music", library albums, radio and recommendations are not reachable through it.

## Setup

Last verified: 2026-11-26, Windows 11, Node 22.13.

### 1. Install

Requires Node.js 22 or newer.

```powershell
git clone https://github.com/mathplayer31/youtube-music-mcp.git
cd youtube-music-mcp
npm install
```

`npm install` also builds the server into `dist/`.

### 2. Create your Google credentials

All in https://console.cloud.google.com with the Google account that owns your YouTube Music playlists.

1. Top bar, project picker, **New project**. Name it `youtube-music-mcp`, then **Create** and select it.
2. **APIs & Services > Library**, search **YouTube Data API v3**, then **Enable**.
3. **Google Auth Platform** (OAuth consent screen), **Get started**:
   - App name: `youtube-music-mcp`, support email: your email
   - Audience: **External**
   - Contact email: your email, accept the policy, **Create**
4. **Audience**, under Publishing status click **Publish app**, then **Confirm**. Without this step the app stays in "Testing" and Google expires your login every 7 days. The app stays unverified, which is fine for personal use.
5. **Clients > Create client**, Application type **Desktop app**, name `youtube-music-mcp`, **Create**. Keep the window with the Client ID and Client secret open.

### 3. Add the credentials

Copy `.env.example` to `.env` in the repo folder and paste your values:

```
YTM_CLIENT_ID=1234567890-abc.apps.googleusercontent.com
YTM_CLIENT_SECRET=GOCSPX-...
```

`.env` is gitignored. Never commit it.

### 4. Log in once

```powershell
npm run auth
```

Your browser opens on Google's login page. Because the app is unverified, Google shows **"Google hasn't verified this app"**: click **Advanced**, then **Go to youtube-music-mcp (unsafe)**, then **Continue**. The terminal prints `Logged in.` and the token is saved to `%USERPROFILE%\.youtube-music-mcp\token.json`.

### 5. Connect it to Claude

**Claude Code:**

```powershell
claude mcp add youtube-music -s user -- node "C:/full/path/to/youtube-music-mcp/dist/index.js"
```

**Claude Desktop:** edit `%APPDATA%\Claude\claude_desktop_config.json`, then restart Claude Desktop:

```json
{
  "mcpServers": {
    "youtube-music": {
      "command": "node",
      "args": ["C:/full/path/to/youtube-music-mcp/dist/index.js"]
    }
  }
}
```

Then ask Claude things like "make me a private playlist of 90s French rap classics" or "remove every live version from my Workout playlist".

## Development

```powershell
npm test
```

Builds with `tsc` and runs the unit tests in `src/*.test.ts`.

## Revoking access

Delete `%USERPROFILE%\.youtube-music-mcp\token.json` and remove the app at https://myaccount.google.com/permissions.

## License

MIT