youtube-music-cli-mcp

youtube-music-cli-mcp

Provides a local stdio MCP server for controlling YouTube Music through the CLI, enabling playback, search, queue management, and library access via MCP-compatible clients.

Category
访问服务器

README

[!IMPORTANT] This is an unofficial fork of involvex/youtube-music-cli that adds a local stdio MCP server. It is not affiliated with upstream, YouTube, or Google. The custom fork is built from source and is not the npm package advertised by upstream.

See mcp/README.md for MCP installation, tools, permissions, and client configuration.

<div align="center">

🎵 youtube-music-cli

A powerful Terminal User Interface (TUI) music player for YouTube Music

<p align="center"> <img src="assets/player-preview.gif" alt="youtube-music-cli terminal preview" width="800"> </p>

License: MIT

Features • Installation • Usage • Plugins • Documentation

</div>


Features

  • 🎨 Beautiful TUI - Rich terminal interface built with React and Ink
  • 🔍 Search - Find songs, albums, artists, and playlists
  • 📋 Queue Management - Build and manage your playback queue
  • ❤️ Favorites - Mark tracks as favorites with f and view them with Shift+F
  • 🔀 Shuffle & Repeat - Multiple playback modes
  • 🎚️ Volume Control - Fine-grained volume adjustment
  • 💡 Smart Suggestions - Discover related tracks
  • 🎨 Themes - Dark, Light, Midnight, Matrix themes
  • 🔌 Plugin System - Extend functionality with plugins
  • ⌨️ Keyboard-Driven - Efficient vim-style navigation
  • 🖥️ Immersive Mode - Fullscreen Windows TUI with audio visualizer and disco effects
  • 💾 Downloads - Save tracks/playlists/artists with Shift+D
  • 🏷️ Metadata Tagging - Auto-tag title/artist/album with optional cover art
  • ⚡️ Shell Completions - ymc completions <bash|zsh|powershell|fish> emits scripts you can source or save so the CLI (also available as ymc) tab-completes subcommands and flags

Support the Upstream Project

If you find youtube-music-cli useful, consider supporting the upstream project's development:

Your support helps keep this project alive and improving!

Roadmap

Visit SUGGESTIONS.md for the full backlog and use docs/roadmap.md to understand the current implementation focus (crossfade + gapless playback) and the next steps planned for equalizer/enhancements. The roadmap doc also explains how to pick up work so reviewers and contributors remain aligned.

Prerequisites

Required:

  • mpv - Media player for audio playback
  • yt-dlp - YouTube audio extraction

Installing Prerequisites

<details> <summary><b>Windows</b></summary>

# With Scoop
scoop install mpv yt-dlp

# With Chocolatey
choco install mpv yt-dlp

</details>

<details> <summary><b>macOS</b></summary>

brew install mpv yt-dlp

</details>

<details> <summary><b>Linux</b></summary>

# Ubuntu/Debian
sudo apt install mpv
pip install yt-dlp

# Arch Linux
sudo pacman -S mpv yt-dlp

# Fedora
sudo dnf install mpv yt-dlp

</details>

Installation

Node.js (Recommended)

Requires Node.js 18+ installed.

npm install -g @involvex/youtube-music-cli

Bun

bun install -g @involvex/youtube-music-cli

Homebrew

brew tap involvex/youtube-music-cli https://github.com/involvex/youtube-music-cli.git
brew install youtube-music-cli

GitHub Releases

https://github.com/involvex/youtube-music-cli/releases

Install Script (bash)

curl -fssl https://raw.githubusercontent.com/involvex/youtube-music-cli/main/scripts/install.sh | bash

Install Script (PowerShell)

iwr https://raw.githubusercontent.com/involvex/youtube-music-cli/main/scripts/install.ps1 | iex

From Source

git clone https://github.com/involvex/youtube-music-cli.git
cd youtube-music-cli

# With bun (recommended for development)
bun install
bun run build
bun link

# With npm
npm install
npm run build
npm link

Usage

Interactive Mode

