dervish666/sonarr-mcp-server
If you are the rightful owner of sonarr-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Sonarr MCP Server is a Model Context Protocol server designed to integrate with Sonarr for managing TV series, allowing AI assistants to interact with Sonarr for various tasks.
Sonarr MCP Server
A Model Context Protocol (MCP) server that provides integration with Sonarr for managing TV series. This server allows AI assistants to interact with your Sonarr instance to list series, check calendars, search for new shows, and add series to your collection.
Features
- List Series: Retrieve all TV series currently tracked by Sonarr
- Calendar: Get upcoming and recently aired episodes
- Series Lookup: Search for new TV series by name
- Add Series: Add new TV series to Sonarr with custom settings
- Get Monitored Episodes: Retrieve all monitored episodes for a specific series
- Search Monitored Episodes: Trigger Sonarr to actively search for monitored episodes
Prerequisites
- Node.js (version 14 or higher)
- npm or yarn
- A running Sonarr instance
- Sonarr API key
Installation
-
Clone this repository:
git clone <repository-url> cd sonarr-mcp-server
-
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env
-
Edit the
.env
file with your Sonarr configuration:PORT=12009 SONARR_URL=http://your-sonarr-host:8989 SONARR_API_KEY=your-sonarr-api-key-here
Configuration
Getting Your Sonarr API Key
- Open your Sonarr web interface
- Go to Settings > General
- Scroll down to the Security section
- Copy the API Key
Environment Variables
PORT
: The port the MCP server will listen on (default: 12009)SONARR_URL
: The full URL to your Sonarr instanceSONARR_API_KEY
: Your Sonarr API key
Usage
Development
Run the server in development mode with hot reloading:
npm run dev
Production
Build and run the server:
npm run build
npm start
Health Check
The server provides a health check endpoint:
curl http://localhost:12009/health
API Endpoints
MCP Endpoint
The main MCP endpoint is available at:
POST http://localhost:12009/mcp
Available Tools
- listSeries: Get all series tracked by Sonarr
- getCalendar: Get upcoming/recent episodes (optional date range)
- lookupSeries: Search for new series by name
- addSeries: Add a new series to Sonarr
- getMonitoredEpisodes: Get all monitored episodes for a specific series
- searchMonitoredEpisodes: Trigger Sonarr to search for monitored episodes
Integration with AI Assistants
This server implements the Model Context Protocol (MCP) and can be integrated with compatible AI assistants. The server supports both standard MCP protocol and legacy tool discovery for backward compatibility.
Example MCP Request
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "listSeries",
"arguments": {}
},
"id": 1
}
Docker Support
A Dockerfile is included for containerized deployment:
docker build -t sonarr-mcp-server .
docker run -p 12009:12009 --env-file .env sonarr-mcp-server
Troubleshooting
Common Issues
- Connection refused: Ensure Sonarr is running and accessible at the configured URL
- Unauthorized: Verify your API key is correct
- Port already in use: Change the PORT in your
.env
file
Logs
The server logs all requests and errors to the console. Check the logs for detailed error information.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
ISC License
Support
For issues and questions, please open an issue on the GitHub repository.