YouTube 字幕提取服务

一个无需 API 密钥即可提取 YouTube 视频字幕的 MCP 服务器,可返回视频标题、频道名称及带时间戳的完整转录文本,适用于视频内容检索与分析场景。

  • by jlopez
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 jlopez/youtube-transcript-mcp

使用说明

youtube-transcript-mcp

An MCP server that extracts YouTube video transcripts. Uses the InnerTube API (no API key required) with metadata from YouTube's free oEmbed endpoint.

Tools

get_transcript

Fetch the transcript of a YouTube video.

Parameter Type Required Description
url string yes YouTube video URL
lang string no Language code (default: "en")

Returns the video title, channel name, and full transcript text with [M:SS] timestamp markers at 1-minute boundaries.

Supports all YouTube URL formats:

  • https://www.youtube.com/watch?v=...
  • https://youtu.be/...
  • https://www.youtube.com/shorts/...
  • https://www.youtube.com/embed/...
  • https://www.youtube.com/live/...

Installation

Via npx (recommended)

claude mcp add youtube-transcript -- npx @jesusla/youtube-transcript-mcp

From source

git clone https://github.com/jlopez/youtube-transcript-mcp.git
cd youtube-transcript-mcp
pnpm install
pnpm mcp:register

The mcp:register script builds the project and registers it with Claude Code (--scope user by default). Use -n for a dry run or --scope project to override.

Development

pnpm install        # install dependencies
pnpm dev            # run with watch mode (tsx)
pnpm build          # build with tsup
pnpm test           # run tests
pnpm test:watch     # run tests in watch mode
pnpm typecheck      # type check
pnpm lint           # lint
pnpm lint:fix       # lint with auto-fix

Publishing

Releases are automated via release-please. Pushing conventional commits to main will create/update a release PR. Merging that PR triggers a build and publish to npm.

Setup required: Add an NPM_TOKEN secret to the repository (Settings → Secrets → Actions) with a valid npm access token that has publish permissions for this package.

License

MIT