YouTube Content Management MCP Server

YouTube Content Management MCP Server

A Model Context Protocol (MCP) server that provides YouTube Data API v3 integration for content discovery and analytics. It enables AI assistants to search for videos, channels, playlists, and retrieve detailed metrics.

Category
访问服务器

README

YouTube Content Management MCP Server

A Model Context Protocol (MCP) server that provides YouTube Data API v3 integration for content discovery and analytics. This server enables AI assistants to search for YouTube videos, channels, playlists, and retrieve detailed metrics for videos, channels, and playlists.

Features

Current Tools

  • 🎥 search_videos: Search YouTube for videos with advanced filtering options, including view count, like count, and comment count.
  • 📺 search_channels: Find YouTube channels based on search queries, including subscriber count, video count, and total view count.
  • 📋 search_playlists: Search YouTube for playlists based on search queries.
  • 📊 get_video_metrics: Retrieve statistics (views, likes, comments) for a specific video by ID.
  • 📈 get_channel_metrics: Retrieve statistics (subscribers, total views, video count) for a specific channel by ID.
  • 📑 get_playlist_metrics: Retrieve statistics (item count, total views) for a specific playlist by ID.

Planned Features

  • Playlist creation and management
  • Comment retrieval and analysis
  • Video upload and management (with proper authentication)
  • Trending videos by region
  • Video transcription access

Prerequisites

  • Python 3.8 or higher
  • YouTube Data API v3 key
  • VSCode with MCP extension (for VSCode usage)
  • Required Python packages: google-api-python-client, python-dotenv, pydantic

Getting Your YouTube API Key

  1. Go to the Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the YouTube Data API v3:
    • Navigate to "APIs & Services" > "Library"
    • Search for "YouTube Data API v3"
    • Click on it and press "Enable"
  4. Create credentials:
    • Go to "APIs & Services" > "Credentials"
    • Click "Create Credentials" > "API Key"
    • Copy the generated API key
  5. (Recommended) Restrict the API key:
    • Click on the API key to edit it
    • Under "API restrictions", select "Restrict key"
    • Choose "YouTube Data API v3"
    • Save the changes

Installation

  1. Clone or download this repository

    git clone https://github.com/NastyRunner13/youtube-content-management-mcp
    cd youtube-content-management-mcp
    
  2. Install dependencies

    pip install -r requirements.txt
    

    Or if using uv:

    uv install
    
  3. Set up your environment (Optional) Create a .env file in the project root:

    YOUTUBE_API_KEY=your_youtube_api_key_here
    

Usage

With VSCode (Recommended)

  1. Install the MCP extension in VSCode

  2. Configure the MCP server by adding this to your VSCode settings.json:

    {
      "mcp.servers": {
        "youtube-content-management": {
          "command": "python",
          "args": [
            "/path/to/youtube-content-management-mcp/main.py"
          ],
          "env": {
            "YOUTUBE_API_KEY": "your_youtube_api_key_here"
          }
        }
      }
    }
    

    Alternative using uv:

    {
      "mcp.servers": {
        "youtube-content-management": {
          "command": "uv",
          "args": [
            "--directory",
            "/path/to/youtube-content-management-mcp",
            "run",
            "main.py"
          ],
          "env": {
            "YOUTUBE_API_KEY": "your_youtube_api_key_here"
          }
        }
      }
    }
    
  3. Restart VSCode or reload the window

  4. Use the tools through the MCP panel or by asking your AI assistant

With Claude Desktop

Add this configuration to your Claude Desktop config file:

Windows: %APPDATA%/Claude/claude_desktop_config.json macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "youtube-content-management": {
      "command": "python",
      "args": ["/path/to/youtube-content-management-mcp/main.py"],
      "env": {
        "YOUTUBE_API_KEY": "your_youtube_api_key_here"
      }
    }
  }
}

With Other MCP Clients

The server implements the standard MCP protocol and should work with any compatible MCP client. Refer to your client's documentation for configuration instructions.

Available Tools

search_videos

Search YouTube for videos with advanced filtering options, including metrics like view count, like count, and comment count.

Parameters:

  • query (string, required): Search query
  • max_results (integer, optional): Maximum number of results (1-50, default: 25)
  • order (string, optional): Sort order - "relevance", "date", "rating", "viewCount" (default: "relevance")
  • duration (string, optional): Video duration - "medium", "long" (default: "medium")
  • published_after (string, optional): RFC 3339 timestamp (e.g., "2023-01-01T00:00:00Z")

Example usage:

Search for Python tutorials uploaded in the last year, sorted by view count

