Skip to main content

YouTube MCP Server for Claude Code

Project description

YouTube MCP Server

Connect Claude to YouTube Data API v3

Search videos, get details, fetch comments, access playlists, transcripts, and more.

PyPI Version Python Version License

PyPI Package: youtube-connector-mcp


Quick Start

# 1. Get your YouTube API Key from Google Cloud Console
#    https://console.cloud.google.com/apis/credentials

# 2. Set your API key as environment variable
export YOUTUBE_API_KEY="your_api_key_here"

# 3. Install the package
pip install youtube-connector-mcp

# 4. Add the MCP server
claude mcp add -s user -e YOUTUBE_API_KEY="${YOUTUBE_API_KEY}" youtube-connector-mcp -- youtube-connector-mcp

# 5. Restart Claude Code and start using!

Prerequisites

Requirement How to Get
Python 3.10+ Download Python or brew install python3
YouTube API Key Get it free from Google Cloud Console
Claude Code Install from claude.com/code

Installation

Install from PyPI (Recommended)

pip install youtube-connector-mcp

Note: If pip doesn't work, try pip3 install youtube-connector-mcp

Install from Source

git clone https://github.com/ShellyDeng08/youtube-connector-mcp.git
cd youtube-connector-mcp
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

Verify Installation

youtube-connector-mcp --help
claude mcp list  # Check if server is registered

Configuration

Option 1: Using claude mcp add (Easiest)

# Install for current project only
claude mcp add -s local -e YOUTUBE_API_KEY="${YOUTUBE_API_KEY}" youtube-connector-mcp -- youtube-connector-mcp

# Install for all your projects (recommended)
claude mcp add -s user -e YOUTUBE_API_KEY="${YOUTUBE_API_KEY}" youtube-connector-mcp -- youtube-connector-mcp

# Install to project's .mcp.json
claude mcp add -s project -e YOUTUBE_API_KEY="${YOUTUBE_API_KEY}" youtube-connector-mcp -- youtube-connector-mcp

Don't have an API key? See Creating a YouTube API Key below - it's free and takes just a few minutes.

Option 2: Manual Configuration

Add to your ~/.claude/mcp_config.json:

{
  "mcpServers": {
    "youtube-connector-mcp": {
      "command": "youtube-connector-mcp",
      "env": {
        "YOUTUBE_API_KEY": "${YOUTUBE_API_KEY}"
      }
    }
  }
}

API Key Setup

Set as Environment Variable (Recommended):

# Linux/Mac - Add to ~/.bashrc, ~/.zshrc, or ~/.profile
export YOUTUBE_API_KEY="your_api_key_here"
source ~/.zshrc
# Windows PowerShell - Add to $PROFILE
$env:YOUTUBE_API_KEY="your_api_key_here"
# Or set permanently
[System.Environment]::SetEnvironmentVariable('YOUTUBE_API_KEY', 'your_api_key_here', 'User')
# Windows CMD
setx YOUTUBE_API_KEY "your_api_key_here"

Or Put Directly in MCP Config:

{
  "mcpServers": {
    "youtube-connector-mcp": {
      "command": "youtube-connector-mcp",
      "env": {
        "YOUTUBE_API_KEY": "AIzaSyC-Your-Actual-API-Key-Here"
      }
    }
  }
}

Security Note: Using environment variables is safer as it keeps your key out of version control.

Creating a YouTube API Key

  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable YouTube Data API v3
  4. Go to Credentials and create an API key
  5. (Optional) Restrict the key to YouTube Data API v3 for better security

Environment Variables

Variable Required Default Description
YOUTUBE_API_KEY Yes - YouTube Data API v3 key
YOUTUBE_RATE_LIMIT No 100 Max requests per second

Features

Core Capabilities

Tool Description
youtube_search Search videos, channels, playlists with filters (duration, date, type, order)
youtube_get_video Get detailed video metadata, statistics, thumbnails, and content details
youtube_get_channel Get channel info, subscriber count, upload playlists, statistics
youtube_get_transcript Retrieve actual video transcript text with timestamps
youtube_get_comments Fetch video comments with pagination support
youtube_get_playlist Get playlist details and complete video list
youtube_list_playlists List all playlists for a specific channel
youtube_get_analytics Get analytics data (views, likes, comments, watch time)

Use Cases

  • Research: Search and analyze YouTube content programmatically
  • Content Analysis: Extract transcripts and comments for AI processing
  • Channel Monitoring: Track channel statistics and new uploads
  • Data Mining: Gather YouTube data for analytics projects
  • Automated Workflows: Integrate YouTube data into Claude-assisted workflows

Usage Examples

Category Example Prompts
Search "Search for Python tutorials" / "Find recent AI videos" / "Channels about cooking with 100k+ subscribers"
Video "Get details for this video: URL" / "What's the view count?" / "Get the transcript"
Channel "How many subscribers does @MKBHD have?" / "Recent uploads from this channel" / "Channel statistics"
Playlist "List all playlists for this channel" / "Get videos in this playlist"
Comments/Analytics "Get top comments for this video" / "Show channel analytics"

Troubleshooting

MCP Server Not Found

Error: No MCP servers configured

Solutions:

  1. Verify ~/.claude/mcp_config.json exists
  2. Check JSON syntax is valid
  3. Run claude mcp list to see registered servers
  4. Restart Claude Code after updating config

Python Not Found

Error: command not found: python

Solutions:

  1. Use python3 instead of python
  2. Provide full path: which python3 (Mac/Linux) or where python (Windows)

Module Not Found

Error: ModuleNotFoundError: No module named 'mcp'

Solutions:

  1. Activate virtual environment: source .venv/bin/activate
  2. Reinstall: pip install youtube-connector-mcp

API Quota Exceeded

Error: 403 Forbidden - quota exceeded

Solutions:

  1. Check Google Cloud Console quota
  2. Default: 10,000 units/day
  3. Consider upgrading for higher limits

Transcript Not Available

Error: "No transcript available" or "Transcripts are disabled"

Solutions:

  1. Video may not have captions enabled
  2. Auto-generated captions may take 24+ hours after upload
  3. Try a video known to have captions

Transcript Request Blocked

Error: "YouTube is blocking requests from your IP"

Solutions: See youtube-transcript-api documentation for proxy options.


License

MIT License - see LICENSE for details.


Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

youtube_connector_mcp-0.1.2.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

youtube_connector_mcp-0.1.2-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file youtube_connector_mcp-0.1.2.tar.gz.

File metadata

  • Download URL: youtube_connector_mcp-0.1.2.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.1 CPython/3.13.2 Darwin/24.6.0

File hashes

Hashes for youtube_connector_mcp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 514870a2429b1fe7f429235df8f1f77cc4e88efa733ecf014e1f3b5e59b8c969
MD5 98fcc34972cce7d061e3c8152802be4d
BLAKE2b-256 6596b2995cbac7be40223131ecebe6649b5dcbba007547336a71af014366433c

See more details on using hashes here.

File details

Details for the file youtube_connector_mcp-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for youtube_connector_mcp-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 549e054fc701ea1165ec7d91abc54bba9e3477a652bd917fecb21db04393ba42
MD5 64948720bdaf8dd1d1405ec037e92eac
BLAKE2b-256 94050fe0fe82415853dd4221ee2a220bfc52edc9e3abbb164735148f5fe9ec36

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page