minas-webdav
小米智能存储(Xiaomi Smart Storage / MINAS)WebDAV 控制工具箱——不挂盘、不依赖 Samba,直接通过设备的 HTTPS WebDAV 端点(:5000)控制整个 /pool0/data 存储池。
三条能力线:
| 入口 | 作用 |
|---|---|
python -m minas_webdav <cmd> |
文件 CLI:列目录、统计、上传下载、移动复制、删除 |
python -m minas_webdav probe |
协议能力探测:读写全链路 + 认证 + 锁 |
python -m minas_webdav proxy |
本机反向代理(127.0.0.1:8899),供 Windows net use 挂 N 盘 |
安装
pipx install minas-webdav # CLI(推荐)
pip install "minas-webdav[mcp]" # 需要 MCP server 时加 extra
要求 Python ≥ 3.10。除 [mcp] extra 外无第三方依赖(只用标准库)。
不装也可以:PYTHONPATH=. python3 -m minas_webdav --help。
前置条件
配套环境、设备版本与兼容性说明见 docs/ENVIRONMENT.md(Windows 11 / Python 3.10+ / 小米智能存储官方客户端 1.0.8.170 / mcp 2.x;NAS 服务面:nginx/1.24.0 + DAV:1,2)。
- NAS 与本机同一局域网(默认
192.168.1.100:5000) - 官方客户端已登录过(证书在
%LOCALAPPDATA%\minasCert\) - 凭据文件在仓库外:
%LOCALAPPDATA%\minasCred\credentials.env
MINAS_USER=...
MINAS_PASS=...
- 非机密配置:复制
minas_webdav/minas_config.example.json为minas_webdav/minas_config.json(已 gitignore),填入真实host/cn
快速开始
# 列目录(JSON 输出适合 agent)
python -m minas_webdav ls /pool0/data --json
# 存储池容量
python -m minas_webdav df
# 上传 / 下载(中文路径直接写)
python -m minas_webdav put ./local.txt "/pool0/data/agent操作区/a.txt"
python -m minas_webdav get "/pool0/data/agent操作区/a.txt" ./back.txt
# 整理
python -m minas_webdav mkdir /pool0/data/work
python -m minas_webdav mv /pool0/data/a.txt /pool0/data/work/a.txt
python -m minas_webdav cp /pool0/data/a.txt /pool0/data/a-copy.txt
python -m minas_webdav rm /pool0/data/work -r # 递删前务必确认!
# 能力探测(写测试用唯一路径,自动清理)
python -m minas_webdav probe
# 本地代理(供挂 N 盘 / Explorer 使用)
python -m minas_webdav proxy
也可 pip install -e . 后直接用 minas-webdav / minas-webdav-proxy / minas-webdav-probe 命令。
挂 N 盘(可选)
.\scripts\挂载NAS为N盘.ps1 # 自动拉起代理 + net use N:
.\scripts\删除N盘文件.ps1 <路径> # 删掉资源管理器删不动的文件
命令一览
| 命令 | 作用 |
|---|---|
ls stat tree find |
浏览(--max-depth 防全盘递归) |
du df |
目录体积 / 存储池容量 |
get put cat |
传输 / 查看文本 |
mkdir mv cp rm |
整理(rm -r 需用户确认) |
退出码:0 成功 · 1 错误 · 2 不存在 · 3 认证/网络。
项目结构
minas_webdav/
config.py # 配置与凭据加载(minas_config.json + credentials.env)
cli.py # 文件 CLI
probe.py # 能力探测
proxy.py # 本机反向代理(WebClient 兼容调优)
scripts/ # 挂 N 盘 / 清理脚本 + rclone.zip
docs/ # webdav-surface.md 协议实测结论
协议要点(详见 docs/webdav-surface.md)
Host/SNI 必须用设备 CN(nas.<uid>.<hash>),不能裸用 IPPROPFIND Depth: infinity被拒(403),递归必须逐层Depth: 1MOVE/COPY的Destination用百分号编码的纯路径;IP 形式的 URL 会 400- 无认证访问返回 451;Basic 即可,mTLS 可选
安全约束
- 凭据与设备 CN 不进 Git(
.gitignore已挡minas_config.json/*.env) - 不写日志、不打印密码;不碰 SSH/Docker/固件
- 递归删除、批量动照片/备份目录前必须征得用户同意
Agent 接入
本项目同时提供两种 agent 接入方式(设计见 docs/agent-integration-design.md):
| 方式 | 位置 | 说明 |
|---|---|---|
| Skill | 仓库 skill/ → 拷到 ~/.config/mimocode/skills/minas-webdav/ |
SKILL.md 触发 + 调本 CLI;全局可用 |
| MCP | mcp_server.py + mimocode.jsonc 注册 minas-webdav |
14 个 nas_* 工具(stdio);nas_rm 递归必须 confirm=true |
安装 Skill(MiMoCode):
Copy-Item -Recurse skill "$HOME\.config\mimocode\skills\minas-webdav"
注册 MCP(~/.config/mimocode/mimocode.jsonc 的 mcp 段):
"minas-webdav": {
"type": "local",
"command": ["<python>", "-m", "minas_webdav.mcp_server"],
"environment": { "PYTHONPATH": "<本仓库路径>" },
"enabled": true
}
MCP 依赖装在项目 venv(pip install mcp,2.x)。改 CLI 后请同步更新 SKILL.md 命令表与 MCP 工具签名。
License
Apache-2.0,见 LICENSE 与 NOTICE。与 Xiaomi 无关联。
相关
- 挂 N 盘可选 rclone(官方下载;仓库不打包二进制)
- Samba 通道(仅 Z: 备份共享)是另一套:
minas-skill(SMB 445)
Metadata
Release files for minas-webdav 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| minas_webdav-0.1.1.tar.gz | 27.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| minas_webdav-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 55.6 kB
Release files / minas_webdav-0.1.1.tar.gz
| Download URL | minas_webdav-0.1.1.tar.gz |
|---|---|
| Size | 27.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cf56d3d34277a182b6e7ab5abc416dcc8a3cba52183f4ab4b418e7fa867ff0fd
|
|
BLAKE2b-256 checksum How to use checksums |
45e955e3d5d6b509fe730087a9bba0f68c56a447f0000ae28504a4523086ec69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 25, 2026.
Transparency logRelease files / minas_webdav-0.1.1-py3-none-any.whl
| Download URL | minas_webdav-0.1.1-py3-none-any.whl |
|---|---|
| Size | 27.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4322bff48b2e80aaedc7d27369860ccd9f7ce46c3285d348efdad9e0c6fd7dd4
|
|
BLAKE2b-256 checksum How to use checksums |
4f340d906a333f239592c2d6e9c9577f1764c35364e47bb8f60d1b65d94ceb41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 25, 2026.
Transparency logSecurity for minas-webdav 0.1.1
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.
Attestation for minas_webdav-0.1.1.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 Oct 25, 2026.
Transparency logA 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.