
此工程是一个 Sonos MCP( 模式上下文协议) 服务器, 允许您在网络上控制和与 Sonos 设备交互 .
概览
此工程是一个 Sonos MCP( 模式上下文协议) 服务器, 允许您在网络上控制和与 Sonos 设备交互 。 它提供各种功能,如发现设备,控制回放,检索设备状态,以及管理队列等. - 在网络上发现索诺斯设备 - 设备的检索和控制回放状态 - 管理回放队列 - Expose功能作为MCP工具 - Python 3.12+ - 用于管理Python项目 2. 使用 uv 安装所需的依赖性: 服务器在本地支持MCP可流-http运输(mcp SDK QQ 1.12). 无需代理 : 旧的可选办法(折旧——以上更喜欢可流式http): 要用 MCP 检查器以“ 开发” 模式运行服务器 : 此命令为测试和调试目的托管了 MCP 检查器 .
概述(AI 翻译)
此工程是一个 Sonos MCP( 模式上下文协议) 服务器, 允许您在网络上控制和与 Sonos 设备交互 。 它提供各种功能,如发现设备,控制回放,检索设备状态,以及管理队列等.
□ 特性
- 在网络上发现索诺斯设备
- 获取和控制设备的回放状态
- 管理回放队列
- 将功能作为多功能程序工具进行展示
□ 要求
- Py 3.12+
- [[T0]管理Python项目
□ 安装
QQ 从 Git (直接安装)
QQ 促进发展
-
清除储存库:
-
使用
uv:
□ 使用量
QQ 运行服务器
- 斯特迪奥
使用 stdio 运行服务器 :
QQ HTTP( 可流- http)
服务器在本地支持MCP可流-http运输(mcp SDK QQ 1.12). 无需代理 :
终点: http://127.0.0.1:8090/mcp
环境变量:
Var 默认笔记 |.
QQ[ [T8] [T9] [HTTP 绑定地址 *
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Sonos MCP Server
This project is a Sonos MCP (Model Context Protocol) server that allows you to control and interact with Sonos devices on your network. It provides various functionalities such as discovering devices, controlling playback, retrieving device states, and managing queues.
Features
- Discover Sonos devices on the network
- Retrieve and control playback state for devices
- Manage playback queues
- Expose functionalities as MCP tools
Requirements
- Python 3.12+
uvfor managing Python projects
Installation
From Git (Direct Install)
pip install git+https://github.com/WinstonFassett/sonos-mcp-server.git
For Development
-
Clone the repository:
git clone https://github.com/WinstonFassett/sonos-mcp-server.git cd sonos-mcp-server -
Install the required dependencies using
uv:uv sync
Usage
Running the Server
Stdio
Run the server using stdio:
uv run mcp run server.py
HTTP (streamable-http)
The server supports the MCP streamable-http transport natively (mcp SDK >= 1.12). No proxy needed:
SONOS_MCP_TRANSPORT=streamable-http \
SONOS_MCP_HOST=127.0.0.1 \
SONOS_MCP_PORT=8090 \
uv run sonos-mcp-server
Endpoint: http://127.0.0.1:8090/mcp
Environment variables:
| Var | Default | Notes |
|---|---|---|
SONOS_MCP_TRANSPORT |
stdio |
stdio, sse, or streamable-http |
SONOS_MCP_HOST |
127.0.0.1 |
HTTP bind address |
SONOS_MCP_PORT |
8000 |
HTTP port (path is /mcp) |
SONOS_MCP_ALLOWED_HOSTS |
(localhost only) | Extra Host headers to accept, comma-separated. Needed when serving behind a proxy with a different hostname (e.g. mac-mini.tailc3138.ts.net:*). |
SONOS_DEVICE_IPS |
(SSDP discovery) | Comma-separated speaker IPs. Skips SSDP multicast and resolves names over unicast SOAP — required when the process can’t multicast (e.g. launchd without Local Network permission). |
Legacy: SSE with supergateway
Older alternative (deprecated — prefer streamable-http above):
npx -y supergateway --port 8000 --stdio "uv run mcp run server.py"
Development
To run the server in “development” mode with the MCP Inspector:
uv run mcp dev server.py
This command hosts an MCP Inspector for testing and debugging purposes.
To run the server with SSE in development mode, use the SSE command for supergateway, and in a second terminal window run:
npx @modelcontextprotocol/inspector
Install in Claude Desktop
After publishing to git, users can install directly:
mcp install git+https://github.com/WinstonFassett/sonos-mcp-server.git
Or add to Claude Desktop config:
{
"mcpServers": {
"sonos": {
"command": "sonos-mcp-server"
}
}
}
Available MCP Tools
Use the exposed MCP tools to interact with Sonos devices. The available tools include:
安装
npx -y supergateway --port 8000 --stdio "uv run mcp run server.py"配置
{
"mcpServers": {
"sonos": {
"command": "sonos-mcp-server"
}
}
}