Launch the TUI:

youtube-music-cli

CLI Commands

# Play a specific track
youtube-music-cli play <video-id|youtube-url>

# Search for music
youtube-music-cli search "artist or song name"

# Play a playlist
youtube-music-cli playlist <playlist-id>

# Get suggestions based on current track
youtube-music-cli suggestions

# Playback control
youtube-music-cli pause
youtube-music-cli resume
youtube-music-cli skip
youtube-music-cli back

Immersive Mode (Windows)

Launch a fullscreen visual player with real playback, queue controls, and audio visualization. Requires mpv and yt-dlp (same as normal playback).

# Standard immersive mode
youtube-music-cli --win32

# Search and play immediately
youtube-music-cli --win32 --search "artist song"

# With disco mode enabled
DISCO_MODE=true youtube-music-cli --win32

# Standalone Windows binary (Bun compile)
bun run build:win32
dist/ymc-win32.exe

Hotkeys in Immersive Mode:

Key Action
/ or S Open search overlay
Tab Cycle search type (query view)
Ctrl+A Edit artist filter
Ctrl+L Edit album filter
= / + Volume up (+5%, player view)
- Volume down (-5%, player view)
+ Increase search result limit (query view)
- Decrease search result limit (query view)
Shift+D Download selected search result
Space Play / Pause
F Toggle favorite (current track or search)
L Library menu (playlists, favorites)
P Open saved playlist picker
E Play all favorites
Shift+S Toggle shuffle
R Cycle repeat (off → all → one)
, Open settings overlay (Ctrl+, on WT also)
M Create mix from search result (results view)
D Toggle disco mode
↑ / ↓ Navigate lists (overlays)
← / → Previous / Next track
Enter Select / play (overlays)
Esc Back / close overlay
Q Quit immersive mode
Ctrl+C Force quit

The footer shows shuffle/repeat/disco status on one line and prioritized shortcuts on the next. Random favorite is available from the library menu (L). Right-click the system tray icon for Settings or Exit (uses assets/icon.ico).

Global media keys (Alt+Media keys) also work when the terminal is unfocused on Windows with Bun runtime.

