Sponsored by Deepsite.site

Youtube MCP Server

Created By
space-cadet6 months ago
A MCP server for connecting with Youtube. You have to obtain your own youtube API key, since the app is not yet approved by Google and I cannot provide API access. To access your private youtube information using the MCP tools you will have to authorize the app using npx auth.
Content

YouTube MCP Server

smithery badge

A Model Context Protocol (MCP) server implementation utilizing the YouTube Data API. It allows AI language models to interact with YouTube content through a standardized interface.

Key Features

Video Information

  • Retrieve detailed video information (title, description, duration, statistics)
  • Search for videos by keywords
  • Get related videos based on a specific video
  • Calculate and analyze video engagement ratios

Transcript/Caption Management

  • Retrieve video captions with multi-language support
  • Specify language preferences for transcripts
  • Access time-stamped captions for precise content reference

Channel Analysis

  • View detailed channel statistics (subscribers, views, video count)
  • Get top-performing videos from a channel
  • Analyze channel growth and engagement metrics

Playlist Management

  • Retrieve detailed playlist information
  • Get all videos within a playlist
  • Search for public playlists by keywords
  • Get all public playlists from a specific channel

Trend Analysis

  • View trending videos by region and category
  • Compare performance metrics across multiple videos
  • Discover popular content in specific categories

OAuth Authentication for Private Content

This MCP server supports OAuth authentication to access private YouTube content including your personal playlists. To set up and use OAuth:

  1. Create OAuth Credentials:

    • Go to the Google Cloud Console
    • Create OAuth 2.0 Client ID credentials (Web application type)
    • Set the authorized redirect URI to http://localhost:3000/oauth2callback
    • Add the client ID and secret to your .env file
  2. Authenticate:

    # Start the OAuth flow
    npm run auth
    # This will display a URL to visit in your browser
    
  3. Verify Authentication Status:

    npm run auth:status
    
  4. Revoke Authentication:

    npm run auth:revoke
    

Once authenticated, you can access your private playlists using the getMyPlaylists tool.

Available Tools

The server provides the following MCP tools:

Tool NameDescriptionRequired Parameters
getVideoDetailsGet detailed information about multiple YouTube videos including metadata, statistics, and content detailsvideoIds (array)
searchVideosSearch for videos based on a query stringquery, maxResults (optional)
getTranscriptsRetrieve transcripts for multiple videosvideoIds (array), lang (optional)
getRelatedVideosGet videos related to a specific video based on YouTube's recommendation algorithmvideoId, maxResults (optional)
getChannelStatisticsRetrieve detailed metrics for multiple channels including subscriber count, view count, and video countchannelIds (array)
getChannelTopVideosGet the most viewed videos from a specific channelchannelId, maxResults (optional)
getVideoEngagementRatioCalculate engagement metrics for multiple videos (views, likes, comments, and engagement ratio)videoIds (array)
getTrendingVideosGet currently popular videos by region and categoryregionCode (optional), categoryId (optional), maxResults (optional)
compareVideosCompare statistics across multiple videosvideoIds (array)
getPlaylistDetailsGet detailed information about a specific YouTube playlistplaylistId
getPlaylistVideosRetrieve all videos contained in a specific playlistplaylistId, maxResults (optional)
searchPublicPlaylistsSearch for public playlists based on a query stringquery, maxResults (optional), channelId (optional)
getChannelPlaylistsGet all public playlists from a specific channelchannelId, maxResults (optional)
getMyPlaylistsGet your own playlists (including private ones)maxResults (optional)
checkOAuthStatusCheck if OAuth authentication is activeNone

Installation

Automatic Installation via Smithery

Automatically install YouTube MCP Server for Claude Desktop via Smithery:

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

Manual Installation

# Install from npm
npm install youtube-data-mcp-server

# Or clone repository
git clone https://github.com/icraft2170/youtube-data-mcp-server.git
cd youtube-data-mcp-server
npm install

Environment Configuration

Set the following environment variables:

  • YOUTUBE_API_KEY: YouTube Data API key (required)
  • YOUTUBE_TRANSCRIPT_LANG: Default caption language (optional, default: 'en')

OAuth Configuration (for Private Playlists)

To access private playlists and content, you'll need to configure OAuth:

  • GOOGLE_OAUTH_CLIENT_ID: OAuth 2.0 client ID
  • GOOGLE_OAUTH_CLIENT_SECRET: OAuth 2.0 client secret
  • OAUTH_REDIRECT_URI: OAuth callback URL (default: http://localhost:3000/oauth2callback)

MCP Client Configuration

Add the following to your Claude Desktop configuration file:

{
  "mcpServers": {
    "youtube": {
      "command": "npx",
      "args": ["-y", "youtube-data-mcp-server"],
      "env": {
        "YOUTUBE_API_KEY": "YOUR_API_KEY_HERE",
        "YOUTUBE_TRANSCRIPT_LANG": "ko"
      }
    }
  }
}

YouTube API Setup

  1. Access Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable YouTube Data API v3
  4. Create API credentials (API key)
  5. Use the generated API key in your environment configuration

Development

# Install dependencies
npm install

# Run in development mode
npm run dev

# Build
npm run build

Network Configuration

The server exposes the following ports for communication:

  • HTTP: 3000
  • gRPC: 3001

System Requirements

  • Node.js 18.0.0 or higher

Security Considerations

  • Always keep your API key secure and never commit it to version control systems
  • Manage your API key through environment variables or configuration files
  • Set usage limits for your API key to prevent unauthorized use

License

This project is licensed under the MIT License. See the LICENSE file for details.

Server Config

{
  "mcpServers": {
    "youtube": {
      "command": "npx",
      "args": [
        "-y",
        "yt-mcp"
      ],
      "env": {
        "YOUTUBE_API_KEY": "YOUR_API_KEY_HERE",
        "YOUTUBE_TRANSCRIPT_LANG": "en"
      }
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
WindsurfThe new purpose-built IDE to harness magic
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Serper MCP ServerA Serper MCP Server
Amap Maps高德地图官方 MCP Server
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
DeepChatYour AI Partner on Desktop
ChatWiseThe second fastest AI chatbot™
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Playwright McpPlaywright MCP server
CursorThe AI Code Editor
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Tavily Mcp
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。