mc

mcp-server-youtube-transcript

Fetch YouTube subtitles and transcripts for AI analysis

Publishermcp-server-youtube-transcript
Submitted date4/13/2025

Decoding YouTube: An Expert's Guide to the Model Context Protocol Server for Transcripts

Harness the power of Large Language Models (LLMs) by seamlessly integrating YouTube transcripts into your AI applications with this robust Model Context Protocol (MCP) server. This guide provides an in-depth look at leveraging this tool for enhanced AI workflows.

smithery badge

This MCP server unlocks direct access to YouTube video captions and subtitles, streamlining the process of feeding contextual information to your LLMs.

mcp-server-youtube-transcript MCP server

Streamlined Installation via Smithery

For Claude Desktop users, Smithery offers a one-command installation:

npx -y @smithery/cli install @kimtaeyoon83/mcp-server-youtube-transcript --client claude

Core Components: The get_transcript Tool

This server revolves around a single, powerful tool:

  • get_transcript: Extracts transcripts from YouTube videos.

    • Inputs:
      • url (string, required): Accepts both full YouTube video URLs (e.g., https://www.youtube.com/watch?v=VIDEO_ID) and video IDs (e.g., VIDEO_ID). This flexibility simplifies integration.
      • lang (string, optional, default: "en"): Specifies the desired language code for the transcript (e.g., "ko" for Korean, "en" for English, "es" for Spanish). If omitted, defaults to English.

Key Advantages: Why This MCP Server Stands Out

  • Versatile URL Handling: Accepts both full URLs and video IDs, providing maximum flexibility.
  • Language Precision: Retrieve transcripts in specific languages, ensuring accurate context for your LLMs.
  • Rich Metadata: Responses include detailed metadata, enabling advanced processing and analysis.

Configuration: Integrating with Claude Desktop

To enable this server within Claude Desktop, add the following configuration block to your settings:

{ "mcpServers": { "youtube-transcript": { "command": "npx", "args": ["-y", "@kimtaeyoon83/mcp-server-youtube-transcript"] } } }

Alternative Installation: Using mcp-get

For command-line enthusiasts, mcp-get provides a dedicated tool for managing MCP servers:

npx @michaellatman/mcp-get@latest install @kimtaeyoon83/mcp-server-youtube-transcript

Expanding Your Toolkit: Exploring awesome-mcp-servers

Discover a curated collection of MCP servers at awesome-mcp-servers to further enhance your LLM applications.

Development Deep Dive: Building and Testing

Prerequisites

  • Node.js 18+
  • npm or yarn package manager

Setup

  1. Install dependencies:

    npm install
  2. Build the server:

    npm run build
  3. For real-time development with automatic rebuilds:

    npm run watch

Testing

Execute the test suite to ensure functionality:

npm test

Debugging Strategies

Debugging MCP servers, which communicate via standard input/output (stdio), can be tricky. The MCP Inspector is highly recommended:

npm run inspector

Robust Error Handling: Ensuring Reliability

This server incorporates comprehensive error handling to gracefully manage common issues:

  • Invalid Input: Detects and handles malformed video URLs or IDs.
  • Transcript Availability: Handles cases where transcripts are not available for a given video.
  • Language Support: Addresses situations where the requested language transcript is not available.
  • Network Resilience: Manages potential network connectivity problems.

Practical Examples: Unleashing the Power of Transcripts

  1. Extracting Transcripts by URL:

    await server.callTool("get_transcript", { url: "https://www.youtube.com/watch?v=VIDEO_ID", lang: "en" });
  2. Retrieving Transcripts by Video ID:

    await server.callTool("get_transcript", { url: "VIDEO_ID", lang: "ko" });
  3. Real-World Use Case: Claude Desktop Integration

    In your Claude Desktop chat interface, simply provide a YouTube link and a prompt:

    chat: https://youtu.be/ODaHJzOyVCQ?si=aXkJgso96Deri0aB Extract subtitles
    

Security Best Practices

This server prioritizes security through:

  • Input Validation: Rigorous validation of all input parameters to prevent injection attacks.
  • API Error Handling: Graceful handling of YouTube API errors to prevent unexpected crashes.
  • Timeouts: Implementation of timeouts for transcript retrieval to prevent indefinite hangs.
  • Detailed Error Messages: Providing informative error messages to facilitate troubleshooting and debugging.

Visit More

View All