Skip to main content
Glama

torrent-mcp

A personal movie/series torrent-queue pipeline — IMDb list scraping, OMDb title lookups, Jackett search, and qBittorrent RSS queue management — as a tested Python library, a CLI, and an MCP server so a natural-language client (a Telegram bot, Claude Desktop, etc.) can drive the whole thing in plain English.

This replaces a folder of ad hoc scripts (B6_imdb-torrents/) that each hardcoded one person's Jackett API key, OMDb key, LAN IP, and /home/b/... paths directly in source. All of that is now environment configuration — see .env.sample — so the code itself has nothing sensitive in it.

What it does

Area

CLI command(s)

MCP tool(s)

Find candidate titles from an IMDb list page

find-candidates

find_imdb_candidates

Check IMDb ids against what's already queued (and, optionally, a Plex export)

check-candidates

check_candidates

Add/remove/list a queue's feeds.json entries

add-to-queue, remove-from-queue, list-queue

add_to_queue, remove_from_queue, list_queue

Repoint a queue at a different Jackett indexer

switch-indexer

switch_indexer

Jackett indexer discovery & search

list-indexers, check-imdb-support, search, find-largest

list_indexers, check_imdb_search_support, search_torrents, find_largest_torrent

OMDb title lookups

lookup, search-title, identify-file

lookup_title, search_title, identify_title

Library maintenance

find-duplicates, diff-urls, archive-downloads, backup-queue

find_duplicate_filenames, diff_missing_urls, archive_downloads, backup_queue

list_profiles (MCP only) reports which queue profiles are configured.

Related MCP server: Arr Suite MCP Server

Install

python -m venv .venv
source .venv/bin/activate
pip install -e .

Copy .env.sample to .env and fill in your own OMDB_API_KEY, JACKETT_URL/JACKETT_API_KEY, and TORRENT_MCP_PROFILES (one entry per qBittorrent+Jackett RSS queue — movies, series, upgrades, ...). See the comments in .env.sample for every setting.

CLI

torrent-mcp find-candidates "https://www.imdb.com/list/ls0123456789/"
torrent-mcp check-candidates movies tt1375666 tt0111161
torrent-mcp add-to-queue movies tt1375666 --indexer yts
torrent-mcp list-queue movies --resolve-titles
torrent-mcp switch-indexer movies yts torrentgalaxy
torrent-mcp lookup tt1375666
torrent-mcp --help   # full command list

MCP server

torrent-mcp-server

Runs over stdio, ready for any MCP client (Claude Desktop, the MCP Inspector, a custom client) to spawn as a subprocess. Example claude_desktop_config.json entry:

{
  "mcpServers": {
    "torrent-mcp": {
      "command": "/absolute/path/to/.venv/bin/torrent-mcp-server",
      "env": { "OMDB_API_KEY": "...", "JACKETT_API_KEY": "...", "...": "..." }
    }
  }
}

Integration with ocabra_telegram

ocabra_telegram drives this server the same way it already drives homebox_mcp — over stdio via a small JSON-RPC client (homebox_tools.McpStdioClient, reused as-is by its torrent_tools.py) and bot.py's call_ocabra_with_tools tool-calling loop, which now runs over whichever backends (Homebox, torrent-mcp, both) are active for the current user. See that repo's README, "Torrent Queue Integration", for the TORRENT_MCP_* env vars to set there. Once wired, Telegram messages like "what's queued for movies?" or "add tt1375666 to the movies queue" drive this project directly — this project only owns the MCP server side; the client-side wiring lives in ocabra_telegram.

Development

pip install -e ".[dev]"
pytest

Tests mock all external HTTP (OMDb, Jackett, IMDb) with respx and use tmp_path for filesystem operations — nothing touches the network or a real queue.

Notes on the original scripts

  • manage_queue/queue_get-titles.py used imdbpy to scrape IMDb directly for titles; this project uses OMDb everywhere instead (already needed for other lookups), so there's one metadata dependency, not two.

  • The ten near-identical switchindexer_*.sh scripts (one hardcoded path + container per direction) are now one switch-indexer command parameterized by profile and indexer names.

  • trackers/check_imdbsearch.py logged into Jackett's dashboard with an admin password before calling its API; the API calls it made only ever needed the API key, so that login step (and the password) is gone.

  • Nothing here runs sudo or shells out to docker unless DOCKER_RESTART_ENABLED=true, and then only for a container name from your own TORRENT_MCP_PROFILES config — never a name supplied through a tool call.

