Control Sonos From an AI Agent (MCP Server Guide)

Connect Sonos to Claude or any MCP client with the Castbreeze Sonos MCP server. Let an AI agent play radio, audio clips and chimes on your speakers.

By Sem Postma
MCPAISonosAutomation

The Cast to Sonos Chrome extension is great when you want to cast live audio from a tab. But sometimes you don't want to sit at a browser at all — you want your speakers to be controllable by an AI agent or automation: "play the morning news in the kitchen," "chime when the build finishes," "loop lo-fi in the office until 6pm." That's exactly what the Castbreeze Sonos MCP server is for.

It's published on npm as @castbreeze/sonos-mcp and speaks the Model Context Protocol, so any MCP-compatible agent — Claude Desktop, Cline, or your own — can drive your Sonos speakers through a small set of tools.

What you'll need

  • Node.js 22 or newer
  • A Castbreeze account (for OAuth)
  • Sonos speakers on your network
  • An MCP-compatible client (e.g. Claude Desktop)

Step 1: Add the Sonos MCP server to your agent

In Claude Desktop, open your claude_desktop_config.json and add the server. You don't have to install anything first — npx fetches it on demand:

{
  "mcpServers": {
    "castbreeze-sonos": {
      "command": "npx",
      "args": ["-y", "@castbreeze/sonos-mcp"]
    }
  }
}

Restart the client so it picks up the new server.

Step 2: Authenticate with Castbreeze

The server uses OAuth. Ask your agent to start the login flow:

  • Run the start_login tool — it opens your browser to authorize.
  • Approve access, copy the authorization code.
  • Run finish_login with that code.

The access token is saved (in auth.json) so you only do this once.

Step 3: Discover your speakers

Ask the agent to run get_groups. You'll get back your Sonos households, groups, and players — the names you'll reference when you tell it where to play.

Step 4: Tell the agent what to play

Now you can just ask, in plain language. Behind the scenes the agent calls one of these tools:

  • play_radio — play a stream URL on repeat (great for background music or a radio station).
  • play_audio_clip — play an MP3/WAV from a URL or file:// path (announcements, alerts).
  • play_default_chime — play a built-in chime (notifications, "dinner's ready").
  • get_groups — list speakers and groups.

Each playback tool takes optional volume and priority, so an alert can duck in over music and then hand back.

Example prompts

  • "Play https://example.com/stream.mp3 on repeat in the Office group at volume 30."
  • "Chime all speakers — the deployment just finished."
  • "What Sonos groups do I have?"

Frequently asked questions

What is the Castbreeze Sonos MCP server?

It's an MCP (Model Context Protocol) server, published on npm as @castbreeze/sonos-mcp, that gives an AI agent a set of tools to control your Sonos speakers — playing radio streams, audio clips and chimes, listing groups, and setting volume — over an authenticated Castbreeze connection.

Which AI agents and clients does it work with?

Any MCP-compatible client. The README documents Claude Desktop and Cline, but the same server entry works with other MCP clients and custom agents that speak the Model Context Protocol.

What can the agent actually do with my Sonos?

It exposes tools to play a radio URL on repeat (play_radio), play an MP3/WAV clip from a URL or file (play_audio_clip), play a default chime (play_default_chime), and list speaker groups (get_groups), with optional volume and priority controls.

Do I still need the Cast to Sonos Chrome extension?

They're different tools for different jobs. The extension casts live audio from a browser tab; the MCP server lets an AI agent trigger and automate playback programmatically. Use whichever fits, or both.

What do I need to get started?

Node.js 22 or newer, a Castbreeze account for OAuth, and Sonos speakers on your network. No extra hardware.

Prefer to just cast a tab?

If you only want to send the audio from a browser tab to Sonos, the Chrome extension is the simpler route.

Add to Chrome — Free

Free to start · No account needed.

Related guides