Skip to main content
Glama
by rados10

YouTube 稍后观看 MCP 服务器

铁匠徽章

一个模型上下文协议 (MCP) 服务器,提供对自定义 YouTube 播放列表的访问。该服务器公开了一个简单的工具,用于检索在指定时间范围内添加到指定播放列表的视频的 URL。

特征

  • 获取在可配置的天数内添加到自定义播放列表的视频的 URL

  • 仅返回视频 URL 的简单界面

  • OAuth2 身份验证,用于安全访问您的 YouTube 数据

Related MCP server: MCP YouTube Server

安装

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 YouTube Watch Later:

npx -y @smithery/cli install youtube-watchlater --client claude

手动安装

  1. 克隆此存储库:

git clone https://github.com/rados10/youtube-watchlater-mcp.git cd youtube-watchlater
  1. 安装依赖项:

npm install
  1. 构建项目:

npm run build

设置

1.创建Google Cloud项目

  1. 前往Google Cloud Console

  2. 创建新项目或选择现有项目

  3. 启用 YouTube 数据 API v3

  4. 转到凭证 → 创建凭证 → OAuth 2.0 客户端 ID

  5. 将应用程序类型设置为“Web 应用程序”

  6. 将“ http://localhost:3000/oauth2callback ”添加到授权重定向 URI

  7. 复制您的客户端 ID 和客户端密钥

2. 获取刷新令牌

使用您的 Google Cloud 凭据运行提供的脚本:

OAUTH_CLIENT_ID="your_client_id" OAUTH_CLIENT_SECRET="your_client_secret" node get-refresh-token.js

该脚本将:

  • 打开默认浏览器,进入 Google 授权页面

  • 要求您登录并授权该应用程序

  • 在终端中显示您的刷新令牌

3. 配置 MCP 设置

将服务器配置添加到您的 MCP 设置文件:

对于 VSCode(Claude Dev Extension): ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

对于 Claude 桌面应用程序: ~/Library/Application Support/Claude/claude_desktop_config.json

{ "mcpServers": { "youtube-watchlater": { "command": "node", "args": ["/path/to/youtube-watchlater/build/index.js"], "env": { "OAUTH_CLIENT_ID": "your_client_id", "OAUTH_CLIENT_SECRET": "your_client_secret", "OAUTH_REFRESH_TOKEN": "your_refresh_token" } } } }

用法

服务器提供了一个工具get_watch_later_urls ,它接受可选的daysBack参数:

// Get videos added in the last day (default) { "daysBack": 1 } // Get videos added in the last week { "daysBack": 7 }

服务器将返回匹配视频的 YouTube URL 数组:

[ "https://youtube.com/watch?v=video1", "https://youtube.com/watch?v=video2", ... ]

令牌刷新

除非您明确撤销访问权限,否则刷新令牌不会过期。只有在以下情况下才需要获取新的刷新令牌:

  • 在您的 Google 帐户设置中撤销该应用程序的访问权限

  • 重置您的 Google 帐户的安全设置

  • 令牌因任何其他原因失效

要获取新的刷新令牌,只需按照“设置”部分中的说明再次运行 get-refresh-token.js 脚本。

发展

该服务器由以下组件构建:

  • TypeScript

  • @modelcontextprotocol/sdk

  • googleapis(YouTube 数据 API v3)

修改服务器:

  1. src/index.ts中进行更改

  2. 运行npm run build进行编译

  3. 重启 MCP 服务器以应用更改

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rados10/youtube-watchlater-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server