Spotify MCP Server for macOS
README.md
# Spotify MCP Server for macOS
Control the Spotify app on macOS through the [Model Context Protocol](https://modelcontextprotocol.io/). This server exposes tools for playback, navigation, volume, shuffle, repeat, and context playback so LLM clients can fully manage Spotify using MCP.
## Features
- ✅ Launch Spotify automatically when commands require it
- ✅ Read player status (state, track metadata, position, shuffle/repeat, volume)
- ✅ Playback controls: play, pause, play/pause toggle, next, previous
- ✅ Volume controls: absolute level or relative adjustments
- ✅ Seek within the current track
- ✅ Shuffle and repeat controls
- ✅ Play arbitrary Spotify URIs or URLs with optional seek offset
- ✅ Resource endpoint that returns Spotify status as JSON
> **macOS-only:** Spotify automation relies on AppleScript (JXA) which is only available on macOS. Spotify must be installed locally.
## Prerequisites
- macOS with Spotify installed
- Node.js v18 or newer
- An MCP-compatible client (e.g. Claude Desktop, Cursor, Windsurf, etc.)
- Automation permissions in **System Settings → Privacy & Security → Automation** allowing your MCP host (e.g. "Terminal", "Claude Desktop") to control Spotify
When you run the server for the first time, macOS will prompt for permission. If you deny it, revisit the Automation pane to enable it manually.
## Installation
```bash
npm install
npm run build
```
During development you can run the TypeScript sources directly:
```bash
npm run dev
```
## Running the server
The server communicates over stdio, so you typically let your MCP host spawn it. To run it by hand:
```bash
npm run start
```
The process will stay alive and exchange JSON-RPC messages over stdio until terminated.
### Example Claude Desktop configuration
Add this snippet to `~/Library/Application Support/Claude/claude_desktop_config.json` (create the file if it doesn’t exist) and restart Claude Desktop:
```json
{
"mcpServers": {
"spotify": {
"command": "node",
"args": ["/Users/teephopdisawas/0.at/vs-code/project-3/dist/server.js"],
"env": {}
}
}
}
```
Replace the path with the absolute location of your `dist/server.js` build. When working from TypeScript directly you can use `npx tsx /path/to/src/server.ts` instead of the compiled JS.
### Windsurf / Cursor example
Add an MCP server entry pointing to the same command and arguments. Both editors support stdio transports and will request tool discovery automatically.
## Available tools
| Tool name | Description | Input schema |
|-----------|-------------|--------------|
| `spotify.get_status` | Fetch the latest player status | — |
| `spotify.play` / `spotify.pause` / `spotify.play_pause` | Playback controls | — |
| `spotify.next` / `spotify.previous` | Track navigation | — |
| `spotify.set_volume` | Set absolute volume (0–100) | `{ "volume": number }` |
| `spotify.adjust_volume` | Adjust volume relative to current level | `{ "delta": number }` |
| `spotify.seek` | Seek within the current track | `{ "positionMs": number }` |
| `spotify.set_shuffle` / `spotify.toggle_shuffle` | Control shuffle state | `{ "enabled": boolean }` or `—` |
| `spotify.set_repeat` | Set repeat mode (`off`, `context`, `track`) | `{ "mode": "off" | "context" | "track" }` |
| `spotify.play_uri` | Play a specific Spotify URI/URL with optional offset | `{ "uri": string, "positionMs"?: number }` |
## Resources
- `spotify://status` – Returns the current player status as prettified JSON
## Manual smoke test
To verify Spotify automation outside of MCP, run the status helper:
```bash
npm run status
```
That command prints the raw status JSON to stdout and will surface any automation permission problems immediately.
## Development tips
- `npm run typecheck` – Validate TypeScript types without emitting output
- `npm run build` – Produce `dist/` artifacts for deployment
- `npm run dev` – Run the server directly via `tsx`
### AppleScript debugging
If you encounter automation issues, run the helper in a Node REPL:
```bash
node -e "import('./dist/server.js');"
```
macOS may prompt for permission; accept it so future commands succeed.
## Troubleshooting
- **Spotify isn’t running:** Most tools attempt to launch Spotify automatically. If it still fails, open Spotify manually to confirm it is installed.
- **Automation denied:** Enable the Automation checkbox for your MCP host in System Settings.
- **Volume commands do nothing:** Ensure Spotify is the active output device; some macOS audio setups bypass the Spotify sound volume control.
## License
MIT – see [LICENSE](./LICENSE) for details.
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues