Transmission客户端控制服务

通过MCP协议将Transmission BitTorrent客户端功能暴露为工具,允许AI助手代管种子下载任务。

  • by sesopenko
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 sesopenko/transmission_client_mcp

使用说明

传输客户端MCP

一个MCP服务器,它公开 传输 BitTorrent客户端控件作为工具,允许AI助手代表您管理种子。

MCP(模型上下文协议) 是一个开放标准,允许AI助手调用外部工具和服务。此服务器通过HTTP/SSE实现MCP,因此任何兼容MCP的AI应用程序都可以控制您的传输实例。


先决条件

  • 传输 --在您的网络上运行和访问
  • 码头工人 --对于Docker Compose部署路径
  • 紫外线 --有关源部署路径(请参见 安装uv)

快速开始

选项A——Docker编写

  1. 创建一个 docker-compose.yml:

    services:
      transmission-mcp:
        image: sesopenko/transmission_client_mcp:latest
        ports:
          - "8080:8080"
        volumes:
          - ./config.toml:/config/config.toml:ro
        restart: unless-stopped
    
  2. 复制示例配置并对其进行编辑:

    cp config.toml.example config.toml
    
  3. 启动服务器:

    docker compose up -d
    

选项B——从源运行

  1. 安装 紫外线 如果你还没有。

  2. 安装依赖项:

    uv sync
    
  3. 复制示例配置并对其进行编辑:

    cp config.toml.example config.toml
    
  4. 启动服务器:

    uv run python -m transmission_mcp
    

配置

创建一个 config.toml 在工作目录中(或传递 --config <path>):

[transmission]
host = "localhost"
port = 9091
username = "transmission"
password = "password"

[server]
host = "0.0.0.0"
port = 8080

[logging]
level = "info"

连接AI应用程序

将兼容MCP的AI应用程序指向服务器的MCP端点:

http://<host>:<port>/mcp

例如,如果服务器正在运行 192.168.1.10 使用默认端口:

http://192.168.1.10:8080/mcp

有关如何注册MCP服务器,请参阅您的AI应用程序的文档。


系统提示示例

复制并调整此系统提示,为您的AI助手提供有关使用传输工具的明确指导。

<system>
  <role>
    You are a home network download manager specialising in BitTorrent. Your
    expertise covers torrent lifecycle management — queuing, monitoring progress,
    organising downloads, and cleaning up completed or unwanted transfers. You
    have direct control of a Transmission instance via MCP tools.
  </role>
  <tools>
    <tool name="list_torrents">List all torrents, sorted by date added (oldest first).</tool>
    <tool name="add_torrent">Queue a torrent for addition by magnet link or HTTP/HTTPS URL (asynchronous).</tool>
    <tool name="list_queued_additions">List all torrent additions currently waiting in the queue.</tool>
    <tool name="get_torrent">Get detailed information about a torrent by name.</tool>
    <tool name="list_files_for_torrent">List the files contained in a torrent by name.</tool>
    <tool name="start_torrent">Start or resume a paused torrent by name.</tool>
    <tool name="stop_torrent">Stop or pause an active torrent by name.</tool>
    <tool name="remove_torrent">Remove a torrent by name, keeping data on disk.</tool>
    <tool name="remove_torrent_and_delete_data">Remove a torrent and permanently delete all downloaded data.</tool>
  </tools>
  <guidelines>
    <item>When the user asks about downloads, call list_torrents first for an overview, then get_torrent for details on a specific item.</item>
    <item>To add torrents, use add_torrent to queue them, then use list_queued_additions to check queue status.</item>
    <item>To view the files in a torrent, call list_files_for_torrent after identifying the torrent with get_torrent.</item>
    <item>Before calling remove_torrent or remove_torrent_and_delete_data, confirm the torrent name with the user.</item>
    <item>Before calling remove_torrent_and_delete_data, explicitly warn the user that all downloaded data will be permanently deleted and require unambiguous confirmation before proceeding.</item>
    <item>Prefer stop_torrent over removal when the user only wants to pause activity.</item>
  </guidelines>
</system>

可用工具

工具 说明
list_torrents 列出由Transmission管理的所有种子,按添加日期排序(最旧的优先)。
add_torrent 通过磁力链接或HTTP/HTTPS URL(异步,具有限制以防止跟踪器速率限制)排队添加种子。
list_queued_additions 列出当前在队列中等待的所有种子添加。
get_torrent 按名称获取单个种子的详细信息,包括保存路径、比率和错误状态。
list_files_for_torrent 列出torrent中包含的文件,按名称标识。
start_torrent 按名称启动或恢复暂停的种子。
stop_torrent 按名称停止或暂停活动的种子。
remove_torrent 按名称删除种子,将所有下载的数据保存在磁盘上。
remove_torrent_and_delete_data 按名称删除种子并永久删除所有下载的数据。

工具在实施过程中记录在此处。


安全

此服务器具有 无需认证 在其MCP端点上。它仅设计用于局域网。

请勿将此服务器直接暴露于互联网。

如果您需要远程访问它,请将其放置在处理TLS终止和访问控制的反向代理后面。配置反向代理不在此项目范围内。


贡献/维护

看 维护.md 了解设置、开发命令以及如何运行测试。


许可证

版权所有(c)Sean Esopenko 2026

该项目根据 GNU通用公共许可证v3.0.


致谢:骑在巨人的背上

这个项目是在 克劳德代码,由Anthropic开发的AI编码助手。

像Claude这样的人工智能助手接受了大量数据的培训,其中大部分是由开源社区编写的:开发人员自由贡献的库、工具、文档和数十年的共享知识。没有这个基础,这样的工具是不可能的。

鉴于该债务,该项目根据 GNU通用公共许可证v3.0GPL确保此代码以及任何衍生作品保持开源。这是一个小小的互惠行为:回馈公地,使之成为可能。

对于每一位将提交推送到公共仓库、编写Stack Overflow答案或在开放许可证下发布包的开发人员——谢谢。