YouTube MCP Server

YouTube MCP Server

A server that enables interaction with YouTube data through the Model Context Protocol, allowing users to search videos, retrieve detailed information about videos/channels, and fetch comments.

Category
Visit Server

README

YouTube MCP Server

smithery badge

A Model Context Protocol (MCP) server for interacting with YouTube data. This server provides resources and tools to query YouTube videos, channels, comments, and transcripts through a stdio interface.

Features

  • Search for YouTube videos with advanced filtering options
  • Get detailed information about specific videos and channels
  • Compare statistics across multiple videos
  • Discover trending videos by region and category
  • Analyze channel performance and video statistics
  • Retrieve video comments and transcripts/captions
  • Generate video analysis and transcript summaries

Prerequisites

  • Node.js (v16+)
  • YouTube Data API key

Installation

Installing via Smithery

To install YouTube MCP Server for Claude Desktop automatically via Smithery:

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

Installing Manually

  1. Clone this repository:

    git clone https://github.com/coyaSONG/youtube-mcp-server.git
    cd youtube-mcp-server
    
  2. Install dependencies:

    npm install
    
  3. Create a .env file in the root directory:

    YOUTUBE_API_KEY=your_youtube_api_key_here
    PORT=3000
    

Usage

Building and Running

  1. Build the project:

    npm run build
    
  2. Run the server:

    npm start
    
  3. Run in development mode:

    npm run dev
    
  4. Clean build artifacts:

    npm run clean
    

Docker Deployment

The project includes a Dockerfile for containerized deployment:

# Build the Docker image
docker build -t youtube-mcp-server .

# Run the container
docker run -p 3000:3000 --env-file .env youtube-mcp-server

API Reference

Resources

  • youtube://video/{videoId} - Get detailed information about a specific video
  • youtube://channel/{channelId} - Get information about a specific channel
  • youtube://transcript/{videoId} - Get transcript for a specific video
    • Optional query parameter: ?language=LANGUAGE_CODE (e.g., en, ko, ja)

Tools

Basic Tools

  • search-videos - Search for YouTube videos with advanced filtering options
  • get-video-comments - Get comments for a specific video
  • get-video-transcript - Get transcript for a specific video with optional language
  • enhanced-transcript - Advanced transcript extraction with filtering, search, and multi-video capabilities
  • get-key-moments - Extract key moments with timestamps from a video transcript for easier navigation
  • get-segmented-transcript - Divide a video transcript into segments for easier analysis

Statistical Tools

  • get-video-stats - Get statistical information for a specific video
  • get-channel-stats - Get subscriber count, view count, and other channel statistics
  • compare-videos - Compare statistics across multiple videos

Discovery Tools

  • get-trending-videos - Retrieve trending videos by region and category
  • get-video-categories - Get available video categories for a specific region

Analysis Tools

  • analyze-channel-videos - Analyze performance trends of videos from a specific channel

Prompts

  • video-analysis - Generate an analysis of a YouTube video
  • transcript-summary - Generate a summary of a video based on its transcript with customizable length and keywords extraction
  • segment-by-segment-analysis - Provide detailed breakdown of content by analyzing each segment of the video

Examples

Accessing a Video Transcript

youtube://transcript/dQw4w9WgXcQ

Getting a Transcript in a Specific Language

youtube://transcript/dQw4w9WgXcQ?language=en

Using the Statistical Tools

// Get video statistics
{
  "type": "tool",
  "name": "get-video-stats",
  "parameters": {
    "videoId": "dQw4w9WgXcQ"
  }
}

// Compare multiple videos
{
  "type": "tool",
  "name": "compare-videos",
  "parameters": {
    "videoIds": ["dQw4w9WgXcQ", "9bZkp7q19f0"]
  }
}

Using the Transcript Summary Prompt

{
  "type": "prompt",
  "name": "transcript-summary",
  "parameters": {
    "videoId": "dQw4w9WgXcQ",
    "language": "en"
  }
}

Using the Enhanced Transcript Tool

// Basic multi-video transcript extraction
{
  "type": "tool",
  "name": "enhanced-transcript",
  "parameters": {
    "videoIds": ["dQw4w9WgXcQ", "9bZkp7q19f0"],
    "format": "timestamped"
  }
}

// With search and time filtering
{
  "type": "tool",
  "name": "enhanced-transcript",
  "parameters": {
    "videoIds": ["dQw4w9WgXcQ"],
    "filters": {
      "timeRange": {
        "start": 60,  // Start at 60 seconds
        "end": 180    // End at 180 seconds
      },
      "search": {
        "query": "never gonna",
        "contextLines": 2
      }
    },
    "format": "merged"
  }
}

// With smart segmentation for easier analysis
{
  "type": "tool",
  "name": "enhanced-transcript",
  "parameters": {
    "videoIds": ["dQw4w9WgXcQ"],
    "filters": {
      "segment": {
        "count": 5,
        "method": "smart"  // Breaks at natural pauses
      }
    },
    "format": "timestamped",
    "language": "en"
  }
}

Using the Enhanced Transcript Analysis Features

// Get key moments from a video
{
  "type": "tool",
  "name": "get-key-moments",
  "parameters": {
    "videoId": "dQw4w9WgXcQ",
    "maxMoments": "5"
  }
}

// Get a segmented transcript
{
  "type": "tool",
  "name": "get-segmented-transcript",
  "parameters": {
    "videoId": "dQw4w9WgXcQ",
    "segmentCount": "4"
  }
}

// Get a segment-by-segment analysis
{
  "type": "prompt",
  "name": "segment-by-segment-analysis",
  "parameters": {
    "videoId": "dQw4w9WgXcQ",
    "segmentCount": "4"
  }
}

// Get customized transcript summary
{
  "type": "prompt",
  "name": "transcript-summary",
  "parameters": {
    "videoId": "dQw4w9WgXcQ",
    "language": "en",
    "summaryLength": "detailed",
    "includeKeywords": "true"
  }
}

Error Handling

The server handles various error conditions, including:

  • Invalid API key
  • Video or channel not found
  • Transcript not available
  • Network issues

License

MIT

Acknowledgements

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured