roon-mcp

roon-mcp

MCP server to control the Roon music player, enabling AI agents to search music, manage playback, and adjust volume across zones.

Category
访问服务器

README

roon-mcp

npm version

An MCP server to control the Roon music player, so an AI agent can find music and start playback. Built on the official Roon Extension API (node-roon-api + node-roon-api-transport / node-roon-api-browse).


"Play a female vocal trance mix on Roon (Zone: This Computer) — 2000s Dutch trance vibes, the kind of set you'd hear at Amnesia in its prime. Start with something like 4 Strings' Take Me Away."

Claude searches across your library and streaming, hand-picks the tracks, and queues them — all from a single natural-language prompt.


Requirements

  • Node.js 20+
  • A running Roon Core on the local network to pair with
  • git on the install host — the node-roon-api* dependencies are published on GitHub (not npm) and are fetched via git URLs during install

MCP Client Configuration

Add this to your MCP client config. npx fetches the package on first run:

{
  "mcpServers": {
    "roon": {
      "command": "npx",
      "args": ["-y", "roon-mcp"],
      "env": { "ROON_DEFAULT_ZONE": "Office" }
    }
  }
}

On first launch, open Roon → Settings → Extensions and enable Roon MCP to pair. Pairing status is logged to stderr; stdout is reserved for the MCP protocol.

Global install (optional)

npm install -g roon-mcp
{
  "mcpServers": {
    "roon": {
      "command": "roon-mcp",
      "env": { "ROON_DEFAULT_ZONE": "Office" }
    }
  }
}

Configuration

Env var Purpose
ROON_DEFAULT_ZONE Optional fallback target for play_now / enqueue_and_play when no zoneId is given — a zone/output id or a display-name substring. If unset, the server falls back to the only zone, an Office zone, or the currently-playing zone; if it still can't decide it returns ZONE_AMBIGUOUS so the agent can ask.

Tools

Tool Purpose
list_zones() List playable zones/outputs (id, name, state, output ids).
search_music({ query, type?, limit?, includeStreaming? }) Resolve a text query into ranked browse candidates (opaque, session-scoped item keys). type (artist/album/track/genre/playlist/radio) restricts the category; for non-genre types an empty typed search broadens to all categories. See Streaming search for type:"genre"/type:"artist" and includeStreaming.
get_tracks_for({ itemKey, limit? }) Expand an artist/album/genre/playlist candidate into concrete playable tracks.
play_now({ zoneId?, itemKey, shuffle? }) Immediately play one search candidate; zoneId optional (defaults as above).
enqueue_and_play({ zoneId?, itemKeys, shuffle? }) Build an ad-hoc queue from curated item keys and start it (replaces the zone's queue); reports queued/skipped.
now_playing({ zoneId? }) Snapshot of the zone's current track — state, title, artist, album, seek position. title/artist/album are undefined when nothing is playing.
control_playback({ zoneId?, action }) Run a transport verb: pause / resume / next / previous / stop.
set_volume({ zoneId?, level }) Set the zone's volume to level percent (0–100). Rescales to each output's native range; incremental outputs are reported as skipped.
mute({ zoneId?, muted }) Mute (muted: true) or unmute (muted: false) every output in the zone.

Streaming search (genre and artist)

Genres don't appear in Roon's flat search hierarchy, so search_music({ type: "genre" }) is handled specially: the server walks Roon's dedicated Genres tree (cached per session) and returns the nearest-match genre nodes by fuzzy score, with their parent path in the subtitle — e.g. "Psychedelic Trance" yields Psytrance / Trance. It never silently broadens to artists/albums. These candidates are library-scoped (genres present in your collection, including TIDAL albums you've added). Expand one with get_tracks_for to get a cross-album mix of that genre.

Artist search is library-scoped too: search_music({ type: "artist" }) returns artists present in your collection. When the top-ranked artist has no library content — e.g. a node with subtitle: "0 Albums" because all albums were removed, or an artist not in your library at all but available on TIDAL — the result's message field carries a hint so the agent can opt in to the streaming path (see below) without having to discover the dead end at get_tracks_for time.