Available Tools

18 tools
add_to_queueA

Add an IMDb id to a queue profile's feeds.json so qBittorrent starts searching for it.

indexer selects which Jackett indexer the feed searches (defaults to the profile's configured default, then Jackett's aggregate "all"). Fails if the id is already queued unless overwrite is set.

Inputs: imdb_id (required), profile (required), indexer, overwrite.

archive_downloadsA

Move finished downloads (by extension) out of the download client's folders into the archive.

Falls back to ARCHIVE_SOURCE_DIRS/ARCHIVE_DEST_DIR from the server's environment when not given explicitly.

Inputs: dest_dir, source_dirs.

backup_queueB

Back up a queue profile's feeds.json to a timestamped file.

Inputs: profile (required), dest_dir.

check_candidatesB

Split a list of IMDb ids into already-queued, already-in-Plex, and new.

plex_export_xml is optional; pass it to also check a Plex library XML export for titles already owned but not currently queued.

Inputs: profile (required), imdb_ids (required), plex_export_xml.

check_imdb_search_supportB

Check whether a Jackett indexer supports searching by IMDb id.

Inputs: indexer_id (required).

diff_missing_urlsA

List IMDb title URLs present in an old library export but missing from a newer one.

Inputs: new_export_path (required), old_export_path (required). Returns: result

find_duplicate_filenamesB

Find likely-duplicate filenames in a media directory (e.g. movie.avi vs movie.mp4).

Inputs: directory (required), threshold. Returns: result

find_imdb_candidatesB

Scrape an IMDb list page (e.g. a "coming this year" list) for title ids.

Inputs: list_url (required). Returns: result

find_largest_torrentA

Find the largest-sized search result for an IMDb id on one indexer (highest quality heuristic).

Inputs: imdb_id (required), indexer_id (required). Returns: result

identify_titleB

Guess the IMDb id/title for a messy title (e.g. cleaned-up filename), via OMDb.

Inputs: title_hint (required), year. Returns: result

list_indexersB

List Jackett indexers known to the server.

Inputs: configured_only. Returns: result

list_profilesA

List the configured queue profile names (e.g. "movies", "series").

Inputs: no named parameters. Returns: result

list_queueA

List a queue profile's entries. Set resolve_titles=True to include title/year via OMDb (slower).

Inputs: profile (required), resolve_titles. Returns: result

lookup_titleA

Resolve an IMDb id to its title/year/type via OMDb.

Inputs: imdb_id (required).

remove_from_queueB

Remove an IMDb id from a queue profile's feeds.json.

Inputs: imdb_id (required), profile (required).

search_titleB

Fuzzy-search OMDb by title, optionally narrowed by year.

Inputs: title (required), year. Returns: result

search_torrentsA

Search one Jackett indexer (or "all") for torrents matching an IMDb id.

Inputs: imdb_id (required), indexer_id (required). Returns: result

switch_indexerA

Repoint every feed URL in a queue profile from one Jackett indexer to another.

Set restart to also restart the profile's configured docker container so qBittorrent reloads feeds.json (requires DOCKER_RESTART_ENABLED=true on the server).

Inputs: profile (required), new_indexer (required), old_indexer (required), restart.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 18 tools

    Disambiguation4/5

    Most tools are clearly separated by object (profiles, queue entries, indexers, titles, files), and descriptions specify exact inputs and outputs. The main potential confusion is between lookup_title/search_title/identify_title and search_torrents/find_largest_torrent, but their boundary conditions are stated clearly enough.

    Naming Consistency5/5

    Every tool uses a consistent snake_case, imperative verb-first naming pattern such as list, add, remove, search, find, or check. Even longer names like check_imdb_search_support and find_duplicate_filenames follow the same convention, making the set predictable.

    Tool Count4/5

    At 18 tools, this is slightly above the typical sweet spot, but the server spans queue management, indexer operations, metadata resolution, and media-file housekeeping. Each tool maps to a distinct operation, so the count feels broad rather than redundant.

    Completeness4/5

    The core pipeline—finding IMDb candidates, checking them against the queue/Plex, adding and removing queue entries, searching indexers, and archiving downloads—is well covered. Minor gaps such as profile creation/deletion and directly adding a found torrent to qBittorrent exist but can be worked around with the available tools.

    Related MCP Connectors

    Related MCP Servers