search_channels

Find YouTube channels based on search queries, including metrics like subscriber count, video count, and total view count.

Parameters:

  • query (string, required): Search query for channels
  • max_results (integer, optional): Maximum number of results (1-50, default: 25)
  • published_after (string, optional): RFC 3339 timestamp (e.g., "2023-01-01T00:00:00Z")

Example usage:

Find coding tutorial channels

search_playlists

Search YouTube for playlists based on search queries.

Parameters:

  • query (string, required): Search query for playlists
  • max_results (integer, optional): Maximum number of results (1-50, default: 25)
  • published_after (string, optional): RFC 3339 timestamp (e.g., "2023-01-01T00:00:00Z")

Example usage:

Find playlists about machine learning

get_video_metrics

Retrieve statistics for a specific YouTube video, including view count, like count, and comment count.

Parameters:

  • video_id (string, required): The YouTube video ID

Example usage:

Get metrics for the video with ID dQw4w9WgXcQ

get_channel_metrics

Retrieve statistics for a specific YouTube channel, including subscriber count, total view count, and video count.

Parameters:

  • channel_id (string, required): The YouTube channel ID

Example usage:

Get metrics for the channel with ID UC_x5XG1OV2P6uZZ5FSM9Ttw

get_playlist_metrics

Retrieve statistics for a specific YouTube playlist, including item count and total view count of all videos.

Parameters:

  • playlist_id (string, required): The YouTube playlist ID

Example usage:

Get metrics for the playlist with ID PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU

Example Interactions

Once the MCP server is configured, you can interact with it through your AI assistant:

Video Search with Metrics:

"Search for machine learning tutorials from the last 6 months, sorted by view count, and show view counts"

Channel Discovery with Metrics:

"Find top cooking channels on YouTube with their subscriber counts"

Playlist Search:

"Show me playlists about Python programming"

Video Metrics:

"Get the view count and like count for the video with ID dQw4w9WgXcQ"

Channel Metrics:

"What are the subscriber count and total views for the channel UC_x5XG1OV2P6uZZ5FSM9Ttw?"

Playlist Metrics:

"How many videos and total views are in the playlist PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU?"

Input Validation

All tools use Pydantic for robust input validation, ensuring:

  • Required fields (e.g., query, video_id) are provided and non-empty.
  • Numeric fields (e.g., max_results) are within valid ranges (1-50).
  • String fields (e.g., order, duration) match allowed values.
  • Timestamps (e.g., published_after) follow RFC 3339 format.

Invalid inputs result in clear error messages, improving reliability and user experience.

Security Notes

  • Never commit your API key to version control
  • Consider using environment variables instead of hardcoding API keys
  • Regularly rotate your API keys
  • Monitor your API usage in Google Cloud Console
  • Set up API key restrictions to limit usage to YouTube Data API v3

Troubleshooting

Common Issues

  1. "YouTube API key is not set"

    • Ensure your API key is properly configured in the environment variables
    • Check that the key is valid and has YouTube Data API v3 enabled
  2. "quotaExceeded" errors

    • You've hit your daily API quota limit (default: 10,000 units)
    • Wait until the quota resets (daily) or increase your quota in Google Cloud Console
    • Note: Metrics tools and search tools with metrics may consume more quota due to multiple API calls
  3. "keyInvalid" errors

    • Your API key is invalid or has been revoked
    • Generate a new API key and update your configuration
  4. "Invalid input arguments" errors

    • Check the Pydantic error message for details (e.g., missing query, invalid order)
    • Ensure inputs match the tool's parameter requirements
  5. MCP server not starting

    • Check that all dependencies (google-api-python-client, python-dotenv, pydantic) are installed
    • Verify the Python path in your configuration is correct
    • Check the MCP extension logs for detailed error messages

Debug Mode

To enable debug logging, add this to your environment:

"env": {
  "YOUTUBE_API_KEY": "your_key_here",
  "DEBUG": "true"
}

Contributing

We welcome contributions! Areas where you can help:

  • Additional YouTube API endpoints (comments, transcriptions)
  • Optimizing API quota usage (e.g., batching metrics calls)
  • Enhancing Pydantic validation rules
  • Performance optimizations
  • Documentation improvements
  • Testing and bug reports

API Limits

  • YouTube Data API v3: 10,000 units per day (default)
  • Search operations: 100 units per request
  • List operations (videos, channels, playlists): 1 unit per request
  • Playlist items: 5 units per request
  • Rate limiting: Be mindful of making too many requests in quick succession, especially with metrics tools

Support

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选