Skip to main content
Glama

youtube-mcp

OAuth-authentifizierter YouTube-MCP für Kanalinhaber. Bearbeiten Sie Videometadaten, antworten Sie auf Kommentare und moderieren Sie diese, verwalten Sie Playlists, fragen Sie Kanalanalysen ab und generieren oder setzen Sie KI-Thumbnails über eine ComfyUI-Brücke. Geht weit über die schreibgeschützten Data API v3-Wrapper hinaus, die diesen Bereich dominieren.

youtube-mcp MCP server

GitHub Sponsors Ko-fi

Das Konzept

Die meisten existierenden YouTube-MCPs verwenden einen API-Schlüssel für die Data API v3. Videos suchen, öffentliche Metadaten abrufen, schreibgeschützt. Dieser hier verwendet OAuth 2.0 (Authorization Code + PKCE), sodass er tatsächlich auf Ihren Kanal schreiben kann: Videotitel, Beschreibungen und Tags aktualisieren, auf Kommentare antworten, Spam moderieren, Playlists verwalten. Er greift außerdem auf die separate YouTube Analytics API für Kanalstatistiken zu und generiert ein Thumbnail über ComfyUI, das in einem einzigen MCP-Aufruf auf YouTube hochgeladen wird.

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

ComfyUI rendert 1280×720, youtube-mcp ruft die Bytes ab und sendet sie per POST an thumbnails.set. Fertig.

Related MCP server: yt-fetch

Installation

# 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

Einrichtung: Einmalig Google Cloud (~10 Min.)

  1. Google-Konto plus YouTube-Kanal. Verwenden Sie ein persönliches Konto, kein Workspace-Konto, das Sie möglicherweise verlieren könnten.

  2. Google Cloud-Projekt unter https://console.cloud.google.com. Nennen Sie es, wie Sie möchten (z. B. youtube-mcp).

  3. APIs aktivieren:

    • YouTube Data API v3

    • YouTube Analytics API

  4. OAuth-Zustimmungsbildschirm: Extern, App-Name, Support-E-Mail. Fügen Sie unter Scopes hinzu:

    • youtube.upload

    • youtube.force-ssl

    • yt-analytics.readonly

  5. Bleiben Sie im Testmodus. Fügen Sie sich selbst als Testnutzer hinzu (erforderlich). Als Projekteigentümer läuft Ihr Refresh-Token nicht ab.

  6. OAuth-Client-ID erstellen: Anwendungstyp = Desktop-App. Laden Sie das JSON herunter.

  7. Interaktiven Auth-Flow ausführen:

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

    Ein Browser öffnet sich, Sie melden sich bei dem Google-Konto an, das mit Ihrem YouTube-Kanal verknüpft ist, und gewähren die angeforderten Scopes. Bei Erfolg wird ein Refresh-Token unter ~/.config/youtube-mcp/token.json gespeichert.

  8. Server starten:

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

    Oder stellen Sie die Client-Anmeldeinformationen über Umgebungsvariablen bereit: YOUTUBE_CLIENT_SECRET_FILE oder YOUTUBE_CLIENT_ID + YOUTUBE_CLIENT_SECRET.

Einen MCP-Client verbinden

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

Oder verweisen Sie Ihren MCP-Gateway auf den Streamable HTTP-Endpunkt.

Konfiguration

CLI-Flag

Umgebungsvariable

Standard

Hinweise

--client-secret-file

YOUTUBE_CLIENT_SECRET_FILE

(keine)

Pfad zum Google OAuth JSON

--client-id

YOUTUBE_CLIENT_ID

(keine)

Alternative zur Secret-Datei

--client-secret

YOUTUBE_CLIENT_SECRET

(keine)

Alternative zur Secret-Datei

--token-file

YOUTUBE_TOKEN_FILE

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

Speicherort für Refresh-Token

--host

MCP_HOST

0.0.0.0

Bind-Host (nur HTTP-Modus)

--port

MCP_PORT

9120

Bind-Port (nur HTTP-Modus)

--stdio

MCP_TRANSPORT=stdio

(nicht gesetzt)

MCP über stdio statt HTTP sprechen. Verwenden, wenn als Subprozess von einem stdio-first MCP-Client (Claude Desktop, mcp-inspector) gestartet.

--comfyui-url

COMFYUI_URL

(nicht gesetzt, Brücke deaktiviert)

ComfyUI HTTP-URL für Brücken-Tools

(kein Flag)

COMFYUI_DEFAULT_CKPT

