Sonos MCP server

Provides a bridge between Sonos audio devices and natural language control, enabling speaker discovery, playback management, volume adjustment, and system configuration through specialized tools for seamless home audio control.
Back to servers
Setup instructions
Provider
Winston Fassett
Release date
Mar 24, 2025
Language
Python
Stats
3 stars

The Sonos MCP Server allows you to control and interact with Sonos devices on your network through a Model Context Protocol (MCP) interface. It provides capabilities for discovering devices, controlling playback, retrieving device states, and managing playback queues.

Installation

To install the Sonos MCP Server, follow these steps:

  1. Clone the repository:

    git clone https://github.com/WinstonFassett/sonos-mcp-server.git
    cd sonos-mcp-server
    
  2. Install the required dependencies using uv:

    uv sync
    

Running the Server

Using Standard I/O

Run the server using standard I/O with:

uv run mcp run server.py

Using Server-Sent Events (SSE)

To run the server with SSE via the Supergateway tool:

npx -y supergateway --port 8000 --stdio "uv run mcp run server.py"

Alternatively, use the convenience script included in the repository:

./npx-serve-sse-8000.sh

Running in Development Mode

For development and debugging purposes, you can run the server with the MCP Inspector:

uv run mcp dev server.py

To use the SSE in development mode, run the Supergateway command in one terminal and then in a second terminal window:

npx @modelcontextprotocol/inspector

Using MCP Tools

The Sonos MCP Server exposes various tools to interact with your Sonos devices. Here are the key functionalities:

Device Discovery and State

  • Get all device states: Retrieve information about all discovered Sonos devices
  • Get device state: Retrieve state information for a specific device
  • Speaker info: Get detailed information about a specific speaker

Playback Control

  • Play/Pause/Stop: Control basic playback functions
  • Next/Previous: Skip between tracks
  • Volume: Get or set the volume level

Queue Management

  • Get queue: Retrieve the current queue
  • Get queue length: Check how many items are in the queue
  • Skip/Play index: Jump to specific tracks in the queue
  • Remove index from queue: Delete specific tracks

Track Information

  • Now playing: See what's currently playing on all devices
  • Get current track info: Get detailed information about the currently playing track

Advanced Features

  • Mode: Get or set the playback mode
  • Party mode: Enable party mode on the current device

These tools allow you to build sophisticated control interfaces or automation workflows for your Sonos system.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "sonos" '{"command":"uv","args":["run","mcp","run","server.py"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "sonos": {
            "command": "uv",
            "args": [
                "run",
                "mcp",
                "run",
                "server.py"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "sonos": {
            "command": "uv",
            "args": [
                "run",
                "mcp",
                "run",
                "server.py"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later