YouTube浏览器控制工具

通过MCP协议控制Chrome浏览器实现YouTube自动化操作的工具,适用于自动化测试、批量视频管理等场景。

  • by bangdc90
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 bangdc90/youtube_mcp

使用说明

YouTube Browser Control - MCP Server

Điều khiển YouTube thông qua trình duyệt Chrome bằng MCP protocol.

Cài đặt

1. Cài Python

  • Tải Python 3.8+ từ: https://www.python.org/downloads/
  • Khi cài, tick chọn "Add Python to PATH"

2. Cài thư viện

pip install -r requirements.txt

3. Cấu hình Endpoint

  • Truy cập https://xiaozhi.me để lấy WebSocket token
  • Mở file client.py, tìm dòng DEFAULT_ENDPOINT (dòng 444)
  • Thay thế URL bằng endpoint của bạn:
DEFAULT_ENDPOINT = "wss://api.xiaozhi.me/mcp/?token=YOUR_TOKEN_HERE"

4. Chạy chương trình

python client.py

Tools có sẵn

  • open_youtube - Mở YouTube
  • search_video - Tìm kiếm video
  • play_first_video - Phát video đầu tiên
  • search_and_play - Tìm và phát luôn
  • skip_ad - Bỏ qua quảng cáo
  • toggle_fullscreen - Bật/tắt fullscreen
  • get_current_url - Lấy URL hiện tại
  • close_browser - Đóng trình duyệt

Chế độ chạy

# WebSocket (mặc định)
python client.py

# Debug mode
python client.py --debug

# Stdio mode
python client.py stdio

Lưu ý: Chrome sẽ tự động mở khi chạy tool lần đầu.