youtube-mcp
MCP server for YouTube creator-ops — video metadata, comments, playlists, channel analytics, plus a ComfyUI bridge for AI thumbnail generation.
README
youtube-mcp
OAuth-authenticated YouTube MCP for channel owners — edit your video metadata, reply to and moderate comments, manage playlists, query channel analytics, and generate + set AI thumbnails via a ComfyUI bridge. Goes beyond the read-only Data API v3 wrappers that dominate this space.
Part of the MCP Server Series.
The pitch
Most existing YouTube MCPs use an API key against Data API v3 — search videos, fetch public metadata, read-only. This one uses OAuth 2.0 (Authorization Code + PKCE) so it can actually write to your channel: update video titles/descriptions/tags, reply to comments, moderate spam, manage playlists. Plus it hits the separate YouTube Analytics API for channel stats, and — the hero tool — generates a thumbnail via ComfyUI and pushes it to YouTube in a single MCP call.
Claude, use generate_and_set_thumbnail on video abc123:
prompt: "cyberpunk hacker at keyboard, neon blue and pink, high contrast"
→ ComfyUI renders 1280×720 → youtube-mcp fetches the bytes → POSTs to thumbnails.set. Done.
Install
# npx — no install
npx @miller-joe/youtube-mcp --help
# Docker
docker run -p 9120:9120 \
-e YOUTUBE_CLIENT_ID=... \
-e YOUTUBE_CLIENT_SECRET=... \
-e YOUTUBE_TOKEN_FILE=/token/token.json \
-v $PWD/token:/token \
ghcr.io/miller-joe/youtube-mcp:latest
Setup — Google Cloud one-time (~10 min)
-
Google account + YouTube channel — use a personal account, not a workspace one you might lose.
-
Google Cloud project at https://console.cloud.google.com — call it whatever (e.g.
youtube-mcp). -
Enable APIs:
- YouTube Data API v3
- YouTube Analytics API
-
OAuth consent screen — External, App name, support email; in Scopes add:
youtube.uploadyoutube.force-sslyt-analytics.readonly
-
Stay in Testing mode. Add yourself as a test user (required). As the project owner, your refresh token won't expire.
-
Create OAuth Client ID: Application type = Desktop app. Download the JSON.
-
Run the interactive auth flow:
npx @miller-joe/youtube-mcp --auth --client-secret-file ./client_secret.jsonA browser opens → you log in to the Google account tied to your YouTube channel → grant the requested scopes. On success, a refresh token is saved to
~/.config/youtube-mcp/token.json. -
Start the server:
npx @miller-joe/youtube-mcp --client-secret-file ./client_secret.jsonOr provide the client credentials via env:
YOUTUBE_CLIENT_SECRET_FILE, orYOUTUBE_CLIENT_ID+YOUTUBE_CLIENT_SECRET.
Connect an MCP client
claude mcp add --transport http youtube http://localhost:9120/mcp
Or point your MCP gateway at the Streamable HTTP endpoint.
Configuration
| CLI flag | Env var | Default | Notes |
|---|---|---|---|
--client-secret-file |
YOUTUBE_CLIENT_SECRET_FILE |
— | Path to Google OAuth JSON |
--client-id |
YOUTUBE_CLIENT_ID |
— | Alternative to the secret file |
--client-secret |
YOUTUBE_CLIENT_SECRET |
— | Alternative to the secret file |
--token-file |
YOUTUBE_TOKEN_FILE |
~/.config/youtube-mcp/token.json |
Refresh token storage |
--host |
MCP_HOST |
0.0.0.0 |
Bind host |
--port |
MCP_PORT |
9120 |
Bind port |
--comfyui-url |
COMFYUI_URL |
(unset — bridge disabled) | ComfyUI HTTP URL for bridge tools |
| — | COMFYUI_DEFAULT_CKPT |
sd_xl_base_1.0.safetensors |
Default checkpoint for bridge tool |
Tools
Videos
list_my_videos— paginated list of authenticated channel's uploadsget_video— full detail for one videoupdate_video_metadata— title / description / tags / category / privacydelete_video— permanently delete a video. Requiresconfirm_video_titleto match the current title exactly as a guard against deleting the wrong video.
Captions
list_captions— list caption tracks on a video (language, name, status, draft flag)upload_caption— upload an SRT or WebVTT caption track to a videodelete_caption— delete a caption track
Shorts
list_my_shorts— find Shorts in recent uploads (filters by ≤60s duration)get_shorts_analytics— YouTube Analytics query restricted to Shorts (creatorContentType==SHORTS)
Playlists
create_playlist— create a playlist (default private)add_to_playlist— add a video to an existing playlist
Comments
list_comments— top-level comment threads on a videoreply_to_comment— reply to a top-level commentmoderate_comment— hold / approve / reject a comment
Analytics
query_channel_analytics— date-ranged metrics with optional dimensions and filters
Bridge (when COMFYUI_URL is configured)
generate_and_set_thumbnail— generate thumbnail via ComfyUI and set it on a video in one call
Quota notes
YouTube Data API free tier = 10,000 units/day. Key operation costs:
videos.list,commentThreads.list— 1 unit eachvideos.update,comments.insert,thumbnails.set— 50 units eachvideos.insert(upload) — 1,600 units → ~6 uploads/day on free tier
Most creator-ops workflows stay well under the free cap.
Architecture
┌────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ MCP client │────▶│ youtube-mcp │────▶│ YouTube APIs │
│ (Claude etc.) │◀────│ (this server) │◀────│ (Data/Analytics)│
└────────────────┘ └────────┬─────────┘ └─────────────────┘
│
│ (bridge tools only)
▼
┌──────────────────┐
│ ComfyUI │
│ (txt2img) │
└──────────────────┘
OAuth refresh tokens are cached locally and refreshed just-in-time before expiry. The bridge tool downloads image bytes from ComfyUI internally — ComfyUI does not need to be publicly reachable.
Development
git clone https://github.com/miller-joe/youtube-mcp
cd youtube-mcp
npm install
npm run dev
npm run build
npm test
Requires Node 20+.
Roadmap
- [x] Video list / get / update metadata
- [x] Playlist create + add-to
- [x] Comments list / reply / moderate
- [x] Channel analytics query
- [x] ComfyUI thumbnail bridge (
generate_and_set_thumbnail) - [x] Caption upload + list + delete (
upload_caption,list_captions,delete_caption) - [x] Video delete with title-match confirm guard
- [x] Shorts ergonomics:
list_my_shorts(duration filter) +get_shorts_analytics(creatorContentType==SHORTS) - [ ] Video upload (
video_upload) — resumable upload support - [ ] Reporting API for bulk historical data exports
License
MIT © Joe Miller
Support
If this saves you time, consider supporting development:
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.