z-cli
This server provides a CLI and MCP-based interface for managing files, directories, and storage pools on a zspace NAS, exposing all capabilities to AI assistants via the Model Context Protocol.
File & Directory Management: List, create, rename, copy, move, and delete (to recycle bin) files and folders, with auto-rename on conflict.
File Search (
search_files): Search by name, type, size, and time, with filters for directory-only, hidden files, shared-only, and pagination/sorting.Recent Files (
list_recent_files): Retrieve a paginated list of recently accessed files.Storage Pool Info (
get_pool_info,get_pool_names): View storage pool details and name mappings.General HTTP Requests (
make_request): Send GET, POST, PUT, DELETE, or PATCH requests to any URL, with optional headers and JSON body.AI Assistant Integration: All functionality is exposed via a Model Context Protocol (MCP) server for use with AI assistants.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@z-clilist files in /sata12/my/data"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Z-CLI
zspace 私有云命令行工具,支持 CLI 和 MCP Server 两种使用方式,提供文件管理、存储池查询等 NAS 操作能力。
功能特性
文件操作 — 列表、创建、重命名、移动、复制、删除(回收站)
目录管理 — 创建文件夹,支持冲突自动重命名
文件搜索 — 按名称/类型/大小/时间搜索,支持分页
存储池查询 — 查看存储池信息和名称映射
最近文件 — 获取最近访问文件列表
通用请求 — 向任意 URL 发送 HTTP 请求
MCP Server — 通过 Model Context Protocol 暴露所有能力给 AI 助手
Related MCP server: truenas-ws-mcp
安装
前置条件
macOS(认证模块依赖 zspace 桌面客户端,暂不支持其他系统)
Python >= 3.10
zspace 桌面客户端已安装、登录,并保持在后台运行
安装方式
# 创建虚拟环境
python -m venv .venv
source .venv/bin/activate
# 安装
pip install -e .
# 验证
zcli pool快速上手
# 查看存储池
./dev pool
./dev poolname
# 文件操作
./dev list /sata12/my/data
./dev mkdir /sata12/my/data 新建文件夹
./dev create /sata12/my/data/文件.txt
./dev rename /sata12/my/data/旧名称 新名称
./dev copy /sata12/my/data/a /sata12/my/data/b
./dev move /sata12/my/data/a /sata12/my/data/sub/
./dev remove /sata12/my/data/无用文件.txt
# 搜索与最近文件
./dev search 关键词
./dev recent
# 通用请求
./dev request get https://api.example.com
# 启动 MCP Server
./dev mcp开发模式使用 ./dev 脚本(改源码即生效),生产模式使用 zcli 命令。
接入 Agent 示例
将 z-cli 的 MCP Server 接入 AI 助手(如 opencode、Claude Code)后,用户可以通过自然语言直接操控 NAS。
下图为自研的 NAS 助手 Agent:

CLI 命令参考
命令 | 功能 | 示例 |
| 查看存储池信息 |
|
| 查看存储池名称映射 |
|
| 列出目录文件 |
|
| 创建文件夹 |
|
| 创建文件 |
|
| 重命名 |
|
| 复制 |
|
| 移动 |
|
| 删除(回收站) |
|
| 搜索文件 |
|
| 最近文件 |
|
| 通用 HTTP 请求 |
|
| 启动 MCP Server |
|
MCP 配置
推荐方式:pipx 全局安装
pipx install -e /path/to/zspace-cli然后在 opencode.json 中配置:
{
"mcp": {
"zspace-cli": {
"type": "local",
"command": ["zcli", "mcp"],
"enabled": true
}
}
}备选方式:项目虚拟环境
在 opencode.json 中配置:
{
"mcp": {
"zspace-cli": {
"type": "local",
"command": [".venv/bin/python", "-m", "zspace", "mcp"],
"enabled": true
}
}
}注意:macOS 可能对
.venv下的文件自动设置隐藏标志,导致 Python 3.8+ 跳过__editable__的.pth文件(CPython #113659)。如果遇到ModuleNotFoundError: No module named 'zspace'错误,运行以下命令修复:xattr -rc .venv chflags -R 0 .venv
MCP 工具列表
工具 | 功能 |
| 查看存储池信息 |
| 查看存储池名称映射 |
| 列出目录文件 |
| 创建文件夹 |
| 创建文件 |
| 删除文件/文件夹(移至回收站) |
| 重命名 |
| 复制 |
| 移动 |
| 搜索文件 |
| 最近文件 |
| 通用 HTTP 请求 |
存储池路径规则
访问文件路径格式为 /<pool_name>/my/data,其中 pool_name 是 pool 接口返回的 name 字段(如 sata12、sata14),不是 id 或系统挂载点。
环境变量
变量 | 说明 |
| 覆盖 zspace 本地代理地址,用于跨网络访问 |
项目结构
z-cli/
├── .github/workflows/ # CI 配置
├── .claude/ # Claude 技能配置
├── src/zspace/
│ ├── api/ # NAS API 层
│ │ ├── fields.py # 字段映射
│ │ ├── file.py # 文件操作 API
│ │ └── pool.py # 存储池 API
│ ├── commands/ # CLI 子命令
│ │ ├── base.py # Command 基类
│ │ └── ... # 每个命令一个文件
│ ├── mcp/ # MCP 服务器
│ │ ├── base.py # McpTool 基类
│ │ └── tools/ # 每个工具一个文件
│ ├── auth.py # 登录凭据读取
│ └── client.py # HTTP 客户端封装
├── tests/ # 测试
├── dev # 热更新运行脚本
├── Makefile # 常用开发命令
├── CHANGELOG.md # 变更日志
└── CONTRIBUTING.md # 贡献指南开发
# 安装开发依赖
pip install -e ".[dev]"
# 热更新模式(改源码即生效)
./dev pool
# 代码检查
make lint
# 运行测试
make test许可证
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/philipxiaoxi/z-cli'
If you have feedback or need assistance with the MCP directory API, please join our Discord server