Skip to main content

AI agent for qBittorrent management, RSS automation, and search.

Project description

Qbittorrent Agent

CLI or API | MCP | Agent

PyPI - Version MCP Server PyPI - Downloads GitHub Repo stars GitHub forks GitHub contributors PyPI - License GitHub GitHub last commit (by committer) GitHub pull requests GitHub closed pull requests GitHub issues GitHub top language GitHub language count GitHub repo size GitHub repo file count (file type) PyPI - Wheel PyPI - Implementation

Version: 0.31.0

Documentation — Installation, deployment, usage across the API, CLI, and MCP interfaces, and guidance for provisioning the qBittorrent backing service are maintained in the official documentation.


Table of Contents


Overview

Qbittorrent Agent is a production-grade Agent and Model Context Protocol (MCP) server designed to interface directly with AI agent for qBittorrent management, RSS automation, and search..


Documentation

The complete documentation is published as the official documentation site and is the recommended reference for installation, deployment, and day-to-day operation.

Page Contents
Installation pip, source, extras, prebuilt Docker image
Deployment run the MCP server and A2A agent, Compose, Caddy + Technitium, env config
Usage the MCP tools, the QbittorrentApi client, the CLI
Backing Platform deploy qBittorrent with Docker
Overview concept overview and enterprise readiness
Architecture agent, MCP server, layered client
Concepts concept registry (CONCEPT:QBT-*)

Key Features

  • Consolidated Action-Routed MCP Tools: Minimizes token overhead and eliminates tool bloat in LLM contexts by grouping methods into optimized, togglable tool modules.
  • Enterprise-Grade Security: Comprehensive support for Eunomia policies, OIDC token delegation, and granular execution context tracking.
  • Integrated Graph Agent: Built-in Pydantic AI agent supporting the Agent Control Protocol (ACP) and standard Web interfaces (AG-UI).
  • Native Telemetry & Tracing: Out-of-the-box OpenTelemetry exports and native Langfuse tracing.

CLI or API

This agent wraps the AI agent for qBittorrent management, RSS automation, and search. API. You can interact with it programmatically or via its integrated execution entrypoints.

Detailed instructions on how to use the underlying API wrappers, extended schema bindings, and developer SDK references are maintained in docs/index.md.


MCP

This server utilizes dynamic Action-Routed tools to optimize token overhead and maximize IDE compatibility.

Available MCP Tools

Tool Module Toggle Env Var Enabled by Default Description & Nested Methods
App APP_TOOL True Manage qbittorrent app operations. Action-routed methods: get_api_version, get_application_version, get_build_info, get_default_save_path, get_preferences, set_preferences, shutdown_application.
Log LOG_TOOL True Manage qbittorrent log operations. Action-routed methods: get_main_log, get_peer_log.
Sync SYNC_TOOL True Manage qbittorrent sync operations. Action-routed methods: get_main_data, get_torrent_peers_data.
Transfer TRANSFER_TOOL True Manage qbittorrent transfer operations. Action-routed methods: ban_peers, get_global_download_limit, get_global_transfer_info, get_global_upload_limit, get_speed_limits_mode, set_global_download_limit, set_global_upload_limit, toggle_speed_limits_mode.
Torrents TORRENTS_TOOL True Manage qbittorrent torrents operations. Action-routed methods: add_new_category, add_new_torrent, add_peers, add_torrent_tags, add_trackers_to_torrent, bottom_torrent_priority, create_tags, decrease_torrent_priority, delete_tags, delete_torrents, edit_category, edit_tracker, get_all_categories, get_all_tags, get_torrent_contents, get_torrent_download_limit, get_torrent_list, get_torrent_piece_hashes, get_torrent_piece_states, get_torrent_properties, get_torrent_trackers, get_torrent_upload_limit, get_torrent_webseeds, increase_torrent_priority, pause_torrents, reannounce_torrents, recheck_torrents, remove_categories, remove_torrent_tags, remove_trackers, rename_file, rename_folder, resume_torrents, set_auto_management, set_file_priority, set_force_start, set_super_seeding, set_torrent_category, set_torrent_download_limit, set_torrent_location, set_torrent_name, set_torrent_share_limit, set_torrent_upload_limit, toggle_first_last_piece_priority, toggle_sequential_download, top_torrent_priority.
Rss RSS_TOOL True Manage qbittorrent rss operations. Action-routed methods: add_rss_feed, add_rss_folder, get_all_rss_articles_matching_rule, get_all_rss_auto_downloading_rules, get_all_rss_items, mark_rss_as_read, move_rss_item, refresh_rss_item, remove_rss_auto_downloading_rule, remove_rss_item, rename_rss_auto_downloading_rule, set_rss_auto_downloading_rule.
Search SEARCH_TOOL True Manage qbittorrent search operations. Action-routed methods: delete_search, enable_search_plugin, get_search_plugins, get_search_results, get_search_status, install_search_plugin, start_search, stop_search, uninstall_search_plugin, update_search_plugins.

