MCP Sonarr Server
Provides tools for interacting with a Sonarr instance's API, enabling AI assistants to manage TV series, episodes, downloads, calendar, history, missing episodes, commands, disk space, and system statistics.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MCP Sonarr Server
A Model Context Protocol (MCP) server that enables AI assistants like Claude and ChatGPT to control your Sonarr instance. Manage your TV series library, search for shows, monitor downloads, and get statistics through natural language.
Features
Series Management: Search, add, update, and delete TV series
Episode Management: View episodes, track downloads, manage files
Download Queue: Monitor and manage current downloads
Calendar: View upcoming episodes
Statistics: Get comprehensive library statistics
System Status: Health checks, disk space, and configuration info
Remote Access: HTTP API for integration with Claude/ChatGPT
Docker Support: Easy deployment with Docker and docker-compose
Related MCP server: Sonarr & Radarr MCP Server
Quick Start
Using Docker (Recommended)
Clone the repository:
git clone https://github.com/ZakiZtraki/mcp-sonarr.git
cd mcp-sonarrCreate your environment file:
cp .env.example .envEdit
.envwith your Sonarr details:
SONARR_URL=https://sonarr.zenmedia.live
SONARR_API_KEY=your-api-key-here
MCP_AUTH_TOKEN=your-secure-token # Optional but recommendedStart the server:
docker-compose up -dThe MCP server will be available at http://localhost:8080.
Manual Installation
Clone the repository:
git clone https://github.com/ZakiZtraki/mcp-sonarr.git
cd mcp-sonarrInstall dependencies:
pip install -e .Set environment variables:
export SONARR_URL=https://sonarr.zenmedia.live
export SONARR_API_KEY=your-api-key-hereRun the server:
# For HTTP server (remote access)
python -m mcp_sonarr.http_server
# For stdio server (local MCP client)
mcp-sonarrConfiguration
Environment Variables
Variable | Required | Description |
| Yes | URL of your Sonarr instance |
| Yes | Sonarr API key (Settings -> General -> API Key) |
| No | Simple Bearer token for API authentication |
| No | Server host (default: |
| No | Server port (default: |
OAuth 2.0 Configuration (for ChatGPT)
Variable | Required | Description |
| For OAuth | OAuth client ID (provide to ChatGPT) |
| For OAuth | OAuth client secret (provide to ChatGPT) |
| For OAuth | Password for the authorization form |
| No | Secret for signing JWTs (auto-generated if not set) |
| No | Token expiry in minutes (default: |
Integration with AI Assistants
Claude Desktop
Add to your Claude Desktop configuration (~/.config/claude/claude_desktop_config.json on Linux/Mac or %APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"sonarr": {
"command": "mcp-sonarr",
"env": {
"SONARR_URL": "https://sonarr.zenmedia.live",
"SONARR_API_KEY": "your-api-key-here"
}
}
}
}Claude (Remote MCP Server)
For Claude with remote MCP server support, configure the HTTP endpoint:
{
"mcpServers": {
"sonarr": {
"type": "http",
"url": "https://your-mcp-server.com/mcp",
"headers": {
"Authorization": "Bearer your-auth-token"
}
}
}
}ChatGPT (with OAuth Authentication)
ChatGPT supports OAuth 2.0 for authenticating with MCP servers. Here's how to set it up:
1. Configure OAuth on Your Server
Set these environment variables on your MCP server:
# Generate secure values for these
OAUTH_CLIENT_ID=my-chatgpt-client
OAUTH_CLIENT_SECRET=your-super-secret-value-here
OAUTH_AUTH_PASSWORD=your-authorization-password2. Configure ChatGPT Custom Action
In ChatGPT, create a new GPT or edit an existing one:
Go to Configure → Actions → Create new action
Set the Authentication type to OAuth
Enter the following OAuth settings:
Client ID: Your
OAUTH_CLIENT_IDvalueClient Secret: Your
OAUTH_CLIENT_SECRETvalueAuthorization URL:
https://your-mcp-server.com/oauth/authorizeToken URL:
https://your-mcp-server.com/oauth/tokenScope:
full(or leave empty)
Import the OpenAPI schema from your server, or manually configure the MCP endpoint:
Server URL:
https://your-mcp-server.com
3. Authorize Access
When ChatGPT tries to use your MCP server for the first time:
You'll be redirected to the authorization page
Enter your
OAUTH_AUTH_PASSWORDClick Authorize
ChatGPT will receive an access token and can now call your MCP tools
The OAuth flow follows the standard Authorization Code grant type, which ChatGPT handles automatically.
ChatGPT (Simple Bearer Token)
For simpler setups without OAuth, you can use a Bearer token:
Set
MCP_AUTH_TOKEN=your-secure-tokenon your serverIn ChatGPT, configure the action with API Key authentication
Set the header to
Authorization: Bearer your-secure-token
Available Tools
System & Statistics
Tool | Description |
| Get Sonarr system information |
| Check for any issues |
| Get comprehensive library statistics |
| View disk space for root folders |
| List configured root folders |
| List quality profiles |
| List all tags |
Series Management
Tool | Description |
| List all series in library |
| Get details for a specific series |
| Search for series to add |
| Add a new series |
| Remove a series |
Episodes
Tool | Description |
| List episodes for a series |
| List downloaded files for a series |
Calendar & Queue
Tool | Description |
| View upcoming episodes |
| View download queue |
| Remove item from queue |
History & Wanted
Tool | Description |
| View download history |
| List missing episodes |
Commands
Tool | Description |
| Search for all episodes of a series |
| Search for a specific season |
| Refresh series metadata |
| Rescan disk for files |
| Trigger RSS sync |
API Endpoints
Endpoint | Method | Description |
| GET | Health check |
| GET | Server information |
| POST | MCP Streamable HTTP endpoint (for ChatGPT/Claude) |
| GET, POST | OAuth 2.0 authorization endpoint |
| POST | OAuth 2.0 token endpoint |
| GET | OAuth 2.0 server metadata |
The /mcp endpoint implements the full MCP protocol over HTTP, supporting:
initialize- Initialize the MCP sessiontools/list- List available toolstools/call- Execute a tool
Example Usage
Get Library Statistics
"Hey Claude, can you show me my Sonarr library statistics?"Search and Add a Series
"Search for 'Breaking Bad' on Sonarr and add it to my library"Check Download Queue
"What's currently downloading in Sonarr?"View Upcoming Episodes
"What episodes are coming up this week?"Find Missing Episodes
"Show me which episodes are missing from my library"Security Considerations
Use HTTPS: Always deploy behind a reverse proxy with TLS
Enable Authentication: Use OAuth (
OAUTH_*variables) or simple Bearer token (MCP_AUTH_TOKEN)Strong Secrets: Use long, random values for
OAUTH_CLIENT_SECRETandOAUTH_AUTH_PASSWORDFirewall: Limit access to trusted networks/IPs
API Key Security: Never expose your Sonarr API key publicly
Token Expiry: Adjust
OAUTH_ACCESS_TOKEN_EXPIRE_MINUTESbased on your security requirements
Deployment with Traefik
Example docker-compose.yml for Traefik:
version: '3.8'
services:
mcp-sonarr:
build: .
environment:
- SONARR_URL=https://sonarr.zenmedia.live
- SONARR_API_KEY=${SONARR_API_KEY}
- MCP_AUTH_TOKEN=${MCP_AUTH_TOKEN}
labels:
- "traefik.enable=true"
- "traefik.http.routers.mcp-sonarr.rule=Host(`mcp-sonarr.yourdomain.com`)"
- "traefik.http.routers.mcp-sonarr.entrypoints=websecure"
- "traefik.http.routers.mcp-sonarr.tls.certresolver=letsencrypt"
networks:
- traefik
networks:
traefik:
external: trueDevelopment
Setup Development Environment
# Clone repository
git clone https://github.com/ZakiZtraki/mcp-sonarr.git
cd mcp-sonarr
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Linux/Mac
# or .venv\Scripts\activate # Windows
# Install with dev dependencies
pip install -e ".[dev]"
# Run tests
pytestProject Structure
mcp-sonarr/
├── src/
│ └── mcp_sonarr/
│ ├── __init__.py
│ ├── server.py # MCP server (stdio transport)
│ ├── http_server.py # HTTP server (remote access)
│ ├── sonarr_client.py # Sonarr API client
│ └── auth.py # OAuth 2.0 authentication
├── tests/
├── Dockerfile
├── docker-compose.yml
├── pyproject.toml
└── README.mdLicense
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
Issues: GitHub Issues
Sonarr API Docs: Sonarr Wiki
MCP Specification: MCP Docs
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Track the TV and films you watch, and find more like them, by talking to your own AI.
Control Android TV from any AI. 38 MCP tools: playback, recap, recommend, smart-home, schedules.
The media memory layer for AI agents and their humans. Your AI client can search your collection, add and log what you've finished, update ratings and lists, and find patterns across everything you've read, watched, played, and listened to.
Connects AI assistants to TrackingTime for querying time entries, projects, tasks, customers, and team data using natural language.
Related MCP Servers
- FlicenseBqualityDmaintenanceEnables AI assistants to manage TV series collections through Sonarr's API using natural language interactions. Supports searching, adding, updating, and deleting TV series with detailed control over quality profiles, season monitoring, and episode downloads.9-
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Sonarr and Radarr APIs to query media libraries, check recent additions, view upcoming releases, manage download queues, and perform searches for TV shows and movies through natural language.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to manage media automation services like Sonarr, Radarr, Prowlarr, Bazarr, Overseerr, and Plex through natural language commands.10MIT
- FlicenseAqualityDmaintenanceEnables users to manage Sonarr and Radarr instances through natural language, allowing search, addition, deletion, and monitoring of TV series and movies.60-