YouTube Playlist MCP
Integrates with the YouTube Data API v3 to search and score candidate videos, preview ranked playlists, and create or manage playlists in the user's YouTube account, including adding and removing 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 Playlist MCP Build me a beginner Python playlist in English, longer than 20 minutes."
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 Playlist MCP
An MCP server that lets AI agents (Claude, ChatGPT, Cursor, …) research a topic on YouTube, rank the most valuable videos and save them as a playlist in your account.
Ask "I want to learn German, where should I start?" and get back a ready-to-watch playlist instead of 40 open tabs.
🔎 Searches 50–100 candidates, with filters for language, country, upload date and duration
📊 Scores every video 0–100 on popularity, like rate, comment rate and (optionally) recency, so an 8-year-old viral video doesn't win by age alone
🧹 Drops Shorts, live streams, low-view videos, and caps how many videos one channel can place in the list
🧠 Lets the agent judge relevance by reading titles and descriptions to remove off-topic, clickbait or wrong-language results
👀 Previews a numbered list (title, channel, duration, views, score) that you can tweak: "remove #3", "favour newer videos", "sort by like rate"
✅ Creates the playlist only after you approve it. Playlists are unlisted by default
🗂️ Manages your existing playlists: list them, add videos, remove videos
📉 Tracks the daily API quota and refuses up front if an action wouldn't fit
What it doesn't do: it doesn't watch or summarize videos, upload, comment, like, subscribe, or delete playlists, and it never scrapes. It only uses the official YouTube Data API v3.
Setup (about 10 minutes, one time)
Every user creates their own free Google Cloud project and OAuth client. You never share keys with the author or anyone else, your data and quota stay yours, and nothing passes through a third-party server.
0. Get the code
Requires Node.js 22 or newer and git.
git clone https://github.com/haktanonur/youtube-playlist-mcp.git
cd youtube-playlist-mcp
npm install
npm run buildTo update later, run git pull && npm install && npm run build.
1. Create a Google Cloud project and enable the API
Go to https://console.cloud.google.com/ and create a project (e.g.
youtube-playlist-mcp).Open APIs & Services → Library, search for YouTube Data API v3 and click Enable.
2. Configure the OAuth consent screen
Go to APIs & Services → OAuth consent screen (shown as Google Auth Platform in newer consoles).
Choose External and fill in an app name and your email. ("Internal" is only offered to Google Workspace organizations. For a personal Gmail account, External is the only option. It doesn't make your app public: while it's in Testing mode, only the test users you add can sign in.)
Under Audience → Test users, add your own Google account (the one that owns the YouTube channel).
Under Data access, you can add the scope
https://www.googleapis.com/auth/youtube(optional; the app asks for it anyway).
While the app's publishing status is Testing, Google expires the authorization after 7 days and you'll need to run
authagain. To avoid that, click Publish app. Google will warn that the app is unverified, which is expected for a personal app only you use. You can click Advanced → Go to (app name).
3. Create an OAuth client
Go to APIs & Services → Credentials → Create credentials → OAuth client ID.
Application type: Desktop app.
Click Download JSON. You'll get a file like
client_secret_XXXX.json.
4. Authorize (in a terminal, inside the project folder)
npm run auth -- --client-file ~/Downloads/client_secret_XXXX.jsonA browser window opens. Sign in with your YouTube account and allow access. The client and token are saved to ~/.config/youtube-playlist-mcp/ (on Windows, %APPDATA%\youtube-playlist-mcp\) with permissions only you can read. After that you can delete the downloaded JSON.
5. Add it to your MCP client
You need two absolute paths: one to node (run which node, or where node on Windows) and one to dist/index.js in the folder you cloned.
Claude Desktop: edit claude_desktop_config.json (Settings → Developer → Edit Config):
{
"mcpServers": {
"youtube-playlist": {
"command": "/usr/local/bin/node",
"args": ["/Users/you/youtube-playlist-mcp/dist/index.js"]
}
}
}Use the full path to node: Claude Desktop doesn't always see your shell's PATH.
Claude Code:
claude mcp add youtube-playlist -- node /Users/you/youtube-playlist-mcp/dist/index.jsCursor / VS Code / others: use the same command + args in the client's MCP config.
Restart the client and ask: "Build me a playlist of the best beginner Python tutorials in English, longer than 20 minutes."
Optional: search-only mode with an API key
If you only want search and scoring, without creating playlists, you can skip OAuth and use an API key (Credentials → Create credentials → API key, then restrict it to YouTube Data API v3):
"env": { "YOUTUBE_API_KEY": "your-key" }Related MCP server: YouTube MCP Server
Tools
Tool | What it does | Writes to your account? | Quota |
| Search, filter and score candidates | No | ~101 per 50 candidates |
| Numbered preview; exclusions, sorting, recency, custom order | No | 0 |
| Create the approved draft (unlisted by default) | Yes (needs | 50 + 50/video |
| Your playlists | No | 1 |
| Videos in a playlist | No | 1 per 50 |
| Add videos, skipping ones already present | Yes (needs | 50/video |
| Remove videos | Yes (needs | 50/video |
| Auth state and today's quota usage | No | 0 |
There is also a prompt, research_playlist, that walks the agent through the whole workflow.
Quota
Google gives each project 10,000 units per day for free (resets at midnight Pacific Time). A typical run looks like this: search 100 candidates (~202) + create a 20-video playlist (1,050) ≈ 1,250 units, so about 8 playlists a day. Writes are the expensive part: each video added costs 50 units. If your project has a higher quota, set YOUTUBE_DAILY_QUOTA.
The counter is kept locally, so it can't see usage from other apps that share the same Cloud project. YouTube's own "quota exceeded" error is still handled cleanly.
How scoring works
Each signal is converted to a percentile within the candidate pool, then combined with weights you can adjust:
Signal | Default weight | Notes |
Popularity | 0.45 | Half total views (log scale), half views per day, so old videos don't win by age alone |
Like rate | 0.35 | likes/views with Bayesian smoothing, so 50 views with 10 likes doesn't beat 2M views with 100K likes |
Comment rate | 0.20 | comments/views, smoothed the same way |
Recency | 0 (off) | One-year half-life; turn it on with |
Hidden likes or disabled comments count as neutral. Filters remove videos ≤60 s (or ≤3 min tagged #shorts), live/upcoming streams, videos under 1,000 views (min_views), and limit each channel to 2 videos (max_per_channel).
Configuration
Env var | Purpose |
| Alternative to |
| Search-only mode without OAuth |
| Your project's daily quota (default |
| Config directory (default |
CLI (from the project folder):
npm run status # what is configured
npm run logout # revoke access at Google and delete the tokenSecurity & privacy
Uses only the official YouTube Data API over HTTPS. There's no telemetry and no third-party server.
OAuth uses the installed-app loopback flow with PKCE (S256) and a random state. The callback listens on
127.0.0.1only and shuts down after one use or 5 minutes.Requests a single scope,
youtube, which is the narrowest one that can manage playlists. The server has no tool that deletes playlists.Tokens and the OAuth client are stored in files with mode
0600, in a0700directory. Credentials are sent in headers, never in URLs.Every write tool requires
confirm: trueand is marked with MCP tool annotations. Each draft can only be created once, so a retry can't create duplicate playlists.Video titles and descriptions are treated as untrusted. Control and bidi characters are stripped, text is truncated, and the agent is told to treat it as data, not instructions.
Revoke access at any time with
logoutor at https://myaccount.google.com/permissions.
See SECURITY.md for how to report vulnerabilities.
Development
npm test # builds and runs unit + end-to-end tests (YouTube API is mocked)Try it with the MCP Inspector:
npx @modelcontextprotocol/inspector node dist/index.jsLicense
MIT
Available Tools
8 toolsadd_videos_to_playlistAdd videos to a playlistAIdempotent
Add videos to an existing playlist owned by the user; videos already in it are skipped. WRITES TO THE USER'S ACCOUNT: only after explicit approval. Costs 50 units per added video.
Inputs: confirm (required), video_ids (required), playlist_id (required).
create_playlistCreate playlist on YouTubeA
Create the previewed playlist in the user's YouTube account and add its videos. WRITES TO THE USER'S ACCOUNT: call only after the user explicitly approved the preview for this draft_id. Each draft can be created once. Costs 50 + 50 per video quota units.
Inputs: confirm (required), draft_id (required).
get_playlist_itemsGet playlist itemsARead-only
List the videos in one of the user's playlists (1 quota unit per 50 videos). Read-only.
Inputs: playlist_id (required).
get_statusAuth & quota statusARead-only
Show whether YouTube access is configured and how much of today's API quota this server has used. Costs no quota.
Inputs: no named parameters.
list_my_playlistsList my playlistsBRead-only
List playlists in the authorized YouTube account (50 per page, 1 quota unit). Read-only.
Inputs: page_token.
preview_playlistPreview playlistARead-only
Build (or rebuild) a numbered playlist preview from a search. Exclusions are remembered across calls for the same search_id. Show the returned markdown to the user and ask for approval or changes before create_playlist. Read-only, costs no quota.
Inputs: title (required), search_id (required), privacy, sort_by, +10 more.
remove_videos_from_playlistRemove videos from a playlistADestructiveIdempotent
Remove videos from one of the user's playlists (all occurrences). DESTRUCTIVE, WRITES TO THE USER'S ACCOUNT: only after explicit approval. Costs 50 units per removed item.
Inputs: confirm (required), video_ids (required), playlist_id (required).
search_videosSearch & score YouTube videosARead-only
Search YouTube for a topic, collect 10–100 candidate videos, drop Shorts/live/low-view videos and score each 0–100 (popularity incl. views-per-day, like rate, comment rate, optional recency). Read-only. Costs 100 quota units per 50 candidates (+1 per 50 for statistics). Afterwards, review titles/descriptions for relevance and call preview_playlist.
Inputs: query (required), order, language, min_views, +14 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool maps to a distinct stage or resource: search, preview, create, list, inspect items, add, remove, and status. The overlapping-looking pair (create_playlist vs add_videos_to_playlist) is clearly separated by descriptions—one builds a new playlist from an approved draft, the other appends to an existing one—and read-only vs write operations are explicitly flagged.
All eight tools use snake_case verb_noun form (search_videos, create_playlist, add_videos_to_playlist, remove_videos_from_playlist, get_status). The only minor quirk is the possessive in list_my_playlists, which still fits the pattern and is readable.
Eight tools is well-scoped for a playlist workflow: search, preview, create, list, inspect, mutate membership, and check quota/auth status. No tool feels redundant or gratuitous.
The core discover→preview→create→manage pipeline is covered, including add/remove of videos. However, there is no way to delete a playlist, rename/update an existing playlist, or reorder items, which are notable lifecycle gaps that leave agents at a dead end for cleanup or editing.
Maintenance
Related MCP Connectors
YouTube transcripts, search, channel/playlist listings and upload tracking for AI agents.
YouTube transcripts, search, channel browsing, and playlists for AI agents via MCP.
Search YouTube videos, read transcripts and get public video information in your AI assistant.
YouTube for AI agents: transcripts, comments, video stats, channel monitor, Shorts captions.
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
- AlicenseAqualityDmaintenanceEnables AI models to interact with YouTube content including video details, transcripts, channel information, playlists, and search functionality through the YouTube Data API.797 npm11MIT
- 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.47 PyPI68MIT