sd_xl_base_1.0.safetensors

Standard-Checkpoint für Brücken-Tool

Transporte

Der Server spricht standardmäßig streamable HTTP (großartig für Claude Code, MetaMCP, rohes fetch). Übergeben Sie --stdio (oder setzen Sie MCP_TRANSPORT=stdio), um in den stdio-Modus zu wechseln, den stdio-first Clients wie Claude Desktop und der MCP Inspector erwarten:

// 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"
      }
    }
  }
}

Der Stdio-Modus überspringt die OAuth-Token-Vorabprüfung – der Server startet auch ohne gespeichertes Token und zeigt Authentifizierungsfehler erst zum Zeitpunkt des Tool-Aufrufs an. Führen Sie youtube-mcp --auth --client-secret-file <path> einmal im HTTP-Modus aus, um das Refresh-Token zu initialisieren, bevor Sie Claude Desktop darauf verweisen.

Tools

Videos

  • list_my_videos: paginierte Liste der Uploads des authentifizierten Kanals.

  • get_video: vollständige Details für ein Video.

  • update_video_metadata: Titel, Beschreibung, Tags, Kategorie, Privatsphäre.

  • delete_video: ein Video dauerhaft löschen. Erfordert, dass confirm_video_title exakt mit dem aktuellen Titel übereinstimmt, als Schutz gegen das Löschen des falschen Videos.

Untertitel

  • list_captions: Liste der Untertitelspuren eines Videos (Sprache, Name, Status, Entwurfs-Flag).

  • upload_caption: eine SRT- oder WebVTT-Untertitelspur auf ein Video hochladen.

  • delete_caption: eine Untertitelspur löschen.

Shorts

  • list_my_shorts: Shorts in aktuellen Uploads finden (filtert nach Dauer ≤60s).

  • get_shorts_analytics: YouTube Analytics-Abfrage, beschränkt auf Shorts (creatorContentType==SHORTS).

Playlists

  • create_playlist: eine Playlist erstellen (standardmäßig privat).

  • add_to_playlist: ein Video zu einer bestehenden Playlist hinzufügen.

Kommentare

  • list_comments: Top-Level-Kommentar-Threads zu einem Video.

  • reply_to_comment: auf einen Top-Level-Kommentar antworten.

  • moderate_comment: einen Kommentar zurückhalten, genehmigen oder ablehnen.

Analysen

  • query_channel_analytics: Metriken mit Datumsbereich, optionalen Dimensionen und Filtern.

Brücke (wenn COMFYUI_URL konfiguriert ist)

  • generate_and_set_thumbnail: ein Thumbnail über ComfyUI generieren und in einem Aufruf für ein Video festlegen.

Kontingent-Hinweise

YouTube Data API Free Tier = 10.000 Einheiten/Tag. Kosten für wichtige Operationen:

  • videos.list, commentThreads.list: jeweils 1 Einheit.

  • videos.update, comments.insert, thumbnails.set: jeweils 50 Einheiten.

  • videos.insert (Upload): 1.600 Einheiten, also etwa 6 Uploads pro Tag im Free Tier.

Die meisten Creator-Ops-Workflows bleiben weit unter dem kostenlosen Limit.

Architektur

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

OAuth-Refresh-Token werden lokal zwischengespeichert und kurz vor Ablauf aktualisiert. Das Brücken-Tool lädt Bild-Bytes intern von ComfyUI herunter, sodass ComfyUI nicht öffentlich erreichbar sein muss.

Entwicklung

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

Erfordert Node 20+.

Roadmap

Veröffentlicht:

  • Videos: auflisten, abrufen, Metadaten aktualisieren, löschen mit Titel-Übereinstimmungsprüfung.

  • Untertitel: hochladen, auflisten, löschen.

  • Shorts: list_my_shorts (Dauerfilter) und get_shorts_analytics (creatorContentType==SHORTS).

  • Playlists: erstellen, hinzufügen.

  • Kommentare: auflisten, antworten, moderieren.

  • Analysen: Kanal-Analyse-Abfrage.

  • ComfyUI Thumbnail-Brücke: generate_and_set_thumbnail.

Geplant:

  • Video-Upload (video_upload) mit Unterstützung für fortsetzbare Uploads.

  • Reporting-API für Massenexporte historischer Daten.

Lizenz

MIT © Joe Miller

Support

Wenn Ihnen dies Zeit spart, ziehen Sie eine Unterstützung der Entwicklung in Betracht:

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