ytmcp
Provides tools for controlling a YouTube channel end-to-end, including uploading videos, editing metadata, setting visibility, managing playlists, moderating comments, updating channel branding, reading analytics, and searching 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., "@ytmcpupload my new video from ~/Videos/demo.mp4 with title 'Demo'"
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.
ytmcp
Unofficial YouTube API + MCP server — let AI agents control a YouTube channel end-to-end.
ytmcp is a Python library, REST API, CLI, and Model Context Protocol server that wraps an unofficial YouTube client. It lets AI agents (Claude Desktop, Cursor, custom agents…) upload videos, edit metadata, manage playlists, moderate comments, and read analytics — all through MCP tools.
⚠️ Disclaimer
This project is provided for educational and research purposes only.
It uses reverse-engineered, undocumented YouTube endpoints that may change or break at any time.
Automating YouTube may violate YouTube's Terms of Service.
Using this software can result in account suspension or termination.
The authors accept no liability for any consequences arising from its use.
Use at your own risk, ideally with a test account. You are solely responsible for complying with all applicable terms and laws.
Related MCP server: youtube-live-mcp
✨ Features
Domain | Capabilities |
Video | upload (resumable), update metadata, set visibility, set thumbnail, delete, get info |
Playlist | create, list, add/remove videos, delete |
Comments | list, reply, moderate (approve/hold/reject) |
Channel | get info, subscriber count, update branding/links |
Analytics | views, watch-time, subscriber growth, top videos |
Search | search videos, list channel uploads |
Three interfaces share one core:
🐍 Python library —
from ytmcp.core import YouTubeClient🤖 MCP server —
ytmcp serve(stdio / HTTP)🌐 REST API —
ytmcp api(FastAPI, auto docs at/docs)
🔐 Authentication (hybrid)
ytmcp supports two auth methods and picks automatically (auth_mode = auto):
Option A — Browser cookies (fastest)
Export cookies for
youtube.comwith a browser extension (e.g. Get cookies.txt) oryt-dlp --cookies-from-browser chrome --cookies cookies.txt.Point ytmcp at the file:
export YTMCP_AUTH_MODE=cookie
export YTMCP_COOKIE_FILE=/path/to/cookies.txt
uv run ytmcp auth verify-cookies /path/to/cookies.txtSupports Netscape cookies.txt and JSON exports (including Playwright storage_state).
Option B — OAuth 2.0 (device flow)
Create an OAuth client (type TVs and Limited Input devices) in Google Cloud Console.
Configure and log in:
export YTMCP_AUTH_MODE=oauth
export YTMCP_OAUTH_CLIENT_ID=...
export YTMCP_OAUTH_CLIENT_SECRET=...
uv run ytmcp auth loginTokens are cached in ~/.ytmcp/oauth_token.json and refreshed automatically.
Check status any time:
uv run ytmcp auth status🚀 Quick start
# 1. Install
git clone https://github.com/Lightforce325/ytmcp.git
cd ytmcp
uv venv && source .venv/bin/activate
uv pip install -e ".[dev]"
# 2. Configure auth (see above)
cp .env.example .env # then edit
# 3. Run the MCP server
uv run ytmcp serve
# or the REST API
uv run ytmcp api # http://127.0.0.1:8765/docs🤖 Connect to Claude Desktop (MCP)
Add this to claude_desktop_config.json:
{
"mcpServers": {
"ytmcp": {
"command": "uv",
"args": [
"--directory", "/ABSOLUTE/PATH/TO/ytmcp",
"run", "ytmcp", "serve"
],
"env": {
"YTMCP_AUTH_MODE": "cookie",
"YTMCP_COOKIE_FILE": "/ABSOLUTE/PATH/TO/cookies.txt"
}
}
}
}Restart Claude Desktop — the agent will now see 20 tools for controlling your channel.
See examples/claude_desktop_config.json and docs/TOOLS.md.
🧰 MCP tools
Tool | Auth | Description |
| ✅ | Upload a video file with metadata |
| ✅ | Edit title/description/tags/category |
| ✅ | public / unlisted / private / scheduled |
| ✅ | Permanently delete a video |
| — | Fetch video details |
| — | Search YouTube |
| — | List a channel's uploads |
| ✅ | Create a playlist |
| — | List channel playlists |
| ✅ | Add a video to a playlist |
| ✅ | Remove a video from a playlist |
| ✅ | Delete a playlist |
| — | List video comments |
| ✅ | Reply to a comment |
| ✅ | Approve / hold / reject a comment |
| — | Channel metadata |
| — | Subscriber count |
| ✅ | Banner / avatar / links |
| ✅ | Views, watch-time, growth |
| — | Most-viewed videos |
🧩 Example agent workflow
"Upload
intro.mp4as a private video titled Hello World, add it to my Demos playlist, then reply to the latest comment."
The agent chains: upload_video → list_playlists → add_video_to_playlist → list_comments → reply_to_comment. See examples/agent_batch_upload.py.
🏗️ Architecture
AI Agent ──MCP──► mcp/server.py ──► core/* ──► YouTube endpoints
api/app.py ──►
cli.py ──►See docs/ARCHITECTURE.md for the full breakdown.
🧪 Development
uv pip install -e ".[dev]"
uv run pytest # run tests
uv run ruff check . # lint
uv run ruff format . # format
uv run mypy src # type-check📄 License
MIT — provided as-is, without warranty. See the disclaimer above.
This server cannot be deployed
Maintenance
Related MCP Connectors
YouTube transcripts, search, channel browsing, and playlists for AI agents via MCP.
Build, run, schedule, and publish AI video pipelines to YouTube and TikTok from any MCP client.
Give AI agents a creator's video pipeline: Shorts, thumbnails and YouTube publishing.
11Hosted MCP for YouTube Studio: uploads, metadata, playlists, comments, analytics, captions.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceGives AI coding agents full control over a YouTube channel with 22 tools for channel management, videos, playlists, comments, search, analytics, thumbnails, and captions.13 npm3MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to control YouTube Live Streaming, including creating broadcasts, managing chat, and monitoring stream health via MCP tools.13 npmMIT
- FlicenseNot gradedqualityDmaintenanceEnables AI models to interact with YouTube content through 18 MCP tools for videos, transcripts, channels, and playlists.18 npm-
- AlicenseAqualityCmaintenanceEnables Claude to control a YouTube channel through MCP, including uploading and editing videos, scheduling releases, and reading channel and video analytics via official APIs.8MIT