Skip to main content
Glama

youtube-mcp

チャンネル所有者向けのOAuth認証済みYouTube MCPです。動画メタデータの編集、コメントへの返信とモデレーション、プレイリストの管理、チャンネル分析のクエリ、そしてComfyUIブリッジを介したAIサムネイルの生成・設定が可能です。この分野で主流の読み取り専用Data API v3ラッパーを超えた機能を提供します。

youtube-mcp MCP server

GitHub Sponsors Ko-fi

概要

既存のYouTube MCPのほとんどは、Data API v3に対してAPIキーを使用する読み取り専用(動画検索、公開メタデータの取得)のものです。本ツールはOAuth 2.0(Authorization Code + PKCE)を使用するため、実際にチャンネルへの書き込みが可能です。動画のタイトル、説明文、タグの更新、コメントへの返信、スパムのモデレーション、プレイリストの管理などが行えます。また、チャンネル統計用のYouTube Analytics APIにも対応しており、ComfyUIでサムネイルを生成してYouTubeにアップロードする処理を1つのMCP呼び出しで完結させます。

Claude, use generate_and_set_thumbnail on video abc123:
  prompt: "cyberpunk hacker at keyboard, neon blue and pink, high contrast"

ComfyUIが1280×720の画像をレンダリングし、youtube-mcpがそのバイトデータを取得して thumbnails.set にPOSTします。これで完了です。

Related MCP server: yt-fetch

インストール

# npx, no install
npx @miller-joe/youtube-mcp --help

# Docker
docker run -p 9120:9120 \
  -e YOUTUBE_CLIENT_ID=... \
  -e YOUTUBE_CLIENT_SECRET=... \
  -e YOUTUBE_TOKEN_FILE=/token/token.json \
  -v $PWD/token:/token \
  ghcr.io/miller-joe/youtube-mcp:latest

セットアップ: Google Cloudでの初期設定(約10分)

  1. GoogleアカウントとYouTubeチャンネル。 紛失のリスクがあるワークスペース用ではなく、個人用アカウントを使用してください。

  2. Google Cloudプロジェクト を https://console.cloud.google.com で作成します。名前は何でも構いません(例: youtube-mcp)。

  3. APIの有効化:

    • YouTube Data API v3

    • YouTube Analytics API

  4. OAuth同意画面: 「外部」を選択し、アプリ名とサポートメールアドレスを設定します。スコープには以下を追加してください:

    • youtube.upload

    • youtube.force-ssl

    • yt-analytics.readonly

  5. テスト モードのままにします。自分自身を テストユーザー として追加してください(必須)。プロジェクト所有者であれば、リフレッシュトークンは期限切れになりません。

  6. OAuthクライアントIDの作成: アプリケーションの種類 = デスクトップアプリ。JSONをダウンロードします。

  7. 対話型認証フローの実行:

    npx @miller-joe/youtube-mcp --auth --client-secret-file ./client_secret.json

    ブラウザが開き、YouTubeチャンネルに紐付いたGoogleアカウントでログインし、要求されたスコープを許可します。成功すると、リフレッシュトークンが ~/.config/youtube-mcp/token.json に保存されます。

  8. サーバーの起動:

    npx @miller-joe/youtube-mcp --client-secret-file ./client_secret.json

    または、環境変数 YOUTUBE_CLIENT_SECRET_FILE、あるいは YOUTUBE_CLIENT_ID + YOUTUBE_CLIENT_SECRET を介してクライアント認証情報を提供します。

MCPクライアントへの接続

claude mcp add --transport http youtube http://localhost:9120/mcp

または、MCPゲートウェイをStreamable HTTPエンドポイントに向けてください。

設定

CLIフラグ

環境変数

デフォルト

備考

--client-secret-file

YOUTUBE_CLIENT_SECRET_FILE

(なし)

Google OAuth JSONへのパス

--client-id

YOUTUBE_CLIENT_ID

(なし)

シークレットファイルの代わり

--client-secret

YOUTUBE_CLIENT_SECRET

(なし)

シークレットファイルの代わり

--token-file

YOUTUBE_TOKEN_FILE

~/.config/youtube-mcp/token.json

リフレッシュトークンの保存先

--host

MCP_HOST

0.0.0.0

バインドホスト(HTTPモードのみ)

--port

MCP_PORT

9120

バインドポート(HTTPモードのみ)

--stdio

MCP_TRANSPORT=stdio

(未設定)

