YggTorrent MCP Server is a Python wrapper that allows you to interact programmatically with the YggTorrent website, providing functionalities such as searching torrents, retrieving torrent details, and downloading torrent files through a standardized MCP (Model Context Protocol) interface.
pip install ygg-torrent-mcp
.env
file in your working directory with your YggTorrent passkey:YGG_PASSKEY=your_passkey_here
python -m ygg_torrent
Using Docker helps bypass common DNS issues:
git clone https://github.com/philogicae/ygg-torrent-mcp.git
cd ygg-torrent-mcp
cp .env.example .env
Edit the .env
file to add your passkey
Build and run with Docker Compose:
docker-compose -f docker/compose.yaml up --build
You can use the YggTorrent wrapper directly in your Python code:
from ygg_torrent import ygg_api
results = ygg_api.search_torrents('ubuntu')
for torrent in results:
print(f"{torrent.filename} | {torrent.size} | {torrent.seeders} SE | {torrent.leechers} LE | {torrent.downloads} DL | {torrent.date}")
Run as an MCP server with different transport options:
from ygg_torrent import ygg_mcp
ygg_mcp.run(transport="sse")
For direct API calls or testing:
# Development mode
python -m ygg_torrent --fastapi
# Production mode
uvicorn ygg_torrent.fastapi_server:app
The FastAPI server exposes endpoints at http://<host>:<port>
with interactive documentation at /docs
.
The MCP server provides these tools:
search_torrents
get_torrent_details
get_magnet_link
download_torrent_file
Configure Windsurf to connect to the YggTorrent MCP server:
{
"mcpServers": {
"mcp-ygg-torrent": {
"command": "uvx",
"args": ["ygg-torrent-mcp"],
"env": { "YGG_PASSKEY": "your_passkey_here" }
}
}
}
Or with SSE transport (requires separate installation):
{
"mcpServers": {
"mcp-ygg-torrent": {
"serverUrl": "http://127.0.0.1:8000/sse"
}
}
}
Your YggTorrent passkey is injected locally into torrent files and magnet links, ensuring it's not exposed externally.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "ygg-torrent-mcp" '{"command":"uvx","args":["ygg-torrent-mcp"],"env":{"YGG_PASSKEY":"your_passkey_here"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"ygg-torrent-mcp": {
"command": "uvx",
"args": [
"ygg-torrent-mcp"
],
"env": {
"YGG_PASSKEY": "your_passkey_here"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"ygg-torrent-mcp": {
"command": "uvx",
"args": [
"ygg-torrent-mcp"
],
"env": {
"YGG_PASSKEY": "your_passkey_here"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect