
Youtube Mcp
io.github.pratikgh0se由 GitHub 帳號 pratikgh0se 發布v0.3.1更新於 Nov 7, 2026
Search YouTube, manage your channel and read analytics; every change needs your approval.
概覽
本機 MCP 伺服器,讓助理搜尋 YouTube、讀取字幕與留言、管理你的頻道並查看創作者分析,所有變更都需你核准。
- 可以做什麼
- 搜尋影片、熱門排行、頻道上傳內容、影片與頻道詳情、公開留言和字幕
- 讀取自己的頻道、訂閱、留言串、自有影片、播放清單、字幕軌與審核佇列
- 取得創作者分析:頻道概覽、熱門影片、觀眾留存及依日期範圍的自訂報表
- 上傳、續傳或取消影片;更新中繼資料與縮圖;管理字幕和播放清單
- 回覆、審核或刪除留言,編輯頻道資料,並在一次核准後批次取消訂閱
- 匯入 Google Takeout 觀看紀錄到本機 SQLite 檔案,做私密觀看分析與時段比較
- 適用情境
- 適合讓助理調研 YouTube 內容、依字幕摘要影片,或不必離開對話就完成上傳、播放清單整理、留言審核與分析查看等日常頻道工作。
- 執行需求
- 以 stdio 在本機執行;npx 方式需 Node.js 22.13 或更新版本,或使用 Claude Desktop 安裝包。需要啟用 YouTube Data API v3(創作者工具另需 YouTube Analytics API)的 Google Cloud 專案、YOUTUBE_API_KEY;帳戶工具還需在 YOUTUBE_OAUTH_CLIENT_SECRET_FILE 指定 Desktop OAuth 用戶端 JSON 路徑,以及 YOUTUBE_MCP_PROFILE_ID 和 YOUTUBE_MCP_CHANNEL_ID。需用 youtube-auth 指令完成一次 Google 登入;狀態預設存於 ~/.youtube-mcp。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Youtube Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
YouTube MCP
A local-first MCP server that lets AI assistants search YouTube, manage your channel and read your analytics, and asks you to approve changes to your channel and content first.
[License: MIT] [Node.js >=22.13] [MCP server]
YouTube MCP is a Model Context Protocol server written in TypeScript. It exposes 79 tools to MCP clients such as Claude Code, Claude Desktop, Cursor and Codex. It runs on your own machine over stdio, keeps its OAuth tokens and working data on your disk, and never starts a network listener unless you ask for one.
Anything that changes your YouTube account goes through a preflight, approve, execute flow. The assistant first shows you exactly what it is about to do, and nothing happens until the exact previewed change is approved.
Quick start
- Get your keys. Follow the beginner setup guide (5 minutes for public research, about 15 with your own channel).
- Install in your agent. Pick yours in Install in your AI agent.
- Sign in once (only for your own channel): run the
youtube-authcommand in Account and creator tools. - Ask your agent: "Check my YouTube auth status", then "Search YouTube for talks about MCP".
What it can do
Read (no account needed, just an API key)
- Search videos (with order, date, duration, channel, region and safe-search filters), see what is trending, list the recent uploads of any channel, look up videos and channels.
- List the public comments on a video.
- Fetch a public transcript (best effort; some videos have none).
Read (your own account and channel, via OAuth)
- Your channel, your subscriptions, and comment threads on your channel.
- Creator analytics: channel overview, top videos and audience retention for a date range, plus a flexible report (views by day, traffic sources, devices, countries, demographics and more).
- Your uploaded videos, playlists and playlist items, caption tracks, and the comment moderation queue.
Write (your own account; channel and content changes need preview and approval, viewer actions need confirm: true)
- Uploads: resumable video uploads, with status check, resume and cancel. Uploads are private unless you explicitly ask to publish.
- Videos: update title, description and other metadata, and set thumbnails.
- Captions: upload, update, download and delete caption tracks.
- Playlists: create, update, delete, and add, remove or reorder items. New playlists default to private.
- Comments and moderation: reply to comments, set a moderation status (including banning an author), and delete comments on your channel.
- Channel profile: edit your channel description, keywords, country and default language.
- Subscription curation: review subscriptions with subscriber counts and last upload date, then remove many at once after one approval.
- Account actions: subscribe, unsubscribe, rate a video, post a top-level comment (these need a literal
confirm: true).
Private viewing analysis (local only)
- Import your Google Takeout YouTube history and get a profile and trend comparison between two date ranges. The data stays in a local SQLite file.
- Save local curation allowlists and generate a finite, proposed queue. The server never applies a queue to your account.
Safety model
Write tools are built so an AI client cannot make a surprise change:
- Preflight. A
youtube_preflight_*tool reads fresh state from YouTube, validates the request and returns an exact preview. - Approve. A separate
youtube_approvecall (one tool for every kind of change), withconfirm: true, binds approval to the profile, channel, target, requested change and fresh state. Approvals expire. They are stored locally, so an approved operation survives a server restart until it expires. - Execute. The write tool runs only with the same approved inputs and
confirm: true.
More guard rails, all from the code:
- Viewer actions (
youtube_subscribe,youtube_unsubscribe,youtube_rate_video),youtube_create_commentand the local curation and reset tools are single-step writes: no preflight, but they require a literalconfirm: true. - Mutations are never retried automatically. Ambiguous outcomes are reconciled with a read.
- Public visibility, scheduling, synthetic-media changes and banning an author need an explicit, elevated flag.
- Comment deletion requires the comment to belong to your selected channel.
- Caption downloads never overwrite an existing path or follow symbolic links.
- Creator tools check that the signed-in Google account matches the channel ID you configured.
- The automated tests never make a live mutation.
Full details are in docs/README.md.
Requirements
- Node.js 22.13 or newer
- A Google Cloud project with the YouTube Data API v3 enabled (and the YouTube Analytics API for the creator analytics tools)
- A YouTube Data API key for public reads, and an OAuth desktop client for account and creator tools
Install in your AI agent
No npm publish is needed. Every route below runs the server from the prebuilt tarball attached to the GitHub release with npx -y https://github.com/pratikgh0se/youtube-mcp/releases/download/v0.3.2/youtube-mcp-0.3.2.tgz --transport stdio, except the Claude Desktop bundle, which carries its own copy. You need Node.js 22.13+ on your PATH for the npx routes. Create your Google credentials first with the beginner setup guide (short version: Google credentials). You need at least a YouTube Data API key.
Ready-made files for each client are in configs/. Use the placeholders as shown and never paste a real key into a file you commit.
The first launch downloads the prebuilt release tarball and installs its dependencies, which takes a few seconds on a normal connection. Later launches use npm's cache. To be safe against a client start-up timeout on a slow network, warm the cache once in a terminal first:
Claude Code
Or inside Claude Code: /plugin marketplace add pratikgh0se/youtube-mcp, then /plugin install youtube-mcp@youtube-mcp. Claude Code asks for your API key (stored in your OS credential store) and four more settings: OAuth client file, profile name and channel ID are required, and the state directory is optional (leave it blank to use ~/.youtube-mcp). The plugin only holds config. The server itself still runs through npx.
Claude Desktop
Download youtube-mcp-<version>.mcpb (one universal bundle for macOS, Windows and Linux) from GitHub Releases and double-click it. Claude Desktop shows an install dialog and asks for your API key. The bundle includes the server, so it needs no npx at run time.
Fallback if you prefer not to use the bundle: add configs/claude-desktop.json to claude_desktop_config.json and restart. The first start downloads the package, which can take a few seconds.
Codex CLI
That stores the key in ~/.codex/config.toml. To keep it out of the file, use configs/codex.toml instead. It forwards the variables from your shell with env_vars (Codex does not expand ${VAR}) and sets startup_timeout_sec = 180, because the default of 10 seconds is shorter than the first npx run.
Gemini CLI
Gemini prompts for your API key (kept in the system keychain, required) and the OAuth client file, profile name and channel ID (needed for your channel's tools; see the setup guide). Change them later with gemini extensions config youtube-mcp. A plain settings.json entry is in configs/gemini-settings.json.
Note: Google stopped serving Gemini CLI to AI Pro, Ultra and free individual users on 2026-06-18. Paid API-key and enterprise users keep it (source). Everyone else should use Antigravity CLI below.
Antigravity CLI
Add this to ~/.gemini/config/mcp_config.json (global) or <workspace>/.agents/mcp_config.json. It is also in configs/antigravity.json.
Cursor
The button reads YOUTUBE_API_KEY from your shell environment. Or add configs/cursor.json to .cursor/mcp.json (or ~/.cursor/mcp.json). It uses ${env:YOUTUBE_API_KEY}, so no secret is written to the file.
VS Code / Copilot
The button installs the server without a key. Add one afterwards through the server's env, or use the file below, which prompts for it. From a terminal:
Or save configs/vscode.json as .vscode/mcp.json. VS Code asks for the key on first start (password: true) and stores it securely.
Windsurf
Use configs/windsurf.json (it reads ${env:YOUTUBE_API_KEY}). The current Devin docs put the file at ~/.config/devin/mcp_config.json (Windows: %APPDATA%\devin\mcp_config.json). The older path ~/.codeium/windsurf/mcp_config.json is what many guides still show. Only the first is confirmed by the vendor's docs, so if one does not load, try the other.
Cline
Open the MCP Servers panel, Configure, then "Configure MCP Servers", and add configs/cline.json. For Cline CLI the file is ~/.cline/data/settings/cline_mcp_settings.json. Cline does not document env interpolation, so the key goes in as a literal value in that file. You can also ask Cline to install it from llms-install.md.
Zed
Add configs/zed.json to your Zed settings (run the zed: open settings file action). Zed calls the map context_servers. The key goes in as a literal value.
goose
Run goose configure, choose Add Extension, then Command-Line Extension, and enter npx -y https://github.com/pratikgh0se/youtube-mcp/releases/download/v0.3.2/youtube-mcp-0.3.2.tgz --transport stdio with the key as an environment variable. Or add configs/goose.yaml to ~/.config/goose/config.yaml. The deeplink form (paste it into a browser or open) sets only the command, so add the key afterwards:
Other agents
Any client that launches stdio MCP servers can use configs/generic-stdio.json. Templates for OpenCode, OpenClaw and Hermes are in configs/ too. Agents installing this for a user should read AGENTS.md.
Account and creator tools: authorize once
Public tools need only the API key. For account and creator tools, add the OAuth client file, profile name and channel ID from step 2 to your client config, then run the one-time Google sign-in from a terminal with the same values:
This opens a browser for Google consent on a local 127.0.0.1 callback and requests the youtube, youtube.force-ssl and yt-analytics.readonly scopes. The token is stored under ~/.youtube-mcp for that profile, and later calls refresh it silently. Run it again if you revoke access.
Google credentials
1. Create credentials
New to Google Cloud? Use the step-by-step beginner setup guide. The short version:
In the Google Cloud console:
- Create or pick a project, then enable YouTube Data API v3 and YouTube Analytics API.
- Create an API key. This is enough for the public tools.
- For account and creator tools, configure the OAuth consent screen (add yourself as a test user while the app is in testing), then create an OAuth client ID of type Desktop app and download its JSON file.
2. Set environment variables
Put these in your client config (see Install in your AI agent), or copy .env.example to .env (it is git-ignored) when running from a checkout. Never commit real values.
Run from a local checkout
For development, or to run without npx:
Point your client at the checkout with an absolute path:
More templates (one per client) are in configs/. They launch the server with npx -y https://github.com/pratikgh0se/youtube-mcp/releases/download/v0.3.2/youtube-mcp-0.3.2.tgz --transport stdio. To use your checkout instead, change the command to node with the path above.
Optional: local HTTP
This binds to 127.0.0.1 only. Do not expose it to the internet.
Example prompts
- "Search YouTube for recent talks about the Model Context Protocol and summarise the top three."
- "Get the transcript for this video and list the main points."
- "Show my channel's top 10 videos for the last 90 days and where viewers drop off in the most recent one."
- "Preview a private upload of
/Users/me/videos/demo.mp4titled 'Demo', and wait for me to approve it." - "Create a private playlist called 'To review' and add these five videos to it. Show me the preview first."
- "List the unreplied comments on my latest video and draft replies for me to approve."
- "Import my Takeout watch history and compare what I watched in January with what I watched in June."
Tools
79 tools, grouped by area. Tools marked "preflight and approve" need the three-step flow above.
Privacy and security
- The OAuth refresh token is stored on your machine under
~/.youtube-mcp(orYOUTUBE_MCP_STATE_DIR), in a file with user-only permissions. - Operation approvals, upload recovery state and your Takeout-derived SQLite database (
consumption.sqlite) live in the same directory. The Takeout importer never sends data to YouTube. - Your Google credentials go only to Google's APIs. The public transcript tool uses the
youtube-transcriptpackage to fetch captions from YouTube. - The default transport is stdio. The optional HTTP transport binds to
127.0.0.1only. - Never commit
.env, your OAuth client JSON, token state or Takeout exports. The.gitignorealready excludes.envfiles. - Running this server gives the AI client access to your YouTube account within the scopes you grant. Review each preview before approving it.
- To report a vulnerability, follow SECURITY.md and use GitHub's private reporting. Please do not open a public issue.
Development
Continuous integration (.github/workflows/verify.yml) runs the same checks on Node 22. See docs/CHANGELOG.md for what has changed.
Contributing
Issues and pull requests are welcome. Please run npm run lint, npm run typecheck:tests and npm test before opening a pull request, add tests for any behavior change, and keep write actions behind the preflight and approve flow. Never include real credentials, tokens or personal data in issues, tests or fixtures.
License
MIT (c) 2026 Pratik Ghose
來源:README.md,提交 1d5d254
工具
0版本歷史
2- v0.3.1最新Oct 31, 2026
- v0.3.0Oct 29, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分