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 "Deploy 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-cli list 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 私有云 NAS 的命令行工具,支持 CLI 和 MCP Server 两种使用方式。通过 MCP 协议接入 AI 助手后,可以用自然语言操控 NAS 上的文件和存储资源。
Related MCP server: hcloud-mcp-server
功能特性
文件操作 — 列表、创建、重命名、移动、复制、删除(回收站)
目录管理 — 创建文件夹,支持冲突自动重命名
文件搜索 — 按名称/类型/大小/时间搜索,支持分页
存储池查询 — 查看存储池信息和名称映射
最近文件 — 获取最近访问文件列表
MCP Server — 通过 Model Context Protocol 暴露所有能力给 AI 助手
双模式运行 — 开发模式
./dev(热更新)与生产模式zcli
接入 Agent 示例
将 z-cli 的 MCP Server 接入 AI 助手(如 opencode、Claude Code)后,用户可以通过自然语言直接操控 NAS。
下图为自研的 NAS 助手 Agent z-agent 的演示:

快速上手
前置条件
macOS / Windows(认证模块从 zspace 桌面客户端本地数据目录读取凭据)
Python >= 3.10
zspace 桌面客户端已安装、登录,并保持在后台运行
安装
python -m venv .venv
source .venv/bin/activate
# Windows: .venv\Scripts\Activate.ps1
pip install -e .
# 验证
zcli poolCLI 模式
# 存储池
zcli pool
zcli poolname
# 文件操作
zcli list /sata12/my/data
zcli mkdir /sata12/my/data 新建文件夹
zcli create /sata12/my/data/文件.txt
zcli rename /sata12/my/data/旧名称 新名称
zcli copy /sata12/my/data/a /sata12/my/data/b
zcli move /sata12/my/data/a /sata12/my/data/sub/
zcli remove /sata12/my/data/无用文件.txt
# 搜索与最近文件
zcli search 关键词
zcli recent
# 启动 MCP Server
zcli mcpMCP 模式
推荐方式:pipx 全局安装
pipx install -e /path/to/zspace-cli然后在 AI 工具(如 opencode、Claude Code)中配置:
{
"mcp": {
"zspace-cli": {
"type": "local",
"command": ["zcli", "mcp"],
"enabled": true
}
}
}备选方式:项目虚拟环境
{
"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
项目结构
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 # 登录凭据读取
├── tests/ # 测试
├── dev # 热更新运行脚本
├── Makefile # 常用开发命令
├── CHANGELOG.md # 变更日志
└── CONTRIBUTING.md # 贡献指南CLI 命令参考
命令 | 功能 | 示例 |
| 查看存储池信息 |
|
| 查看存储池名称映射 |
|
| 检查与本地代理的连通性 |
|
| 列出目录文件 |
|
| 创建文件夹 |
|
| 创建文件 |
|
| 读取文本文件内容 |
|
| 重命名 |
|
| 复制 |
|
| 移动 |
|
| 删除(回收站) |
|
| 搜索文件 |
|
| 最近文件 |
|
| 管理 AI skills(install/uninstall) |
|
| 启动 MCP Server |
|
MCP 工具列表
工具 | 功能 |
| 查看存储池信息 |
| 查看存储池名称映射 |
| 检查与本地代理的连通性 |
| 列出目录文件 |
| 创建文件夹 |
| 创建文件 |
| 读取文本文件内容 |
| 删除文件/文件夹(移至回收站) |
| 重命名 |
| 复制 |
| 移动 |
| 搜索文件 |
| 最近文件 |
存储池路径规则
访问文件路径格式为 /<pool_name>/my/data,其中 pool_name 是 pool 接口返回的 name 字段(如 sata12、sata14),不是 id 或系统挂载点。
配置
变量 | 说明 |
| 覆盖 zspace 本地代理地址,用于跨网络访问 |
开发
# 安装开发依赖
pip install -e ".[dev]"
# 热更新模式(改源码即生效)
./dev pool
# 代码检查
make lint
# 运行测试
make test致谢
本项目基于 skyzhao1223/zspace-cli 的构思与想法,重新实现并调整了架构。
许可证
Available Tools
13 toolscheck_connectivityA
检查与 zspace NAS 本地代理的连通性(TCP + HTTP),适用于诊断连接问题
Inputs: timeout.
copy_itemC
复制 zspace NAS 上的文件或文件夹,支持个人空间和团队空间路径
Inputs: to (required), paths (required), rename.
create_fileC
在 zspace NAS 上创建文件,同时支持个人空间(/sata12/my/data)和团队空间(/sata12/public)路径
Inputs: path (required), rename, content.
create_folderB
在 zspace NAS 上创建新文件夹,同时支持个人空间(/sata12/my/data)和团队空间(/sata12/public)路径
Inputs: name (required), parent (required), rename.
delete_itemC
删除 zspace NAS 上的文件或文件夹,支持个人空间和团队空间路径
Inputs: paths (required), show_hidden.
get_pool_infoB
查看 zspace NAS 存储池信息
Inputs: no named parameters.
get_pool_namesB
获取存储池名称映射(pool key → display name)
Inputs: no named parameters.
list_filesA
列出 zspace NAS 指定目录下的文件与子文件夹。设置 team=true 可列出团队空间文件
Inputs: path (required), num, team, order, +3 more.
list_recent_filesC
获取 zspace NAS 上最近访问的文件列表
Inputs: num, scope, start, show_hidden.
move_itemC
移动或重命名 zspace NAS 上的文件或文件夹,支持个人空间和团队空间路径
Inputs: to (required), paths (required), rename.
read_fileA
读取 zspace NAS 上文本文件的内容(仅限文本文件,非文本文件返回错误),支持个人空间和团队空间路径
Inputs: path (required).
rename_itemB
重命名 zspace NAS 上的文件或文件夹,支持个人空间和团队空间路径
Inputs: path (required), newname (required).
search_filesB
在 zspace NAS 上搜索文件,同时支持个人空间(/sata12/my/data)和团队空间(/sata12/public)路径
Inputs: name (required), num, ftype, start, +7 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
Most tools have clearly distinct purposes (create, read, list, search, copy, move, rename, delete, connectivity check, pool info). The only minor overlap is between 'get_pool_info' and 'get_pool_names', which are related but distinguishable.
All tool names follow a consistent verb_noun pattern in lowercase snake_case (e.g., create_file, list_files, check_connectivity), making it easy for an agent to infer the action and target.
With 13 tools, the server covers all essential file management operations and some diagnostic functions without being overwhelming. The number is well-scoped for a NAS CLI server.
The tool set covers most common operations (create, read, list, search, copy, move, rename, delete, folder creation, recent files, pool info). However, there is no tool to write or update file content, which is a notable gap for file management.
Maintenance
Related MCP Connectors
Egnyte's remote MCP server for secure AI access, search, upload and file management in your account.
Hosted MCP server connecting AI assistants to 9,000+ apps and 40,000+ actions via Zapier.
Tigris MCP Server seamlessly connects AI agents to Tigris bucket and object management.
The CustomGPT.ai MCP server is a fully managed, RAG-powered endpoint that connects large language models with private knowledge bases and external data sources. It provides tools for retrieval-augmented generation queries (send_message), data ingestion (upload_file), and source listing, enabling AI agents to query private documents like PDFs with high accuracy and real-time citations.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server for file and directory operations with enterprise-grade security, enabling autonomous AI development workflows.MIT
- FlicenseCqualityDmaintenanceAn MCP server that exposes the Huawei Cloud CLI as a single tool for AI assistants to discover and execute commands interactively via --help navigation, with built-in safety for destructive operations.91-
- AlicenseAqualityBmaintenanceAI-powered MCP server for TrueNAS SCALE storage operations with governance and safety features, enabling management of pools, datasets, snapshots, disks, alerts, and services.251MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents like Claude Code to directly control a ZSpace NAS with 90 tools for file management, media, notes, cloud disks, and more.39MIT