maagpi-youtube-mcp

https://github.com/vamsi-kodimela/maagpi-youtube-mcp

Documentación

maagpi-youtube-mcp

MCP npm node

maagpi-youtube-mcp es un servidor MCP completo de gestión de canales de YouTube: sube vídeos, programa publicaciones, consulta analíticas, modera comentarios, gestiona listas de reproducción, actualiza la marca del canal y opera múltiples canales de YouTube simultáneamente — todo desde cualquier cliente de IA compatible con MCP.

Envuelve la YouTube Data API v3 oficial + la YouTube Analytics API detrás de una única superficie MCP con OAuth integrado, seguimiento de cuota, caché de respuestas y gestión estructurada de errores.

Transporte

  • Predeterminado: stdio (proceso local, iniciado por tu cliente MCP)
  • Opcional: Streamable HTTP (YOUTUBE_MCP_TRANSPORT=http) para acceso multi-cliente / remoto
  • Distribución: npx maagpi-youtube-mcp — no se requiere instalación global
  • Documentación completa: consulta Referencia de herramientas a continuación

Autenticación

Este servidor usa Google OAuth 2.0 (credenciales de aplicación de escritorio). Proporcionas un ID de cliente + Secreto de cliente como variables de entorno; el servidor gestiona el flujo de consentimiento del navegador y almacena tokens de actualización en el directorio de configuración de tu SO bajo perfiles con nombre (uno por canal).

Configuración única de Google Cloud

  1. Google Cloud Console → APIs y Servicios → Biblioteca → habilita:
    • YouTube Data API v3
    • YouTube Analytics API
  2. APIs y Servicios → Pantalla de consentimiento de OAuth → Externa → completa el nombre de la aplicación + tu correo electrónico → añade tu cuenta de Google como usuario de prueba.
  3. APIs y Servicios → Credenciales → Crear credenciales → ID de cliente de OAuth → Tipo de aplicación Aplicación de escritorio → copia el ID de cliente y el Secreto de cliente.

Mantén tu Secreto de cliente fuera del control de versiones. El servidor nunca lo transmite a ningún sitio excepto accounts.google.com.

Primera llamada: el servidor abre una ventana del navegador para el consentimiento de OAuth. Aprueba una vez y los tokens se guardan automáticamente bajo el perfil "default" y se actualizan automáticamente a partir de entonces. Añade más canales con youtube_account_add.

Conexión rápida

Elige tu cliente y pega el fragmento en el archivo de configuración correspondiente. Reemplaza your_client_id / your_client_secret con tus credenciales de Google OAuth.

Claude Desktop

~/Library/Application Support/Claude/claude_desktop_config.json (macOS) %APPDATA%\Claude\claude_desktop_config.json (Windows)

{
  "mcpServers": {
    "youtube": {
      "command": "npx",
      "args": ["-y", "maagpi-youtube-mcp"],
      "env": {
        "YOUTUBE_CLIENT_ID": "your_client_id",
        "YOUTUBE_CLIENT_SECRET": "your_client_secret"
      }
    }
  }
}

Claude Code

~/.claude/settings.json

{
  "mcpServers": {
    "youtube": {
      "command": "npx",
      "args": ["-y", "maagpi-youtube-mcp"],
      "env": {
        "YOUTUBE_CLIENT_ID": "your_client_id",
        "YOUTUBE_CLIENT_SECRET": "your_client_secret"
      }
    }
  }
}

O mediante la CLI de Claude Code:

claude mcp add youtube -- npx -y maagpi-youtube-mcp \
  -e YOUTUBE_CLIENT_ID=your_client_id \
  -e YOUTUBE_CLIENT_SECRET=your_client_secret

Cursor

~/.cursor/mcp.json

{
  "mcpServers": {
    "youtube": {
      "command": "npx",
      "args": ["-y", "maagpi-youtube-mcp"],
      "env": {
        "YOUTUBE_CLIENT_ID": "your_client_id",
        "YOUTUBE_CLIENT_SECRET": "your_client_secret"
      }
    }
  }
}

Windsurf

~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "youtube": {
      "command": "npx",
      "args": ["-y", "maagpi-youtube-mcp"],
      "env": {
        "YOUTUBE_CLIENT_ID": "your_client_id",
        "YOUTUBE_CLIENT_SECRET": "your_client_secret"
      }
    }
  }
}

VS Code (extensiones compatibles con MCP)

.vscode/mcp.json (espacio de trabajo) o Configuración de usuario:

{
  "servers": {
    "youtube": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "maagpi-youtube-mcp"],
      "env": {
        "YOUTUBE_CLIENT_ID": "your_client_id",
        "YOUTUBE_CLIENT_SECRET": "your_client_secret"
      }
    }
  }
}

Zed

~/.config/zed/settings.json

{
  "context_servers": {
    "youtube": {
      "command": {
        "path": "npx",
        "args": ["-y", "maagpi-youtube-mcp"],
        "env": {
          "YOUTUBE_CLIENT_ID": "your_client_id",
          "YOUTUBE_CLIENT_SECRET": "your_client_secret"
        }
      }
    }
  }
}

mcporter

