sonos-s1-mcp
Provides tools to control Sonos S1 speakers over the local UPnP API, including playback, volume and mute, grouping, favorites, playlists, queue management, Spotify playback, home-theater inputs, EQ, sleep timers, and alarms.
Enables searching the Spotify catalog through the Spotify Web API and playing Spotify tracks, albums, playlists, and artists on Sonos speakers using Spotify URIs or share links.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
sonos-s1-mcp
A self-hosted remote MCP connector for Sonos S1 systems. The official Sonos connector works through the Sonos cloud, and that cloud only supports S2. This server talks to your speakers directly over the local UPnP API (via SoCo), so it has to run on the same LAN as your speakers.
It exposes ten broad tools rather than one per action, so it costs an agent little context:
Tool | What it does |
| Every group (what's playing, volume), player, and alarm; or, for one room, track, volumes, play modes, and sleep timer |
| Play a Sonos Favorite, a Sonos playlist, Spotify links/URIs, or a queue position; or resume. Replace, play next, or add to end |
| Pause, resume, next, previous, seek; |
| Set or nudge volume and mute, for a group or a single room |
| Add rooms to a group, take them out, or group everything |
| Show, remove from, or clear a group's queue |
| List Sonos Favorites or playlists, or search Spotify |
| Shuffle, repeat, crossfade, sleep timer, EQ, night sound, speech enhancement, TV/line-in input |
| Link, check, or unlink your own Spotify account |
| Your top tracks/artists, recently played, current playback, Liked Songs, playlists, followed artists |
Speakers are addressed by room name (case-insensitive; a partial match works if only one room matches). Group actions accept any room in the group.
Deploy
Image
Multi-arch images (amd64, arm64) are published to GHCR:
ghcr.io/unrealjune/sonos-s1-mcp:edgeis rebuilt frommainon every push and nightly.ghcr.io/unrealjune/sonos-s1-mcp:X.Y.Z,:X.Y, and:latestare built on every automatic release (see Development).
Helm (Kubernetes)
The chart is published as an OCI artifact on every release, with chart version = app version = image tag:
helm install sonos oci://ghcr.io/unrealjune/charts/sonos-s1-mcp --version 0.2.0 \
--set hostNetwork=true \
--set publicUrl=https://sonos.example.com \
--set oidc.issuer=https://auth.example.com/application/o/sonos-s1/ \
--set oidc.clientId=<client-id> \
--set 'oidc.allowedGroups={authentik Admins}' \
--set existingSecret=sonos-s1-mcp # holds OIDC_CLIENT_SECRET (+ MCP_AUTH_TOKEN, Spotify keys)Discovery needs the pod on the speakers' network. Use hostNetwork=true, or set sonos.hosts to a speaker IP the pod can route to. See values.yaml for ingress and other options.
Docker Compose
cp .env.example .env # fill it in (see below)
docker compose up -d --build
curl localhost:8080/healthzCompose uses network_mode: host so that SSDP discovery can find the speakers. If you set SONOS_HOSTS to a speaker IP, you can drop host networking and publish port 8080 instead. Giving the speakers DHCP reservations is a good idea either way.
Related MCP server: sonos-ts-mcp
Expose it over HTTPS
claude.ai calls custom connectors from Anthropic's servers, so the endpoint must be reachable from the public internet over TLS. Any of these work: a Cloudflare Tunnel, Tailscale Funnel, or your existing reverse proxy pointing https://sonos.example.com → http://<host>:8080.
Don't put Authentik forward-auth or an outpost in front of /mcp. The server does its own OAuth bearer validation. A login redirect in front of it breaks the MCP client.
Auth: OAuth with login through Authentik
claude.ai connects with just the URL. To make that work, this server is its own OAuth 2.1 authorization server: it supports dynamic client registration, PKCE, and refresh-token rotation, and keeps its state in SQLite under DATA_DIR. Login is delegated to your OIDC provider.
claude.ai ──register/authorize──▶ sonos-s1-mcp ──login──▶ Authentik
│ group check + consent page
claude.ai ◀──────code, tokens──────────┘Authentik sees a single fixed client, which is this server. MCP clients never talk to Authentik directly.
In Authentik, create an OAuth2/OpenID provider and an application:
Client type: Confidential
Redirect URI (strict):
https://sonos.example.com/oauth/callbackScopes:
openid,profile,email. The profile scope carries thegroupsclaim.Bind a group policy to the application so only your household can log in.
Configure the server: set
PUBLIC_URL,OIDC_ISSUER,OIDC_CLIENT_ID,OIDC_CLIENT_SECRET, andOIDC_ALLOWED_GROUPS(checked again here, as a second gate). Give it a persistentDATA_DIR.In claude.ai, go to Settings → Connectors → Add custom connector and enter
https://sonos.example.com/mcp. Nothing else is needed. Claude registers itself, sends you to Authentik, and you approve the connection on the consent page.
Safeguards:
Registration only accepts redirect URIs on
ALLOWED_REDIRECT_HOSTS. The default is claude.ai, claude.com, and localhost.The consent page shows where tokens will go and can't be framed.
Codes are single-use. Refresh tokens rotate, and the old grant dies with them.
To sign everything out, delete oauth.db.
For Claude Code or other clients, MCP_AUTH_TOKEN also works as a static bearer token:
claude mcp add --transport http sonos-s1 https://sonos.example.com/mcp --header "Authorization: Bearer $MCP_AUTH_TOKEN"If OIDC_ISSUER is unset, the server runs in static-token-only mode and accepts Authorization: Bearer … or ?token=….
Spotify
Playback goes through the Spotify account that's linked in your Sonos S1 app. play (with spotify=[...]) accepts spotify: URIs and open.spotify.com links for tracks, albums, playlists, and artists (artists play their top tracks). It can replace the queue, play next, or add to the end. Spotify items saved as Sonos Favorites also work through play with favorite=.
Spotify search (find_music with source="spotify") uses the Spotify Web API through the client-credentials flow, so it needs only an app key and no Spotify login:
Sign in at https://developer.spotify.com/dashboard with any Spotify account and click Create app.
Enter any name and description. For the redirect URI, enter any valid URL such as
https://localhost/callback; it's never used. Under APIs, tick Web API, accept the terms, and save.Open the app's Settings and copy the Client ID. Then click View client secret and copy that too.
Set
SPOTIFY_CLIENT_IDandSPOTIFY_CLIENT_SECRET. With the Helm chart, put them in a Secret referenced fromextraEnvFrom.
Without those keys, you can still paste Spotify links into play.
Your listening (optional)
my_spotify shows Claude your Spotify listening: top tracks and artists over 4 weeks, 6 months or all time (the 4-week list is the closest the API gets to On Repeat, which Spotify doesn't expose), recently played, current playback, Liked Songs, playlists, and followed artists. play queues any of those on the speakers. Access is read-only.
Everyone in the house links their own account. Each Authentik login is a separate person, so your Claude sees your listening and theirs sees theirs. The static MCP_AUTH_TOKEN (Claude Code) counts as the server owner. To add someone, give them an Authentik login in an allowed group; they add the connector in their own claude.ai and ask Claude to connect their Spotify.
In the Spotify app's Settings, add the redirect URI
<PUBLIC_URL>/spotify/callback, e.g.https://sonos.example.com/spotify/callback.While the app is in development mode, only accounts listed under User Management can link (the app owner's own account is allowed already). Add each household member's Spotify email there.
Ask Claude to connect your Spotify.
spotify_accountreturns a one-time login link, valid for 15 minutes, tied to whoever asked. Open it and approve.
Refresh tokens are stored in DATA_DIR/spotify_users.json, so keep DATA_DIR on a persistent volume. A spotify_user.json from an older version (one link for the whole server) is moved to the owner on startup; claude.ai logins link again. To unlink, ask Claude to disconnect your Spotify, and remove the app at https://www.spotify.com/account/apps/.
Development
scripts/smoke.sh <image>checks health, 401s, and tool listing, then runs the whole OAuth flow (tests/oauth_e2e.py) against a fake OIDC provider (tests/fake_oidc.py), and Spotify account links for two people (tests/spotify_e2e.py) against a fake Spotify. That covers registration, login, the group gate, consent, PKCE, refresh rotation, and revocation. CI runs it on every PR.Dependabot opens weekly PRs for pip, the Docker base image, and GitHub Actions. Every update (patch, minor, and major) gets auto-merge, and it merges only after the required
ci-okcheck passes. An hourly sweep re-arms any PR that GitHub dropped auto-merge on.Auto-merging GitHub Actions bumps needs an
AUTOMERGE_TOKENsecret, because the built-in token can't merge workflow-file changes. Create a fine-grained PAT scoped to this repo with Contents, Pull requests, and Workflows set to read/write. Add it as both an Actions secret and a Dependabot secret.Releases are automatic. Every push to
mainthat changes something shippable gets the next version fromscripts/next-version.sh:feat:bumps the minor version,type!:orBREAKING CHANGEbumps the major version (the minor while on 0.x), and anything else (fixes, Dependabot bumps) bumps the patch. The run tagsvX.Y.Z, creates a GitHub release, and publishes the image and chart. Changes only to CI, docs, or scripts don't release. A nightly run picks up merges that didn't triggerpush.
Caveats
Verified against a live S1 household (stereo pair, sub, Play:3, Connect) and Authentik. The OAuth login itself has only been exercised up to the metadata and JWKS, not a full claude.ai login.
Spotify share-link playback depends on SoCo matching your linked Spotify account. If adding to the queue fails with a UPnP error 800, check that Spotify is linked in the S1 app and try updating SoCo.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
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.
One OAuth connector for your team's remote MCP servers, with Tool Packs, guardrails and logs.
MCP server for Yoto: manage cards, tracks, icons and family devices from any MCP client.
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/
Related MCP Servers
- AlicenseAqualityBmaintenanceA server that allows you to control and interact with Sonos devices on your network through the Model Context Protocol, providing functionalities for discovering devices, controlling playback, retrieving device states, and managing queues.1811MIT
- 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 gradedqualityDmaintenanceMCP server for controlling Sonos speakers. Currently early scaffolding with a temporary discover tool.ISC
- AlicenseNot gradedqualityBmaintenanceExposes Spotify search, playlist, library, discovery, and playback tools to AI assistants over MCP Streamable HTTP. Supports Spotify OAuth, multi-client MCP OAuth with PKCE and dynamic client registration, encrypted token storage, and self-hosted Docker deployment.1AGPL 3.0