Skip to main content
Glama

YggTorrent MCP Server & Wrapper

uv Python PyPI Actions status License: MIT Ask DeepWiki

This repository provides a Python wrapper for the YggTorrent website and an MCP (Model Context Protocol) server to interact with it programmatically. This allows for easy integration of YggTorrent functionalities into other applications or services.

⚠️ DEPRECATED - This repository is no longer maintained

Please use one of the following alternatives instead:

Quickstart

How to use it with MCP Clients > Run it with Docker to bypass common DNS issues

Related MCP server: MCP Builder

Table of Contents

Features

  • API wrapper for YggAPI, an unofficial API for YggTorrent

    • Your Ygg passkey is injected locally into the torrent file/magnet link, ensuring it's not exposed externally

  • MCP server interface for standardized communication (stdio, sse, streamable-http)

  • FastAPI server interface for alternative HTTP access (e.g., for direct API calls or testing)

  • Tools:

    • Search for torrents on YggTorrent

    • Get details for a specific torrent

    • Retrieve magnet links

    • Retrieve torrent files

    • Retrieve torrent categories

Setup

Prerequisites

  • An active YggTorrent account and passkey.

  • Python 3.10+ (required for PyPI install).

  • uv (for local development)

  • Docker and Docker Compose (for Docker setup)

Configuration

This application requires your YggTorrent passkey to interact with the API.

  1. Find your Passkey: On the YggTorrent website, navigate to Mon compte -> PASSKEY field.

  2. Set Environment Variable: The application reads the passkey from the YGG_PASSKEY environment variable. The recommended way to set this is by creating a .env file in your project's root directory. The application will load it automatically.

Installation

Choose one of the following installation methods.

This method is best for using the package as a library or running the server without modifying the code.

  1. Install the package from PyPI:

pip install ygg-torrent-mcp
  1. Create a .env file in the directory where you'll run the application and add your passkey:

YGG_PASSKEY=your_passkey_here
  1. Run the MCP server (default: stdio):

python -m ygg_torrent

For Local Development

This method is for contributors who want to modify the source code. Using uv:

  1. Clone the repository:

git clone https://github.com/philogicae/ygg-torrent-mcp.git
cd ygg-torrent-mcp
  1. Install dependencies using uv:

uv sync --locked
  1. Create your configuration file by copying the example and add your passkey:

cp .env.example .env
  1. Run the MCP server (default: stdio):

uv run -m ygg_torrent

For Docker

This method uses Docker to run the server in a container.

compose.yaml is configured to bypass DNS issues (using quad9 DNS).

  1. Clone the repository (if you haven't already):

git clone https://github.com/philogicae/ygg-torrent-mcp.git
cd ygg-torrent-mcp
  1. Create your configuration file by copying the example and add your passkey:

cp .env.example .env
  1. Build and run the container using Docker Compose (default port: 8000):

docker compose up --build -d
  1. Access container logs:

docker logs ygg-torrent-mcp -f

Usage

As Python Wrapper

from ygg_torrent import ygg_api

results = ygg_api.search_torrents('...')
for torrent in results:
    print(f"{torrent.filename} | {torrent.size} | {torrent.seeders} SE | {torrent.leechers} LE | {torrent.downloads} DL | {torrent.date}")

As MCP Server

from ygg_torrent import ygg_mcp

ygg_mcp.run(transport="sse")

As FastAPI Server

This project also includes a FastAPI server as an alternative way to interact with the YggTorrent functionalities via a standard HTTP API. This can be useful for direct API calls, integration with other web services, or for testing purposes.

Running the FastAPI Server:

# With Python
python -m ygg_torrent --mode fastapi
# With uv
uv run -m ygg_torrent --mode fastapi
  • --host <host>: Default: 0.0.0.0.

  • --port <port>: Default: 8000.

  • --reload: Enables auto-reloading when code changes (useful for development).

  • --workers <workers>: Default: 1.

The FastAPI server will then be accessible at http://<host>:<port>

Available Endpoints: The FastAPI server exposes similar functionalities to the MCP server. Key endpoints include:

  • /: A simple health check endpoint. Returns {"status": "ok"}.

  • /docs: Interactive API documentation (Swagger UI).

  • /redoc: Alternative API documentation (ReDoc).

Environment variables (like YGG_PASSKEY) are configured the same way as for the MCP server (via an .env file in the project root).

Via MCP Clients

Usable with any MCP-compatible client. Available tools:

  • search_torrents: Search for torrents.

  • get_torrent_details: Get details of a specific torrent.

  • get_magnet_link: Get the magnet link for a torrent.

  • download_torrent_file: Download the .torrent file for a torrent.

Example with Windsurf

Configuration:

{
  "mcpServers": {
    ...
    # with stdio (only requires uv installed)
    "ygg-torrent-mcp": {
      "command": "uvx",
      "args": ["ygg-torrent-mcp"],
      "env": { "YGG_PASSKEY": "your_passkey_here" }
    }
    # with sse transport (requires installation)
    "ygg-torrent-mcp": {
      "serverUrl": "http://127.0.0.1:8000/sse"
    }
    # with streamable-http transport (requires installation)
    "ygg-torrent-mcp": {
      "serverUrl": "http://127.0.0.1:8000/mcp" # not yet supported by every client
    }
    ...
  }
}

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.

Available Tools

4 tools
download_torrent_fileC

Download the torrent file.

ParametersJSON Schema
NameRequiredDescriptionDefault
output_dirYes
torrent_idYes

TDQS

C2.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states 'Download' which implies a write operation to local storage, but doesn't disclose behavioral traits like file overwriting, permissions needed, network usage, or error handling. This leaves significant gaps for a tool that likely involves I/O and external resources.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It's front-loaded and appropriately sized for the simple action described, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, 0% schema coverage, no output schema, and 2 parameters, the description is incomplete. It lacks details on what the tool does beyond the basic action, such as return values, error cases, or how it interacts with siblings. For a download operation, this leaves too much unspecified.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the schema provides no parameter details. The description adds no meaning beyond the tool name; it doesn't explain what 'torrent_id' or 'output_dir' represent, their formats, or constraints. For 2 undocumented parameters, this is inadequate compensation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the action ('Download') and resource ('the torrent file'), which is clear but vague. It doesn't specify what distinguishes this from sibling tools like 'get_magnet_link' or 'get_torrent_details', which might also involve torrent file access. The purpose is understandable but lacks differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_magnet_link' for magnet links or 'get_torrent_details' for metadata. There's no mention of prerequisites, such as needing a valid torrent ID or output directory, or any context for selection among siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_torrent_detailsC

Get details about a specific torrent.

ParametersJSON Schema
NameRequiredDescriptionDefault
torrent_idYes
with_magnet_linkNo

TDQS

C2.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states this is a read operation ('Get'), but doesn't cover aspects like authentication requirements, rate limits, error handling, or what details are included in the response. This leaves significant gaps for an agent to understand how to use it effectively.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, straightforward sentence with no unnecessary words. It's front-loaded with the core action and resource, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is insufficient for a tool with 2 parameters. It doesn't explain what 'details' are returned, how to interpret the torrent ID, or the implications of the boolean parameter. For a tool that likely returns structured data, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description mentions 'specific torrent' which hints at the 'torrent_id' parameter, but doesn't explain what this ID is or how to obtain it. It also doesn't address the 'with_magnet_link' parameter at all, leaving its purpose unclear.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('details about a specific torrent'), making the purpose understandable. However, it doesn't distinguish this tool from sibling tools like 'get_magnet_link' or 'search_torrents', which might also retrieve torrent information in different ways.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_magnet_link' or 'search_torrents'. It doesn't specify prerequisites, such as needing a torrent ID, or clarify use cases like retrieving metadata versus links.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_torrentsC

Search for torrent files.

ParametersJSON Schema
NameRequiredDescriptionDefault
categoriesNo
limitNo
order_byNoseeders
pageNo
per_pageNo
queryYes

TDQS

C2.1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states the action ('Search') without any information about rate limits, authentication needs, pagination behavior (implied by parameters but not described), or what the search returns. This is inadequate for a tool with 6 parameters and no output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It's appropriately sized for a basic search tool, though this brevity contributes to the lack of detail in other dimensions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (6 parameters, 0% schema coverage, no output schema, no annotations), the description is severely incomplete. It doesn't explain the search scope, result format, behavioral traits, or parameter usage, making it inadequate for an AI agent to use the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, meaning parameters like 'categories', 'order_by', 'limit', 'page', and 'per_page' are undocumented in the schema. The description adds no meaning beyond the schema—it doesn't explain what these parameters do, their formats, or examples. For a tool with 6 parameters, this is a significant gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the basic action ('Search for torrent files') which is clear but vague. It doesn't specify what kind of search (e.g., across which platforms, with what criteria) or how it differs from sibling tools like 'get_torrent_details'. The purpose is understandable but lacks specificity and differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'download_torrent_file' or 'get_torrent_details'. The description doesn't mention prerequisites, context, or exclusions, leaving the agent to infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 4 tool updatesv1.0.0
    • First observeddownload_torrent_file
    • First observedget_magnet_link
    • First observedget_torrent_details
    • First observedsearch_torrents

TDQS

B3.2/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct purpose with no overlap: search_torrents finds torrents, get_torrent_details retrieves metadata, get_magnet_link provides a magnet link, and download_torrent_file downloads the file. An agent can easily distinguish between these operations.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern using snake_case (e.g., search_torrents, get_torrent_details). The naming is predictable and readable throughout the set.

Tool Count5/5

With 4 tools, the server is well-scoped for torrent operations, covering search, details retrieval, magnet links, and downloads. Each tool earns its place without being overly sparse or bloated.

Completeness5/5

The toolset provides complete coverage for torrent interaction: search, view details, get magnet links, and download files. There are no obvious gaps in the workflow for this domain.

Related MCP Connectors

Related MCP Servers