Provides a comprehensive set of tools for managing the Transmission torrent client, including capabilities to add torrents via magnet links or URLs, monitor transfer speeds, manage session configurations, and perform torrent lifecycle operations like starting, pausing, and removing.
Python API Wrapper & MCP Server for Transmission
This repository provides a Python API wrapper and an MCP (Model Context Protocol) server for the Transmission torrent client using the transmission-rpc library. It allows for easy integration into other applications or services.
Table of Contents
Features
API wrapper for the
Transmissiontorrent client using the officialtransmission-rpclibrary.MCP server interface for standardized communication (stdio, sse, streamable-http).
Tools:
get_session: Get Transmission session configuration and version info.get_session_stats: Get session statistics (speeds, torrent counts, cumulative stats).free_space: Get free disk space in bytes at the specified path.list_torrents: List all torrents and their details.get_torrent_details: Get detailed information about a specific torrent.get_torrent_stats: Get stats/status of a specific torrent.get_recently_active: Get recently active torrents and IDs of recently removed ones.add_torrent: Download a torrent from magnet link, HTTP URL, or local file.download_torrent: Download a torrent from a magnet link, HTTP URL, or local file.start_torrent: Start (resume) a torrent.stop_torrent: Stop (pause) a torrent.pause_torrent: Pause a torrent.verify_torrent: Verify torrent data integrity.reannounce_torrent: Reannounce torrent to trackers.move_torrent: Move torrent data to a new location.set_torrent_labels: Set labels for a torrent.remove_torrent: Remove a torrent (optionally delete data).delete_torrent: Delete a torrent and its files.forget_torrent: Forget a torrent, keeping the files.
Setup
Prerequisites
An running instance of Transmission. (Included in docker compose)
Python 3.10+ (required for PyPI install).
uv(for local development)
Configuration
This application requires the URL of your Transmission instance.
Set Environment Variable: Copy .env.example to .env in your project's root directory and edit it with your settings. The application will automatically load variables from .env:
MCP Server:
TRANSMISSION_URL: The URL of the Transmission instance (Default:http://localhost:9091).TRANSMISSION_USER: The username for Transmission authentication (optional).TRANSMISSION_PASS: The password for Transmission authentication (optional).
Transmission Instance (for docker-compose setup):
TRANSMISSION_DOWNLOAD_DIR: The download directory for torrents (e.g.,/downloads).TRANSMISSION_WATCH_DIR: The watch directory for torrent files (e.g.,/watch).TRANSMISSION_RPC_URL: The RPC URL for the Transmission API (e.g.,http://localhost:9091/transmission/rpc).TRANSMISSION_PEER_PORT: The peer port for BitTorrent connections (e.g.,51413).TRANSMISSION_SPEED_LIMIT_DOWN: Download speed limit in KB/s (e.g.,100).TRANSMISSION_SPEED_LIMIT_UP: Upload speed limit in KB/s (e.g.,100).Check Transmission for other variables and more information.
Installation
Choose one of the following installation methods.
Install from PyPI (Recommended)
This method is best for using the package as a library or running the server without modifying the code.
Install the package from PyPI:
Create a
.envfile in the directory where you'll run the application and add yourTransmissionURL:
Run the MCP server (default: stdio):
For Local Development
This method is for contributors who want to modify the source code.
Using uv:
Clone the repository:
Install dependencies using
uv:
Create your configuration file by copying the example and add your settings:
Run the MCP server (default: stdio):
For Docker
This method uses Docker to run the server in a container. compose.yaml includes Transmission torrent client.
Clone the repository (if you haven't already):
Create your configuration file by copying the example and add your settings:
Build and run the container using Docker Compose (default port: 8000):
Access container logs:
Usage
As Python API Wrapper
As MCP Server
Via MCP Clients
Usable with any MCP-compatible client. Available tools:
get_session: Get Transmission session configuration and version info.get_session_stats: Get session statistics (speeds, torrent counts, cumulative stats).free_space: Get free disk space in bytes at the specified path.list_torrents: List all torrents and their details.get_torrent_details: Get details of a specific torrent by ID or hash.get_torrent_stats: Get stats/status of a specific torrent by ID or hash.get_recently_active: Get recently active torrents and IDs of recently removed ones.add_torrent: Add a torrent from magnet link, HTTP URL, or local file path.download_torrent: Download a torrent via magnet link, HTTP URL, or local file.start_torrent: Start (resume) a torrent by ID or hash.stop_torrent: Stop (pause) a torrent by ID or hash.pause_torrent: Pause a torrent by ID or hash.verify_torrent: Verify torrent data integrity by ID or hash.reannounce_torrent: Reannounce torrent to trackers by ID or hash.move_torrent: Move torrent data to a new location by ID or hash.set_torrent_labels: Set labels for a torrent by ID or hash.remove_torrent: Remove a torrent (optionally delete data) by ID or hash.delete_torrent: Delete a torrent and its files by ID or hash.forget_torrent: Forget a torrent, keeping the files, by ID or hash.
Example with Windsurf
Configuration:
Changelog
See CHANGELOG.md for a history of changes to this project.
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
This project is licensed under the MIT License - see the LICENSE file for details.