
Ugnas Mcp
io.github.Omodaka9375由 GitHub 帳號 Omodaka9375 發布v0.1.2更新於 Oct 27, 2026
Generic MCP server for UGREEN NAS (UGOS) over SSH — 39 tools with dry-run safety.
概覽
透過 SSH 連接 UGREEN NAS 的 MCP 伺服器,提供 39 個工具,涵蓋系統、Docker、檔案、備份與網路操作,並具備 dry-run 確認機制。
- 可以做什麼
- 檢視連線與系統狀態:狀態、資訊、儲存池與陣列
- 管理 Docker:容器、映像、網路的列出、檢查、日誌、啟停、刪除與 compose
- 瀏覽與異動檔案:列表、用量、搜尋、縮圖、建立目錄、複製、移動、刪除、上傳、下載、rsync 同步
- 執行備份:建立、列出、驗證、還原與排程工作
- 檢視網路介面、路由與連接埠
- 所有寫入操作會先回傳 dry-run 計畫與確認權杖,確認後才執行
- 適用情境
- 適合擁有執行 UGOS 的 UGREEN NAS、想讓助理遠端檢視或操作裝置的使用者,例如檢查儲存健康、管理容器、搬移檔案或執行備份,且不需寫死主機或共用資料夾名稱。
- 執行需求
- 以本機程序執行,透過 npx 或全域 npm 安裝(需 Node.js)。NAS 需開啟 SSH,並提供 ~/.ugnas-mcp/config.json 設定或 UGNAS_* 環境變數:主機、使用者名稱,以及 SSH 金鑰路徑(UGNAS_KEY_PATH)或密碼(UGNAS_PASSWORD)。容器工具要求 SSH 使用者屬於 docker 群組,排程備份需要 crontab;rsync 為選用,僅 files.sync 使用。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Ugnas Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
ugnas-mcp
A generic MCP (Model Context Protocol) server for UGREEN NAS devices running UGOS, talking to the NAS over SSH (with SFTP for file transfers).
Unlike most existing UGREEN NAS integrations, nothing here is hard-coded — no fixed IPs, subnets, usernames, or share names. Every target-specific value comes from your config, so the same server works for anyone's NAS.
What it does
Organized the way a NAS owner actually thinks about daily operations:
39 tools total. system.pools reports mdadm array + degradation state, LVM volume/logical/physical
volumes, btrfs devices, block devices, and filesystems.
files.find searches a directory tree by name glob and/or extension (returns path, size, modified
time). files.thumbnail renders a preview of an image or a video frame with ffmpeg on the NAS and
downloads it locally — read-only with respect to your NAS data (only a /tmp scratch file is written
and removed), but writing the thumbnail to the local machine is gated: the first call returns a
dry-run plan, and you confirm with the token to write the local file. Requires ffmpeg on the NAS
(present on UGOS by default).
files.list and files.find prefer GNU coreutils flags (ls --time-style=long-iso, find -printf);
when those are unavailable (BusyBox), they fall back to ls -1p and find -exec stat so they keep
working — with size/mtime zeroed out for plain ls where BusyBox can't report them.
files.sync and the rsync fallback
files.sync uses rsync for fast, resumable NAS↔NAS copies, with --delete mirroring and an
rsync --dry-run pre-flight. rsync is not installed on UGOS by default, so:
- Default (
fallback: "refuse") — if rsync is missing, the dry-run plan still shows the rsync command but adds anotetelling you how to install rsync (Entware:opkg install rsync) or how to turn on the fallback. Nothing runs until you confirm. - Opt in (
fallback: "cp") — the tool instead falls back to a built-incp -acopy. The plan'snoteexplains this, andwarningscall out what the fallback can't do: no--deletemirroring, no rsync--dry-run, andextraArgsare ignored.
So you opt in per call by passing fallback: "cp". Nothing changes unless you ask for it.
Safety model — dry-run first, then confirm
Every mutating tool has two phases:
- Call without a token → returns a dry-run plan: the exact shell commands it would run,
a human summary, any warnings, and a short-lived
confirmationToken. - Call again with
confirmToken→ the token is validated (action-bound, single-use, expires in 10 minutes) and the exact commands captured at plan time are executed.
Read-only tools never need a token. This makes "copy my data", "pull this image", or "restart that container" reviewable before anything changes.
All user-supplied values (paths, container names, image tags) are POSIX-shell-quoted before being interpolated into a remote command, so they cannot break out into arbitrary command execution.
At confirm time, the arguments of the confirming call are cross-checked against the plan-time arguments captured in the token: if they differ, the tool refuses and asks you to re-run for a fresh plan (so a stale token can never execute a differently-argued action).
Configuration
The server reads a JSON config from ~/.ugnas-mcp/config.json (override with the
UGNAS_MCP_CONFIG environment variable). See config.example.json.
Environment-variable overrides
Useful for CI or secret injection. Env values win over the file:
Relative vs absolute paths
File/backup tools accept either. An absolute path is used as-is; a relative path is joined onto
defaultShare:
Install & run
Published on npm as ugnas-mcp. Run it directly —
no clone, no build:
That starts the stdio MCP server. It reads its config from ~/.ugnas-mcp/config.json
(or UGNAS_MCP_CONFIG / UGNAS_* env vars — see Configuration).
Wiring it into an MCP client
Point your client at the official package (stdio):
Or, if you installed it globally, "command": "ugnas-mcp" with no args.
Optional HTTP transport
The server is stdio by default. Set UGNAS_HTTP_PORT to also expose a streamable HTTP
transport (both run side by side):
POST http://127.0.0.1:4110/mcp— JSON-RPC (stateless; a fresh session per request, max 1 MiB body).GET http://127.0.0.1:4110/health— liveness + target host.
It binds to loopback by default. UGNAS_HTTP_HOST=0.0.0.0 (or any non-loopback address) is refused
unless UGNAS_HTTP_ALLOW_REMOTE=1 is also set — the /mcp endpoint has no authentication, and
confirmation tokens are process-wide, so only opt in if the port is secured by something else
(reverse proxy with auth, VPN, etc.).
Prerequisites on the NAS
- SSH enabled (UGOS: Control Panel → Terminal & SNMP).
- The SSH user can run
docker(be in thedockergroup) and, for scheduled backups, usecrontab. tar,df,du,ip,ssare present on UGOS — these are standard.backup.schedulejob names must be plain words ([A-Za-z0-9._-]) — they are embedded in a generated shell script and a crontab line, so anything else is rejected up front.rsyncis optional, used only byfiles.sync. If it's missing you get a note explaining how to install it or how to enable the built-incpfallback (files.sync { fallback: "cp" }); every other file tool works without rsync.
License
MIT — see LICENSE. Contributing, architecture, and the dev/release toolchain
live in DEVELOPMENT.md.
來源:README.md,提交 7e89906
工具
0版本歷史
1- v0.1.2最新Oct 17, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分