本项目是一个基于 Model Context Protocol (MCP) 的服务器,旨在为用户提供对自定义 YouTube 播放列表的便捷访问。仅需简单操作,就能获取指定时间段内添加到播放列表中的视频 URL,为用户节省时间和精力。
若想通过 Smithery 自动安装 YouTube 观看稍后再看插件,可执行以下命令:
npx -y @smithery/cli install youtube-watchlater --client claude
git clone https://github.com/rados10/youtube-watchlater-mcp.git
cd youtube-watchlater
npm install
npm run build
运行提供的脚本,并使用您的 Google Cloud 凭据:
OAUTH_CLIENT_ID="your_client_id" OAUTH_CLIENT_SECRET="your_client_secret" node get-refresh-token.js
该脚本将执行以下操作:
将服务器配置添加到您的 MCP 设置文件中:
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
~/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
,接受一个可选的天数参数。以下是一些示例:
# 获取最近一天添加的所有视频
get_watch_later_urls --days=1
# 获取过去七天添加的所有视频
get_watch_later_urls --days=7
# 获取过去30天添加的所有视频
get_watch_later_urls --days=30
{
"videos": [
{
"url": "https://www.youtube.com/watch?v=video123",
"title": "视频标题 1",
"duration": "3:45"
},
{
"url": "https://www.youtube.com/watch?v=video456",
"title": "视频标题 2",
"duration": "5:20"
}
]
}
此工具使用以下技术栈构建:
若需对服务器进行修改,可按以下步骤操作:
src/index.ts
文件。npm run build
若要将更改提交到仓库,请执行以下步骤:
git add .
git commit -m "添加新功能"
git push origin main
欢迎为这个项目做出贡献!请按照以下步骤进行:
本项目受 MIT License 保护。