Detailed tool schemas, parameter shapes, and validation constraints are preserved in docs/mcp.md.

Dynamic Tool Selection & Visibility

This MCP server supports dynamic toolset selection and visibility filtering at runtime. This allows you to restrict the set of exposed tools in order to prevent blowing up the LLM's context window.

You can configure tool filtering via multiple input channels:

  • CLI Arguments: Pass --tools or --toolsets (or their disabled counterparts --disabled-tools and --disabled-toolsets) during startup.
  • Environment Variables: Define standard environment variables:
    • MCP_ENABLED_TOOLS / MCP_DISABLED_TOOLS
    • MCP_ENABLED_TAGS / MCP_DISABLED_TAGS
  • HTTP SSE Request Headers: Pass custom headers during transport initialization:
    • x-mcp-enabled-tools / x-mcp-disabled-tools
    • x-mcp-enabled-tags / x-mcp-disabled-tags
  • HTTP SSE Request Query Parameters: Append query parameters directly to your transport connection URL:
    • ?tools=tool1,tool2
    • ?tags=tag1

When query strings or parameters are supplied, an LLM-free Knowledge Graph resolution layer (using DynamicToolOrchestrator) matches query intents against known tool tags, names, or descriptions, with safe fallback and automated 24-hour background cache refreshing.


MCP Configuration Examples

stdio Transport (Recommended for local IDEs e.g., Cursor, Claude Desktop)

Configure your IDE's mcp.json to launch the MCP server via uvx:

{
  "mcpServers": {
    "qbittorrent-agent": {
      "command": "uvx",
      "args": [
        "--from",
        "qbittorrent-agent",
        "qbittorrent-mcp"
      ],
      "env": {
        "QBITTORRENT_HOST": "your_qbittorrent_host_here",
        "QBITTORRENT_PORT": "your_qbittorrent_port_here",
        "QBITTORRENT_USERNAME": "your_qbittorrent_username_here",
        "QBITTORRENT_PASSWORD": "your_qbittorrent_password_here",
        "QBITTORRENT_API_KEY": "your_qbittorrent_api_key_here"
      }
    }
  }
}

Streamable-HTTP Transport (Recommended for production deployments)

Configure your client's mcp.json to launch the Streamable-HTTP server via uvx with explicit host and port definition:

{
  "mcpServers": {
    "qbittorrent-agent": {
      "command": "uvx",
      "args": [
        "--from",
        "qbittorrent-agent",
        "qbittorrent-mcp"
      ],
      "env": {
        "TRANSPORT": "streamable-http",
        "HOST": "0.0.0.0",
        "PORT": "8000",
        "QBITTORRENT_HOST": "your_qbittorrent_host_here",
        "QBITTORRENT_PORT": "your_qbittorrent_port_here",
        "QBITTORRENT_USERNAME": "your_qbittorrent_username_here",
        "QBITTORRENT_PASSWORD": "your_qbittorrent_password_here",
        "QBITTORRENT_API_KEY": "your_qbittorrent_api_key_here"
      }
    }
  }
}

