sonarr-mcp-server
# sonarr-mcp-server
An [MCP](https://modelcontextprotocol.io) server for [Sonarr](https://sonarr.tv) that lets Claude (or any MCP client)
browse and manage your TV library: see what's airing, check downloads, add shows, run searches, fix stuck imports and more.
- **Zero setup:** run it with `npx`. Nothing to clone, build or download. You only pass your Sonarr URL and API key.
- **No dependencies:** ships as a single bundled file, so `npx` starts it quickly.
- **36 tools** for series, episodes, calendar, missing episodes, queue, history, release search, commands and system status,
plus a raw API tool for everything else.
- **Safe by default:** tools are labeled read-only or destructive, deletes keep files unless asked, and `--read-only` mode
hides every tool that changes anything.
> Targets the **Sonarr v5 API** (`/api/v5`).
## Quick start
You need **Node.js 18.17+** and your Sonarr API key (Sonarr → **Settings → General → Security → API Key**).
```bash
npx -y sonarr-mcp-server --url http://localhost:8989 --api-key YOUR_API_KEY
```
### Claude Desktop
Add this to `claude_desktop_config.json` (Settings → Developer → Edit Config), then restart Claude Desktop:
```json
{
"mcpServers": {
"sonarr": {
"command": "npx",
"args": ["-y", "sonarr-mcp-server", "--url", "http://localhost:8989", "--api-key", "YOUR_API_KEY"]
}
}
}
```
### Claude Code
```bash
claude mcp add sonarr -- npx -y sonarr-mcp-server --url http://localhost:8989 --api-key YOUR_API_KEY
```
### Other MCP clients (Cursor, VS Code, etc.)
Use the command `npx` with the arguments `-y sonarr-mcp-server --url <url> --api-key <key>`.
### Keeping the API key out of arguments
Every option can also come from an environment variable, which most MCP clients support:
```json
{
"mcpServers": {
"sonarr": {
"command": "npx",
"args": ["-y", "sonarr-mcp-server"],
"env": {
"SONARR_URL": "http://localhost:8989",
"SONARR_API_KEY": "YOUR_API_KEY"
}
}
}
}
```
## Options
| Argument | Environment variable | Description |
| --- | --- | --- |
| `--url`, `-u` | `SONARR_URL` | Sonarr URL, e.g. `http://192.168.1.10:8989`. Include your URL base if you use one, e.g. `https://example.com/sonarr`. |
| `--api-key`, `-k` | `SONARR_API_KEY` | Sonarr API key. |
| `--read-only` | `SONARR_READ_ONLY=true` | Only expose tools that read data. |
| `--timeout <ms>` | `SONARR_TIMEOUT_MS` | HTTP timeout (default `60000`). Release searches always allow up to 3 minutes. |
| `--api-version <v>` | `SONARR_API_VERSION` | API path segment (default `v5`). |
You can also pass the URL and key as positional arguments: `npx -y sonarr-mcp-server http://localhost:8989 YOUR_API_KEY`.
## Tools
| Area | Tools |
| --- | --- |
| System | `sonarr_get_system_status` (version, health warnings, disk space, queue summary), `sonarr_list_quality_profiles`, `sonarr_list_root_folders`, `sonarr_list_tags`, `sonarr_create_tag`, `sonarr_parse_title` |
| Series | `sonarr_list_series`, `sonarr_get_series`, `sonarr_lookup_series`, `sonarr_add_series`, `sonarr_update_series`, `sonarr_delete_series`, `sonarr_set_season_monitoring` |
| Episodes | `sonarr_list_episodes`, `sonarr_get_episode`, `sonarr_set_episode_monitoring`, `sonarr_list_episode_files`, `sonarr_delete_episode_files` |
| Calendar & wanted | `sonarr_get_calendar`, `sonarr_get_wanted_missing`, `sonarr_get_wanted_cutoff_unmet` |
| Downloads | `sonarr_get_queue`, `sonarr_remove_queue_items`, `sonarr_grab_queue_items`, `sonarr_get_history`, `sonarr_mark_history_failed`, `sonarr_search_releases`, `sonarr_grab_release` |
| Commands | `sonarr_search_episodes`, `sonarr_search_series`, `sonarr_search_wanted`, `sonarr_refresh_series`, `sonarr_run_command`, `sonarr_get_commands` |
| Anything else | `sonarr_list_api_endpoints` (every endpoint in the v5 spec, filterable), `sonarr_api_request` (raw call to any endpoint) |
Results are trimmed to the useful fields (no image URLs, translations and so on) so large libraries fit in the model's context.
### Things to try
- "What's airing this week?"
- "What's downloading right now, and is anything stuck?"
- "Add Severance and grab all existing episodes in 1080p."
- "Which episodes of The Expanse am I missing?"
- "Search for a better release of S02E05 and show me what's available."
- "Why didn't this import? `Show.Name.S01E01.1080p.WEB.h264-GROUP`"
## Development
```bash
npm install
npm run build # bundle src/ into dist/index.js
npm test # build, then run end-to-end tests against a fake Sonarr
npm run typecheck
```
Run your local build: `node dist/index.js --url http://localhost:8989 --api-key YOUR_API_KEY`.
To try it with the MCP Inspector:
```bash
npx @modelcontextprotocol/inspector node dist/index.js --url http://localhost:8989 --api-key YOUR_API_KEY
```
The endpoint index used by `sonarr_list_api_endpoints` is generated from the Sonarr OpenAPI spec in `openapi/`.
After updating the spec, run `npm run generate`.
### Publishing
```bash
npm login
npm publish
```
`prepublishOnly` runs the typecheck and the tests first. Only `dist/index.js`, this README and the license are published.
## License
MIT. The Sonarr OpenAPI document in `openapi/` belongs to the Sonarr project and is licensed under GPL-3.0.
TDQS
Scored across 36 tools
Tools are largely organized around distinct resources (series, episodes, files, queue, history, commands), and the descriptions make boundaries clear. The main overlap is the catch-all sonarr_run_command and sonarr_api_request duplicating dedicated operations like search/refresh/rescan, but the descriptions explicitly steer agents toward the specific tools. Minor potential confusion between sonarr_grab_release and sonarr_grab_queue_items, though scopes differ.
Every tool uses the sonarr_ prefix followed by a clear verb_noun pattern (list_series, get_episode, add_series, search_releases, delete_episode_files) in consistent snake_case. No mixing of conventions or vague verbs.
36 tools is on the heavy side for the stated scope, and some dedicated tools are partly redundant with sonarr_run_command and sonarr_api_request. However the Sonarr domain is genuinely broad (library, episodes, files, queue, history, search, monitoring), so most tools do map to real operations.
The surface covers the full lifecycle well: series CRUD/lookup, episodes, files, monitoring, queue, history, search, tags, quality profiles, root folders, calendar, and wanted lists. A few areas (indexers, blocklist management, notifications/settings) are only reachable via sonarr_api_request rather than dedicated tools, which is a minor gap.