YTDL RMCP
UnexploredRust MCP server and CLI for yt-dlp search, downloads, metadata, transfers, and Plex playlists.
Install
Terminal
$npx -y ytdl-rmcpmcp_config.json
{
"mcpServers": {
"ai-dinglebear-ytdl-rmcp": {
"env": {
"RUST_LOG": "${RUST_LOG}",
"YTDLP_PLEX_URL": "${YTDLP_PLEX_URL}",
"YTDLP_PLEX_TOKEN": "${YTDLP_PLEX_TOKEN}",
"YTDL_RMCP_BINARY_VERSION": "${YTDL_RMCP_BINARY_VERSION}",
"YTDLP_ACOUSTID_CLIENT_KEY": "${YTDLP_ACOUSTID_CLIENT_KEY}",
"YTDL_RMCP_RELEASE_BASE_URL": "${YTDL_RMCP_RELEASE_BASE_URL}"
},
"args": [
"-y",
"ytdl-rmcp"
],
"command": "npx"
}
}
}Documentation
ytdl-rmcp
yt-dlp search, download, metadata, delivery, and Plex workflows over MCP and CLI.
Written in Rust on the rmcp crate. yt-dlp
and ffmpeg are auto-downloaded into a per-user cache on first run, so the host
needs neither pre-installed — the one binary is the whole install.
30-second path: npx -y @dinglebear/rytdl setup -> configure a target path ->
call youtube_search or youtube_probe; use youtube_download only after the
destination and trust boundary are clear.
Status: production personal-media MCP server. Read-only search/probe/stats paths are safe; download, playlist, queue-drain, and tag-writing paths create or move state and are intended for trusted callers.
Not for: a generic web-downloader SaaS, a multi-tenant media ingestion boundary, a replacement for yt-dlp's upstream site handling, or an arbitrary filesystem writer for untrusted MCP callers.
Contents
- Naming
- Capabilities And Boundaries
- Install
- Quickstart
- Client Configuration
- Runtime Surfaces
- MCP Tool Reference
- CLI Reference
- Configuration
- Authentication
- Safety And Trust Model
- Architecture
- Distribution Contract
- Development
- Verification
- Deployment
- Troubleshooting
- Related Servers
- Documentation
- License
Naming
| Surface | This repo |
|---|---|
| Repository | dinglebear-ai/rytdl |
| Cargo crate | ytdl-rmcp |
| npm package | @dinglebear/rytdl |
| CLI / binary | rytdl |
| MCP tools | youtube_search, youtube_search_ui, youtube_download, youtube_probe, youtube_identify, youtube_stats, youtube_plex_playlist, youtube_transfer_queue |
| Env prefix | YTDLP_*, plus FFMPEG_*, FPCALC_PATH, and YTDLP_LOG |
| Transport | stdio only — no HTTP listener, no service port |
The crate and npm package use the *-rmcp family naming pattern, while the
repository and runtime binary are rytdl so local shells get a short
Rust-native command.
Capabilities And Boundaries
- Searches YouTube through yt-dlp without downloading media.
- Downloads audio, video, or both into a staging tree, tags audio metadata, and transfers the result to local, SSH, or rclone destinations.
- Optionally fingerprints audio through AcoustID/MusicBrainz and syncs completed audio downloads into a Plex playlist.
- Builds Plex playlists from successful transfer history and drains server-made retained-staging transfer manifests.
- Exposes an MCP App search UI for hosts that can render embedded widgets.
- Keeps a JSONL ledger for repeat-safe downloads and stats.
| This repo owns | Upstream owns | Explicitly out of scope |
|---|---|---|
| MCP tools, CLI setup, media staging, tagging, transfer policy, queue manifests, config validation, response shaping, plugin/package metadata. | yt-dlp extraction behavior, source-site availability, ffmpeg media conversion, Plex library indexing, SSH/rclone authentication. | Multi-tenant isolation, arbitrary local writes for untrusted callers, credential brokering, site-specific scraping guarantees, media-server replacement. |
Features
- Audio, video, or both — audio-first by default, with separate targets for audio and video.
- Proper tagging — embeds title / artist / album / date and cover art, and
organizes output as
Artist/Title [id].extso media servers (Plex, etc.) index it cleanly. A non-greedyArtist - Titleparse recovers the artist from free-form video titles. Source.info.json, thumbnail, and description sidecars are preserved next to the media for future retagging/indexing. Common YouTube title noise like(Official Video),[Official Audio], and trailing channel handles is stripped from embedded title metadata by default. - Self-contained paths — the binary downloads/caches yt-dlp + ffmpeg when run directly; the container image bakes in ffmpeg, fpcalc, SSH, and rsync for media-host batch jobs.
- Self-installing —
ytdl-rmcp setupregisters the server into Claude Code, Codex, and/or Gemini CLI via each tool's ownmcp add. - Robust transfers — local paths (
/path) are copied in-process by the binary itself, SSH targets (host:/path) usersync -a --partial --protect-argswith anscpfallback whenrsyncis missing, and rclone targets (remote:pathorrclone:remote:/path) userclone copy. On transfer failure the local staging copy is kept for retry and recorded as a drainable manifest foryoutube_transfer_queue. - Repeat-safe —
use_archiverecords downloaded IDs (per mode) and skips them on later runs; YouTube mix/radio URLs are auto-cleaned to the seed video. - Stats-ready ledger — every completed download call appends a JSONL entry with timestamp, destinations, files, bytes, uploader, and transfer status.
- Plex playlist sync — when Plex credentials are configured, downloaded
audio is added to
yt-dlp Downloadsby default.
MCP Tool Reference
| Tool | Purpose |
|---|---|
youtube_search | Search YouTube with yt-dlp and return result URLs without downloading. |
youtube_search_ui | Open an interactive YouTube search UI in MCP App-capable hosts. |
youtube_download | Download one or more URLs (audio/video/both) and transfer them to a target path. |
youtube_probe | Read-only: resolve title/duration/uploader/format counts without downloading. |
youtube_identify | Fingerprint local audio with fpcalc, return AcoustID/MusicBrainz candidates, preview canonical tags, and optionally write high-confidence tags. |
youtube_stats | Summarize the download ledger: totals, file kinds, uploaders, and recent entries. |
youtube_plex_playlist | Build or preview Plex audio playlists from successful transferred audio history. |
youtube_transfer_queue | List and drain retained-staging transfer failure manifests. |
youtube_download parameters
| Param | Default | Meaning |
|---|---|---|
urls | — (required) | One URL string or an array of URLs. |
mode | audio | audio, video, or both. |
audio_format | env YTDLP_AUDIO_FORMAT → mp3 | mp3/m4a/opus/flac/wav/best. |
audio_quality | 0 | yt-dlp quality for lossy codecs: 0–9 or a bitrate like 192K. |
max_height | best | Cap video resolution (e.g. 1080). |
container | mp4 | mp4 or mkv for video. |
target_path | env YTDLP_TARGET_PATH | Destination for audio. Use /path for local, host:/path for SSH, or remote:path or rclone:remote:/path for rclone. |
video_target_path | env YTDLP_VIDEO_TARGET_PATH → target_path | Destination for video when it should land somewhere different from audio. Same target forms. |
keep_local | false | Keep the local staging copy after transfer. |
use_archive | false | Record + skip already-downloaded IDs (per mode). |
plex_playlist | env YTDLP_PLEX_PLAYLIST → yt-dlp Downloads when Plex is configured | Plex playlist title or ID to add downloaded audio tracks to. Requires YTDLP_PLEX_URL and YTDLP_PLEX_TOKEN. |
response_format | markdown | markdown or json. |
When Plex credentials are configured, successful downloads that produced audio
files search Plex for each downloaded track, create the target playlist if
needed, and add missing tracks while skipping entries already present. The
default playlist is yt-dlp Downloads; set YTDLP_PLEX_PLAYLIST or pass
plex_playlist to override it. Plex errors are reported as
plex_playlist_error and do not make the completed download fail. JSON
responses include a plex_playlist summary with matched, added,
already_present, and missing counts.
Canonical metadata matching through MusicBrainz/AcoustID is documented in
docs/musicbrainz-acoustid.md. youtube_download automatically runs
high-confidence MusicBrainz retagging for downloaded audio when
YTDLP_ACOUSTID_CLIENT_KEY is configured; youtube_identify remains available
for previewing or repairing existing library files, with manual tag writes
enabled by write_tags=true.
youtube_download JSON response
With response_format=json, the call returns a single object describing the
batch:
| Field | Meaning |
|---|---|
transferred | true if every produced subtree reached its target. |
transfer_error | null on success, else the failure/timeout message (string). |
target_path / destination / destinations | The per-kind target destination(s) actually used. |
staging_kept_at | Local staging path retained for retry (set when the transfer failed or keep_local was requested). |
total_files / total_bytes / total_size | Aggregate counts across all items. |
partial_items | Count of items that errored but still produced files. |
failed_items | Count of items that errored and produced no files. |
items[] | Per-URL results, each with a status, title, video_id, error, and a files[] list. |
Each items[].status is one of:
ok— succeeded with files.partial— an error occurred but some files were still produced.failed— errored with no files.skipped— nothing new (already in the archive).
Optional keys are attached only when the relevant stage ran:
metadata_retag— MusicBrainz/AcoustID auto-retag summary (attempted,matched,written,skipped,errors, or anerrorstring); present whenYTDLP_ACOUSTID_CLIENT_KEYis configured.plex_playlist— Plex playlist summary (playlist,matched,added,already_present,missing);plex_playlist_erroris set instead if the Plex update failed (a Plex failure does not fail the download).history_error— set when the download succeeded but the JSONL ledger append failed.
youtube_probe takes urls and response_format.
youtube_plex_playlist
Build or preview Plex audio playlists from successful ytdl-rmcp download history.
Actions:
| Action | Meaning |
|---|---|
list_candidates | Return audio candidates from history entries where transferred is true. |
preview | Resolve selected candidates against Plex without mutating Plex. |
apply | Add selected candidates to a Plex audio playlist idempotently. |
Candidates are history-derived and audio-only. Failed or retained-staging transfers are intentionally excluded.
apply can return plexamp_url, plex_web_url, and
playback_link_status. plexamp_url is a best-effort generated
listen.plex.tv playback link, not an official Plexamp API guarantee. The
regular Plex playlist API calls use the official Plex Media Server API.
youtube_transfer_queue
List and drain server-created transfer failure manifests.
Actions:
| Action | Meaning |
|---|---|
list | Show pending retained-staging transfer manifests. |
retry | Retry one manifest by opaque manifest_id. |
retry_all | Retry all pending manifests. |
prune | Remove manifests whose staging directory is gone. |
The queue never accepts arbitrary filesystem paths. Retry uses the original target paths recorded at failure time and re-checks local target policy before transfer. Manifests are created by the local server when a transfer fails while the staging directory, manifest ID, file list, and original targets still match.
youtube_identify parameters
| Param | Default | Meaning |
|---|---|---|
paths | — (required) | One local audio file path string or an array of paths. |
write_tags | false | Write high-confidence MusicBrainz tag previews back to the audio files. |
response_format | markdown | markdown or json. |
youtube_identify runs Chromaprint fpcalc, sends the fingerprint to AcoustID,
and returns MusicBrainz recording candidates. When the best candidate is
high-confidence, it also fetches the MusicBrainz recording/release data and
includes a retag_preview showing the canonical artist, title, release, release
date, release type, track number, and MusicBrainz IDs. By default it is
preview-only. With write_tags=true, it writes the preview to the file with
Lofty, including common title/artist/album/date/track fields plus MusicBrainz
recording, release, release-group, and release-type tags. It requires
YTDLP_ACOUSTID_CLIENT_KEY; set FPCALC_PATH if fpcalc is not on PATH.
youtube_search parameters
| Param | Default | Meaning |
|---|---|---|
query | - (required) | YouTube search text. The server passes this to yt-dlp as ytsearchN:<query>. |
limit | 10 | Number of results, clamped to 1..=25. |
response_format | markdown | markdown or json. |
youtube_search_ui accepts the same input and returns the same search payload,
plus MCP App metadata for hosts that can render the embedded UI. Hosts without
app rendering still receive the normal search result text and structured data.
MCP App pattern
youtube_search_ui is the widget-backed entry point for this repo:
- The tool descriptor advertises
_meta.ui.resourceUri. - The server exposes
ui://ytdl-rmcp/youtube-search.htmlthroughresources/listandresources/read. - The resource uses
text/html;profile=mcp-appand an explicit CSP metadata block. .mcpb/.dxtpackaging installs the local server; UI resources are still advertised through the MCP tools/resources protocol and are host-rendered.
youtube_stats parameters
| Param | Default | Meaning |
|---|---|---|
limit | 10 | Number of recent ledger entries to include, clamped to 0..=100. |
response_format | markdown | markdown or json. |
JSON stats include total_downloads, total_files, total_bytes,
skipped_entries, by_kind, by_uploader, and recent. Bucket fields include
downloads (compatibility alias for call count), calls, items, files,
bytes, and human-readable size. Malformed ledger lines are skipped and
counted instead of failing the whole stats call. If a download succeeds but the
ledger append fails, the download response still succeeds and includes
history_error in JSON output.
CLI Reference
The CLI owns process setup and diagnostics; media operations are exposed as MCP tools.
| Command | Purpose |
|---|---|
rytdl or rytdl serve | Serve MCP over stdio. This is the default runtime used by clients. |
rytdl setup | Fetch tool dependencies when needed and register local MCP clients. |
rytdl doctor | Print version, platform, tool-resolution, and config-presence diagnostics. |
The npm launcher exposes the same binary:
npx -y @dinglebear/rytdl doctor
npx -y @dinglebear/rytdl serve
Install
Run the guided installer through npm:
npx -y @dinglebear/rytdl setup
Or install the command globally:
npm i -g @dinglebear/rytdl
ytdl-rmcp setup
The npm package downloads the matching GitHub Release binary during
postinstall; the installed command is the Rust binary served through a tiny
Node launcher. You can also use the one-line installer:
curl -fsSL https://raw.githubusercontent.com/dinglebear-ai/rytdl/main/scripts/install.sh | bash
Or download the binary tarball for your platform from Releases, or build it (see below). The guided setup fetches yt-dlp + ffmpeg, prompts for your audio/video target paths, detects which agent CLIs are present, and registers the server into the ones you pick.
Quickstart
After setup, prove the read-only path first:
npx -y @dinglebear/rytdl doctor
For raw MCP clients, call a read-only tool with JSON-RPC tools/call:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "youtube_search",
"arguments": {
"query": "lcd soundsystem live",
"limit": 3,
"response_format": "json"
}
}
}
Then probe a known URL before downloading:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "youtube_probe",
"arguments": {
"urls": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
}
}
Use youtube_download only after YTDLP_TARGET_PATH or
YTDLP_VIDEO_TARGET_PATH points at a destination you are comfortable letting
trusted MCP callers write into.
Client Configuration
Run without subcommands, npx -y @dinglebear/rytdl serves MCP over stdio. Register it
yourself:
# Claude Code
claude mcp add -s user @dinglebear/rytdl -e YTDLP_TARGET_PATH=tootie:/media/music -e YTDLP_EXTRACTOR_ARGS=youtube:player_client=android -- npx -y @dinglebear/rytdl
# Codex
codex mcp add --env YTDLP_TARGET_PATH=tootie:/media/music --env YTDLP_EXTRACTOR_ARGS=youtube:player_client=android @dinglebear/rytdl -- npx -y @dinglebear/rytdl
# Gemini CLI (command is positional, env last)
gemini mcp add -s user @dinglebear/rytdl npx -y @dinglebear/rytdl -e YTDLP_TARGET_PATH=tootie:/media/music -e YTDLP_EXTRACTOR_ARGS=youtube:player_client=android
If you already installed a standalone binary with npm i -g @dinglebear/rytdl,
scripts/install.sh, or a release tarball, you can use that binary path in
place of npx -y @dinglebear/rytdl.
For raw MCP JSON configs, include the required target path env var and the YouTube extractor override:
{
"mcpServers": {
"ytdl-rmcp": {
"command": "npx",
"args": ["-y", "@dinglebear/rytdl"],
"env": {
"YTDLP_TARGET_PATH": "tootie:/mnt/user/data/media/music/yt-dlp",
"YTDLP_VIDEO_TARGET_PATH": "tootie:/mnt/user/data/media/movies/yt-dlp",
"YTDLP_AUTO_UPDATE": "1",
"YTDLP_MAX_AGE_DAYS": "1",
"YTDLP_EXTRACTOR_ARGS": "youtube:player_client=android"
}
}
}
}
The checked-in .mcp.json is also a complete raw MCP profile: it declares the
same user_config keys used by the plugin/bundle manifests, supplies defaults
for local gateway imports, and maps every setting into the server environment.
For reliable YouTube search/probe behavior it defaults
YTDLP_EXTRACTOR_ARGS to youtube:player_client=android; official music-video
results frequently reject yt-dlp's default YouTube clients during metadata
extraction.
Runtime Surfaces
| Surface | Command or file | Notes |
|---|---|---|
| stdio MCP server | npx -y @dinglebear/rytdl or rytdl | Default runtime for local MCP clients. |
| CLI | rytdl --help | Same binary; exposes setup and diagnostics. |
| Guided setup | npx -y @dinglebear/rytdl setup | Registers Claude Code, Codex, and Gemini CLI configs where available. |
| MCP App | youtube_search_ui | Embedded search widget plus normal fallback tool output. |
| Bundle | mcpb/manifest.json | Binary MCPB/DXT package for desktop hosts that support bundles. |
| Container | ghcr.io/dinglebear-ai/rytdl:main | Includes ffmpeg, fpcalc, SSH, rclone, and rsync for shared deployments. |
| TOOTIE persistent runtime | ops/compose/tootie/ | Product-owned Compose declaration; sessions enter the long-lived container over stdio with mcp-stdio.sh. |
Distribution Contract
- npm launcher —
npx -y @dinglebear/rytdldownloads and runs the matching GitHub Release binary. Run without subcommands, it serves MCP ove
Sourced from the repository README.
More in AI & Agents
- PonytailMakes your AI agent think like the laziest senior dev in the room. The best code is the code you never wrote.109,599
- AgentsMulti-harness agentic plugin marketplace for Claude Code, Codex, Cursor, OpenCode, GitHub Copilot, and Google Antigravity39,079
- Frontend SlidesCreate beautiful slides on the web using a coding agent's frontend skills28,060
- Agent Skills Search ServerSearch and discover Agent Skills from the skills.sh registry. Powered by HAPI MCP server.24,658
- Agency Agents Zh🎭 267 个即插即用的 AI 专家角色 — 支持 Hermes Agent/Claude Code/Cursor/Copilot 等 18 种工具,覆盖工程/设计/营销/金融等 20 个部门。含 52 个中国市场原创智能体(小红书/抖音/微信/飞书/钉钉等)。搭配编排器 agency-orchestrator,一句话即可让多位专家按 DAG 自动协作。19,868
- Watermarks RemoverStrip multi-vendor AI provenance marks: Unicode text hygiene, statistical rewrite hooks, and C2PA/metadata from PNG/JPEG/SVG/PDF/DOCX/HTML/MD17,822