Alternatively, connect to a pre-deployed remote or local Streamable-HTTP instance:

{
  "mcpServers": {
    "qbittorrent-agent": {
      "url": "http://localhost:8000/qbittorrent-agent/mcp"
    }
  }
}

Deploying the Streamable-HTTP server via Docker:

docker run -d \
  --name qbittorrent-agent-mcp \
  -p 8000:8000 \
  -e TRANSPORT=streamable-http \
  -e PORT=8000 \
  -e QBITTORRENT_HOST="your_value" \
  -e QBITTORRENT_PORT="your_value" \
  -e QBITTORRENT_USERNAME="your_value" \
  -e QBITTORRENT_PASSWORD="your_value" \
  -e QBITTORRENT_API_KEY="your_value" \
  knucklessg1/qbittorrent-agent:latest

Additional Deployment Options

qbittorrent-agent can also run as a local container (Docker / Podman / uv) or be consumed from a remote deployment. The Deployment guide has full, copy-paste mcp_config.json for all four transports — stdio, streamable-http, local container / uv, and remote URL:

  • Local container / uv — launch the server from mcp_config.json via uvx, docker run, or podman run, or point at a local streamable-http container by url.
  • Remote URL — connect to a server deployed behind Caddy at http://qbittorrent-mcp.arpa/mcp using the "url" key.

Agent

This repository features a fully integrated Pydantic AI Graph Agent. It communicates over the Agent Control Protocol (ACP) and interacts seamlessly with the Agent Web UI (AG-UI) and Terminal interface.

Running the Agent CLI

To start the interactive command-line agent:

# Set credentials
export QBITTORRENT_HOST="your_value"
export QBITTORRENT_PORT="your_value"
export QBITTORRENT_USERNAME="your_value"
export QBITTORRENT_PASSWORD="your_value"
export QBITTORRENT_API_KEY="your_value"

# Run the agent server
qbittorrent-agent --provider openai --model-id gpt-4o

Docker Compose Orchestration

The following docker/agent.compose.yml configures the Agent, Web UI, and Terminal Interface together:

version: '3.8'

services:
  qbittorrent-agent-mcp:
    image: knucklessg1/qbittorrent-agent:latest
    container_name: qbittorrent-agent-mcp
    hostname: qbittorrent-agent-mcp
    restart: always
    env_file:
      - ../.env
    environment:
      - PYTHONUNBUFFERED=1
      - HOST=0.0.0.0
      - PORT=8000
      - TRANSPORT=streamable-http
    ports:
      - "8000:8000"
    healthcheck:
      test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s
    logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "3"

  qbittorrent-agent-agent:
    image: knucklessg1/qbittorrent-agent:latest
    container_name: qbittorrent-agent-agent
    hostname: qbittorrent-agent-agent
    restart: always
    depends_on:
      - qbittorrent-agent-mcp
    env_file:
      - ../.env
    command: [ "qbittorrent-agent" ]
    environment:
      - PYTHONUNBUFFERED=1
      - HOST=0.0.0.0
      - PORT=9004
      - MCP_URL=http://qbittorrent-agent-mcp:8000/mcp
      - PROVIDER=${PROVIDER:-openai}
      - MODEL_ID=${MODEL_ID:-gpt-4o}
      - ENABLE_WEB_UI=True
      - ENABLE_OTEL=True
    ports:
      - "9004:9004"
    healthcheck:
      test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:9004/health')"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s
    logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "3"

Detailed graph node architecture explanations, custom skill configurations, and agentic trace guides are available in docs/agent.md.


Environment Variables

The agent and MCP server can be fully configured using the following environment variables:

