youtube-mcp
youtube-mcp
@ザビエル-zav のYouTubeチャンネル分析を、Claudeから直接できるようにするMCPサーバー。
「先週の動画、どれが一番CTR良かった?」のような質問に、実データを取ってきて答えられる状態を目指す。
Node.js製(Python不使用)。YouTube Analytics API / Reporting API / Data API v3 を
公式のNode用ライブラリ(googleapis, google-auth-library)でラップし、
MCP公式のTypeScript SDK(@modelcontextprotocol/sdk)でツールとして公開している。
使うAPIと使い分け
欲しいデータ | API | 取得方式 |
再生数、視聴時間、平均視聴維持率、登録者増減、流入元、視聴者層 | YouTube Analytics API | リクエストするとその場でJSONが返る |
サムネ表示回数、インプレッションCTR | YouTube Reporting API (Bulk Reports) | 事前にジョブ登録 → 毎日CSVが生成 → DLして読む |
動画タイトル、説明、コメント | YouTube Data API v3 | リクエストするとその場でJSONが返る |
CTRだけ取得方式が根本的に違う(バルクレポート)ため、register-reach-job.js で
ジョブ登録 → download-reports.js で定期的にローカルへCSVを蓄積、という別経路になっている。
Related MCP server: YouTube MCP Server
セットアップ
1. Google Cloud Console
プロジェクトを作成
以下3つのAPIを有効化
YouTube Analytics API
YouTube Reporting API
YouTube Data API v3
OAuth同意画面を設定(ユーザーの種類=外部、テストユーザーに自分のGoogleアカウントを追加)
認証情報 > OAuthクライアントID > アプリの種類=デスクトップアプリ を作成し、JSONをダウンロード
ダウンロードしたJSONを
client_secret.jsonという名前でこのリポジトリ直下に置くclient_secret.jsonと、初回認証後に作られるtoken.jsonは絶対にコミットしないこと。.gitignore済みだが、誤ってgit add -fしないよう注意。
2. Node.jsと依存パッケージ
Node.js 18以上が必要(未インストールなら nodejs.org からLTS版を入れる。
インストーラーに npm も含まれるので、Pythonのような別途PATH設定は基本不要)。
npm install3. リーチレポート(CTR)のジョブ登録 — 最優先で実行
Reporting API は「ジョブを登録した日」からデータ生成が始まり、過去分も登録時点から 30日前までしか遡れない。登録が遅れるほど過去のCTRデータが失われるので、 他の作業より先にこれだけ実行しておく。
npm run register-reach-job初回はブラウザが開いて認証を求められる(以降は token.json で自動更新)。
4. MCPサーバー起動
npm startClaude Desktop から使う場合は claude_desktop_config.json に以下のように登録する。
{
"mcpServers": {
"youtube-analytics": {
"command": "node",
"args": ["/absolute/path/to/youtube-mcp/server.js"]
}
}
}5. リーチレポートのダウンロード(登録から数時間〜2日後)
npm run download-reportsdata/reach/<report_type>/ 配下にCSVが蓄積される。レポートはYouTube側で60日
(過去データ分は30日)で消えるため、定期的に(できれば1日1回)実行し続けること。
Windowsならタスクスケジューラ、Mac/Linuxならcronに登録しておくとよい。
get_reach ツールはこのローカルCSVを読む。
公開ツール一覧
ツール名 | 引数 | 返すもの |
|
| 期間全体の再生数・視聴時間・登録者増減 |
|
| 再生数上位の動画とその基本数値 |
|
| 指定動画の詳細数値 |
|
| 視聴維持率カーブ(10%刻み)+最大離脱ポイント |
|
| 流入元の内訳 |
|
| サムネ表示回数とCTR(ローカル蓄積CSVから集計) |
|
| コメント一覧(関連度順) |
出力は生JSONではなく、丸めた数値・上限20件程度のテキスト表で返す (Claude側のコンテキスト消費を抑えるため)。
既知の制約
Analytics APIのデータは YouTube Studio 表示より最大2日程度のラグがある。「昨日の数字」は取れないことがある。
get_reachはローカルにダウンロード済みのCSVしか見ない。download-reports.jsを実行していない期間のデータは出てこない。channel_reach_basic_a1/channel_reach_combined_a1の正確な列構成は未確認。get_reachは列名をキーワードで推測して読むフォールバックにしてあるが、実際にダウンロードしたCSVのヘッダーで一度確認すること。書き込み系スコープは付けていない(読み取り専用)。動画を誤って変更・削除する経路は存在しない。
デプロイ先の分岐
使いたい場所 | 必要なもの |
Claude Desktop アプリ | ローカルで |
claude.ai (Web/スマホ) | HTTPSでアクセスできるリモートMCPサーバーとして公開が必要 |
スマホからも使いたい場合は、StdioServerTransport を StreamableHTTPServerTransport
(@modelcontextprotocol/sdk/server/streamableHttp.js)に切り替えて、
既存のホスティング環境に相乗りするのが早い。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables Claude to access and manage YouTube channel data through the YouTube Data API v3 and YouTube Analytics API. Provides tools for reading analytics, fetching video metadata, searching uploads, and updating video SEO directly from Claude.91MIT
- FlicenseNot gradedqualityDmaintenanceProvides AI assistants with comprehensive YouTube analytics and channel management capabilities, including channel performance, video analytics, audience insights, and content strategy tools.391
- AlicenseAqualityDmaintenanceEnables YouTube integration with Claude Code, including video search, metadata retrieval, transcript fetching, channel exploration, and trending videos.81MIT
- AlicenseAqualityCmaintenanceEnables AI assistants to access YouTube organic analytics, including channel stats, video performance, watch time, and audience engagement, via the YouTube Data API v3 and Analytics API v2.621MIT
Related MCP Connectors
YouTube transcripts, search, channels, playlists and bulk transcript jobs for AI agents. 14 tools.
Agent-callable creator intelligence: 952+ scored YouTube creators across 180 niches.
Provide token-optimized, structured YouTube data to enhance your LLM applications. Access efficien…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Zavier0305/youtube-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server