Pass includeStreaming: true (meaningful for both type:"genre" and type:"artist") to also pull a track mix from streaming services for discovery beyond your library:

  • For type:"genre", the server takes the genre-relevant albums the flat search surfaces and samples tracks across them. Library genre nodes come first, then ready-to-play streaming tracks (each a track candidate, source group Streaming) appended after.
  • For type:"artist", the server runs a track search and filters to entries by that artist (matching the track's subtitle, which Roon uses for the artist on track rows). Library artist candidates come first, then streaming tracks by the same artist appended after. This is the path that unblocks "play/queue multiple Artist songs" for an artist with no library content: the streaming tracks are queue-playable directly via enqueue_and_play. Results are best-effort — a small fraction may be features or compilations; the agent's per-artist cap / dedupe handles that.

Default is false (library only).

Cost: with includeStreaming on, each sampled album/track re-navigates the flat search, so an opt-in streaming search does a handful of extra browse round-trips.

Now playing & transport

now_playing({ zoneId? }) returns a structured snapshot (state, title, artist, album, seek position) so the agent can confirm what's on and where before running a transport verb. The server subscribes to Roon's zone-state stream once per paired Core and waits for the next Changed event after play_now /enqueue_and_play/control_playback — so nowPlaying in the response reflects the new track rather than the one that was playing before the action. The wait times out fast on a slow Core (2 s) and falls back to the cached snapshot, so a hung subscription can never delay an MCP call. control_playback takes one verb at a time (pause, resume, next, previous, stop) — there is no compound "pause and skip." For "louder" / "softer" without a number, set_volume is absolute, so the agent should ask for a target percent or apply a default delta; volume isn't reported in now_playing. Volume and mute fan out to every output in the resolved zone and rescale per output, so a single set_volume({ level: 50 }) works correctly across a grouped zone with mixed dB / numeric devices; incremental outputs (IR blasters and the like) are reported as skipped in the result.

Assumptions

  • Core language: English. Category/action label matching (Artists, Play Now, Top Tracks, …) assumes an English Core.
  • Sources: local library + TIDAL. What searches surface reflects this; results differ on a local-only Core.
  • Queue: replace. enqueue_and_play starts a fresh queue rather than adding to whatever is already playing.
  • Curation is agent-side. Dedupe / cap-per-artist / ordering / trimming stay in the agent; the server has no curation logic.

There is no save_playlist tool: Roon exposes no official playlist-write service, so durable playlists are out of scope. Curated playback is delivered by enqueue_and_play (an ad-hoc, in-the-moment queue).

Logging

Every Roon API call (browse, load, get_zones, change_settings) emits one structured line to stderr (stdout stays reserved for MCP JSON-RPC):

[roon-call] {"t":"2026-06-19T18:00:00.000Z","lvl":"info","op":"browse","ms":12,"params":{"hierarchy":"search","item_key":"…"},"result":{"action":"list","count":7}}

Failures log lvl:"error" with the mapped error code, and retries surface as repeated lines for the same op. Grep stderr for [roon-call] to trace a flow.

Development

npm install              # pulls node-roon-api packages from RoonLabs' GitHub
npm run build
npm test                 # builds, then runs node:test
npm run dev              # tsc --watch
npm run typecheck

Run the built server directly:

npm start

Integration smoke test

scripts/integration.mjs spawns the built server over stdio (like a real MCP client) and runs list → search → expand against your Core. Audible steps are opt-in so it never blasts music by accident:

npm run build
node scripts/integration.mjs                 # list_zones + search only (read-only)
ROON_PLAY=1 node scripts/integration.mjs     # also play_now a shuffled genre
ROON_ENQUEUE=1 node scripts/integration.mjs  # also enqueue a few curated tracks
# overrides: ROON_ZONE="Office"  ROON_QUERY="Tycho"

Enable Roon MCP under Roon → Settings → Extensions on the first run (the script retries list_zones for ~45s while it waits to pair).

Releasing

npm run release -- <patch|minor|major>

Requires a clean worktree on main and a matching ## [<version>] entry in CHANGELOG.md. The script runs the tests, bumps the version, tags the commit, and verifies the package with npm pack. It then prints the push and npm publish commands to run.

License

MIT

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选