HTTPの代わりにstdio経由でMCP通信を行う。stdio優先のMCPクライアント(Claude Desktop, mcp-inspector)からサブプロセスとして起動する場合に使用

--comfyui-url

COMFYUI_URL

(未設定、ブリッジ無効)

ブリッジツール用のComfyUI HTTP URL

(フラグなし)

COMFYUI_DEFAULT_CKPT

sd_xl_base_1.0.safetensors

ブリッジツールのデフォルトチェックポイント

トランスポート

サーバーはデフォルトでStreamable HTTPを使用します(Claude Code、MetaMCP、生の fetch に最適)。--stdio を渡す(または MCP_TRANSPORT=stdio を設定する)とstdioモードに切り替わります。これはClaude DesktopやMCP Inspectorのようなstdio優先クライアントが期待する動作です:

// claude_desktop_config.json
{
  "mcpServers": {
    "youtube": {
      "command": "npx",
      "args": ["-y", "@miller-joe/youtube-mcp", "--stdio"],
      "env": {
        "YOUTUBE_CLIENT_SECRET_FILE": "/path/to/client_secret.json",
        "YOUTUBE_TOKEN_FILE": "/path/to/token.json"
      }
    }
  }
}

StdioモードではOAuthトークンの事前チェックがスキップされます。サーバーは保存されたトークンがなくても起動し、ツール呼び出し時に認証エラーが発生します。Claude Desktopから使用する前に、一度HTTPモードで youtube-mcp --auth --client-secret-file <path> を実行してリフレッシュトークンを生成してください。

ツール

動画

  • list_my_videos: 認証済みチャンネルのアップロード動画をページネーション付きでリスト表示。

  • get_video: 特定の動画の詳細情報を取得。

  • update_video_metadata: タイトル、説明文、タグ、カテゴリ、プライバシー設定の更新。

  • delete_video: 動画を完全に削除。誤削除を防ぐため、confirm_video_title で現在のタイトルと一致させる必要があります。

字幕

  • list_captions: 動画の字幕トラックをリスト表示(言語、名前、ステータス、ドラフトフラグ)。

  • upload_caption: SRTまたはWebVTT字幕トラックを動画にアップロード。

  • delete_caption: 字幕トラックを削除。

ショート動画

  • list_my_shorts: 最近のアップロードからショート動画を検索(長さ60秒以下でフィルタリング)。

  • get_shorts_analytics: ショート動画に限定したYouTube Analyticsクエリ (creatorContentType==SHORTS)。

プレイリスト

  • create_playlist: プレイリストを作成(デフォルトは非公開)。

  • add_to_playlist: 既存のプレイリストに動画を追加。

コメント

  • list_comments: 動画のトップレベルコメントスレッドを取得。

  • reply_to_comment: トップレベルコメントに返信。

  • moderate_comment: コメントの保留、承認、拒否。

分析

  • query_channel_analytics: 日付範囲指定、オプションのディメンションとフィルタを使用したメトリクス取得。

ブリッジ (COMFYUI_URL 設定時)

  • generate_and_set_thumbnail: ComfyUI経由でサムネイルを生成し、1回の呼び出しで動画に設定。

クォータに関する注意

YouTube Data APIの無料枠は1日あたり10,000ユニットです。主な操作のコスト:

  • videos.list, commentThreads.list: 各1ユニット。

  • videos.update, comments.insert, thumbnails.set: 各50ユニット。

  • videos.insert (アップロード): 1,600ユニット(無料枠では1日約6回まで)。

ほとんどのクリエイター運用ワークフローは無料枠内に収まります。

アーキテクチャ

┌────────────────┐     ┌──────────────────┐     ┌─────────────────┐
│  MCP client    │────▶│  youtube-mcp     │────▶│  YouTube APIs   │
│  (Claude etc.) │◀────│  (this server)   │◀────│  (Data/Analytics)│
└────────────────┘     └────────┬─────────┘     └─────────────────┘
                                │
                                │ (bridge tools only)
                                ▼
                       ┌──────────────────┐
                       │  ComfyUI         │
                       │  (txt2img)       │
                       └──────────────────┘

OAuthリフレッシュトークンはローカルにキャッシュされ、期限切れ直前に更新されます。ブリッジツールは内部的にComfyUIから画像バイトをダウンロードするため、ComfyUIが公開されている必要はありません。

開発

git clone https://github.com/miller-joe/youtube-mcp
cd youtube-mcp
npm install
npm run dev
npm run build
npm test