mcporter add youtube --command "npx -y maagpi-youtube-mcp" \
  --env YOUTUBE_CLIENT_ID=your_client_id \
  --env YOUTUBE_CLIENT_SECRET=your_client_secret

mcporter call youtube youtube_account_list '{}'

Streamable HTTP (remoto / multi-cliente)

Ejecuta el servidor como un servicio HTTP:

YOUTUBE_MCP_TRANSPORT=http \
YOUTUBE_MCP_HTTP_PORT=3000 \
YOUTUBE_CLIENT_ID=your_client_id \
YOUTUBE_CLIENT_SECRET=your_client_secret \
npx -y maagpi-youtube-mcp
# MCP endpoint: POST http://127.0.0.1:3000/mcp
# Health check: GET  http://127.0.0.1:3000/health

Luego apunta cualquier cliente MCP compatible con HTTP a http://127.0.0.1:3000/mcp.

Referencia de herramientas

Todas las herramientas aceptan un parámetro opcional channel (nombre de perfil). Omítelo para usar el perfil activo.

Gestión de cuentas

HerramientaParámetrosDescripción
youtube_account_addnameConecta un nuevo canal mediante OAuth y guárdalo como perfil con nombre
youtube_account_listningunoLista todos los perfiles conectados con IDs y estado activo
youtube_account_switchnameEstablece el perfil activo predeterminado
youtube_account_currentningunoMuestra el perfil actualmente activo
youtube_account_removename, confirm: trueDesconecta y elimina un perfil

Vídeos

HerramientaParámetrosCuota
youtube_video_uploadfilePath, title, privacyStatus, channel?1600
youtube_video_getvideoId, parts?, channel?1
youtube_video_listchannelId?, query?, order?, maxResults?, channel?1
youtube_video_updatevideoId, title?, description?, tags?, channel?50
youtube_video_deletevideoId, confirm: true, channel?50
youtube_video_ratevideoId, rating (like/dislike/none), channel?50
youtube_video_set_thumbnailvideoId, thumbnailPath, channel?50

Programación y publicación

HerramientaParámetrosCuota
youtube_video_set_privacyvideoId, privacyStatus, channel?50
youtube_video_schedule_publishvideoId, publishAt (fecha futura ISO 8601), channel?50
youtube_video_set_premierevideoId, premiereAt (fecha futura ISO 8601), channel?50

Analíticas

HerramientaParámetrosCuota
youtube_analytics_video_metricsvideoId, startDate, endDate, metrics[], channel?1
youtube_analytics_channel_metricsstartDate, endDate, metrics[], channel?1
youtube_analytics_top_videosstartDate, endDate, metric, maxResults?, channel?1
youtube_analytics_audience_retentionvideoId, startDate, endDate, channel?1
youtube_analytics_revenue_reportstartDate, endDate, dimensions?, channel?1

Las fechas usan YYYY-MM-DD. Métricas de vídeo comunes: views, watchTime, averageViewDuration, averageViewPercentage, likes, shares, subscribersGained, subscribersLost. Las métricas de canal añaden estimatedRevenue, estimatedAdRevenue, grossRevenue, monetizedPlaybacks, cpm, adImpressions.

Comentarios

HerramientaParámetrosCuota
youtube_comment_listvideoId, maxResults?, order?, searchTerms?, channel?1
youtube_comment_thread_getcommentThreadId, maxReplies?, channel?1
youtube_comment_replyparentCommentId, text, channel?50
youtube_comment_deletecommentId, channel?50
youtube_comment_moderatecommentId, moderationStatus (published/heldForReview/rejected), banAuthor?, channel?50

Listas de reproducción

HerramientaParámetrosCuota
youtube_playlist_createtitle, privacyStatus, channel?50
youtube_playlist_updateplaylistId, title?, description?, channel?50
youtube_playlist_deleteplaylistId, confirm: true, channel?50
youtube_playlist_getplaylistId, channel?1
youtube_playlist_listchannelId?, maxResults?, channel?1
youtube_playlist_item_addplaylistId, videoId, position?, channel?50
youtube_playlist_item_removeplaylistItemId, channel?50
youtube_playlist_item_reorderplaylistItemId, playlistId, newPosition, channel?50
youtube_playlist_items_listplaylistId, maxResults?, channel?1

Gestión de canales

HerramientaParámetrosCuota
youtube_channel_getparts?, channel?1
youtube_channel_updatetitle?, description?, keywords?, country?, channel?50
youtube_channel_branding_updateshowRelatedChannels?, featuredChannelsTitle?, channel?50
youtube_channel_watermark_setchannelId, imagePath, position, timing, channel?50
youtube_channel_watermark_unsetchannelId, channel?50
youtube_channel_section_listchannelId?, channel?1
youtube_channel_section_createtype, title?, playlistIds?, channel?50
youtube_channel_section_deletesectionId, channel?50

Ejemplos de prompts

Una vez conectado, envía estos a tu cliente de IA como lenguaje natural:

