Skip to main content
Glama

aria2-mcp

English | 简体中文

A zero-config, zero-dependency Model Context Protocol (MCP) server and Magpie tools plugin that gives AI coding agents reliable background HTTP(S) file downloads powered by aria2.

Why aria2-mcp?

Asking an agent to run ad-hoc curl / Invoke-WebRequest in a shell breaks on real-world downloads: interrupted sessions drop progress, proxies silently fail over to direct connections or leak credentials in logs, and existing files get clobbered. Most existing aria2 MCP wrappers also require you to manually start and configure an aria2c RPC daemon first.

aria2-mcp solves this out of the box:

  • Zero-config local daemon: Automatically locates aria2c, binds a free 127.0.0.1 port with a random 32-byte RPC secret, locks down the state directory (icacls on Windows, 0700 on macOS/Linux), prevents concurrent duplicate launches, and persists resumable sessions (downloads.session).

  • Fail-closed OS proxy safety: Automatically reads the system proxy (Windows Internet Settings registry, macOS scutil --proxy, Linux env vars), TCP-probes reachability before starting, refuses silent fallback to direct, rejects unsupported PAC/WPAD explicitly, and never modifies system/global proxy settings.

  • Agent-safe by default: Never overwrites existing files (auto-suffixes a UUID on conflict), validates filenames and rejects embedded URL credentials, and strips URLs/proxy secrets from tool outputs.

  • Zero dependencies, fast startup: Pure Node.js 20+ (and Bun-compatible), ~50ms cold start.

  • Dual-mode + Remote RPC: Runs as a standard stdio MCP server (npx -y aria2-mcp), as a 1-click Magpie tools plugin (magpie-plugin), or pointed at an existing/NAS aria2c instance via ARIA2_RPC_URL.

Related MCP server: abdm-mcp

