YO

YouTube DLP MCP Server: Video Info, Subtitles, Comments

Retrieve YouTube video info, subtitles, and top comments via an MCP server with proxy support for reliable DLP access.

Overview

This MCP (Model Context Protocol) server exposes YouTube metadata, subtitles, and top comments as simple HTTP resources so LLMs and other agents can fetch reliable video context at runtime. It wraps a yt-dlp style extractor behind a small web service and adds proxy support to improve reliability in regions or environments where direct YouTube access can be flaky.

By exposing structured endpoints for video info, captions, and comments, the server is useful when you need to supply long-form context to an LLM (e.g., summarization, moderation, or question-answering) without embedding network calls inside the model. The server is lightweight and intended to be deployed near your model runtime or behind your own API gateway to reduce latency and control access.

Features

  • Retrieve YouTube video metadata (title, uploader, duration, thumbnails, formats)
  • Download or list subtitles/captions (by language and format)
  • Fetch top-level or threaded comments (with configurable limits)
  • Optional HTTP(S) proxy support for stable access from restricted networks
  • Simple REST API compatible with automated MCP resource fetching
  • Docker-ready for quick deployment and environment-variable configuration

Installation / Configuration

Clone the repository and run locally or in Docker. The server expects a working yt-dlp (or compatible) binary available in PATH or set via environment variable.

Clone and run locally:

git clone https://github.com/AgentX-ai/youtube-dlp-server.git
cd youtube-dlp-server
# install dependencies (if the project includes a Node/Python backend)
# e.g., for Node:
npm install
# start with optional env vars
PORT=8080 YTDLP_BIN=/usr/local/bin/yt-dlp PROXY=http://127.0.0.1:3128 npm start

Run with Docker:

docker build -t youtube-dlp-mcp .
docker run -d \
  -p 8080:8080 \
  -e PORT=8080 \
  -e PROXY=http://proxy.example:3128 \
  -e YTDLP_BIN=/usr/local/bin/yt-dlp \
  --name youtube-dlp-mcp \
  youtube-dlp-mcp

Important environment variables

  • PORT: HTTP port (default 8080)
  • YTDLP_BIN: path to yt-dlp binary (if not in PATH)
  • PROXY: optional HTTP/HTTPS proxy to route requests through
  • MAX_COMMENTS: default limit for comments endpoints

Configuration file (example JSON)

{
  "port": 8080,
  "ytdlp_bin": "/usr/local/bin/yt-dlp",
  "proxy": "http://127.0.0.1:3128",
  "max_comments": 50
}

Available Resources

The server exposes REST endpoints that return JSON (and for subtitles, plain text or VTT/SRT). Example endpoints:

EndpointMethodQuery / BodyDescription
/videoGETurl or idReturns structured metadata about a video
/subtitlesGETurl or id, lang, formatLists or downloads subtitles (vtt/srt/plain)
/commentsGETurl or id, limitReturns top comments (JSON)
/healthGETLiveness / readiness check

Example /video request:

curl "http://localhost:8080/video?url=https://youtu.be/dQw4w9WgXcQ"

Example /video response (trimmed):

{
  "id": "dQw4w9WgXcQ",
  "title": "Never Gonna Give You Up",
  "uploader": "RickAstleyVEVO",
  "duration": 213,
  "thumbnails": [
    { "url": "...", "width": 480, "height": 360 }
  ],
  "formats": [
    { "format_id": "251", "ext": "webm", "acodec": "opus" }
  ]
}

Subtitles example:

curl "http://localhost:8080/subtitles?url=https://youtu.be/dQw4w9WgXcQ&lang=en&format=vtt"

Comments example:

curl "http://localhost:8080/comments?url=https://youtu.be/dQw4w9WgXcQ&limit=20"

Use Cases

  • LLM-assisted moderation: fetch video metadata and top comments to feed into a moderation pipeline that evaluates context, toxicity, or policy risks without streaming raw video.
  • Summarization and QA: retrieve subtitles in a normalized format to provide the transcript for summarization or question-answering tasks.
  • Content indexing: gather titles, descriptions, and top comments to build searchable indexes or features for recommendation models.
  • Region-restricted access: run the server behind a proxy to provide consistent extraction results in environments that block direct YouTube requests.
  • Data pipelines: run as a microservice in ETL jobs that enrich records with video context before storing in a database.

Examples

Node.js fetch example:

const fetch = require('node-fetch');
const url = 'http://localhost:8080/subtitles?url=https://youtu.be/dQw4w9WgXcQ&lang=en&format=srt';

(async () => {
  const res = await fetch(url);
  const srt = await res.text();
  console.log(srt.slice(0, 400)); // preview first 400 chars
})();

curl summarization pipeline:

# get subtitles and pipe into your summarizer
curl "http://localhost:8080/subtitles?url=...&lang=en&format=plain" | my-summarizer --max-tokens 150

Resources

  • GitHub repository: https://github.com/AgentX-ai/youtube-dlp-server
  • Ensure you have an up-to-date
Tags:media