youtube subtitle extraction via yt-dlp command execution
Downloads and extracts subtitle files from YouTube videos by spawning yt-dlp as a subprocess via spawn-rx, handling the command-line invocation, process lifecycle management, and output capture. The implementation wraps yt-dlp's native YouTube subtitle downloading capability, abstracting away subprocess management complexity and providing structured error handling for network failures, missing subtitles, or invalid video URLs.
Unique: Uses spawn-rx for reactive subprocess management of yt-dlp rather than direct Node.js child_process, providing RxJS-based stream handling for subtitle download lifecycle and enabling composable async operations within the MCP protocol flow
vs alternatives: Avoids YouTube API authentication overhead and quota limits by delegating to yt-dlp, making it simpler for local/offline-first deployments than REST API-based approaches
vtt subtitle format parsing and text extraction
Parses WebVTT (VTT) subtitle files to extract clean, readable text by removing timing metadata, cue identifiers, and formatting markup. The processor strips timestamps (HH:MM:SS.mmm --> HH:MM:SS.mmm format), blank lines, and VTT-specific headers, producing plain text suitable for LLM consumption. This enables downstream text analysis without the LLM needing to parse or ignore subtitle timing information.
Unique: Implements lightweight regex-based VTT stripping rather than full WebVTT parser library, optimizing for speed and minimal dependencies while accepting that edge-case VTT features are discarded
vs alternatives: Simpler and faster than full VTT parser libraries (e.g., vtt.js) for the common case of extracting plain text, with no external dependencies beyond Node.js stdlib
mcp tool registration and request routing
Registers YouTube subtitle extraction as an MCP tool with the Model Context Protocol server, exposing a named tool endpoint that Claude.ai can invoke. The implementation defines tool schema (name, description, input parameters), registers request handlers for ListTools and CallTool MCP messages, and routes incoming requests to the appropriate subtitle extraction handler. This enables Claude to discover and invoke the YouTube capability through standard MCP protocol messages without direct function calls.