youtube-playlist-mcp
Enables analyzing and managing YouTube playlists, including Watch Later, using InnerTube authentication via browser cookies.
README
youtube-playlist-mcp
MCP server for analyzing and cleaning up your YouTube playlists — including Watch Later, which the official YouTube Data API hasn't been able to read since 2016. Built with Bun and TypeScript (Bun runs the TypeScript directly; there is no build step).
Instead of the official API (OAuth setup, Google Cloud project, 50-quota-units-per-write limits), this uses InnerTube — the internal API youtube.com itself uses — authenticated with your own browser cookies. No Google Cloud project, no OAuth client, no API quota. The only setup is exporting your cookies, which is automated.
Tools
All tools operate on the authenticated user's own playlists. "WL" works as a playlistId everywhere, so Watch Later is a first-class citizen.
youtube_list_playlists
Your playlists with title, video count, and URL.
youtube_get_playlist_items
One page (~100 items) of a playlist via continuationToken paging. Each item has:
setVideoId— the playlist-entry ID that removal expects (duplicate-safe)- duration, availability status (deleted/private flagged)
- fuzzy view count and publish age ("50K views", "2 weeks ago") — enough for trend analysis with no extra calls. Since playlists are ordered and a save can't predate the video's publish date, a running max of publish dates from the bottom of the list up estimates a save-date timeline.
youtube_add_playlist_items
Batch-add videos in a single request. Combined with remove, this moves videos between playlists (add to destination, verify, remove from source).
youtube_remove_playlist_items
Batch-remove entries by setVideoId. Destructive; the assistant should confirm first.
youtube_create_playlist / youtube_update_playlist / youtube_delete_playlist
Create (private by default, optionally seeded with videos), rename / edit description / change privacy, and delete playlists.
youtube_refresh_cookies / youtube_install_yt_dlp
Self-healing auth: when cookies go stale, the assistant can re-export them from your browser directly (same as bun run cookies, no restart needed — the server picks up the new file on the next call), and install yt-dlp via Homebrew/pipx/pip if it's missing.
Setup
Clone and register — that's it. No install step, no build, no auth flow:
git clone https://github.com/brentvatne/youtube-playlist-mcp.git
claude mcp add youtube -s user -- ./youtube-playlist-mcp/src/index.ts
Or any MCP client via stdio (use the absolute path):
{
"mcpServers": {
"youtube": {
"command": "/path/to/youtube-playlist-mcp/src/index.ts"
}
}
}
The only prerequisite is Bun. The entry point is a self-executing script (#!/usr/bin/env bun), and Bun auto-installs the two dependencies from its global cache on first launch — no node_modules is created, no bun install needed. First launch may take a few extra seconds while Bun fetches packages.
Auth happens on first use, from inside the session. Ask the assistant to list your playlists: the youtube_refresh_cookies tool exports youtube.com cookies from your browser (and youtube_install_yt_dlp installs yt-dlp first if needed). You must be logged in to YouTube in that browser. Only youtube.com cookies are kept, saved to ~/.config/youtube-playlist-mcp/cookies.txt (0600).
Expect a macOS password prompt. Browsers encrypt their cookie stores with a key kept in the macOS Keychain, so the first export triggers a system dialog like "security wants to use your confidential information stored in 'Chrome Safe Storage' in your keychain", asking for your Mac login password. That's the OS asking permission to release the decryption key to yt-dlp — the same mechanism Chrome itself uses — not this project collecting your password (the dialog is drawn by macOS; the password never reaches yt-dlp or this server). Enter your login password or click Allow. The assistant is instructed to warn you before triggering it.
Prefer to do it manually? bun run cookies from the repo does the same thing (bun run cookies safari, firefox, brave, edge, or agent-browser for other sources). Why not AppleScript? Scripting a browser only exposes document.cookie, which excludes the HttpOnly cookies (SID, HSID, SSID) that InnerTube auth requires.
Development
bun install # dev dependencies (typescript) — only needed for development
bun run smoke # read-only test against the real API (requires cookies)
bun run typecheck # tsc --noEmit
Caveats
- Cookies rotate. Google rotates session cookies aggressively — sometimes within hours while the browser is open. Every stale-cookie symptom is detected and reported with a fix hint: 401/403s, private playlists 404ing as if nonexistent, and even 200 responses that YouTube served as logged-out (checked via the
logged_inresponse flag, so stale cookies never silently return anonymous data). The assistant can recover on its own viayoutube_refresh_cookies. - Your cookies are account-level credentials:
cookies.txtcan do anything your YouTube session can. It stays local (0600) and is only ever sent to youtube.com, but treat the file accordingly. - InnerTube is unofficial — if YouTube changes their response structure, tools return a diagnostic error pointing at where the JSON path broke (see
diagnoseJsonPathinsrc/util.ts). - Deleted/private videos hidden by YouTube ("N unavailable videos are hidden") aren't listed and expose no handle to remove.
- Watch history (
HL) is not supported. - Batched writes are validated live at 5,000-video scale (batches of 50, ~250 ms apart, zero failures). Keep request rates human-scale anyway.
- Config lives in
~/.config/youtube-playlist-mcp/(override withYOUTUBE_PLAYLIST_MCP_CONFIG_DIR). Not affiliated with YouTube; mind their Terms of Service.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。