youtube-mcp

youtube-mcp

MCP server for YouTube that provides tools to fetch video metadata and transcripts, enabling natural language queries about YouTube videos.

Category
访问服务器

README

youtube-mcp

MCP server for YouTube. Exposes four tools to any MCP client (Claude Desktop, etc.):

Tool What it does
get_video Fetch video metadata (title, views, duration, etc.)
get_transcript Fetch timestamped caption segments (YouTube captions)
search_videos Search YouTube by keyword, ordered by date or relevance
transcribe_video Download audio and transcribe locally using Whisper — works when captions are unavailable, no extra API keys

Zero system dependencies. ffmpeg is bundled via static-ffmpeg and downloaded automatically on first use. No Homebrew, no manual installs.

Setup

1. Get a YouTube Data API v3 key

  1. Go to console.cloud.google.com
  2. Create a project → APIs & Services → Enable APIs → search "YouTube Data API v3" → Enable
  3. APIs & Services → Credentials → Create Credentials → API Key
  4. Copy the key

2. Install

git clone https://github.com/sparsh-gaurav/youtube-mcp.git
cd youtube-mcp
pip install -e ".[dev]"

3. Configure

cp .env.example .env
# edit .env and paste your YOUTUBE_API_KEY

4. Run tests

pytest -v

5. Wire up Claude Desktop

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

{
  "mcpServers": {
    "youtube": {
      "command": "/path/to/youtube-mcp/.venv/bin/python3",
      "args": ["-m", "youtube_mcp.server"],
      "cwd": "/path/to/youtube-mcp",
      "env": {
        "YOUTUBE_API_KEY": "your_key_here"
      }
    }
  }
}

Restart Claude Desktop. You can then ask things like:

"Search the latest YouTube videos about Ram Mandir fund scam and summarise them"
"Get the transcript for video dQw4w9WgXcQ"
"Transcribe this video even though it has no captions: ..."
"What is the view count and duration of this YouTube video?"

First-run notes

  • transcribe_video first call: downloads the Whisper base model (~145 MB) to ~/.cache/whisper and the bundled ffmpeg binary (~60 MB) to the Python package directory. Both are cached — subsequent calls are fast.
  • Temp files: audio downloaded during transcription is stored in a system temp directory and deleted automatically after each call, whether it succeeds or fails.

Tools

get_video(video_id: str) -> VideoMetadata

Field Type Description
id str YouTube video ID
title str Video title
description str Full description
channel_title str Channel name
view_count int Total views
like_count int | None Likes (None if hidden by creator)
duration str ISO 8601 duration (e.g. PT3M33S)
published_at str ISO 8601 publish date
thumbnail_url str Default thumbnail URL

get_transcript(video_id: str, language: str | None = None) -> list[TranscriptSegment]

Returns YouTube's caption segments when available.

Field Type Description
start float Segment start time (seconds)
duration float Segment duration (seconds)
text str Caption text

language: BCP-47 code (e.g. "en", "hi"). Defaults to first available language.


search_videos(query: str, max_results: int = 5, language: str | None = None, order: str = "date") -> list[VideoSearchResult]

Searches YouTube via the Data API v3. Returns newest-first by default.

Field Type Description
video_id str YouTube video ID
title str Video title
description str Snippet description
channel_title str Channel name
published_at str ISO 8601 publish date
thumbnail_url str Default thumbnail URL

max_results: 1–50, default 5.
order: date (default), relevance, viewCount, rating.
language: BCP-47 relevance hint (e.g. "en", "hi"). Optional.


transcribe_video(video_id: str, language: str | None = None) -> WhisperTranscript

Downloads audio and transcribes locally using OpenAI Whisper (base model). No API key required.

Field Type Description
video_id str YouTube video ID
text str Full transcript text
segments list[WhisperSegment] Timestamped segments

Each WhisperSegment:

Field Type Description
start float Segment start time (seconds)
end float Segment end time (seconds)
text str Transcribed text

language: BCP-47 hint for Whisper (e.g. "en", "hi"). Auto-detected if omitted.


Project structure

src/youtube_mcp/
  server.py       # MCP entry point, tool registry
  api.py          # YouTube Data API v3 wrapper (get_video, search_videos)
  transcript.py   # youtube-transcript-api wrapper (get_transcript)
  whisper.py      # yt-dlp + local Whisper transcriber (transcribe_video)
  models.py       # Pydantic models
tests/
  test_api.py
  test_transcript.py
  test_whisper.py

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选