
youtube-kit
io.github.eukosh由 GitHub 账号 eukosh 发布v0.7.3更新于 Nov 2, 2026
YouTube CLI and MCP server: search and read public YouTube, and manage your own channels.
概览
本地 MCP 服务器兼命令行工具,让助手搜索和读取公开 YouTube 内容,并管理自己的频道:分析数据、视频、字幕、评论和播放列表。
- 可以做什么
- 搜索并读取公开的 YouTube 视频、频道、播放列表和评论
- 获取频道分析数据与展示次数,可按日期、视频、国家、设备或流量来源细分
- 读取、上传、替换、隐藏或删除字幕轨,包括转写文本和机器翻译
- 列出、发布、回复、编辑、审核、批准、搁置、拒绝或删除评论,并可封禁作者
- 上传、更新、设置缩略图、评分或删除视频,并管理播放列表和频道品牌设置
- 查看并切换多个已登录频道,以及订阅或取消订阅
- 适用场景
- 适合让助手处理自己的 YouTube 频道:查看表现数据、提取转写文本、审核评论,或上传和编辑视频;也适合在对话中直接查询公开的 YouTube 内容。
- 运行要求
- 通过 uvx 在本地运行(Python/uv)。需要一个带 YouTube 频道的 Google 账号,并完成一次性的 Google Cloud 配置:通过 ytk auth login 创建自己的 OAuth 桌面客户端 JSON,并启用 YouTube Data、Analytics 和 Reporting API。公开读取也可改用 YOUTUBE_API_KEY。可选 YOUTUBE_CHANNEL 设置默认频道。每个 Cloud 项目每天有 10,000 单位配额。
安装
在 SourceWeft 中
- 打开 控制台中的 youtube-kit,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
youtube-kit
[CI] [PyPI] [Python] [License: MIT] [Listed on mcpservers.org]
YouTube CLI (ytk) and MCP server, built for agents and humans. Let Claude Code, Codex, Cursor, Claude Desktop or ChatGPT work on your channel: analytics, transcripts, uploads, metadata, playlists and comment moderation. It handles several channels, and you can run the same commands in your own terminal.
[Claude Code answering "what were my top 3 videos in the last 28 days?" with ytk]
Quick start
You need a Google account with a YouTube channel, and uv (brew install uv on macOS). The first ytk auth login takes about 5 minutes: it opens each Google Cloud page, says what to click and picks up the file you download.
[ytk commands piping JSON into jq]
Or ask your agent: "Which of my videos got the most views this month, and are any comments waiting for review?"
Use it from your agent
Skill: Claude Code, Codex, Cursor and other shell agents
A short skill teaches the agent the CLI. It loads only when a YouTube task comes up.
The plugins follow ytk releases. Codex updates them at startup; Claude Code does once you turn on auto-update under /plugin → Marketplaces. With npx skills, run npx skills update.
MCP: Claude Desktop, ChatGPT and other MCP clients
ytk mcp serves the same operations as tools. In Claude Code:
In clients configured with JSON (Claude Desktop, Cursor and others):
In the ChatGPT desktop app: Settings → MCP servers → Add server → STDIO, with the command uvx youtube-kit mcp. Codex shares that setting (codex mcp add youtube -- uvx youtube-kit mcp).
The server uses your ytk auth login logins. If you also installed ytk with uv tool install, uvx runs that installed version: ytk upgrade updates both. Restart the MCP client afterwards. Not set up yet? The model can walk you through it with the setup_guide tool.
What it covers
Not covered: localizations, live streaming and channel memberships. ytk --help lists every command, and the skill fits them on one page with jq recipes.
Channels and login
ytk auth login connects one channel. Run it again for each of your other channels, including brand channels: pick the one you want when Google asks.
Commands work on the default channel unless --my-channel names another, by UC… ID, @handle or exact title. MCP tools take my_channel the same way, so you can say "upload this to my gaming channel". YOUTUBE_CHANNEL sets the default for one shell or one MCP server.
Why your own Google Cloud client. YouTube's daily quota of 10,000 units belongs to a Cloud project. A client shipped inside ytk would split one quota among all its users. Yours is shared by your channels only.
Let an agent set it up. ytk auth guide (setup_guide over MCP) lists what's left, with links and the values to enter. With the gcloud CLI signed in, the agent can create the project and enable the APIs for you. The rest needs your browser. Already have the client JSON? Run ytk auth login --client-secrets FILE.
[The guided ytk auth login setup]
Manual setup, files and environment variables
The guided setup does this:
- In the Google Cloud Console, create a project and enable YouTube Data API v3, YouTube Analytics API and YouTube Reporting API (for impressions and click-through rate).
- In Google Auth Platform, click Get started (audience External). On Branding, fill in the home page (
https://github.com/eukosh/youtube-kit), the privacy policy link (https://github.com/eukosh/youtube-kit/blob/main/PRIVACY.md) and the authorized domaingithub.com; Google won't publish without them. Then on Audience click Publish app. While the app is in Testing, only listed test users can sign in and Google logs them out after 7 days. - Under Clients, create a client of type Desktop app and download its JSON.
ytk auth login --client-secrets path/to/client_secret.json. Google warns that it hasn't verified the app: it's your own, so click Advanced, then Go to ytk (unsafe).
Public data (search, videos, channels, playlists, comments) also works with just an API key: create one in the same project and export YOUTUBE_API_KEY=..., or put it in the MCP server's env. Without a key, ytk reads public data through your login.
ytk remembers each channel's handle from when you logged in. After renaming a channel on YouTube, name it by its UC… ID or run ytk auth login for it again.
Credentials and config.toml live in the user config directory (~/Library/Application Support/youtube-kit/ on macOS, ~/.config/youtube-kit/ on Linux). ytk auth status prints the exact paths. These environment variables override them:
Built for agents
- JSON out, exit codes for failures. Every command prints one JSON document on stdout. On failure, stdout stays empty, the last line of stderr is
{"error": {"type": "not_found", "message": "..."}}, and the exit code names the type: 2 bad input, 3 not found, 4 not authorized, 5 quota exceeded, 6 forbidden, 7 network, 8 confirmation required, 9 protected, 10 timeout, 1 anything else. The skill tells agents what to do about each. At a terminal you get colored JSON and plain-sentence errors. - Forgiving inputs. Pass IDs or pasted YouTube URLs,
@handlesfor channels, and dates or spans like90d. - Quota costs up front. Each command's
--helpand each MCP tool description states what it spends. - One core. The CLI and the MCP server are thin layers over the same code, and a test fails if either misses an operation.
- Guarded deletes. See below.
- Update notices.
ytkchecks PyPI once a day in the background and tells you when a newer release is out: after the output at a terminal, as an{"update": ...}stderr line for agents, and in the MCP server's instructions at startup.ytk upgradeinstalls it. Turn the check off withcheck = falseunder[updates]inconfig.tomlorYTK_NO_UPDATE_CHECK=1; it's also off whenCIorNO_UPDATE_NOTIFIERis set.
Deleting
YouTube has no trash, and agents make mistakes. So deleting videos, playlists, comments and caption tracks is guarded:
-
Two steps. The first call deletes nothing. At a terminal you get a
[y/N]prompt. An agent gets exit 8 with a description of the target and must run the command again with--confirm <id>, so the approval always names the exact thing being deleted. -
Damage limit. A video with more than 100 views, or one that is public and was uploaded more than 7 days ago, can't be deleted here at all (exit 9). Delete those in YouTube Studio. The limits live in
config.toml(ytk auth statusshows where): -
Harness approval. Have your agent ask you before every delete. In Claude Code, add this to
.claude/settings.json: -
Idempotent. Deleting something that is already gone succeeds with
"already_gone": true.
This stops mistakes, not a determined agent. Anything holding your OAuth token can call the API directly.
Quota
Google gives each Cloud project 10,000 units a day, resetting at midnight Pacific time. Reads cost 1 unit per request, most writes 50, and guarded deletes 52, or 102 for a caption track (they look up the target and check ownership first). search and uploads don't use those units: each gets its own 100 calls a day, one per page of 50 search results or per upload. ytk analytics and ytk impressions use the separate YouTube Analytics and Reporting API quotas.
Contributing
See CONTRIBUTING.md for the development setup and CHANGELOG.md for what changed. Report security issues privately, as SECURITY.md describes.
License
MIT. youtube-kit is not affiliated with or endorsed by Google or YouTube. YouTube is a trademark of Google LLC.
来源:README.md,提交 52c8e49
工具
0版本历史
5- v0.7.3最新Oct 26, 2026
- v0.7.2Oct 25, 2026
- v0.7.1Oct 21, 2026
- v0.7.0Oct 20, 2026
- v0.6.0Oct 18, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分