YouTube Data MCP Server

YouTube Data MCP Server

diasm3

Research & Data
Visit Server

README

YouTube Data MCP Server

A Model Context Protocol (MCP) server for extracting YouTube video transcripts and comments. This server provides tools to get transcripts and comments from YouTube videos for analysis and summarization.

Features

  • getTranscript: Extract subtitles/transcripts from YouTube videos
  • getVideoInfo: Get basic information about a YouTube video
  • getReplies: Fetch comments for YouTube videos (using SerpAPI)
  • getCommentReplies: Get replies to specific YouTube comments

Requirements

  • Node.js 16+
  • TypeScript
  • SerpAPI API key (for comments functionality)

Installation(for Developer)

# Clone the repository
git clone https://github.com/diasm3/serpapi-youtube-mcp-server.git
cd youtube-data-mcp

# Install dependencies
npm install

Configuration

Create a .env file in the root directory with your SerpAPI key:

SERPAPI_KEY=your_serpapi_key_here

You can get a SerpAPI key by signing up at SerpAPI.

Build and Run

# Build the project
npm run build

# Run the server
npm start

The server will start running and listening for commands via stdin/stdout.

Using with Claude

To use this MCP server with Claude:

  1. Add the server to your Claude configuration file:
{
  "mcpServers": {
    "youtube-data": {
      "command": "npx",
      "args": ["-y","youtube-data-mcp"],
      "env": {
        "SERPAPI_KEY": "your_serpapi_key_here"
      }
    }
  }
}
  1. Restart Claude to apply the configuration.

  2. Now you can ask Claude to:

    • "Get the transcript for this YouTube video: [URL]"
    • "Show me the comments for this YouTube video: [URL]"
    • "Get replies to specific comments"

API Tools

searchYoutube

Search for videos, channels, and playlists on YouTube.

Parameters:

  • query: Search query for YouTube (required)
  • limit: Maximum number of results to return (optional, default: 10)
  • gl: Country code for search results (optional, e.g., 'us', 'kr', 'jp')
  • hl: Language code for search results (optional, e.g., 'en', 'ko', 'ja')
  • sp: Special parameter for filtering or pagination (optional)
  • pageToken: Token for pagination from previous response (optional)

Example (via Claude):

Search for "JavaScript tutorial" on YouTube and show me the top 5 results

getVideoInfo

Retrieve basic information about a YouTube video.

Parameters:

  • url: YouTube video URL or video ID (required)

Returns:

  • videoId: The video's ID
  • title: The video's title
  • viewCount: Number of views
  • publishDate: Date when the video was published
  • channelName: Name of the channel that published the video
  • commentCount: Number of comments on the video
  • commentsNextPageToken: Token for fetching comments
  • commentsSortingTokens: Tokens for different comment sorting options

Example (via Claude):

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

getTranscript

Extracts transcripts/subtitles from YouTube videos.

Parameters:

  • url: YouTube video URL or video ID (required)
  • lang: Language code for transcript (optional, default: 'en')

Example (via Claude):

Please get the transcript for this YouTube video: https://www.youtube.com/watch?v=dQw4w9WgXcQ

getReplies

Retrieves comments from a YouTube video using SerpAPI.

Parameters:

  • url: YouTube video URL or video ID (required for initial page, optional for pagination)
  • limit: Maximum number of comments to retrieve (optional, default: 100)
  • sort: Sort order for comments ('relevance' or 'time', optional, default: 'relevance')
  • pageToken: Token for pagination from previous response (optional)

Example (via Claude):

Show me comments for this YouTube video: https://www.youtube.com/watch?v=dQw4w9WgXcQ

getCommentReplies

Gets replies for a specific YouTube comment.

Parameters:

  • pageToken: Reply token from a comment to get its replies (required)

This function is typically used programmatically after getting the repliesToken from a comment.

Understanding SerpAPI Integration

This MCP server uses SerpAPI's YouTube Search API and YouTube Video API to fetch search results, comments, and other data. SerpAPI provides a way to scrape YouTube data without directly using YouTube's official API.

Key points about SerpAPI usage:

  • The server uses the youtube_video engine with the v parameter (YouTube video ID)
  • Comments are paginated using tokens returned in the API response
  • Comment replies are fetched separately using their specific tokens
  • API calls are limited by your SerpAPI subscription plan

Troubleshooting

  • If you encounter a 400 Bad Request error, verify your SerpAPI key is valid and properly set in the .env file
  • Check the server logs for detailed error messages and debugging information
  • For comment-related issues, ensure SerpAPI still supports the YouTube Video API format used

License

MIT

Recommended Servers

Crypto Price & Market Analysis MCP Server

Crypto Price & Market Analysis MCP Server

A Model Context Protocol (MCP) server that provides comprehensive cryptocurrency analysis using the CoinCap API. This server offers real-time price data, market analysis, and historical trends through an easy-to-use interface.

Featured
TypeScript
MCP PubMed Search

MCP PubMed Search

Server to search PubMed (PubMed is a free, online database that allows users to search for biomedical and life sciences literature). I have created on a day MCP came out but was on vacation, I saw someone post similar server in your DB, but figured to post mine.

Featured
Python
dbt Semantic Layer MCP Server

dbt Semantic Layer MCP Server

A server that enables querying the dbt Semantic Layer through natural language conversations with Claude Desktop and other AI assistants, allowing users to discover metrics, create queries, analyze data, and visualize results.

Featured
TypeScript
mixpanel

mixpanel

Connect to your Mixpanel data. Query events, retention, and funnel data from Mixpanel analytics.

Featured
TypeScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python
Nefino MCP Server

Nefino MCP Server

Provides large language models with access to news and information about renewable energy projects in Germany, allowing filtering by location, topic (solar, wind, hydrogen), and date range.

Official
Python
Vectorize

Vectorize

Vectorize MCP server for advanced retrieval, Private Deep Research, Anything-to-Markdown file extraction and text chunking.

Official
JavaScript
Mathematica Documentation MCP server

Mathematica Documentation MCP server

A server that provides access to Mathematica documentation through FastMCP, enabling users to retrieve function documentation and list package symbols from Wolfram Mathematica.

Local
Python
kb-mcp-server

kb-mcp-server

An MCP server aimed to be portable, local, easy and convenient to support semantic/graph based retrieval of txtai "all in one" embeddings database. Any txtai embeddings db in tar.gz form can be loaded

Local
Python
Research MCP Server

Research MCP Server

The server functions as an MCP server to interact with Notion for retrieving and creating survey data, integrating with the Claude Desktop Client for conducting and reviewing surveys.

Local
Python