Skip to main content

qb-mcp

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

CI PyPI Python Coverage License MCP

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.

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

Metadata

Release files for qb-mcp 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qb-mcp 0.2.4
File Size Uploaded Provenance Actions
qb_mcp-0.2.4.tar.gz 108.5 kB With provenance Details for qb_mcp-0.2.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qb-mcp 0.2.4
File Interpreter ABI Platform Actions
qb_mcp-0.2.4-py3-none-any.whl Python 3 none any Details for qb_mcp-0.2.4-py3-none-any.whl

Total release size: 138.7 kB

Release files / qb_mcp-0.2.4.tar.gz

Download URL qb_mcp-0.2.4.tar.gz
Size 108.5 kB
Tags Source
SHA-256 checksum
How to use checksums
132695aadb9d810bf5634e33388bf354b1746f7955bb5fea485abb1b9650b768
BLAKE2b-256 checksum
How to use checksums
d4563119669cb8b5976e91413da9193de536631356be6d5d8d51efedfa4ff2bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / qb_mcp-0.2.4-py3-none-any.whl

Download URL qb_mcp-0.2.4-py3-none-any.whl
Size 30.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f76412b76d9888d72fa445604b0efe86231881c8058574b27bfd709c2f980df1
BLAKE2b-256 checksum
How to use checksums
ce9732d4822a778265cd1e1e16c41edf63aac9b2c213706dc0aaa3f10c9b77ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Security for qb-mcp 0.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for qb_mcp-0.2.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page