Skip to main content
Glama
aria2 MCP Server

aria2 MCP Server

by kinmeic
README.md
# aria2 MCP Server

A [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server for [aria2](https://aria2.github.io/) download manager. This server allows AI assistants to interact with aria2 through a standardized interface.

## Features

- **Download Management**: Add, pause, resume, and remove downloads
- **Status Monitoring**: Get real-time download status and progress
- **Batch Operations**: List active, waiting, and stopped downloads
- **Global Statistics**: View overall download/upload speeds
- **Option Control**: Change download options on-the-fly
- **Multi-Protocol Support**: HTTP/HTTPS, FTP/SFTP, BitTorrent, Magnet links

## Installation

### Prerequisites

1. **Node.js 18 or higher**
2. **aria2** running with RPC enabled and WebSocket support

Start aria2 with WebSocket RPC:
```bash
# With RPC secret (recommended)
aria2c --enable-rpc --rpc-listen-all=true --rpc-allow-origin-all \
       --rpc-secret=your_secret_token \
       --rpc-listen-port=6800

# The RPC URL will be: ws://localhost:6800/jsonrpc
```

Install the MCP Server:
```bash
cd /path/to/aira2-mcp
npm install
```

## Configuration

### Environment Variables

| Variable | Description | Default | Required |
|----------|-------------|---------|----------|
| `ARIA2_RPC_URL` | aria2 RPC WebSocket URL | `ws://localhost:6800/jsonrpc` | Yes |
| `ARIA2_RPC_SECRET` | RPC secret token for authentication | `None` | **Yes** |
| `ARIA2_TIMEOUT` | Request timeout in seconds | `30` | No |

**Important**:
- `ARIA2_RPC_URL` must use WebSocket protocol (`ws://` or `wss://`)
- `ARIA2_RPC_SECRET` is **required** if aria2 is configured with `--rpc-secret`

### Integration with Claude Desktop

Add to your Claude Desktop config file:

**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`

```json
{
  "mcpServers": {
    "aria2": {
      "command": "node",
      "args": ["/path/to/aira2-mcp/src/index.js"],
      "env": {
        "ARIA2_RPC_URL": "ws://localhost:6800/jsonrpc",
        "ARIA2_RPC_SECRET": "your_secret_token_here"
      }
    }
  }
}
```

## Available Tools

| Tool | Description |
|------|-------------|
| `add_download` | Add a new download from URL |
| `add_torrent_download` | Add a BitTorrent download |
| `get_download_status` | Get status of a specific download |
| `list_active_downloads` | List all active downloads |
| `list_waiting_downloads` | List downloads in queue |
| `list_stopped_downloads` | List completed/failed downloads |
| `pause_download` | Pause a specific download |
| `resume_download` | Resume a paused download |
| `remove_download` | Remove/delete a download |
| `pause_all_downloads` | Pause all active downloads |
| `resume_all_downloads` | Resume all paused downloads |
| `get_global_stats` | Get global download statistics |
| `purge_stopped_downloads` | Clear stopped download history |
| `get_version` | Get aria2 version info |
| `get_download_options` | Get options for a download |
| `change_download_options` | Change download options |

## Usage Examples

### Add a Download
```
Please download this file: https://example.com/file.zip
```

### Check Download Status
```
What's the status of download with GID 1234567890abcdef?
```

### List Downloads
```
Show me all active downloads
```

### Pause and Resume
```
Pause the download with GID 1234567890abcdef
```

### Download with Options
```
Download https://example.com/largefile.zip and save it to /Downloads folder
```

## Development

### Running with MCP Inspector

```bash
mcp dev src/index.js
```

### Running Directly

```bash
npm start
```

## Architecture

```
aira2-mcp/
├── src/
│   └── index.js         # MCP server implementation
├── package.json          # Project configuration
└── README.md            # This file
```

## License

MIT

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## References

- [aria2 Documentation](https://aria2.github.io/manual/en/html/aria2c.html)
- [MCP Specification](https://spec.modelcontextprotocol.io/)
- [aria2 RPC Methods](https://aria2.github.io/manual/en/html/aria2c.html#rpc-interface)

TDQS

B3.3/5.0

Scored across 16 tools

Disambiguation5/5

Each tool has a distinct action and target: add vs list vs pause/resume vs remove vs options. The list variants are clearly separated by download state, and the single-vs-all pause/resume tools are unambiguous.

Naming Consistency5/5

All tools follow a consistent snake_case verb_noun pattern (add_download, get_download_status, pause_all_downloads, change_download_options). Modifiers like active/waiting/stopped and single/all are used predictably.

Tool Count4/5

Sixteen tools is slightly above the typical 3-15 range, but each maps to a concrete aria2 operation. The surface is not bloated, though some list variants could arguably be filters on a single listing tool.

Completeness4/5

The lifecycle is well covered: add, monitor, pause/resume, remove/purge, inspect/change options, and global stats. Minor gaps exist around global option management and richer torrent metadata/files, but core workflows are complete.

Maintenance

ActivityInactive
ResponsivenessOutdated data