Skip to main content
Glama
qbittorrent-mcp

qbittorrent-mcp

by akioruri
README.md
# qbittorrent-mcp

English | [简体中文](README.zh.md)

An [MCP](https://modelcontextprotocol.io) server that manages torrents through the qBittorrent WebUI API. Once connected, an AI assistant can add, pause, rate-limit and rename torrents directly, and search for resources.

## Features

| Category           | Tools                                                                                                            |
| ------------------ | ---------------------------------------------------------------------------------------------------------------- |
| Torrent management | `add_torrent`, `delete_torrent`, `pause_torrent`, `resume_torrent`, `get_torrent_list`                           |
| Torrent details    | `get_torrent_trackers`, `add_trackers_to_torrent`, `add_torrent_tags`                                            |
| File management    | `get_torrent_files`, `rename_torrent`, `rename_torrent_file`, `rename_torrent_folder`, `batch_rename`            |
| File priority      | `set_file_priority`                                                                                              |
| Speed limits       | `set_global_download_limit`, `set_global_upload_limit`, `set_torrent_download_limit`, `set_torrent_upload_limit` |
| Search and info    | `search_torrents`, `get_application_version`                                                                     |

## Requirements

- Python 3.14 or later
- [uv](https://docs.astral.sh/uv/)
- qBittorrent with the WebUI enabled, reachable from the machine running this server
- For `search_torrents`, a search plugin enabled in qBittorrent

## Installation

```bash
git clone <repository-url>
cd qbittorrent-mcp
uv sync
```

## Configuration

Set the following environment variables, for example in your shell profile or in the MCP client's `env` configuration:

```bash
export QBITTORRENT_HOST=http://127.0.0.1:8080
export QBITTORRENT_USERNAME=admin
export QBITTORRENT_PASSWORD=adminadmin
```

| Variable               | Description                                | Default                 |
| ---------------------- | ------------------------------------------ | ----------------------- |
| `QBITTORRENT_HOST`     | WebUI address, including protocol and port | `http://127.0.0.1:8080` |
| `QBITTORRENT_USERNAME` | WebUI username                             | `admin`                 |
| `QBITTORRENT_PASSWORD` | WebUI password                             | `adminadmin`            |

If a variable is not set, the default shown above is used.

## Running

The server uses the stdio transport and is normally launched by an MCP client, so you do not need to run it manually. For a local check:

```bash
uv run qbittorrent-mcp
```

## Connecting an MCP client

Example using the `mcpServers` configuration format (such as Claude Desktop):

```json
{
  "mcpServers": {
    "qbittorrent": {
      "command": "/absolute/path/to/qbittorrent-mcp/.venv/bin/qbittorrent-mcp"
    }
  }
}
```

Replace the path with the absolute path to this project's `.venv/bin/qbittorrent-mcp` (run `uv sync` first to create it). To pass credentials, add an `env` block to the server entry:

```json
{
  "mcpServers": {
    "qbittorrent": {
      "command": "/absolute/path/to/qbittorrent-mcp/.venv/bin/qbittorrent-mcp",
      "env": {
        "QBITTORRENT_HOST": "http://127.0.0.1:8080",
        "QBITTORRENT_USERNAME": "admin",
        "QBITTORRENT_PASSWORD": "adminadmin"
      }
    }
  }
}
```

## Usage examples

Describe what you need in natural language, for example:

- "List all torrents that are downloading"
- "Pause the torrent with hash `xxx`"
- "Set the global upload limit to 1 MB/s"
- "Show the files of a torrent and rename the first one to `movie.mkv`"
- "Search for Ubuntu 24.04 and list the results with the most seeders"

## Notes

- `delete_torrent` with `delete_files=True` permanently deletes downloaded files, and `hashes` set to `all` deletes every torrent. Double-check before running.
- The `old_path` of `rename_torrent_file` must exactly match the file's relative path inside the torrent, including directories. Use `get_torrent_files` to get it.
- `rename_torrent_folder` renames a folder inside a torrent and requires qBittorrent v4.4.0 or later. `old_path` must be an existing folder path relative to the torrent root.
- `batch_rename` takes a JSON array of `{old_path, new_path, type}` items (`type` is `file` or `folder`, defaults to `file`) and executes them sequentially in the given order. Renaming a folder changes the paths of everything inside it, so order operations accordingly. A failed item does not stop the rest.
- `search_torrents` filters out results larger than `max_size_gb` (default 5 GB) and returns the top 10 by seeders.
- Speed limits are in bytes per second.
- Tool errors are returned to the client as strings and do not stop the server.

## Project structure

```
src/qbittorrent_mcp/
├── api.py     # Async functions that call the qBittorrent WebUI API
└── mcp.py     # MCP server and tool registration; entry point is main()
```

## License

See [LICENSE](LICENSE).

TDQS

B3.1/5.0

Scored across 20 tools

Disambiguation4/5

Most tools have clearly distinct resource+action targets, and descriptions clarify the rename tiers (torrent vs file vs folder vs batch) and the four speed-limit tools. The main soft spot is get_torrent_list vs search_torrents, which sound like they both search torrents but actually hit local vs external indexers, and that distinction is buried in a Chinese-only description.

Naming Consistency4/5

Strong, predictable verb_noun snake_case pattern (add_torrent, delete_torrent, pause_torrent, get_torrent_files, set_torrent_download_limit). Minor deviations like add_trackers_to_torrent and the object-order get_torrent_list keep it from a perfect score but remain readable and unambiguous.

Tool Count3/5

20 tools sits in the borderline-heavy band for a single-client integration. There is visible granularity inflation: four speed-limit setters (global/torrent × up/down) and four rename variants where batch_rename already subsumes the file/folder cases.

Completeness3/5

Core lifecycle is covered (add, delete, pause, resume, list, files, trackers, tags, priority, limits, renames), so agents can do the main workflows. But there are notable gaps: no read-back for global/torrent limits, no torrent properties/info endpoint, no category management, and no removal of trackers or tags, which will dead-end common management tasks.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues