Skip to main content
Glama
granitebps

YouTube MCP Server

by granitebps

YouTube MCP Server

An MCP (Model Context Protocol) server that provides YouTube video data to AI agents like GitHub Copilot, Claude Desktop, and Cursor.

Supports both stdio (local) and Streamable HTTP (VPS/remote) transports.

Features

Tool

Description

search_youtube

Search videos with filters for upload date and popularity

get_video_info

Video metadata: title, views, likes, upload date, duration, tags, description

get_video_comments

Comment threads with full replies, author info, and likes

get_video_transcript

Transcripts (manual + auto-generated captions) with timestamps

get_transcript_languages

Lists available manual and auto-generated caption languages

Related MCP server: yt

Prerequisites

  • Node.js 18+

No YouTube API key required! This server uses youtubei.js (YouTube's InnerTube API) for video info, comments, and search, and youtube-transcript-plus for transcripts. Both work without any API key or authentication.

Setup

# Clone and install
cd youtube-mcp
npm install

# Build
npm run build

Option 1: Local (stdio) — Default

This is the simplest setup. The MCP client spawns the server as a subprocess.

npm start

GitHub Copilot (VS Code)

Add to your VS Code settings.json:

{
  "mcp": {
    "servers": {
      "youtube": {
        "command": "node",
        "args": ["/absolute/path/to/youtube-mcp/dist/index.js"]
      }
    }
  }
}

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

{
  "mcpServers": {
    "youtube": {
      "command": "node",
      "args": ["/absolute/path/to/youtube-mcp/dist/index.js"]
    }
  }
}

Cursor

Add to your Cursor MCP settings:

{
  "mcpServers": {
    "youtube": {
      "command": "node",
      "args": ["/absolute/path/to/youtube-mcp/dist/index.js"]
    }
  }
}

Option 2: VPS Deployment (Streamable HTTP)

For remote deployment, the server runs as a persistent HTTP service using the Streamable HTTP transport (the current MCP standard, replacing the deprecated SSE transport).

1. Deploy to your VPS

# On your VPS
git clone <your-repo-url> youtube-mcp
cd youtube-mcp
npm install
npm run build

# Create .env (optional, for HTTP mode)
cp .env.example .env
# Uncomment TRANSPORT=http, PORT, HOST as needed

2. Run with HTTP transport

# Using --http flag
node dist/index.js --http

# Or using environment variable
TRANSPORT=http PORT=3000 node dist/index.js

# Or using npm script
npm run start:http

The server will listen on http://0.0.0.0:3000/mcp.

3. Set up Nginx reverse proxy with TLS

server {
    listen 443 ssl;
    server_name mcp.yourdomain.com;

    ssl_certificate     /etc/letsencrypt/live/mcp.yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mcp.yourdomain.com/privkey.pem;

    location /mcp {
        proxy_pass http://127.0.0.1:3000/mcp;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        # Required for SSE streaming
        proxy_set_header Connection '';
        proxy_buffering off;
        proxy_cache off;
        chunked_transfer_encoding on;
    }
}

Get a free TLS certificate:

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d mcp.yourdomain.com

4. Keep it running with systemd

Create /etc/systemd/system/youtube-mcp.service:

[Unit]
Description=YouTube MCP Server
After=network.target

[Service]
Type=simple
User=your_user
WorkingDirectory=/path/to/youtube-mcp
ExecStart=/usr/bin/node dist/index.js --http
Restart=always
RestartSec=5
Environment=TRANSPORT=http
Environment=PORT=3000
Environment=HOST=127.0.0.1

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable youtube-mcp
sudo systemctl start youtube-mcp
sudo systemctl status youtube-mcp

5. Connect MCP clients to your VPS

GitHub Copilot (VS Code) — Remote

{
  "mcp": {
    "servers": {
      "youtube": {
        "type": "http",
        "url": "https://mcp.yourdomain.com/mcp"
      }
    }
  }
}

Claude Desktop — Remote

{
  "mcpServers": {
    "youtube": {
      "type": "streamable-http",
      "url": "https://mcp.yourdomain.com/mcp"
    }
  }
}

Usage Examples

Once connected, you can ask your AI agent things like:

  • "Get info about this YouTube video: https://www.youtube.com/watch?v=dQw4w9WgXcQ"

  • "Show me the top comments on video ID abc123"

  • "Get the transcript of this video in English"

  • "Summarize the transcript of https://youtu.be/xyz789"

  • "Search for Node.js tutorials uploaded this week, sorted by views"

  • "Find the most popular React videos from the last month"

Tool Response Format

All tools return:

  • content: short human-readable text for chat-style MCP clients

  • structuredContent: JSON-shaped data for agents that need reliable fields

The server is intentionally JSON-first, text-second. Agents should prefer structuredContent when they need to filter, transform, or chain tool results.

Example shape from get_video_info:

{
  "content": [
    {
      "type": "text",
      "text": "📹 Example title\n\nChannel: Example channel\n..."
    }
  ],
  "structuredContent": {
    "videoId": "dQw4w9WgXcQ",
    "title": "Example title",
    "description": "Example description",
    "channelName": "Example channel",
    "channelId": "UC123",
    "uploadedAt": "1 year ago",
    "duration": "3m 33s",
    "viewCount": "123456",
    "likeCount": "7890",
    "commentCount": "456",
    "tags": ["music", "pop"],
    "thumbnailUrl": "https://..."
  }
}

Tool Details

search_youtube

  • Input: query (search text), maxResults (1-50, default 10), sortBy (relevance | date | viewCount | rating), uploadDate (any | hour | today | week | month | year), videoDuration (any | short | medium | long)

  • Returns: Human-readable summary in content plus structured JSON results in structuredContent

get_video_info

  • Input: video (YouTube URL or video ID)

  • Returns: Human-readable summary in content plus structured JSON metadata in structuredContent

get_video_comments

  • Input: video (URL or ID), maxResults (1-20, default 20), sortBy (relevance or time), page (default 1)

  • Returns: Human-readable summary in content plus structured JSON comment threads, pagination fields, and hasMore in structuredContent

get_video_transcript

  • Input: video (URL or ID), lang (language code, default en), maxSegments (default 0 for all), startSegment (default 0)

  • Returns: Human-readable transcript in content plus structured JSON segments, plain text, and pagination metadata in structuredContent

  • Note: Does NOT require an API key — works via YouTube's internal caption system

get_transcript_languages

  • Input: video (YouTube URL or video ID)

  • Returns: Human-readable language list in content plus structured JSON language metadata in structuredContent

Rate Limits

This server uses YouTube's InnerTube API (the same API used by youtube.com). There are no official API quotas, but:

  • Heavy automated usage may trigger CAPTCHAs or temporary blocks

  • Use responsibly — add delays between bulk requests if needed

  • All tools are free with no API key required

License

ISC

Available Tools

5 tools
get_transcript_languagesA

List all available caption/transcript languages for a YouTube video. Returns language codes and names for both manual and auto-generated captions. Call this first to discover available languages before fetching a transcript.

ParametersJSON Schema
NameRequiredDescriptionDefault
videoYesYouTube video URL or video ID

Output Schema

ParametersJSON Schema
NameRequiredDescription
messageNo
videoIdYes
availableYes
languagesYes
manualCountYes
totalTracksYes
autoGeneratedCountYes

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, but description covers return values (language codes and names) and scope (both manual and auto-generated). Lacks discussion of authentication or rate limits, but these are reasonable defaults for a listing tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences: first states main purpose, second adds detail and usage guidance. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Output schema exists to document return format. Description fully covers purpose, usage, and behavioral aspects for this simple discovery tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with a single parameter already described as 'YouTube video URL or video ID'. Description adds no new semantic detail beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool lists available caption/transcript languages for a YouTube video, specifying both manual and auto-generated. It distinguishes itself from sibling tools like get_video_transcript and get_video_info.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly instructs to call this first before fetching a transcript, providing clear when-to-use guidance and implying when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_video_commentsA

Get YouTube video comments with replies. Returns comment text, author, likes, and date. Supports sorting by 'relevance' (top comments) or 'time' (newest). Returns error if comments are disabled.

ParametersJSON Schema
NameRequiredDescriptionDefault
pageNoPage number for pagination. Each page returns up to 20 comment threads. Use hasMore in the response to know if more pages exist.
videoYesYouTube video URL or video ID
sortByNoSort order: 'relevance' (top comments) or 'time' (newest first)relevance
maxResultsNoNumber of comment threads per page (1-20, YouTube returns ~20 per page)

Output Schema

ParametersJSON Schema
NameRequiredDescription
pageYes
sortByYes
hasMoreYes
threadsYes
videoIdYes
threadCountYes
totalFetchedYes

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, description carries full burden. Covers sorting options and error case (disabled comments), but omits authentication needs, rate limits, or response structure details beyond basic fields. Incomplete for an unaided tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise: two sentences covering purpose, output, sorting, and error. No filler or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Output schema exists, so return structure is not required. However, description lacks guidance on pagination strategy or how to handle multiple pages. Usage context is minimal given four parameters and a pagination mechanism.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline 3. Description mentions sorting and error but adds little beyond schema descriptions (e.g., schema already says maxResults=20 per page). No new parameter insights.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states the tool retrieves YouTube video comments with replies, listing returned fields (text, author, likes, date). Distinct from sibling tools like get_video_info, get_video_transcript, or search_youtube.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Description implies use when you want comments, but no explicit when-to-use or when-not-to-use. No mention of alternatives (e.g., use search_youtube for finding videos). Lacks exclusions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_video_infoA

Get YouTube video metadata: title, views, likes, comment count, upload date, duration, tags, and description. Input: YouTube URL or video ID. Returns error message if video is private, deleted, or unavailable.

ParametersJSON Schema
NameRequiredDescriptionDefault
videoYesYouTube video URL or video ID

Output Schema

ParametersJSON Schema
NameRequiredDescription
tagsYes
titleYes
videoIdYes
durationYes
channelIdYes
likeCountYes
viewCountYes
uploadedAtYes
channelNameYes
descriptionYes
commentCountYes
thumbnailUrlYes

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. It explains the tool returns metadata fields and an error message for unavailable videos. However, it does not mention authentication requirements, rate limits, or whether the tool is read-only. Since it implies a read operation without explicit safety guarantees, a 3 is appropriate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences convey purpose, input, and error behavior without redundancy. The most critical information is front-loaded. Every sentence serves a clear function, making it highly efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (1 parameter, has output schema), the description comprehensively covers input format, returned metadata fields, and possible error scenarios. The presence of an output schema means return value details are omitted appropriately. No gaps remain for a basic metadata retrieval tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% for the single 'video' parameter, with description already stating 'YouTube URL or video ID.' The tool description repeats this exact information without adding new details like allowed URL formats or examples. Thus, description adds no extra value beyond the schema, meeting the baseline of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Get YouTube video metadata' and lists specific fields (title, views, likes, comment count, upload date, duration, tags, and description). This verb+resource+scope approach distinguishes it from sibling tools like get_video_transcript or search_youtube, which serve different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Description explicitly specifies input format: 'YouTube URL or video ID.' It also notes error conditions (private, deleted, unavailable). While it doesn't directly compare to siblings, the sibling names make usage context clear, and the input guidance is sufficient.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_video_transcriptA

Get YouTube video transcript/captions (manual or auto-generated) with timestamps. Use 'lang' to specify language code (e.g. 'en', 'id'). Returns both timestamped and plain text versions. Returns error if captions are unavailable.

ParametersJSON Schema
NameRequiredDescriptionDefault
langNoLanguage code for the transcript (e.g., 'en', 'id', 'ja')en
videoYesYouTube video URL or video ID
maxSegmentsNoMaximum number of transcript segments to return. 0 (default) returns all segments. Use with startSegment for pagination.
startSegmentNoSegment index to start from (0-based). Use with maxSegments to paginate through long transcripts.

Output Schema

ParametersJSON Schema
NameRequiredDescription
hasMoreYes
messageNo
videoIdYes
segmentsYes
availableYes
plainTextYes
languageCodeYes
startSegmentYes
totalSegmentsYes
nextStartSegmentYes
returnedSegmentsYes

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description must disclose behavior. It reveals it returns both timestamped and plain text versions, supports auto-generated and manual captions, and errors if captions are unavailable. This is good coverage, though it doesn't mention rate limits or auth requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences, no fluff, front-loaded with primary purpose. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the presence of an output schema, the description need not detail return values. It covers key aspects: source (YouTube video), type (transcript/captions), and error case. Lacks mention of pagination support but that is handled by parameter descriptions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents all parameters. Description adds minimal extra meaning beyond what schema provides (e.g., language code examples). Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states it gets YouTube video transcript/captions with timestamps. It distinguishes from sibling tools like get_transcript_languages (which lists languages) and get_video_comments (which gets comments).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Description mentions language code specification and error behavior but does not explicitly guide when to use this tool vs alternatives like get_transcript_languages for listing available languages. Usage context is implied but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_youtubeA

Search YouTube videos by query. Returns up to 50 results with title, channel, views, duration, and URL. Supports filtering by uploadDate (today/week/month/year) and videoDuration (short/medium/long), and sorting by relevance, date, viewCount, or rating.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query string
sortByNoSort order: 'relevance' (default), 'date' (newest), 'viewCount' (most popular), 'rating' (highest rated)relevance
maxResultsNoMaximum number of results to return (1-50)
uploadDateNoFilter by upload date: 'any', 'hour', 'today', 'week', 'month', 'year'any
videoDurationNoFilter by duration: 'any', 'short' (<3min), 'medium' (3-20min), 'long' (>20min)any

Output Schema

ParametersJSON Schema
NameRequiredDescription
queryYes
sortByYes
resultsYes
uploadDateYes
resultCountYes
videoDurationYes

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full responsibility. It discloses return fields and limits (up to 50 results) and filtering options, but does not mention authentication, rate limits, or error handling. This is adequate but not comprehensive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences: first states purpose and output, second lists filters and sorting. No redundant information. Every sentence serves a purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the presence of an output schema, the description does not need to detail return values extensively. It covers the main functionality: querying, filtering, sorting, and result limits. Missing details like pagination or language filters are acceptable given the schema coverage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds value by summarizing the return fields (title, channel, views, duration, URL) and the purpose of filters, which goes beyond the schema's parameter descriptions. However, it does not add detail per parameter beyond restating options.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Search YouTube videos by query', which is a specific verb and resource. It distinguishes itself from sibling tools like get_video_transcript or get_video_comments, which serve different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not explicitly contrast with sibling tools. While the sibling list implies this tool is for searching, no guidance is given on when to use search_youtube versus other tools like get_video_info. The usage context is implied but not stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 5 tool updatesv1.0.0
    • First observedget_transcript_languages
    • First observedget_video_comments
    • First observedget_video_info
    • First observedget_video_transcript
    • First observedsearch_youtube

TDQS

A4.2/5.0

Scored across 5 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: transcript languages, comments, video metadata, transcript, and search. No overlap or ambiguity.

Naming Consistency5/5

All tools follow a consistent verb_noun pattern ('get_*' for data retrieval, 'search_youtube' for search). The pattern is uniform and predictable.

Tool Count5/5

5 tools is well-scoped for a YouTube MCP server. Each tool covers a core operation without unnecessary bloat or deficiency.

Completeness5/5

The tool set covers the essential read operations for YouTube video data: search, metadata, comments, and transcripts with language discovery. No obvious gaps for the stated purpose.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    An MCP server that provides AI assistants with powerful tools to interact with YouTube, including video searching, transcript extraction, comment retrieval, and more.
    8
    19
    Apache 2.0
  • A
    license
    Not graded
    quality
    Not graded
    maintenance
    An MCP server that provides YouTube data access without API keys or quotas. It enables agents to search videos, retrieve transcripts and metadata, and perform full-text search across cached content for AI context retrieval.
    3
    -