Sonos MCP
Controls Sonos speakers directly over the local network (UPnP on port 1400): lists rooms, groupings and players, reports now-playing state and source (queue, line-in, TV, stream), pauses/resumes and skips tracks, sets a room's volume (never above SONOS_MAX_VOLUME), and starts a room's own or another player's line-in input.
Plays a Spotify track, album or playlist on the speakers from a spotify: URI or open.spotify.com link, using the Spotify account already linked in the Sonos app (learned from Sonos Favorites or set via SONOS_SPOTIFY_SN), inserting the item after the current track and keeping the rest of the queue.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Sonos MCP Play my Late Night Jazz playlist in the kitchen."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Sonos MCP
Let your AI agent play music on your Sonos speakers. Sonos MCP is a small, free MCP server that finds the speakers on your home network and controls them directly: list rooms, play a Spotify playlist, album or track, switch to a line-in (a turntable or CD player), pause, skip and set the volume.
It talks to the speakers themselves over your local network, the same way the Sonos app does. There is no bridge to install, no web server running on your computer, no cloud service of ours and no Spotify developer account: Spotify plays through the account you already linked in the Sonos app.
MIT licensed. Works with any MCP client (Claude Code, Claude Desktop and
others). Node.js 20 or newer. The package name is @neleus/sonos-mcp; it is
not on npm yet, so install it from source as below.
What you can ask your agent
"Which Sonos rooms do we have?"
"Play my Late Night Jazz playlist in the kitchen" (with a Spotify link, or a Spotify MCP server that finds the playlist for it)
"What is playing in the living room?"
"Turn the bedroom down to 15" or "skip this song"
"Play the record player in the living room"
Related MCP server: Lyrion MCP Server
Install
git clone https://github.com/neleus-agent/sonos-mcp.git
cd sonos-mcp
npm install && npm run build
node dist/index.js rooms # finds your speakers and prints the roomsIf rooms lists your rooms, register the server with your MCP client. For
Claude Code:
claude mcp add sonos -- node /path/to/sonos-mcp/dist/index.jsFor Claude Desktop and other clients, add it to the client's MCP settings:
{
"mcpServers": {
"sonos": {
"command": "node",
"args": ["/path/to/sonos-mcp/dist/index.js"],
"env": { "SONOS_MAX_VOLUME": "60" }
}
}
}The computer running the server must be on the same network as the speakers.
Tools
Tool | What it does |
| Rooms, how they are grouped, and the players in each room |
| State, source (queue, line-in, TV, stream), title, artist, position, volume |
| Play a Spotify track, album or playlist now (a |
| Pause or resume a room (line-in is stopped, since it cannot pause) |
| Next or previous track |
| Set a room's volume, never above |
| Play a line-in input, from the room itself or from another room or player |
Room names are matched without case, and a unique part of a name works ("kitch" for Kitchen). An ambiguous name is refused instead of guessed. When a room is grouped, playback commands go to the whole group and volume goes to the room you named.
Spotify
play_spotify needs Spotify added to your Sonos system in the Sonos app. The
server learns which Spotify account to use from your Sonos Favorites, so save
at least one Spotify playlist or album as a Sonos favourite. If you have
several Spotify accounts linked, it picks the one your favourites use most;
set SONOS_SPOTIFY_SN to choose another. It inserts the item after the
current track and keeps the rest of your queue.
To play something by name, pair this server with a Spotify MCP server (for example Golden Hour Selector) that searches Spotify and hands over the URI.
Line-in
play_line_in with only a room plays that room's own line-in. In a bonded
room (a stereo pair, or a room with several speakers) the input may be on a
speaker other than the main one: list_rooms shows every player id, and you
can pass the right one as source.
Settings
All optional, as environment variables:
Variable | Default | Meaning |
| (discover) | Comma-separated speaker addresses to use instead of discovery, for networks where discovery is blocked. Other speakers the system reports are still only used at private-network addresses |
|
| Highest volume any tool may set (0 to 100) |
|
| Timeout for one request to a speaker |
|
| How long discovery listens for speakers |
| (learned) | Spotify account serial, when several accounts are linked |
Troubleshooting
No speakers found. The computer and the speakers must be on the same network, and the firewall must allow UDP discovery (Windows asks the first time Node.js uses the network; allow it on private networks). Or set
SONOS_HOSTSto a speaker's address, found in the Sonos app under Settings, System, About My System.Spotify fails with error 800 or 804. Spotify is not linked in the Sonos app, the item is not available in your country, or the wrong account was picked: set
SONOS_SPOTIFY_SN.
How it works and what it touches
The server only speaks to Sonos speakers on port 1400 of your local network, using the speakers' standard UPnP control interface. Discovery sends one SSDP search on the local network. An address learned from the network is used only when it is a private-network address on port 1400, so a forged announcement cannot redirect it anywhere else, and every answer is size-capped and parsed in linear time, so a forged speaker cannot stall it. It runs no server of its own, stores nothing on disk, and needs no credentials. Its only runtime dependencies are the MCP SDK and zod.
The Sonos control interface on your network has no password; that is how Sonos works, and it is true with or without this server. Anyone on your network can already control your speakers.
Development
npm test # vitest, no network (fake speakers)
npm run lint # tsc --noEmit
npm run build # tsup -> dist/
npm run gate # the public gate (see below)
npm run hooks # run the gate before every commit and push in your cloneSecurity and privacy for contributors
Your home network is personal. Speaker addresses, player ids (they contain the speaker's hardware address), room names and account ids never belong in this repository. Test fixtures use documentation addresses and invented names.
The gate.
npm run gatefails if a tracked file contains a network address (loopback, the SSDP multicast group and documentation ranges are fine) or a real Sonos player id, if any file in the history has a data-export or.envname, or if a file or any past revision contains a line from your own private markers file. That optional file lives outside the repository, at~/.ai/sonos-mcp/private-markers.txt(or the path inSONOS_MCP_PRIVATE_MARKERS): put your name, room names and network prefix in it, one per line.npm run hooksruns the gate before every commit and push.CI. Every push and pull request runs the typecheck, build, tests and the gate over the full history.
To report a vulnerability, see SECURITY.md.
Licence
MIT. See LICENSE. Sonos and Spotify are trademarks of their owners; this project is not affiliated with or endorsed by either.
Available Tools
8 toolslist_roomsARead-only
List the Sonos rooms on the local network, with how they are grouped and the players that make up each room. Room names come from the speakers and are untrusted text.
Inputs: no named parameters.
now_playingBRead-only
What a Sonos room is playing: state, source (queue, line-in, tv, stream), title, artist, position and volume. Track titles come from the music service and are untrusted text.
Inputs: room (required).
pauseAIdempotent
Pause a Sonos room (stops it when the source cannot pause, such as line-in).
Inputs: room (required).
play_line_inA
Play a line-in input (turntable, CD player, other analog source) in a Sonos room. source is the room whose line-in to play (defaults to the room itself), or a player id from list_rooms when the input sits on one speaker of a bonded room.
Inputs: room (required), source.
play_spotifyA
Play a Spotify track, album or playlist in a Sonos room now, through the Spotify account linked in the Sonos app. Pass a spotify: URI (spotify:playlist:) or an open.spotify.com link. If the room is grouped, the whole group plays it. The existing queue is kept; the new item is inserted after the current track.
Inputs: room (required), spotify (required).
resumeAIdempotent
Resume playback in a Sonos room.
Inputs: room (required).
set_volumeAIdempotent
Set the volume of a Sonos room (0-100). This server caps it at 80; the result says when a request was lowered.
Inputs: room (required), level (required).
skipC
Skip to the next or previous track in a Sonos room.
Inputs: room (required), direction.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool maps to a clearly distinct action: discovery (list_rooms), state inspection (now_playing), source-specific playback (play_spotify vs play_line_in), transport controls (pause, resume, skip), and volume (set_volume). The only near-neighbors, play_spotify and play_line_in, are explicitly differentiated by content type and parameters, so misselection is unlikely.
Naming is mostly a verb_noun pattern (list_rooms, play_spotify, play_line_in, set_volume) with bare-verb transport controls (pause, resume, skip) and one noun-style read (now_playing). The deviations are conventional for media controls and remain predictable, but the set is not uniformly patterned.
Eight tools is well-scoped for a Sonos playback remote; every tool corresponds to a distinct, frequently needed operation. Nothing feels padded or missing at this level of granularity.
Core playback lifecycle is covered: discover rooms, inspect state, play Spotify or line-in, pause/resume/skip, and set volume. Gaps remain around grouping/ungrouping rooms, switching to TV or other sources, and queue management, but the current surface supports the main agent workflows without dead ends.
Maintenance
Related MCP Connectors
Sonos MCP server: control your Sonos speakers from any MCP client. Play songs, artists and playlists, set volume, group rooms, move music to another room, switch to TV, spoken announcements and reminders. 27 tools, English and Chinese. Works through the official Sonos cloud, so there is no home bridge to install; sign in with OAuth. Requires the free ZoneFoundry iOS app.
Control your existing Philips lights, Sonos speakers, Roborock vacuums and other supported devices through Port OS cloud. Give ChatGPT, Claude and other MCP-compatible assistants access to the devices you connect. Turn off the living room lights, play music on your speakers, adjust the thermostat, run a vacuum in a room, check a camera snapshot or find a connected tracker. Available actions depend on your linked provider accounts and each device’s supported capabilities. Port OS runs in the cloud; no local server is required. You choose the account, device and capability permissions each assistant receives. Device operations require user OAuth; public tool discovery does not grant device access. Port OS is in alpha. Setup: https://portoperatingsystem.com/docs/getting-started/ Support: https://portoperatingsystem.com/contact/
Give your AI agent the power to cast to your home TV and control an interactive canvas. By ArdaBot.
Control your Tesla from your AI assistant - climate, charging, access, and security.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to control Sonos audio devices over a local network using UPnP/SOAP protocols, supporting playback, volume, queue management, zone grouping, and music library browsing.5914MIT
- AlicenseNot gradedqualityCmaintenanceEnables LLMs to control a Lyrion Music Server (LMS/Squeezebox) for playback, search, library browsing, and player management.-
- AlicenseBqualityCmaintenanceEnables AI agents to search Spotify tracks and control playback (play, pause, skip, queue, volume) through the Spotify Web API.132MIT
- AlicenseNot gradedqualityCmaintenanceEnables an AI agent to inspect and control Lyrion Music Server (Logitech Media Server) players via the LMS JSON-RPC API, including playback, volume, playlists, favorites, radio, and library search/browse.1MIT