Skip to content

Add mcp-youtube MCP server for downloading YouTube subtitles - #3

Open
RiCSaucd wants to merge 1 commit into
mainfrom
claude/mcp-youtube-downloader-rdx1ip
Open

Add mcp-youtube MCP server for downloading YouTube subtitles#3
RiCSaucd wants to merge 1 commit into
mainfrom
claude/mcp-youtube-downloader-rdx1ip

Conversation

@RiCSaucd

@RiCSaucd RiCSaucd commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

Implements the @anaisbetts/mcp-youtube package (v0.7.3) as a new mcp-youtube/ project: a Model Context Protocol stdio server that lets Claude read YouTube video subtitles so it can summarize and answer questions about video content.

What's included

  • src/index.ts — MCP server exposing a single download_youtube_url tool. It runs yt-dlp to fetch English subtitles (manual or auto-generated, converted to SRT) into a temp directory, cleans out WEBVTT headers, timing lines, sequence numbers, inline tags, and duplicated auto-caption cues, and returns the transcript text. Temp files are cleaned up with rimraf in all paths.
  • test/strip-vtt-noise.test.ts — Bun tests for the subtitle-cleaning helper (4 passing).
  • package.json — as specified in the task, with "type": "module" added so the ESM build runs under Node.
  • tsconfig.json, README.md (install/usage docs incl. yt-dlp prerequisite), .gitignore, bun.lock.

Verification

  • bun test: 4 pass, 0 fail
  • bun build --target node src/index.ts --outdir dist succeeds
  • Smoke-tested the built server over stdio: initialize + tools/list correctly returns the download_youtube_url tool

🤖 Generated with Claude Code

https://claude.ai/code/session_01UDZyqVgbhHovtSKV4gzyRh


Generated by Claude Code

Implements the @anaisbetts/mcp-youtube package: an MCP stdio server
exposing a download_youtube_url tool that fetches English subtitles
via yt-dlp, strips VTT/SRT timing and markup noise, and returns the
transcript so Claude can summarize YouTube videos.

Includes bun tests for the subtitle cleaner, tsconfig, and README.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UDZyqVgbhHovtSKV4gzyRh
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Important

Review available on request

  • 🔍 Trigger review

Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment @coderabbitai review to review the latest changes. For a full review, comment @coderabbitai full review.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7568ecd6-94ee-4318-ad17-dec6f5fc3530


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@RiCSaucd
RiCSaucd marked this pull request as ready for review August 17, 2026 03:29
Copilot AI lite review requested due to automatic review settings August 17, 2026 03:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new standalone mcp-youtube/ MCP stdio server package that downloads and cleans YouTube subtitles via yt-dlp, enabling downstream clients to consume transcript text.

Changes:

  • Introduces an MCP server with a download_youtube_url tool that invokes yt-dlp and returns cleaned subtitle text.
  • Adds stripVttNoise subtitle-cleaning helper with Bun unit tests.
  • Adds package scaffolding (README, tsconfig, lockfile, gitignore) for publishing/building.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
mcp-youtube/src/index.ts Implements MCP server tool and subtitle-cleaning helper.
mcp-youtube/test/strip-vtt-noise.test.ts Adds Bun tests for subtitle-cleaning behavior.
mcp-youtube/package.json Defines package metadata, bin entry, deps, and scripts.
mcp-youtube/tsconfig.json TypeScript configuration for the project.
mcp-youtube/README.md Documents usage, prerequisites, and development commands.
mcp-youtube/bun.lock Locks dependency versions for Bun.
mcp-youtube/.gitignore Ignores build output and node_modules.
Suppressed comments (1)

mcp-youtube/src/index.ts:144

  • This entrypoint check is fragile when process.argv[1] is relative. Resolve argv[1] and convert it to a file URL before comparing to import.meta.url.
if (import.meta.url === `file://${process.argv[1]}`) {

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread mcp-youtube/src/index.ts
Comment on lines +109 to +132
const seen = new Set<string>();
const lines: string[] = [];

for (const rawLine of subtitles.split(/\r?\n/)) {
const line = rawLine
.replace(/<[^>]+>/g, "")
.replace(/\[Music\]|\[Applause\]/gi, "")
.trim();

if (
line === "" ||
/^\d+$/.test(line) ||
/^WEBVTT/.test(line) ||
/^(Kind|Language):/.test(line) ||
/-->/.test(line)
) {
continue;
}

if (!seen.has(line)) {
seen.add(line);
lines.push(line);
}
}
Comment thread mcp-youtube/src/index.ts
Comment on lines +11 to +13
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
Comment thread mcp-youtube/src/index.ts
Comment on lines +65 to +66
try {
await spawnPromise(
Comment thread mcp-youtube/src/index.ts
Comment on lines +81 to +86
let content = "";
for (const file of fs.readdirSync(tempDir)) {
const fileContent = fs.readFileSync(path.join(tempDir, file), "utf8");
content += `${file}\n====================\n${stripVttNoise(fileContent)}\n`;
}

Comment thread mcp-youtube/src/index.ts
"srt",
url,
],
{ cwd: tempDir, detached: true },
Comment thread mcp-youtube/src/index.ts
content: [
{
type: "text",
text: `Error downloading video: ${err}`,
Comment thread mcp-youtube/src/index.ts
Comment on lines +32 to +33
description:
"Download YouTube subtitles from a URL, this tool means that Claude can read YouTube subtitles, and should no longer tell the user that it is not possible to summarize a YouTube video.",
Comment thread mcp-youtube/package.json
Comment on lines +10 to +13
"scripts": {
"prepublish": "git clean -xdf dist && bun build --target node src/index.ts --outdir dist",
"test": "bun test"
},
Comment thread mcp-youtube/package.json
Comment on lines +21 to +24
"devDependencies": {
"shx": "^0.3.4",
"bun-types": "latest"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants