Skip to main content
Glama
youtube-studio-mcp

youtube-studio-mcp

YouTube Studio & Channel Analytics MCP Server

A Production-Grade Model Context Protocol (MCP) Server for YouTube Studio & Channel Intelligence

License: MIT Python: 3.11+ Managed by: uv MCP Compatible

Empower AI assistants (Claude, Cursor, Antigravity, etc.) to analyze your YouTube channel, track video metrics, deep-dive into YouTube Studio analytics, discover audience traffic sources, and analyze community sentiment β€” configured entirely through .env.


πŸš€ Features & MCP Tool Suite

YouTube Studio MCP provides 8 specialized tools:

Tool

Category

Description

get_channel_overview

Channel Stats

Returns channel title, handle, subscriber count, total lifetime views, video count, topic categories, and description.

get_channel_analytics

Studio Analytics

Queries core Studio metrics (views, watch time hours, average view duration, subscribers gained/lost, likes, shares, comments, impressions, CTR) over any timeframe (7d, 28d, 90d, 365d, last_month, or custom dates).

get_analytics_by_dimension

Demographics & Traffic

Detailed breakdowns by dimension: trafficSource (YouTube search, suggested, browse), deviceType, country, ageGroup, gender, operatingSystem, or day.

get_top_performing_videos

Video Intelligence

Ranks your top videos by views, watch time minutes, or subscribers gained in any date range.

get_video_analytics

Video Deep-Dive

Deep-dive analytics on a single specific video (daily trajectory, watch time, audience retention, traffic sources).

list_channel_videos

Content Inventory

Lists uploaded videos with current views, likes, comments, duration, and privacy status.

get_video_details

Video Metadata

Returns full metadata, tags, description, category, and statistics for specified video IDs.

get_video_comments

Community & Sentiment

Retrieves top comment threads and replies across your channel or on a specific video for sentiment analysis and feedback.


Related MCP server: youtube-organic-mcp

βš™οΈ Environment Configuration (.env)

All credentials and settings are read directly from .env:

# Google OAuth 2.0 Credentials (from Google Cloud Console)
YOUTUBE_CLIENT_ID=your_client_id.apps.googleusercontent.com
YOUTUBE_CLIENT_SECRET=your_client_secret

# OAuth Refresh Token (written automatically by run_auth.py)
YOUTUBE_REFRESH_TOKEN=

πŸ› οΈ Step-by-Step Setup Guide

1. Clone & Install Dependencies with uv

git clone https://github.com/Dhananjayrbiraris/youtube-mcp.git
cd youtube-mcp

uv venv
uv pip install -e .

2. Set Up Google Cloud Project (One-Time)

  1. Open Google Cloud Console.

  2. Create a new project (e.g. YouTube-Studio-MCP).

  3. In APIs & Services > Library, enable:

    • YouTube Data API v3

    • YouTube Analytics API

  4. In OAuth consent screen:

    • User Type: External -> fill app name & your email.

    • Under Test users, add your Google email address.

  5. In Credentials:

    • Click Create Credentials > OAuth client ID.

    • Application Type: Desktop App.

    • Copy the Client ID and Client Secret.

  6. Paste them into .env:

    YOUTUBE_CLIENT_ID=123456789-xxxx.apps.googleusercontent.com
    YOUTUBE_CLIENT_SECRET=GOCSPX-xxxx

3. Run 1-Click Authenticator

uv run run_auth.py

This launches your browser for a 1-click Google OAuth login. It automatically writes the YOUTUBE_REFRESH_TOKEN directly into your .env file.


4. Connect to your AI Client

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "youtube-studio": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/youtube-mcp",
        "run",
        "youtube-studio-mcp"
      ]
    }
  }
}

πŸ’‘ Example AI Prompts

  • "Give me an overview of my YouTube channel's performance over the last 28 days."

  • "Where is most of my traffic coming from (search, suggested videos, or browse features)?"

  • "Which of my videos generated the most subscribers this month?"

  • "Summarize common themes and questions from the comments on my latest video."

  • "Show me my audience breakdown by age group and country."


πŸ§ͺ Testing

Run the test suite:

pytest

πŸ“„ License

This project is licensed under the MIT License.

Available Tools

8 tools
get_analytics_by_dimensionA

Fetches channel analytics broken down by a specific dimension.

Args: dimension: The dimension to analyze. Supported values: - 'trafficSource' (YouTube search, suggested videos, browse features, external, etc.) - 'deviceType' (mobile phone, computer, TV, tablet) - 'country' (top geographic viewer locations) - 'ageGroup' (demographics: 18-24, 25-34, 35-44, etc.) - 'gender' (viewer gender percentage) - 'operatingSystem' (Android, Windows, iOS, etc.) - 'day' or 'month' time_period: Preset time period ('7d', '28d', '90d', '365d', 'last_month'). Defaults to '28d'. start_date: Optional explicit start date (YYYY-MM-DD). end_date: Optional explicit end date (YYYY-MM-DD). max_results: Maximum number of rows to return (default: 20).

Returns: A ranked list of metrics for each dimension value.

Inputs: dimension (required), end_date, start_date, max_results, +1 more. Returns: result

get_channel_analyticsA

Queries core YouTube Studio channel analytics for a specified timeframe.

Args: time_period: Preset time period ('7d', '28d', '90d', '365d', 'last_month'). Defaults to '28d'. start_date: Explicit start date in YYYY-MM-DD format (overrides time_period if both start & end are provided). end_date: Explicit end date in YYYY-MM-DD format. dimensions: Dimension to group by, e.g. 'day' (default) or None for a single aggregate row.

Returns: Summary metrics (total views, watch time hours, avg view duration, subscribers gained/lost, net growth, likes, shares, comments, impressions, CTR) and daily time-series data points.

Inputs: end_date, dimensions, start_date, time_period. Returns: result

get_channel_overviewA

Fetches high-level metadata and lifetime statistics for your YouTube channel.

Returns channel title, handle, subscriber count, total lifetime views, video count, creation date, topic categories, and channel description.

Inputs: no named parameters. Returns: result

get_top_performing_videosA

Identifies and ranks your top-performing videos within a time period.

Args: time_period: Preset time period ('7d', '28d', '90d', '365d', 'last_month'). Defaults to '28d'. start_date: Optional explicit start date (YYYY-MM-DD). end_date: Optional explicit end date (YYYY-MM-DD). order_by: Metric to rank by: 'views', 'estimatedMinutesWatched', 'subscribersGained', or 'likes'. max_results: Number of top videos to return (default: 10).

Returns: Ranked list of videos with title, duration, period views, watch time, subscribers gained, and lifetime views.

Inputs: end_date, order_by, start_date, max_results, +1 more. Returns: result

get_video_analyticsA

Performs deep-dive analytics on a single specific video.

Args: video_id: The 11-character YouTube video ID (e.g. 'dQw4w9WgXcQ'). time_period: Preset time period ('7d', '28d', '90d', '365d', 'last_month'). Defaults to '28d'. start_date: Optional explicit start date (YYYY-MM-DD). end_date: Optional explicit end date (YYYY-MM-DD).

Returns: Video metadata, daily trajectory, total period views & watch time, and traffic source breakdown for this specific video.

Inputs: video_id (required), end_date, start_date, time_period. Returns: result

get_video_commentsA

Fetches comment threads and audience discussions for a video or the whole channel.

Args: video_id: Optional specific YouTube video ID. If omitted, retrieves recent comments across the channel. max_results: Number of comment threads to fetch (max 100). order: Sort order: 'relevance' (top comments) or 'time' (newest first).

Returns: List of comments with author, comment text, likes, timestamp, and sample replies.

Inputs: order, video_id, max_results. Returns: result

get_video_detailsA

Fetches full metadata, description, tags, and statistics for specified video IDs.

Args: video_ids: Comma-separated list of YouTube video IDs (e.g. 'vid1,vid2').

Returns: Complete video details including title, description, tags, topic categories, view/like/comment counts, duration, and content settings.

Inputs: video_ids (required). Returns: result

list_channel_videosA

Lists your channel's uploaded videos in reverse chronological order.

Args: max_results: Number of videos to retrieve (max 50 per page). page_token: Optional page token for pagination.

Returns: List of videos with video ID, title, publish date, duration, views, likes, comments, and privacy status.

Inputs: page_token, max_results. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 8 tools

    Disambiguation3/5

    There are several analytics tools with overlapping parameters and outputs: get_channel_analytics can group by day, which overlaps with get_analytics_by_dimension, and get_top_performing_videos overlaps with list_channel_videos in returning video statistics. However, each tool's detailed description clarifies the intended focus (summary vs dimension vs ranked list), so agents can generally disambiguate.

    Naming Consistency4/5

    All tools use snake_case and nearly all start with get_, with list_channel_videos as the only list_ exception. The pattern is easily predictable, though get_top_performing_videos and get_analytics_by_dimension are phrase-style names rather than clean verb_noun resource names.

    Tool Count5/5

    Eight tools is a well-scoped size for a YouTube Studio analytics server; each tool covers a distinct reporting need without redundancy or bloat. This is within the ideal range and doesn't overwhelm an agent.

    Completeness4/5

    The toolset provides solid read-only coverage of channel analytics, video metadata/performance, and comments, supporting common creator reporting workflows. Notable gaps exist for video-level dimension breakdowns beyond traffic source and any management actions, but given the analytics-focused descriptions, these are minor.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers