Skip to main content
Glama

YouTube Search MCP Server

by KnightMode

YouTube Search MCP Server

A fast and comprehensive MCP (Model Context Protocol) server that provides YouTube search functionality using the YouTube Data API v3.

Features

  • Comprehensive Search: Search videos, channels, and playlists
  • Advanced Filtering: Duration, quality, date range, region, and language filters
  • Pagination Support: Handle large result sets with pagination tokens
  • Multiple Search Types: Specialized tools for different content types
  • Error Handling: Robust error handling and validation
  • Rate Limiting Aware: Optimized for YouTube API quota management

Installation

  1. Install dependencies:
pip install -r requirements.txt
  1. Set up your YouTube API key:
export YOUTUBE_API_KEY="your_youtube_api_key_here"
  1. Run the server:
python youtube_search_mcp.py

API Setup

  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the YouTube Data API v3
  4. Create an API key in the credentials section
  5. Set the API key as an environment variable

Available Tools

Main Search Tool

  • search_youtube - Full-featured search with all available filters

Specialized Search Tools

  • search_youtube_videos - Video-specific search with video filters
  • search_youtube_channels - Channel-specific search
  • search_youtube_playlists - Playlist-specific search
  • search_youtube_by_channel - Search within a specific channel

Resource

  • youtube-search-help - Comprehensive help documentation

Usage Examples

# Search for programming videos search_youtube_videos("python programming", max_results=10, order="date")
# Search for short programming videos from last month search_youtube_videos( "machine learning", max_results=20, duration="short", order="viewCount", published_after="2024-01-01T00:00:00Z" )
# Find channels about data science search_youtube_channels("data science", max_results=15)

Search Within Channel

# Search within a specific channel search_youtube_by_channel( "UC_x5XG1OV2P6uZZ5FSM9Ttw", query="tutorial", max_results=25 )

Parameters

Common Parameters

  • query: Search query string
  • max_results: Number of results (0-50, default: 25)
  • order: Sort order (relevance, date, rating, viewCount, title)
  • region_code: Geographic region (ISO 3166-1 alpha-2 country code)

Video-Specific Parameters

  • duration: Video length (any, short, medium, long)
  • definition: Video quality (any, high, standard)
  • published_after/before: Date filtering (RFC 3339 format)

Response Format

All search results include:

  • Search metadata (total results, pagination tokens)
  • Processed items with titles, descriptions, URLs
  • Channel information and publication dates
  • Thumbnail URLs in multiple sizes

Rate Limiting

  • Daily quota: 10,000 units (default)
  • Search cost: 100 units per request
  • Maximum searches: ~100 requests per day
  • Best practices: Implement caching and use specific filters

Error Handling

The server handles various error conditions:

  • Invalid API key
  • Quota exceeded
  • Invalid parameters
  • Network errors
  • Rate limiting

Best Practices

  1. Use specific filters to get relevant results
  2. Implement caching for frequently searched terms
  3. Monitor quota usage in Google Cloud Console
  4. Use pagination tokens for large result sets
  5. Handle errors gracefully with retry logic

Security

  • Store API keys in environment variables
  • Never expose API keys in client-side code
  • Implement proper rate limiting
  • Validate and sanitize search queries

License

This project is open source and available under the MIT License.

-
security - not tested
F
license - not found
-
quality - not tested

A Model Context Protocol server that provides comprehensive YouTube search functionality, enabling users to search for videos, channels, and playlists with advanced filtering options using the YouTube Data API.

  1. Features
    1. Installation
      1. API Setup
        1. Available Tools
          1. Main Search Tool
          2. Specialized Search Tools
          3. Resource
        2. Usage Examples
          1. Basic Video Search
          2. Advanced Video Search
          3. Channel Search
          4. Search Within Channel
        3. Parameters
          1. Common Parameters
          2. Video-Specific Parameters
        4. Response Format
          1. Rate Limiting
            1. Error Handling
              1. Best Practices
                1. Security
                  1. License

                    Related MCP Servers

                    • A
                      security
                      A
                      license
                      A
                      quality
                      A Model Context Protocol server that enables access to YouTube video content through transcripts, translations, summaries, and subtitle generation in various languages.
                      Last updated -
                      5
                      1
                      Python
                      MIT License
                    • A
                      security
                      A
                      license
                      A
                      quality
                      A Model Context Protocol server that enables retrieval of transcripts from YouTube videos. This server provides direct access to video transcripts and subtitles through a simple interface, making it ideal for content analysis and processing.
                      Last updated -
                      1
                      444
                      22
                      TypeScript
                      MIT License
                      • Linux
                      • Apple
                    • -
                      security
                      A
                      license
                      -
                      quality
                      A Model Context Protocol server that enables searching YouTube videos, retrieving and storing transcripts, and performing semantic search over video content without using the official YouTube API.
                      Last updated -
                      5
                      Python
                      MIT License
                    • A
                      security
                      F
                      license
                      A
                      quality
                      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.
                      Last updated -
                      12
                      1
                      4
                      JavaScript

                    View all related MCP servers

                    MCP directory API

                    We provide all the information about MCP servers via our MCP API.

                    curl -X GET 'https://glama.ai/api/mcp/v1/servers/KnightMode/youtube-mcp'

                    If you have feedback or need assistance with the MCP directory API, please join our Discord server