youtube-playlists-mcp
Provides tools for managing YouTube playlists and searching videos via the YouTube Data API v3, including listing playlists and playlist items, adding or removing videos, creating playlists, and searching for videos.
Click on "Deploy 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., "@youtube-playlists-mcp List my YouTube playlists and how many videos are in each"
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.
youtube-playlists-mcp
A small Model Context Protocol (MCP) server that wraps the YouTube Data API v3, so an AI assistant can manage your YouTube playlists (for example a "learning watch list") and search for videos.
Transport: stdio
Language: TypeScript (Node.js 22+)
Auth: OAuth 2.0 with PKCE, scope
https://www.googleapis.com/auth/youtube. Tokens refresh automatically, and a rejected token is refreshed and the call retried once.Quota-aware: every tool description states its quota cost, and search results are cached.
Tools
Tool | What it does | Quota cost |
| Lists your playlists (id, title, item count, privacy) | 1 |
| Lists videos in a playlist, with | 1 per page (50 items) |
| Adds a video (ID or URL) to a playlist | 50 |
| Removes an entry by | 50 |
| Creates a playlist (private by default) | 50 |
| Searches videos, up to 10 results | 100 (0 when served from cache) |
Quota
The default quota is 10,000 units per day per Google Cloud project and resets at midnight Pacific time. search_videos is the expensive one: about 100 uncached searches a day would use it all. Identical searches (same query, page size, page token) are cached on disk for 24 hours (YOUTUBE_SEARCH_CACHE_TTL_HOURS) and cost nothing. If you hit the limit, tools return a quotaExceeded error. See the quota calculator for costs.
Related MCP server: mcp-server-youtube
Setup
1. Google Cloud (one time, about 10 minutes)
Open the Google Cloud Console and create a project.
APIs & Services → Library: enable YouTube Data API v3.
APIs & Services → OAuth consent screen (Google Auth Platform): choose External, fill in the app name and your email, and add your Google account under Test users (Google Auth Platform → Audience → Add users). If you skip this, sign-in fails with "Access blocked: … has not completed the Google verification process".
Credentials → Create credentials → OAuth client ID, application type Desktop app. Leave "Use this client for an AI-powered agent" unticked (it is for clients that use Google's own MCP tools; this server calls the YouTube Data API directly). Copy the client ID and client secret.
Optional but recommended: once everything works, set the consent screen's publishing status to In production. For personal use you don't need Google verification (you'll see an "unverified app" warning that you can click through). While the app is in Testing, Google expires refresh tokens after 7 days, and you'd have to re-run the auth step weekly.
2. Install and build
git clone https://github.com/kvechkanov/youtube-playlists-mcp.git
cd youtube-playlists-mcp
npm install # also builds dist/Or skip the clone and run it straight from GitHub with npx github:kvechkanov/youtube-playlists-mcp (npm builds it on first use). Everywhere below, node dist/index.js and npx github:kvechkanov/youtube-playlists-mcp are interchangeable. The package is not published to the npm registry.
3. Authorize (one time)
Set your credentials in the environment (don't commit them):
export YOUTUBE_CLIENT_ID="...apps.googleusercontent.com"
export YOUTUBE_CLIENT_SECRET="..."The script works on machines where you can't open a browser to localhost (a remote box, for example). It prints a sign-in URL; after you sign in, your browser is redirected to http://localhost:8085/?code=..., which fails to load. That's expected. Copy the full URL from the address bar and give it back to the script.
Interactive:
node dist/index.js authOr in two non-interactive steps (useful when someone else relays the URL):
node dist/index.js auth url # prints the sign-in URL and saves PKCE state
node dist/index.js auth finish "http://localhost:8085/?code=...&state=..."Paste the whole URL, not just the code: its state value is checked against the one saved by url.
The refresh token is written to ~/.config/youtube-playlists-mcp/token.json with mode 600. The PKCE state from url is valid for 30 minutes and must be used on the same machine and user.
4. Run the server
YOUTUBE_CLIENT_ID=... YOUTUBE_CLIENT_SECRET=... node dist/index.jsRegister it in any MCP client (Claude Desktop, Cursor, Grok Bot, ...) as a stdio server:
{
"mcpServers": {
"youtube": {
"command": "node",
"args": ["/absolute/path/to/youtube-playlists-mcp/dist/index.js"],
"env": {
"YOUTUBE_CLIENT_ID": "...apps.googleusercontent.com",
"YOUTUBE_CLIENT_SECRET": "..."
}
}
}
}To run it from GitHub instead of a local clone, use "command": "npx" with "args": ["-y", "github:kvechkanov/youtube-playlists-mcp"] and the same env.
Without credentials or a token, the server still starts and lists its tools. Calling a tool returns an error beginning with NOT AUTHORIZED: that says what to do.
Configuration
Variable | Default | Purpose |
| (required) | OAuth client ID |
| (required) | OAuth client secret |
|
| Where the token is stored |
|
| Token and pending-auth directory. A token in the old |
|
| Search cache directory |
|
| Search cache lifetime in hours (0 or more) |
|
| Port in the redirect URI (nothing listens on it; Desktop-app clients accept any loopback port) |
Invalid numeric values (YOUTUBE_REDIRECT_PORT, YOUTUBE_SEARCH_CACHE_TTL_HOURS) stop startup with an error naming the variable.
Troubleshooting
Symptom | Fix |
Access blocked: … has not completed the Google verification process | Add your Google account under Test users (Audience page), or publish the app. |
Google hasn't verified this app warning | Expected for personal apps. Click Advanced → Go to … (unsafe). |
| Expected. Copy the full URL from the address bar and paste it into |
authorization code … expired or was already used | Run |
refresh token rejected every ~7 days | The app is in Testing. Set publishing status to In production, then re-run |
Google did not return a refresh token | Revoke the app at https://myaccount.google.com/permissions and run |
token file … is corrupt | Delete that file and run |
| The 10,000 daily units are used up. It resets at midnight Pacific time. |
Security notes
Secrets live only in environment variables and the
600-mode token file, outside the repository..gitignorealso excludestoken.json,.env, and credentials files.The scope
youtubegrants full management of your YouTube account (playlists, and more). Treat the token like a password. Revoke it any time at https://myaccount.google.com/permissions.The server only calls Google endpoints (
accounts.google.com,oauth2.googleapis.com,www.googleapis.com).
Development
npm run build # compile to dist/
npm run lint # Biome; `npm run format` fixes
npm run typecheck
npm test # builds, then runs the testsThe tests start the server and the auth CLI in an empty home directory against a local mock of Google's endpoints, so they make no network calls. See CONTRIBUTING.md and the CHANGELOG.
License
MIT © 2026 Kostya Vechkanov
Available Tools
6 toolsadd_to_playlistA
Add a video to a playlist (appended at the end). Quota cost: 50 units per call. Does not check for duplicates.
Inputs: video (required), playlistId (required).
create_playlistC
Create a new playlist. Quota cost: 50 units per call.
Inputs: title (required), privacy, description.
list_my_playlistsA
List the authenticated user's YouTube playlists (id, title, item count, privacy). Quota cost: 1 unit per call. Returns nextPageToken when more pages exist.
Inputs: pageToken, maxResults.
list_playlist_itemsA
List the videos in a playlist. Each item includes playlistItemId (needed for remove_playlist_item) and videoId. Quota cost: 1 unit per call (50 items per page). Returns nextPageToken when more pages exist.
Inputs: playlistId (required), pageToken.
remove_playlist_itemA
Remove an entry from a playlist by playlistItemId (from list_playlist_items; this is NOT the video ID). Quota cost: 50 units per call.
Inputs: playlistItemId (required).
search_videosA
Search YouTube for videos. EXPENSIVE: quota cost 100 units per uncached call (about 100 searches/day on the default 10,000-unit quota). Identical queries are served from a local cache (24h by default) at 0 units; the response says cached: true. Use sparingly.
Inputs: query (required), pageToken, maxResults.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct resource+action: listing playlists vs. listing a playlist's items vs. adding an item vs. removing an item vs. creating a playlist vs. searching videos. The descriptions explicitly warn about the playlistItemId vs. videoId distinction, eliminating the one plausible confusion point.
All six tools follow a consistent snake_case verb_noun pattern (list_, add_, remove_, create_, search_). The 'my' qualifier in list_my_playlists is a minor semantic variation but the structure remains predictable.
Six tools is well-scoped for a playlist management server — every tool covers a distinct operation with no redundancy. Quota-cost annotations further justify each tool's existence and usage.
The surface covers list/create/add/remove plus search, but there is no update_playlist (rename, change description/privacy) and no delete_playlist, so the playlist lifecycle is open-ended. Agents asked to rename or delete a playlist hit a dead end despite create being present.
Maintenance
Related MCP Connectors
YouTube transcripts, search, channels, playlists and bulk transcript jobs for AI agents. 14 tools.
Search YouTube videos, read transcripts and get public video information in your AI assistant.
YouTube transcripts, search, channel/playlist listings and upload tracking for AI agents.
YouTube discovery, transcripts, library search, and monitors with API keys or OAuth.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with YouTube through the YouTube Data API, allowing users to search for videos, playlists, and channels, generate video titles using AI, and manage YouTube content through natural language commands.22ISC
- AlicenseNot gradedqualityDmaintenanceEnables 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
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to search videos, channels, and playlists, retrieve video metadata, transcripts, and comments via the YouTube Data API v3.46 PyPI68MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to search for music and create/manage playlists on YouTube Music via OAuth 2.0 authentication.1MIT