home / mcp / youtube data mcp server

YouTube Data MCP Server

Provides token-optimized access to YouTube data via MCP tools for lean LLM prompts and analyses.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "kirbah-mcp-youtube": {
      "command": "npx",
      "args": [
        "-y",
        "@kirbah/mcp-youtube"
      ],
      "env": {
        "YOUTUBE_API_KEY": "YOUR_YOUTUBE_API_KEY_HERE",
        "MDB_MCP_CONNECTION_STRING": "mongodb+srv://user:[email protected]/youtube_niche_analysis"
      }
    }
  }
}

You can access lean, token-efficient YouTube data through a dedicated MCP server that returns concise, structured results for video details, transcripts, channel analysis, trending content, and more. This design minimizes token usage while preserving useful insights for AI models and LLM workflows.

How to use

To use this MCP server with any MCP-compatible client, connect using the provided MCP configuration and supply your YouTube API key and optional MongoDB connection string for caching and analytics.

How to install

Prerequisites you need before installation.

node --version
npm --version

Install dependencies and set up the server locally.

npm ci

Configure environment variables for local development. Create a .env file in the project root and provide your YouTube API key and an optional MongoDB connection string for caching.

YOUTUBE_API_KEY=YOUR_YOUTUBE_API_KEY_HERE
MDB_MCP_CONNECTION_STRING=your_mongodb_connection_string_here

Additional configuration and usage notes

The MCP client can be configured to spawn the local YouTube MCP server. A typical local usage involves running the server through the MCP-compatible client by specifying an npm-based start script or direct npx invocation. If you are using MongoDB for caching, ensure the database name is youtube_niche_analysis and the user has read/write permissions.

Security and maintenance notes

Keep your YouTube Data API key secure. Do not commit it to source control. Monitor API quotas in the Google Cloud Console and restrict your API key to YouTube Data API v3. If you enable MongoDB caching, protect your MongoDB connection string and limit access to trusted environments.

Troubleshooting

If you encounter issues starting the local MCP server, verify that the required environment variables are correctly set and that the working directory contains the appropriate .env file. Check that the YouTube API key has the necessary permissions and that the MongoDB connection is accessible when using caching.

Available tools

getVideoDetails

Retrieves lean, detailed information for multiple videos, including metadata, statistics, engagement ratios, and content details.

searchVideos

Searches for videos or channels with a query and filters, returning concise results suitable for AI processing.

getTranscripts

Fetches token-efficient transcripts for videos, with options for full text or key segments.

getChannelStatistics

Retrieves lean statistics for channels such as subscribers, views, and video counts.

getChannelTopVideos

Retrieves a channel's top-performing videos with lean details and engagement ratios.

getTrendingVideos

Gets trending videos by region and category with lean details and engagement metrics.

getVideoCategories

Lists available YouTube video categories for a region, providing essential data only.

getVideoComments

Retrieves comments for a video with options to limit results and fetch a number of replies.

findConsistentOutlierChannels

Identifies channels that consistently outperform within a niche, storing data in MongoDB.