Node 20以上が必要です。

ロードマップ

実装済み:

  • 動画: リスト、取得、メタデータ更新、タイトル確認付き削除。

  • 字幕: アップロード、リスト、削除。

  • ショート動画: list_my_shorts(長さフィルタ)および get_shorts_analytics (creatorContentType==SHORTS)。

  • プレイリスト: 作成、追加。

  • コメント: リスト、返信、モデレーション。

  • 分析: チャンネル分析クエリ。

  • ComfyUIサムネイルブリッジ: generate_and_set_thumbnail。

計画中:

  • 動画アップロード (video_upload)、レジュームアップロード対応。

  • 大規模な履歴データエクスポート用のレポートAPI。

ライセンス

MIT © Joe Miller

サポート

このツールが役に立った場合は、開発の支援をご検討ください:

GitHub Sponsors Ko-fi

Available Tools

15 tools
add_to_playlistB

Add a video to an existing playlist. Both playlist_id and video_id are YouTube IDs (not URLs).

Inputs: playlist_id (required), video_id (required).

create_playlistB

Create a new playlist on the authenticated channel. Default privacy is 'private'.

Inputs: title (required), description, privacy_status.

delete_captionA

Delete a caption track by ID. Use list_captions to find the track ID first.

Inputs: caption_id (required).

delete_videoA

Permanently delete a video. Requires confirm_video_title to match the video's current title exactly — guards against deleting the wrong video by ID. Deletion is irreversible.

Inputs: video_id (required), confirm_video_title (required).

get_shorts_analyticsA

Query YouTube Analytics restricted to Shorts for the authenticated channel. Applies filters=creatorContentType==SHORTS on top of the usual start_date/end_date/metrics/dimensions knobs.

Inputs: start_date (required), end_date (required), metrics, dimensions, +2 more.

get_videoA

Fetch full details for one video by ID — snippet, status, statistics, duration.

Inputs: video_id (required).

list_captionsA

List caption tracks on a video with their language, name, status, and whether they are drafts.

Inputs: video_id (required).

list_commentsB

List top-level comment threads on a video (newest first). Returns comment IDs, authors, text, and like counts.

Inputs: video_id (required), max_results.

list_my_shortsA

List your recent Shorts — scans the most recent uploads and filters to videos ≤60s. Useful when the Data API doesn't expose a direct Shorts filter.

Inputs: max_candidates.

list_my_videosA

List videos on the authenticated channel (newest first via the uploads playlist). Returns video IDs, titles, view counts, and privacy status.

Inputs: max_results, page_token.

moderate_commentA

Change the moderation status of a comment: heldForReview (hide pending approval), published (approve), or rejected (delete).

Inputs: comment_id (required), moderation_status (required).

query_channel_analyticsA

Query YouTube Analytics for the authenticated channel. Returns tabular data — useful for views/watch-time/retention/traffic-source reports. Date-ranged and optionally grouped by dimensions.

Inputs: start_date (required), end_date (required), metrics, dimensions, +3 more.

reply_to_commentB

Reply to a top-level comment. Requires youtube.force-ssl scope.

Inputs: parent_id (required), text (required).

update_video_metadataA

Update a video's metadata — title, description, tags, category, or privacy. Only provide fields you want changed.

Inputs: video_id (required), title, description, tags, +2 more.

upload_captionA

Upload a caption track (SRT or WebVTT) to a video. Creates a new track — use a distinct name per language/track, or is_draft=true while iterating.

Inputs: video_id (required), language (required), caption_text (required), name, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 15 tools

    Disambiguation5/5

    Each tool targets a distinct resource and action. Analytics tools are clearly differentiated (general vs Shorts-specific), and video list vs Shorts list is scoped by content type. Comments, captions, and playlists each have their own dedicated tools with no overlap.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun snake_case pattern (list_, get_, create_, update_, delete_, upload_, reply_to_, add_to_, moderate_, query_). There are no mixed conventions or cryptic abbreviations, making the naming predictable and easy to reason about.

    Tool Count5/5

    15 tools cover a broad YouTube management surface without feeling bloated. The set is well-scoped for the server's purpose—video, playlist, caption, comment, and analytics operations—and each tool has a clear role within that scope.

    Completeness3/5

    The coverage has significant gaps, especially for playlists: there is no way to list, retrieve, delete, or remove items from playlists, creating dead ends after creation. Caption updates are also absent (only create and delete), although video CRUD and comment moderation are well covered.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers