Skip to main content
Glama
qb-mcp

qb-mcp

qb-mcp

An MCP server for qBittorrent — manage torrents with natural language.

CI PyPI Python Coverage License MCP qb-mcp MCP server

This is an unofficial project. It is not affiliated with, endorsed by, or supported by the qBittorrent project.

English | 简体中文

Ask your agent "why isn't this torrent uploading?" and it can actually answer — tracker health, listening port, speed caps and peer supply, instead of guessing. Ask it to pause the seedbox and it knows qBittorrent 5.x renamed that endpoint.

qb-mcp wraps the qBittorrent WebUI API v2 and exposes it as eleven tools that an AI agent can call. It manages any number of instances, each with its own credentials, so a single agent can drive a home NAS and a remote seedbox at once.

Why this exists

qBittorrent has a complete HTTP API but no MCP interface. Wrapping it means an agent can answer "why isn't it uploading?" by actually checking tracker health, listening ports, speed limits and peer supply — instead of guessing.

The eleven tools are grouped by user intent, not by API endpoint: mapping all 80+ endpoints one-to-one would produce a tool list no model can choose from.

Related MCP server: Transmission MCP Server

Features

  • Multiple instances, each with independent credentials

  • qb_diagnose — turns "why is nothing uploading?" into one call

  • Field-trimmed responses — the API returns 30+ fields per torrent; this returns 12

  • Before/after reporting on every write operation

  • delete_files is opt-in — removing a torrent never deletes data by default

  • stdio and HTTP transports

  • Credentials never leave your machine; nothing is logged

Quick start

pip install qb-mcp
cp instances.example.json .instances.json
# edit .instances.json with your qBittorrent URL and credentials
chmod 600 .instances.json
qb-mcp

Configuration

qb-mcp reads .instances.json from the current directory, or the path in QB_MCP_CONFIG.

{
  "instances": {
    "nas": {
      "label": "Home NAS",
      "url": "http://192.168.1.100:8080",
      "username": "admin",
      "password": "${QB_PASS_NAS}"
    },
    "seedbox": {
      "url": "https://seedbox.example.com",
      "username": "me",
      "password": {"file": "~/.secrets/seedbox"}
    }
  }
}

Field

Required

Default

Notes

url

✅

—

Must start with http:// or https://

username

✅

—

Per-instance; instances may use different accounts

password

✅

—

Literal, "${ENV_VAR}", or {"file": "/path"}

label

—

key

Display name

verify_ssl

—

true

Set false for self-signed certificates

timeout

—

8.0

Per-request timeout in seconds

Keep .instances.json out of version control. It is already listed in .gitignore. qb-mcp prints a warning if the file is readable by group or others.

Tools

Read (safe)

Tool

Purpose

qb_instances

List configured instances and whether each is reachable

qb_overview

Global status for one or all instances

qb_list

Torrent list with filtering, sorting and a row limit

qb_detail

One torrent in depth, including tracker status (tracker URLs are redacted unless show_tracker_urls=True)

qb_diagnose

Explain why an instance is or is not uploading

Write (state-changing)

Tool

Purpose

qb_control

pause / resume / reannounce / force_start

qb_set_limit

Global or per-torrent speed limits

qb_set_share

Ratio / seeding-time / inactive-seeding-time limits (minutes) and the action taken on reaching them

qb_add

Add from magnet, URL or a local .torrent (paused by default)

qb_remove

Remove torrents; delete_files is opt-in

qb_category

Assign categories and tags

Client setup

stdio (Claude Desktop, Cursor, most local clients):

{
  "mcpServers": {
    "qbittorrent": {
      "command": "qb-mcp",
      "env": { "QB_MCP_CONFIG": "/absolute/path/to/.instances.json" }
    }
  }
}

HTTP (remote or multi-client):

qb-mcp --transport http --host 127.0.0.1 --port 17890
{
  "servers": {
    "qbittorrent": {
      "url": "http://127.0.0.1:17890/mcp",
      "transport": "streamable_http"
    }
  }
}

Compatibility

qBittorrent

WebUI API

Status

4.x

2.8+

Supported

5.x

2.11+

Supported (tested on 5.2.4)

Both official builds and third-party NAS packages (QNAP QPKG, Synology SPK) work, with the proxy quirks below already handled.

Troubleshooting

login rejected (Fails.)

qBittorrent returns HTTP 200 even when the password is wrong — the body is Fails. instead of Ok.. qb-mcp inspects the body, so this message means the credentials are genuinely wrong.

Login fails behind a reverse proxy

The official API requires Referer or Origin to match the request Host exactly, including the port. qb-mcp sets both from your configured url, so make sure url uses the same host and port you would type in a browser.

Works with curl but not through a proxy

Some reverse proxies (QNAP QTS is one) return 204 No Content with an empty body on a successful login instead of 200 Ok.. qb-mcp treats any status below 400 with an empty or Ok. body as success.

login blocked - too many failed attempts

qBittorrent temporarily bans an IP after repeated failures. Wait a few minutes, or check the WebUI's ban list.

Development

git clone https://github.com/zxw060810/qb-mcp.git
cd qb-mcp
pip install -e ".[dev]"
ruff check .
mypy src
pytest

Tests mock the qBittorrent API; no live instance is required.

License

Apache-2.0

Available Tools

11 tools
qb_addA

Add a torrent from a URL, magnet link, or a local .torrent path.

Args: instance: instance key from .instances.json. source: magnet link, http(s) URL, or absolute path to a .torrent file. savepath: target directory; empty uses the instance default. category: category to assign. paused: add in paused state (default true) so it can be reviewed first. wait_seconds: how long to wait for the torrent to show up. Magnet links ingest metadata asynchronously, so the add request returning 200 does not prove anything; the torrent must appear in the list.

Inputs: source (required), instance (required), paused, category, +2 more. Returns: result

qb_categoryA
Idempotent

Move torrents into a category and/or add tags to them.

Use this to organise a library after the fact - a new download that landed in the wrong category, or a batch you want to find again later. It changes metadata only; nothing is downloaded, stopped or removed.

Tags merge, they do not replace: the values in tags are appended to whatever the torrent already carries, and there is no call here for removing a tag. The category is assigned as a whole, so an empty category leaves the existing one untouched rather than clearing it.

Both fields are optional but at least one must be non-empty, otherwise the call returns an error. If the category is applied and the tag call then fails, the category change stays and the error names the failure - the operation is not rolled back.

Args: instance: instance key from .instances.json. hashes: torrent hashes to update. category: category name; empty leaves it unchanged. tags: tags to append; existing tags are kept.

Inputs: hashes (required), instance (required), tags, category. Returns: result

qb_controlB
Idempotent

Change torrent state.

Args: instance: instance key from .instances.json. action: pause | resume | reannounce | force_start. hashes: torrent hashes; empty means every torrent.

Inputs: action (required), instance (required), hashes. Returns: result

qb_detailA
Read-onlyIdempotent

Show one torrent in depth, including tracker status.

Args: instance: instance key from .instances.json. hash: torrent hash (preferred). name: fuzzy name match, used when hash is empty. show_tracker_urls: reveal full announce URLs (they may contain a private tracker passkey - off by default so the secret never reaches the model).

Inputs: instance (required), hash, name, show_tracker_urls. Returns: result

qb_diagnoseA
Read-onlyIdempotent

Explain why a qBittorrent instance is (or is not) uploading.

Checks login, tracker health, listening port, peer counts, speed limits and torrent states, then states a conclusion.

Args: instance: instance key from .instances.json. hash: optional torrent hash to inspect trackers for a single torrent.

Inputs: instance (required), hash. Returns: result

qb_instancesA
Read-onlyIdempotent

List every configured qBittorrent instance and whether it is reachable.

Inputs: no named parameters. Returns: result

qb_listA
Read-onlyIdempotent

List torrents on one instance.

Args: instance: instance key from .instances.json. filter: all | downloading | seeding | completed | paused | active | stalled | errored. category: restrict to a category name. sort: field to sort by, e.g. uploaded, ratio, added_on, size. limit: maximum rows to return (1-50).

Inputs: instance (required), sort, limit, filter, +1 more. Returns: result

qb_overviewA
Read-onlyIdempotent

Summarise one instance (or all) without listing any torrent.

Use this first, when the question is "what is this instance doing right now": it returns connection state, live up/down speed, all-time transfer totals and a count of torrents per state. Reach for qb_list when you need the torrents themselves, qb_detail for one torrent's files and trackers, and qb_diagnose when the question is specifically why nothing is uploading.

Returns, per instance, the qBittorrent version, connection status, current speeds, all-time downloaded/uploaded totals, the share ratio, and a breakdown such as "uploading 2, stalledUP 91".

Args: instance: instance key from .instances.json; empty means every instance.

Inputs: instance. Returns: result

qb_removeA
DestructiveIdempotent

Remove torrents from an instance. Downloaded data is kept by default.

Removal is irreversible: the torrent and its resume data are gone, and re-adding it means re-downloading the metadata. If all you want is to stop transferring, pause it with qb_control instead - that keeps everything and can be undone.

Set delete_files only when you also want the payload deleted; that cannot be undone either. Removing a hash that is no longer present is harmless - qBittorrent accepts the call, and the reply counts the hashes you asked to remove rather than the ones that existed.

Args: instance: instance key from .instances.json. hashes: torrent hashes to remove. delete_files: also delete the downloaded data (default false).

Inputs: hashes (required), instance (required), delete_files. Returns: result

qb_set_limitA
Idempotent

Set upload/download speed limits in bytes per second (0 = unlimited).

Args: instance: instance key from .instances.json. up: upload limit in bytes/s; 0 means unlimited. dl: download limit in bytes/s; 0 means unlimited. hashes: torrent hashes; empty means the global limit. mode: "normal" for the normal global limit, "alternative" for the alternative (scheduled) limit. qBittorrent keeps them separate and the active one depends on whether alternative mode is switched on.

Inputs: instance (required), dl, up, mode, +1 more. Returns: result

qb_set_shareA
Idempotent

Set ratio and/or seeding-time limits for specific torrents.

Args: instance: instance key from .instances.json. hashes: torrent hashes to update. ratio: maximum ratio; -1 means unlimited, -2 means use the global value. seeding_time: maximum seeding time in MINUTES (qBittorrent's unit); -1 unlimited, -2 use global (default). inactive_seeding_time: maximum inactive seeding time in MINUTES; -1 unlimited, -2 use global (default). action: what to do once a limit is reached - "stop" (default) or "enable_super_seeding". Removal is deliberately not offered here; use qb_remove for anything destructive. mode: how the limits combine - "default" (inherit), "any" (stop when either limit is reached) or "all" (both). Only qBittorrent 5.3+ honours it; older versions ignore the field.

Inputs: hashes (required), instance (required), mode, ratio, +3 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 11 tools

    Disambiguation5/5

    Each tool targets a distinct level of the domain (instance summary, torrent list, single-torrent detail, diagnosis, mutation of state, limits, share rules, add, remove, metadata), and the descriptions explicitly route between the close pairs (overview vs list vs detail vs diagnose, control vs remove, set_limit vs set_share). The overlap that does exist is called out in prose, so an agent can pick correctly.

    Naming Consistency4/5

    All tools share a clean `qb_` prefix and snake_case, with verb-led names for operations (qb_add, qb_remove, qb_control, qb_set_limit, qb_set_share). A few read as nouns rather than verb_noun (qb_instances, qb_overview, qb_detail, qb_category), which is a minor deviation from an otherwise predictable pattern.

    Tool Count5/5

    Eleven tools is well within a sensible band and each maps to a real qBittorrent capability, with no filler or near-duplicate entry. The surface is scoped enough to be readable in one pass but broad enough to cover the workflow end to end.

    Completeness4/5

    Core lifecycle is covered: discover instances, inspect, diagnose, add, pause/resume/reannounce, throttle, set share rules, tag/categorise, and remove. Gaps remain around metadata management — no category listing/creation or tag removal, and no recheck/verify-data — which an agent would hit when asked to build new categories or clean up tags.

    Maintenance

    ActivityMaintained
    ResponsivenessUsually handled

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      A service that provides programmatic access to qBittorrent's WebUI API, enabling management of torrents, trackers, tags, speed controls, and system information through natural language.
      29
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides tools for interacting with the Transmission BitTorrent client via natural language, enabling users to manage torrents, configure download settings, and monitor download activity.
      4
      MIT
    • F
      license
      A
      quality
      D
      maintenance
      Enables interaction with qBittorrent through its Web API to search for torrents using search plugins and manage downloads. Supports torrent searching, downloading via URLs/magnet links, and torrent management operations like pause, resume, and delete.
      7
      3
      -
    • A
      license
      A
      quality
      C
      maintenance
      MCP server exposing qBittorrent's WebUI API v2 as tools, enabling LLMs to manage torrents, categories, tags, RSS feeds, search plugins, and application settings.
      90
      4
      MIT