mcpField
Y
YouTube Data MCP Server

YouTube Data MCP Server

Local
github.com/diasm3Media & Design2Updated 41w ago

About YouTube Data MCP Server

YouTube Data MCP Server exposes YouTube transcript, video metadata, comment, and search operations to MCP clients. It supports stdio and StreamableHTTP transports.

Key features

  1. 01Extract transcripts with optional timestamps
  2. 02Retrieve video metadata
  3. 03Fetch comments and replies
  4. 04Search videos, channels, and playlists

Use cases

  1. 01Read a video's transcript in a chosen language
  2. 02Review and paginate video comments
  3. 03Find YouTube videos, channels, or playlists

MCP support

An MCP server offering tools for transcript extraction, metadata lookup, comments, replies, and YouTube search. It supports Stdio and StreamableHTTP transports.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"serpapi-youtube": {
"command": "npx",
"args": [
"-y",
"youtube-data-mcp"
],
"env": {
"SERPAPI_KEY": "<SERPAPI_KEY>"
}
}
}
}
Run commandnpx -y youtube-data-mcp
Environment variables to set
SERPAPI_KEYSecret

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npmyoutube-data-mcp

Tools

5

Saved tool list · updated 3w ago

ParameterTypeRequiredDescription
urlstringYesYouTube video URL or 11-character video ID
langstringNoLanguage code (en, ko, ja, es, etc.)
includeTimestampsbooleanNoInclude start time and duration for each segment

Details

From the project README

YouTube Data MCP Server

A Model Context Protocol (MCP) server for extracting YouTube video transcripts, comments, and search results. Supports both Stdio and StreamableHTTP transports.

Features

  • getTranscript - Extract subtitles/transcripts with optional timestamps
  • getVideoInfo - Get video metadata (title, views, comments count)
  • getComments - Fetch comments with pagination and sorting
  • getCommentReplies - Get replies to specific comments
  • searchYoutube - Search videos, channels, and playlists

What's New in v2.0

  • Dual Transport: Stdio (default) + StreamableHTTP for web integration
  • Reliable Transcripts: Replaced youtube-transcript with youtube-caption-extractor (bot detection bypass, serverless support)
  • Timestamp Support: Optional start time and duration for each transcript segment
  • Modular Architecture: Clean separation of concerns (config, types, services, tools)
  • MCP SDK v1.25.2: Latest SDK with improved stability

Requirements

  • Node.js 18+
  • SerpAPI key (for search, comments, video info)

Installation

git clone https://github.com/diasm3/serpapi-youtube-mcp-server.git
cd serpapi-youtube-mcp-server
npm install

Configuration

Create a .env file:

SERPAPI_KEY=your_serpapi_key_here
PORT=3000  # optional, for HTTP mode

Get your SerpAPI key at serpapi.com.

Running the Server

# Build
npm run build

# Stdio mode (default) - for Claude Desktop, Cursor, etc.
npm start

# HTTP mode - for web applications
npm start -- --http
# or
MCP_TRANSPORT=http npm start
HTTP Endpoints

When running in HTTP mode:

  • GET /health - Health check
  • POST /mcp - MCP request handler

MCP Client Configuration

Claude Desktop / Cursor
{
  "mcpServers": {
    "youtube-data": {
      "command": "node",
      "args": ["/path/to/serpapi-youtube-mcp-server/build/index.js"],
      "env": {
        "SERPAPI_KEY": "your_serpapi_key_here"
      }
    }
  }
}
Using npx
{
  "mcpServers": {
    "youtube-data": {
      "command": "npx",
      "args": ["-y", "youtube-data-mcp"],
      "env": {
        "SERPAPI_KEY": "your_serpapi_key_here"
      }
    }
  }
}

API Tools

getTranscript

Extract transcript/subtitles from a YouTube video.

ParameterTypeRequiredDescription
urlstringYesYouTube URL or video ID
langstringNoLanguage code (default: 'en')
includeTimestampsbooleanNoInclude start/duration per segment
Get the Korean transcript for https://youtube.com/watch?v=xxxxx with timestamps
getVideoInfo

Get video metadata using SerpAPI.

ParameterTypeRequiredDescription
urlstringYesYouTube URL or video ID

Returns: title, views, publish date, channel, comment count, pagination tokens

getComments

Fetch video comments with pagination.

ParameterTypeRequiredDescription
urlstringConditionalRequired for first page
limitnumberNoMax comments (default: 100)
sortstringNo'relevance' or 'time'
pageTokenstringNoFor pagination
getCommentReplies

Get replies to a specific comment.

ParameterTypeRequiredDescription
pageTokenstringYesrepliesToken from comment
searchYoutube

Search YouTube for videos, channels, playlists.

ParameterTypeRequiredDescription
querystringYesSearch query
limitnumberNoMax results (default: 10)
glstringNoCountry code (us, kr, jp)
hlstringNoLanguage code (en, ko, ja)
spstringNoFilter parameter
pageTokenstringNoFor pagination

Project Structure

src/
├── index.ts          # Server entry (Stdio + HTTP)
├── config/           # Environment configuration
├── types/            # Zod schemas + TypeScript types
├── services/
│   ├── serpapi.ts    # SerpAPI integration
│   └── youtube.ts    # Transcript extraction
├── tools/            # MCP tool definitions
└── utils/            # Helper functions

Troubleshooting

Transcript not available
  • Some videos don't have captions enabled
  • Try different language codes (en, ko, ja, etc.)
  • Auto-generated captions may not be available for all videos
SerpAPI errors
  • Verify your API key is valid
  • Check your SerpAPI quota/limits
  • Ensure the video is publicly accessible
HTTP mode not starting
  • Check if PORT is already in use
  • Verify environment variables are set

License

MIT

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.