youtube-kit provides the YouTube command-line tool ytk and an MCP server, both built on the same core codebase and aimed at AI agents and human users. It can be used for channel data analysis, subtitle retrieval, video uploads, metadata modification, playlist management, and comment moderation, and supports managing multiple channels simultaneously.
Usage: A Google account with a YouTube channel is required, and uv must be installed (on macOS, brew install uv works). The first run of ytk auth login takes about 5 minutes and guides you through opening various Google Cloud pages and reading the downloaded client JSON. Agents can also use ytk auth guide (setup_guide in MCP) to list the remaining steps; if the gcloud CLI is already logged in, the agent can create the project and enable APIs on your behalf, while the remaining steps still require browser interaction.
Agent integration: A short skill is provided for shell agents such as Claude Code, Codex, and Cursor to load when encountering YouTube tasks; the plugin updates with ytk versions, updates on Codex startup, and for Claude Code, automatic updates must be enabled in /plugin → Marketplaces; when using npx skills, run npx skills update. For MCP, ytk mcp exposes the same operations as tools; Claude Code can be configured directly, JSON clients such as Claude Desktop and Cursor can be configured, the ChatGPT desktop app uses the command uvx youtube-kit mcp in Settings → MCP servers → Add server → STDIO, and Codex can use codex mcp add youtube -- uvx youtube-kit mcp. The server uses the login information from ytk auth login; if also installed via uv tool install, uvx will run the installed version, ytk upgrade will update both, and the MCP client must then be restarted.
Channels and login: ytk auth login connects to one channel at a time; multiple channels (including brand channels) must be run separately and in GoSelect when prompted. Commands act on the default channel by default; use --my-channel to specify another channel by UC… ID, @handle, or exact title; MCP tools use the my_channel parameter, and the YOUTUBE_CHANNEL environment variable can set the default channel for a single shell or MCP server. Using your own Google Cloud client is necessary because the YouTube daily 10,000-unit quota belongs to the Cloud project, and the built-in client would share the quota with all users.
Google Cloud setup: Create a project in the Google Cloud Console and enable the YouTube Data API v3, YouTube Analytics API, and YouTube Reporting API (for impressions and click-through rate). In Google Auth Platform, click Get started (choose External for audience), fill in the homepage, privacy policy link, and authorized domain github.com under Branding, then click Publish app under Audience; while the app is in Testing, only test users can sign in and they are signed out after 7 days. Under Clients, create a Desktop app client and download the JSON, then run ytk auth login --client-secrets path/to/client_secret.json, and if you encounter an unverified warning, click Advanced and continue. Public data (search, videos, channels, playlists, comments) can also use just an API key: create a key in the same project and set YOUTUBE_API_KEY, or put it in the MCP server env; without a key, public data is read via login. After a channel is renamed, specify it by UC… ID or sign in again. Credentials and config.toml are located in the user config directory (macOS: ~/Library/Application Support/youtube-kit/, Linux: ~/.config/youtube-kit/); ytk auth status prints the exact paths, and environment variable overrides are supported.
Agent-oriented design: Each command outputs a single JSON document to stdout; on failure, stdout is empty, the last line of stderr is {"error": {...}}, and the exit code indicates the error type: 2 invalid input, 3 not found, 4 unauthorized, 5 quota exceeded, 6 forbidden, 7 network, 8 confirmation required, 9 protected, 10 timeout, 1 other. In a terminal, colored JSON and plain-language error messages are shown. Input accepts IDs, pasted YouTube URLs, @handles, dates, or spans such as 90d. Each command's --help and MCP tool descriptions state the quota cost. The CLI and MCP server are thin layers over the same core, and tests check that both behave consistently. ytk checks PyPI for updates in the background daily; the terminal shows a notice after output, agents receive a {"update": ...} line on stderr, and the MCP server startup description also shows a notice; ytk upgrade installs updates, and this can be disabled by setting check = false under [updates] in config.toml or YTK_NO_UPDATE_CHECK=1, and is also disabled in CI or NO_UPDATE_NOTIFIER environments.
Delete protection: YouTube has no recycle bin, so deleting videos, playlists, comments, and caption tracks requires two-step confirmation. The first call deletes nothing: the terminal shows a [y/N] prompt, and agents receive exit code 8 plus a description of the target and must run again with --confirm <id>, ensuring the approval explicitly refers to the object being deleted. Videos with more than 100 views, or public videos uploaded more than 7 days ago, cannot be deleted here (exit code 9) and must be handled in YouTube Studio; the limits can be configured via max_views and max_public_age_days under [delete_protection] in config.toml. In Claude Code's .claude/settings.json, you can set per-invocation permission prompts for delete commands. Deleting an object that no longer exists succeeds and returns "already_gone": true. This mechanism is intended to prevent accidental operations and cannot stop someone holding an OAuth token from calling the API directly.
Quota: 10,000 units per Cloud project per day, resetting at midnight Pacific Time. Read1 unit per request, 50 units for most writes, 52 units for protected deletes (102 units for caption tracks, since the target must first be looked up and ownership checked). search and upload do not use these units; each has 100 calls per day, corresponding to one page of 50 search results or one upload per call. ytk analytics and ytk impressions use separate YouTube Analytics and Reporting API quotas.
Limitations: localization, live streaming, and channel memberships are not covered. ytk --help lists all commands. The project is MIT-licensed and is not affiliated with or endorsed by Google or YouTube; YouTube is a trademark of Google LLC.