Skip to main content

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.

YggTorrent Server MCP server

Quickstart

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

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.

Metadata

Release files for ygg-torrent-mcp 1.8.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ygg-torrent-mcp 1.8.2
File Size Uploaded Provenance
ygg_torrent_mcp-1.8.2.tar.gz 11.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ygg-torrent-mcp 1.8.2
File Interpreter ABI Platform
ygg_torrent_mcp-1.8.2-py3-none-any.whl Python 3 none any Details

Total release size: 27.4 kB

Release files / ygg_torrent_mcp-1.8.2.tar.gz

Download URL ygg_torrent_mcp-1.8.2.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
def5581144d84835d4cd779e5b58e6c061493e113ecb1b42a074e6dccb4a1969
BLAKE2b-256 checksum
How to use checksums
8812e281554f647a6cee7de211a8ae85f1a9f9c461b922429a21978e31b9b807
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2025.

Transparency log

Release files / ygg_torrent_mcp-1.8.2-py3-none-any.whl

Download URL ygg_torrent_mcp-1.8.2-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1f58e0f37b2fc803eab2a60f64aaf9f3dbbb8e8e472209196cd8214883851e3
BLAKE2b-256 checksum
How to use checksums
f0c00dca54f8ec3f6570f4b81a5b550d543e223cccf8a514031ab284cbbdbe46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2025.

Transparency log

Security for ygg-torrent-mcp 1.8.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ygg_torrent_mcp-1.8.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page