YouTube MCP Server

by Nocodeboy
Verified

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Includes support link integration, allowing users to support the developer through the Buy Me A Coffee platform.

  • Provides tools to interact with the YouTube API, including searching for videos, retrieving video details, searching for channels, and obtaining channel information.

YouTube MCP 服务器

这是一个 MCP(模型上下文协议)服务器,允许 Claude 和其他 AI 助手与 YouTube API 交互。该服务器提供搜索视频、获取特定视频详情、搜索频道以及获取频道详细信息的工具。

什么是 MCP?

模型上下文协议 (MCP) 是由 Claude 的创建者 Anthropic 开发的一项开放标准,用于将 AI 助手与外部数据源和工具连接起来。它允许像 Claude 这样的模型以标准化的方式访问最新信息并在外部系统中执行操作。

MCP 作为 AI 的“通用桥梁”,为模型访问各种内容存储库、业务服务或应用程序提供了标准化的方式。

要求

  • Node.js v16 或更高版本
  • YouTube API 密钥(从 Google 开发者控制台获取)

安装

  1. 克隆此存储库:
git clone https://github.com/Nocodeboy/youtube-mcp-server.git cd youtube-mcp-server
  1. 安装依赖项:
npm install
  1. 在项目根目录中创建一个.env文件并添加您的 YouTube API 密钥:
YOUTUBE_API_KEY=your_api_key_here

执行

要启动服务器,请运行:

npm start

与 Claude Desktop 集成

要将此 MCP 服务器与 Claude Desktop 一起使用,请将以下配置添加到您的claude_desktop_config.json文件中(通常位于 Windows 上的%APPDATA%\Claude\或 macOS 上的~/Library/Application Support/Claude/ ):

{ "mcpServers": { "youtube": { "command": "node", "args": ["path/to/youtube-mcp-server/index.js"], "env": { "YOUTUBE_API_KEY": "your_api_key_here" } } } }

"path/to/youtube-mcp-server/index.js"替换为index.js文件的绝对路径,将"your_api_key_here"替换为您的 YouTube API 密钥。

可用工具

1. 搜索视频

根据查询在 YouTube 上搜索视频。

search_videos

参数:

  • query (字符串,必需):搜索词
  • maxResults (数字,可选):最大结果数(1 到 50 之间)
  • pageToken (字符串,可选):获取下一页结果的令牌

2. 获取视频详细信息

获取有关特定视频的详细信息。

get_video_details

参数:

  • videoId (字符串,必需):YouTube 视频 ID

3. 获取频道详情

获取有关特定频道的详细信息。

get_channel_details

参数:

  • channelId (字符串,必需):YouTube 频道 ID

4. 搜索渠道

根据查询在 YouTube 上搜索频道。

search_channels

参数:

  • query (字符串,必需):搜索词
  • maxResults (数字,可选):最大结果数(1 到 50 之间)
  • pageToken (字符串,可选):获取下一页结果的令牌

可用资源

  • youtube://popular/videos :YouTube 上当前热门视频列表

使用示例

使用 Claude Desktop,您可以提出以下问题:

  • “搜索 Python 编程视频”
  • “显示 ID 为 dQw4w9WgXcQ 的视频详情”
  • “搜索烹饪相关频道”
  • “向我提供有关 GoogleDevelopers 频道的信息”
  • “现在最热门的视频是什么?”

获取 YouTube API 密钥

要获取 YouTube API 密钥:

  1. 前往Google 开发者控制台
  2. 创建新项目(或选择现有项目)
  3. 在侧栏中,选择“API 库”
  4. 搜索“YouTube Data API v3”并启用它
  5. 在侧栏中,选择“凭据”
  6. 点击“创建凭证”并选择“API 密钥”
  7. 复制生成的密钥并在.env文件或 Claude Desktop 配置中使用它

故障排除

如果遇到错误,请检查:

  1. 你已经使用npm install安装了所有依赖项
  2. 您的 YouTube API 密钥有效
  3. 您的 Google 项目中已启用 YouTube 数据 API v3
  4. 您正在使用 Node.js 版本 16 或更高版本
  5. 如果您使用 Claude Desktop,请检查%APPDATA%\Claude\logs\ (Windows) 或~/Library/Logs/Claude/ (macOS) 中的日志

贡献

欢迎贡献。您可以通过多种方式进行合作:

  1. 报告错误或问题
  2. 建议新功能
  3. 发送包含改进或修复的拉取请求
  4. 改进文档

连接与支持

  • 在 X (Twitter) 上关注我: @Nocodeboy
  • 如果您发现该项目有用并希望表示支持:

执照

本项目遵循 MIT 许可证。更多详情请参阅许可证文件。

-
security - not tested
A
license - permissive license
-
quality - not tested

MCP 服务器允许 Claude 和其他 AI 助手与 YouTube API 进行交互,提供搜索视频/频道和检索有关它们的详细信息的工具。

  1. What is MCP?
    1. Requirements
      1. Installation
        1. Execution
          1. Integration with Claude Desktop
            1. Available Tools
              1. 1. Search Videos
              2. 2. Get Video Details
              3. 3. Get Channel Details
              4. 4. Search Channels
            2. Available Resources
              1. Usage Examples
                1. Getting a YouTube API Key
                  1. Troubleshooting
                    1. Contributions
                      1. Connect & Support
                        1. License
                          ID: gruax1wz8k