Prerequisites

  • Node.js 20+ (or Bun when installed as a Magpie plugin)

  • aria2 installed locally (unless connecting to a remote instance via ARIA2_RPC_URL):

    • Windows: winget install aria2.aria2 or scoop install aria2

    • macOS: brew install aria2

    • Linux: sudo apt install aria2 (or your distro's package manager)

Quick Start

1. Any MCP Client (npx)

{
  "mcpServers": {
    "aria2": {
      "command": "npx",
      "args": ["-y", "aria2-mcp"]
    }
  }
}

Works with Claude Code, Claude Desktop, Codex, Cursor, Windsurf, Antigravity (agy), VS Code, and any stdio MCP host.

For Claude Code CLI:

claude mcp add aria2 -- npx -y aria2-mcp

2. Magpie (1-click for every connected agent)

Install from Magpie's Plugins → Discover → Unofficial, on GitHub, or via CLI:

magpie plugin add github:Neko-Yukari/aria2-mcp
# or once published to npm:
magpie plugin add aria2-mcp

Magpie automatically serves its tools to every connected agent over its built-in MCP router (aria2-mcp__submit, aria2-mcp__status, aria2-mcp__list, aria2-mcp__control, aria2-mcp__wait), with per-agent toggles in Library → MCP.

3. Remote / NAS aria2 Instance

{
  "mcpServers": {
    "aria2": {
      "command": "npx",
      "args": ["-y", "aria2-mcp"],
      "env": {
        "ARIA2_RPC_URL": "http://192.168.1.10:6800/jsonrpc",
        "ARIA2_RPC_SECRET": "your-secret",
        "ARIA2_DEFAULT_PROXY": "direct"
      }
    }
  }
}

Tools

MCP Tool

Magpie Plugin Tool

Purpose

download_submit

submit

Submit a background HTTP(S) download (url, optional directory, filename, proxy). Returns a GID immediately.

download_status

status

Query progress, speed, status, and safe error code for a GID.

download_list

list

List active, waiting, and recently stopped downloads (up to 100 per queue).

download_control

control

pause, resume, or cancel a download by GID (cancel retains partial files).

download_wait

wait

Wait cleanly (up to 120s in MCP, 50s in Magpie) for completion/error/pause without tight polling loops.

Completion & Progress Notifications

Because MCP hosts differ in how they handle server-initiated events, aria2-mcp supports three layers:

  1. In-call waiting (download_wait + notifications/progress): For short/medium files, call download_wait. When the MCP client passes _meta.progressToken, aria2-mcp streams standard MCP notifications/progress updates as bytes arrive.

  2. Proactive MCP notifications (notifications/message + optional claude/channel): Downloads submitted via download_submit are watched in the background (every 5s by default, configurable via ARIA2_NOTIFY_POLL_MS). When a download completes or errors, aria2-mcp emits a standard MCP notifications/message (never leaking URLs or credentials) and, for clients advertising experimental["claude/channel"] (or with ARIA2_CLAUDE_CHANNEL=1), also emits notifications/claude/channel.

  3. CLI Reactive Waiter (--wait <gid>): For multi-minute downloads in agents that wake up automatically when a background shell task exits (e.g., Antigravity, Claude Code, Codex), run:

npx -y aria2-mcp --wait <gid> [--timeout 3600]

Exit codes: 0 = complete, 1 = error/removed, 2 = paused, 124 = timed out.

Environment Variables

Variable

Default

Description

ARIA2_BIN

Auto-detected

Explicit path to aria2c / aria2c.exe.

ARIA2_DATA_DIR

OS app-data dir

Directory storing rpc.json, aria2.conf, and downloads.session. Point multiple tools at the same folder to share one queue.

ARIA2_DEFAULT_DIR

~/Downloads

Default destination directory for local downloads.

ARIA2_DEFAULT_PROXY

system

Default proxy mode: system, direct, or http://host:port.

ARIA2_RPC_URL

(unset)

Use an external/remote aria2 JSON-RPC URL instead of spawning a local daemon.

ARIA2_RPC_SECRET

(unset)

RPC secret token for ARIA2_RPC_URL.

Security Model

  • Loopback-only RPC (127.0.0.1, random free port, 256-bit random token, rpc-allow-origin-all=false).

  • Private state directory verified via icacls (Windows) or 0700 (POSIX).

  • Proxy environment variables (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NO_PROXY) are stripped from the aria2c process and applied strictly per-task.

  • Tool responses only return { gid, status, totalLength, completedLength, downloadSpeed, errorCode, progress } — never echoing URLs, query tokens, or proxy credentials.

Development & Tests

npm test

License

MIT

Available Tools

5 tools
download_controlA

Pause, resume or cancel a download by GID. Cancel retains partial files and does not delete them. Resume continues the same GID and partial data; query download_status afterward to verify the resulting state.

Inputs: gid (required), action (required).

download_listA

List background downloads (active, waiting, recently stopped) in the aria2 daemon. Find an existing task before submitting a duplicate; use download_status for the selected GID.

Inputs: no named parameters.

download_statusA

Get download progress, speed and safe error code by GID. Confirm status=complete before claiming success or using the downloaded file; active, waiting and paused are not completion. Report errors honestly and avoid tight polling loops.

Inputs: gid (required).

download_submitA

Download an HTTP(S) file to disk in the background via local aria2c; returns a GID, not proof of completion. Call download_wait for short/medium files, or check download_status later or run node "/app/server.mjs" --wait <gid> in a background shell before reporting success or consuming the file. Defaults to the OS system proxy and Downloads; use direct or an explicit HTTP proxy when requested. Keep global and system proxy settings unchanged, report a proxy failure instead of silently switching to direct, and keep URLs and proxy credentials out of chat. Existing files stay untouched. For webpage reading, API calls, Git or package managers, use the dedicated tool. If a requested download feature is unsupported, explain the limitation before choosing another method.

Inputs: url (required), proxy, filename, directory.

download_waitA

Wait up to timeout_seconds (default 30, max 120) for a download GID to reach complete, error, removed, or paused without tight polling. If timedOut=true, do not loop download_wait tightly: continue other work, check download_status later or run node "/app/server.mjs" --wait <gid> in a background shell.

Inputs: gid (required), timeout_seconds.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool targets a distinct action on the download lifecycle: submit (create), status (inspect one), list (enumerate), control (pause/resume/cancel), wait (blocking poll). Boundaries are explicit and the descriptions reinforce when to use each (e.g., submit returns a GID, wait/status confirm completion).

    Naming Consistency5/5

    All tools follow a single predictable pattern: download_<verb> in snake_case (submit, status, list, control, wait). No mixing of conventions or stray verbs.

    Tool Count5/5

    Five tools is well-scoped for a background download manager, and each maps to a genuine lifecycle operation with no redundant or filler tools.

    Completeness4/5

    Core lifecycle (submit, list, status, control, wait) is covered with no dead ends for typical workflows. Minor gaps remain: there is no tool to remove/purge completed or cancelled downloads (control cancel explicitly retains files), so cleanup requires out-of-band action.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      A download tool for AI agents that wraps aria2 with safety rules and MCP server support, enabling reliable downloads without false positives.
      1
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to remotely execute shell commands and transfer files on SSH hosts, including jump-host tunneling, background tasks, resumable transfers, and optional approval of destructive commands, while SSH credentials remain in the local process. It runs over stdio or a streamable HTTP daemon and supports auditing, allow/deny lists, and multiple authentication methods.
      ISC
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents and CLI tools to dispatch downloads through Chrome's native download engine over the MCP protocol, automatically inheriting browser cookies, login sessions, and proxy settings. Supports submitting, monitoring, pausing, resuming, and cancelling download tasks locally without manual server setup.
      8
      MIT