Variable Type Default Description
QBITTORRENT_HOST String None Required. Hostname or IP address of the qBittorrent Web UI server.
QBITTORRENT_PORT Integer 8080 Port of the qBittorrent Web UI server.
QBITTORRENT_USERNAME String None Username for authentication.
QBITTORRENT_PASSWORD String None Password for authentication.
QBITTORRENT_API_KEY String None Optional API Key for credential-less authentication.
APPTOOL Boolean True Toggle to enable/disable the App tool module.
LOGTOOL Boolean True Toggle to enable/disable the Log tool module.
SYNCTOOL Boolean True Toggle to enable/disable the Sync tool module.
TRANSFERTOOL Boolean True Toggle to enable/disable the Transfer tool module.
TORRENTSTOOL Boolean True Toggle to enable/disable the Torrents tool module.
RSSTOOL Boolean True Toggle to enable/disable the RSS tool module.
SEARCHTOOL Boolean True Toggle to enable/disable the Search tool module.
TRANSPORT String stdio Server transport protocol (stdio, sse, or streamable-http).
HOST String 127.0.0.1 The network interface/IP to bind the server to.
PORT Integer 8000 The port to run the server on when using HTTP-based transports.
AUTH_TYPE String none Security authentication mode (none, oidc).
POLICY_MODE String none Eunomia policy enforcement mode (none, embedded, remote).
LOGFIRE_TOKEN String None Optional telemetry token to export metrics/logs to Logfire.

Security & Governance

Built directly upon the enterprise-ready agent-utilities core, standard security parameters are fully supported:

Access Control & Policy Enforcement

  • Eunomia Policies: Fine-grained, policy-driven tool authorization. Supports none, local embedded (mcp_policies.json), or centralized remote modes.
  • OIDC Token Delegation: Compliant with RFC 8693 token exchange for flowing authenticating user credentials from Web UI / ACP → Agent → MCP.
  • Scoped Credentials: Execution context runs restricted to the specific caller identity.

Runtime Security Grid

Feature Functionality Enablement
Tool Guard Sensitivity inspection with human-in-the-loop validation Enabled by default
Prompt Injection Defense Input scanning, repetition monitoring, and recursive loop blocks Enabled by default
Context Safety Guard Stuck-loop detectors and contextual overflow preemptive alerts Enabled by default

Installation

Install the Python package locally:

# Using uv (highly recommended)
uv pip install qbittorrent-agent[all]

# Using standard pip
python -m pip install qbittorrent-agent[all]

Repository Owners

GitHub followers GitHub User's stars


Contribute

Contributions are welcome! Please ensure code quality by executing local checks before submitting pull requests:

  • Format code using ruff format .
  • Lint code using ruff check .
  • Validate type-safety with mypy .
  • Execute test suites using pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qbittorrent_agent-0.31.0.tar.gz (45.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qbittorrent_agent-0.31.0-py3-none-any.whl (55.3 kB view details)

Uploaded Python 3

File details

Details for the file qbittorrent_agent-0.31.0.tar.gz.

File metadata

  • Download URL: qbittorrent_agent-0.31.0.tar.gz
  • Upload date:
  • Size: 45.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for qbittorrent_agent-0.31.0.tar.gz
Algorithm Hash digest
SHA256 f4000741d867f8846c83c4ea6b6f8cd9e8ed3ea062910236ee1b88837f19ce5a
MD5 956fd965faf7b967b0b5847915bd8576
BLAKE2b-256 7f49206b0a36213ff0ce322f5659e27389f3557f53de4afc8526d873d4dd9566

See more details on using hashes here.

File details

Details for the file qbittorrent_agent-0.31.0-py3-none-any.whl.

File metadata

File hashes

Hashes for qbittorrent_agent-0.31.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc3c79d39077d3f035caf5b8339d550cbcae9ffeac09f7adce8b0b36b39521a6
MD5 33b9c4c771caa64125858fcb00c36ce4
BLAKE2b-256 94fad552ac77280552fd4d12179c32d58188e3deb349f8ccd8d1b0b3d598cd0b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page