Upload /videos/tutorial.mp4 with title "Getting Started with TypeScript",
description "A beginner's guide", tags ["typescript","programming"], unlisted.
Schedule video dQw4w9WgXcQ to go public on January 20 2026 at 3pm UTC.
Get top 5 videos by views in Q1 2025 for my "main" channel,
and also for my "gaming" channel.
Show me revenue breakdown for 2025-01-01 to 2025-01-31, split by day.
Reply to comment Ugxxxxx with "Thanks for the feedback! Fixed in v2."

Las herramientas que eliminan datos requieren confirm: true — tu cliente de IA preguntará antes de continuar.

Múltiples canales

Conecta cualquier número de cuentas de YouTube y apunta a cualquiera de ellas desde cualquier herramienta mediante el parámetro opcional channel — sin necesidad de cambiar.

Add a new YouTube channel profile named "gaming"
List all my connected YouTube channel profiles
Switch my active YouTube profile to "gaming"
Upload /videos/clip.mp4 to my "gaming" channel, title "EP1", public

Autenticación CLI para un perfil con nombre (útil para configuraciones sin interfaz):

npm run auth -- --channel gaming

Cuota

YouTube Data API v3 otorga 10.000 unidades/día por defecto. Cada respuesta de herramienta incluye un campo quota:

{
  "quota": {
    "used": 151,
    "budget": 9000,
    "remaining": 8849,
    "resetAt": "2026-01-15T08:00:00.000Z",
    "warningLevel": "ok",
    "costOfThisCall": 1
  }
}

warningLevel: "ok" → "warn" al 80% → "critical" al 95%.

Protecciones integradas

  • Las respuestas GET se almacenan en caché (vídeos 60s, canales 5min, analíticas 5min) — las lecturas repetidas cuestan 0 de cuota
  • Las escrituras se reintentan automáticamente en 429/5xx con retroceso exponencial (hasta 3×)
  • Establece YOUTUBE_MCP_QUOTA_LIMIT por debajo de 10.000 para dejar margen

Formato de error

Todos los errores se devuelven como contenido estructurado de herramienta — los agentes pueden leerlos y actuar sobre ellos sin fallar:

{
  "success": false,
  "error": {
    "code": "QUOTA_EXCEEDED",
    "message": "YouTube API daily quota has been exceeded.",
    "suggestedFix": "Wait for quota reset at midnight Pacific Time, or increase your quota in Google Cloud Console.",
    "retryable": false,
    "docsUrl": "https://developers.google.com/youtube/v3/getting-started#quota"
  },
  "quota": { "used": 9001, "warningLevel": "critical" }
}
CódigoSignificado
AUTH_REQUIREDNo hay tokens almacenados — se necesita el flujo de OAuth
AUTH_TOKEN_EXPIREDToken caducado y actualización fallida — vuelve a autenticarte
AUTH_INSUFFICIENT_SCOPEFalta el ámbito de OAuth — elimina los tokens y vuelve a autenticarte
QUOTA_EXCEEDEDCuota diaria agotada — espera al reinicio de medianoche PT
PERMISSION_DENIEDRecurso no propiedad de la cuenta autenticada
VIDEO_NOT_FOUNDEl ID de vídeo no existe o no es accesible
PLAYLIST_NOT_FOUNDID de lista de reproducción no encontrado
RATE_LIMITEDLímite de velocidad temporal — el servidor reintenta automáticamente
INVALID_PARAMSFalló la validación de Zod — comprueba los tipos de parámetros
PUBLISH_DATE_IN_PASTpublishAt / premiereAt debe ser una fecha y hora futura

Variables de entorno

VariableObligatoriaPredeterminadoDescripción
YOUTUBE_CLIENT_ID✓—ID de cliente de Google OAuth2
YOUTUBE_CLIENT_SECRET✓—Secreto de cliente de Google OAuth2
YOUTUBE_MCP_TRANSPORTstdiostdio o http
YOUTUBE_MCP_HTTP_PORT3000Puerto del servidor HTTP
YOUTUBE_MCP_HTTP_HOST127.0.0.1Dirección de enlace HTTP
YOUTUBE_MCP_QUOTA_LIMIT9000Umbral de advertencia de cuota diaria
YOUTUBE_MCP_CACHE_TTLpor recursoSobrescribe todos los TTL de caché (ms)
YOUTUBE_MCP_LOG_LEVELinfoerror | warn | info | debug

Desarrollo

npm install
npm run dev          # run with tsx (requires .env)
npm run auth         # authenticate the default channel profile
npm run auth -- --channel gaming   # authenticate a named profile
npm run typecheck    # tsc --noEmit
npm test             # vitest unit tests
npm run build        # production bundle → dist/index.js
npm pack --dry-run   # verify publish artifact

Por qué maagpi-youtube-mcp 🎯

  • Opera YouTube desde cualquier cliente de IA — Claude, Cursor, Windsurf, Zed, VS Code, mcporter
  • Gestiona múltiples canales a la vez — sin cambio de contexto, apunta a cualquier canal por llamada
  • Infraestructura de nivel de producción — OAuth, tokens de actualización, seguimiento de cuota, reintentos, errores estructurados
  • Cobertura completa de superficie — vídeos, programación, analíticas, comentarios, listas de reproducción, marca

Enlaces