Troubleshooting immersive playback

  • Track info shows but time does not move / no audio: Press Space to resume. Immersive auto-starts the last session; if mpv was paused externally (screen share, focus loss), the UI now syncs to PAUSED — press Space again.
  • Screen sharing (Discord, Teams, OBS): Remote viewers often do not hear your PC audio unless you enable “share computer sound” / system audio capture. That is a Windows capture limitation, not the player routing audio only to you.
  • Requires Bun for Win32 native features: Global hotkeys and native console title use @bun-win32/* via Bun. Run with bun run dev:win32 or the compiled ymc-win32.exe binary.

Shell completions

Generate shell completion helpers through the lightweight ymc alias that ships with the CLI. Run ymc completions <bash|zsh|powershell|fish> to print the completion script for your shell, then source it or persist it in your profile:

# Bash
source <(ymc completions bash)
ymc completions bash >> ~/.bash_completion

# Zsh
source <(ymc completions zsh)

# PowerShell
ymc completions powershell | Out-File -Encoding utf8 $PROFILE
Invoke-Expression (ymc completions powershell)

# Fish
ymc completions fish > ~/.config/fish/completions/ymc.fish

If you installed the CLI globally with an alias or script name, make sure ymc points at the same binary before generating completions so that the script matches your install path.

Options

Flag Short Description
--theme -t Theme: dark, light, midnight, matrix
--volume -v Initial volume (0-100)
--shuffle -s Enable shuffle mode
--repeat -r Repeat mode: off, all, one
--headless Run without TUI
--win32 Immersive fullscreen mode (Windows only)
--help -h Show help

Examples

# Launch with matrix theme at 80% volume
youtube-music-cli --theme=matrix --volume=80

# Search and play in headless mode
youtube-music-cli search "lofi beats" --headless

# Play with shuffle enabled
youtube-music-cli play dQw4w9WgXcQ --shuffle

Keyboard Shortcuts

Global

Key Action
? Show help
/ Search
p Plugins manager
Shift+F Favorites view
g Suggestions
, Settings
Esc Go back
q Quit

Playback

Key Action
Space Play / Pause
n / → Next track
b / ← Previous track
Shift+→ Seek forward 10s
Shift+← Seek backward 10s
= Volume up
- Volume down
f Toggle favorite
s Toggle shuffle
r Cycle repeat mode

Navigation

Key Action
↑ / k Move up
↓ / j Move down
Enter Select
Esc Back

Downloads

Key Action
Shift+D Download selected song/artist/playlist or playlist view

Plugins

Extend youtube-music-cli with plugins!

Managing Plugins

TUI Mode: Press p to open the plugins manager.

CLI Mode:

# List installed plugins
youtube-music-cli plugins list

# Install from default repository
youtube-music-cli plugins install adblock

# Install from GitHub URL
youtube-music-cli plugins install https://github.com/user/my-plugin

# Enable/disable
youtube-music-cli plugins enable my-plugin
youtube-music-cli plugins disable my-plugin

# Update
youtube-music-cli plugins update my-plugin

# Remove
youtube-music-cli plugins remove my-plugin

Available Plugins

Plugin Description
adblock Block ads and sponsored content
lyrics Display synchronized lyrics
scrobbler Scrobble to Last.fm
discord-rpc Discord Rich Presence integration
notifications Desktop notifications for track changes

Developing Plugins

See Plugin Development Guide and Plugin API Reference.

# Start from a template
cp -r templates/plugin-basic my-plugin
cd my-plugin

# Edit plugin.json and index.ts
# Install for testing
youtube-music-cli plugins install /path/to/my-plugin

Configuration

Config is stored in ~/.youtube-music-cli/config.json:

{
	"theme": "dark",
	"volume": 70,
	"shuffle": false,
	"repeat": "off",
	"streamQuality": "high",
	"downloadsEnabled": false,
	"downloadDirectory": "D:/Music/youtube-music-cli",
	"downloadFormat": "mp3"
}

Stream Quality

Quality Description
low 64kbps - Save bandwidth
medium 128kbps - Balanced
high 256kbps+ - Best quality

Download Settings

  • Enable/disable downloads in Settings (,).
  • Set your download directory in Settings → Download Folder.
  • Choose format in Settings → Download Format (mp3 or m4a).
  • Downloads are saved as:
    • <downloadDirectory>/<artist>/<album>/<title>.mp3 (or .m4a)
  • MP3/M4A files are tagged with metadata (title, artist, album) and include cover art when available.

Troubleshooting

mpv not found

Ensure mpv is installed and in your PATH:

mpv --version

On startup, the CLI now checks for mpv and yt-dlp. In interactive terminals it can prompt to run an install command automatically (with explicit confirmation first).

No audio

  1. Check volume isn't muted (= to increase)
  2. Verify yt-dlp is working: yt-dlp --version
  3. Try a different track

TUI rendering issues

If rendering looks wrong, try resizing your terminal window or restarting the app.

Plugin not loading

  1. Check plugin.json syntax is valid
  2. Verify the plugin is enabled: youtube-music-cli plugins list
  3. Check logs for errors

Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Make your changes
  4. Run tests: bun run test
  5. Commit: git commit -m 'feat: add my feature'
  6. Push: git push origin feature/my-feature
  7. Open a Pull Request

Development

# Install dependencies
bun install

# Run in development mode
bun run dev

# Build
bun run build

# Lint and format
bun run lint:fix
bun run format

# Type check
bun run typecheck

Tech Stack

  • Runtime: Node.js 18+ / Bun
  • UI Framework: Ink (React for CLI)
  • Language: TypeScript
  • Audio: mpv + yt-dlp
  • API: YouTube Music Innertube API

License

MIT © Involvex


<div align="center">

Documentation • Report Bug • Request Feature

Made with ❤️ for music lovers

</div>

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选