truenas-mcp
truenas-mcp
将 NAS 接入 AI 助手通常意味着为每个操作注册一个 MCP 工具。要完整覆盖 TrueNAS SCALE,需要 50-80 个工具模式——在模型读取你的问题之前,每次请求都会消耗约 28,000 个 token 的上下文窗口,无论你是否涉及存储。
truenas-mcp 将 18 个类别的 278 个操作——整个 TrueNAS SCALE REST API——封装在一个分层工具后面,仅需约 200 个 token。模型先询问存在哪些类别,深入所需的类别,然后调用操作。破坏性操作在未提供 confirm: true 时拒绝执行。
安装(60 秒)
# No install needed
TRUENAS_URL=https://truenas.local TRUENAS_API_KEY=1-abc123 npx truenas-mcpClaude Code:
claude mcp add truenas -- npx -y truenas-mcp --env TRUENAS_URL=https://truenas.local --env TRUENAS_API_KEY=1-your-api-key-here从 TrueNAS 界面获取 API 密钥:设置 > API 密钥 > 添加。
Related MCP server: Proxmox MCP Server
效果预览
你:“我的存储池健康吗?你能为媒体数据集创建一个 NFS 共享吗?”
→ truenas({ category: "storage", action: "pool_list" })
tank — ONLINE, 68% used, 0 errors
→ truenas({ category: "sharing", action: "nfs_share_create",
params: { path: "/mnt/tank/media", comment: "Media share" } })模型通过先调用 truenas({ category: "sharing" }) 发现了 nfs_share_create——它的提示中从未包含那 36 个共享操作。
为什么用一个工具而不是 278 个
truenas-mcp | 典型的 NAS MCP 服务器 | |
操作 | 278 | 5-80 |
Token 占用 | ~200 token(1 个工具) | 5,000-30,000 token(50-80 个工具) |
发现方式 | 分层——按需查询 | 扁平——所有内容预先加载 |
MCP 资源 | 12 个只读仪表盘 | 0 |
安装 |
| 从源码构建 / pip |
安全性 | 破坏性操作需要 | 各不相同 |
完整配置
# Using npx (no install needed)
TRUENAS_URL=https://truenas.local TRUENAS_API_KEY=1-abc123 npx truenas-mcp
# Or install globally
npm install -g truenas-mcp环境变量
变量 | 必需 | 描述 |
| 是 | TrueNAS 实例 URL(例如 |
| 是 | 来自 TrueNAS 界面的 API 密钥:设置 > API 密钥 > 添加 |
| 否 | 设置为 |
Claude Desktop 配置
添加到你的 claude_desktop_config.json:
{
"mcpServers": {
"truenas": {
"command": "npx",
"args": ["-y", "truenas-mcp"],
"env": {
"TRUENAS_URL": "https://truenas.local",
"TRUENAS_API_KEY": "1-your-api-key-here",
"TRUENAS_VERIFY_SSL": "false"
}
}
}
}Claude Code
claude mcp add truenas -- npx -y truenas-mcp \
--env TRUENAS_URL=https://truenas.local \
--env TRUENAS_API_KEY=1-your-api-key-here \
--env TRUENAS_VERIFY_SSL=false工作原理——分层工具设计
该服务器没有注册 278 个单独的工具(这将在 LLM 系统提示中消耗约 3 万 token),而是暴露了一个名为 truenas 的工具,具有三种使用模式:
1. 发现类别
truenas()返回所有 18 个类别及其描述和操作数量(约 200 token)。
2. 浏览类别
truenas({ category: "storage" })返回该类别中的所有操作及其必需/可选参数。
3. 执行操作
truenas({ category: "storage", action: "pool_list" })
truenas({ category: "storage", action: "dataset_create", params: { name: "tank/media", compression: "LZ4" } })这意味着 LLM 只需为其实际使用的内容支付 token 成本。
类别
类别 | 操作数 | 涵盖内容 |
| 24 | 系统信息、配置、服务、邮件、API 密钥、NTP |
| 32 | 存储池、数据集、快照、定期快照任务 |
| 36 | SMB/CIFS、NFS 导出、iSCSI 目标/扩展/门户/启动器 |
| 15 | 接口、全局配置、静态路由、IPMI、暂存更改 |
| 16 | 用户、组、权限/角色 |
| 7 | 物理磁盘、SMART 测试、温度 |
| 16 | 虚拟机、VM 设备(磁盘、网卡、显示、PCI) |
| 17 | Docker 应用、容器运行时配置 |
| 14 | 系统更新、引导环境、引导池 |
| 8 | TLS 证书、ACME/Let's Encrypt、DNS 验证器 |
| 10 | 警报、通知服务(Slack、电子邮件、PagerDuty) |
| 49 | 复制、云同步、云备份、cron、rsync、初始化脚本、SSH 密钥 |
| 7 | stat、listdir、mkdir、权限、ACL、chown |
| 3 | 指标配置、图表、时间序列数据 |
| 8 | Active Directory、LDAP、Kerberos |
| 12 | SSH、FTP、SNMP、UPS、系统可调参数 |
| 3 | 审计日志、审计配置 |
| 1 | 任意端点的原始 API 逃生舱 |
MCP 资源(12)
用于仪表盘的只读资源——无需调用工具:
资源 | URI | 描述 |
系统信息 |
| 版本、主机名、运行时间、硬件 |
存储池 |
| 所有存储池及其容量和健康状态 |
数据集 |
| 所有数据集及其属性 |
服务 |
| 服务状态概览 |
警报 |
| 当前系统警报 |
网络 |
| 接口、IP、DNS、网关 |
共享 |
| 所有 SMB、NFS 和 iSCSI 共享 |
虚拟机 |
| 虚拟机及其状态 |
应用 |
| 已安装的应用程序 |
磁盘 |
| 物理磁盘信息 |
引导环境 |
| 引导环境 |
更新 |
| 更新配置 |
示例对话
“我有哪些存储池?它们健康吗?”
→ truenas({ category: "storage", action: "pool_list" })“为 /mnt/tank/media 创建一个 NFS 共享”
→ truenas({ category: "sharing", action: "nfs_share_create", params: { path: "/mnt/tank/media", comment: "Media share" } })“检查系统更新”
→ truenas({ category: "update", action: "update_check" })“sda 上运行过哪些 SMART 测试?”
→ truenas({ category: "disk", action: "disk_smart_test_list", params: { disk: "sda" } })安全性
所有破坏性操作都要求参数中包含 confirm: true:
存储池创建/导出/磁盘更换
数据集/快照删除、快照回滚
虚拟机删除、应用删除/回滚
系统重启/关机、应用更新
磁盘擦除、引导磁盘挂载/卸载
证书删除、引导环境删除
目录服务离开、ACL 设置
如果没有 confirm: true,这些操作将返回一条错误消息,说明将会发生什么。
API 兼容性
专为 TrueNAS SCALE REST API v2.0 构建。兼容 TrueNAS SCALE 22.x 至 25.x。
开发
git clone https://github.com/spranab/truenas-mcp
cd truenas-mcp
npm install
npm run build
npm run dev # watch mode相关项目
同一作者构建的其他 MCP 服务器和代理基础设施:
mcpier — 为你的家庭实验室提供自托管 MCP 控制平面;避免 API 密钥暴露在客户端。
saga-mcp — 基于 SQLite 的项目跟踪器,确保代理在会话之间不会丢失计划。
yantrikdb-mcp — 为 Claude Code、Cursor 和 Windsurf 提供持久化认知记忆。
swarmcode — 不同机器上 Claude Code 实例之间的实时通道。
brainstorm-mcp — 将多模型辩论作为 MCP 工具。
许可证
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseAqualityDmaintenanceEnables Claude to monitor and manage homelab infrastructure including Docker containers, OPNsense firewall, and TrueNAS storage with configurable capability levels from read-only monitoring to full management control.13396
- AlicenseCqualityDmaintenanceEnables management of Proxmox VE infrastructure through natural language, providing 120+ tools to control virtual machines, containers, storage, cluster resources, users, and network configurations via the Proxmox API.10017MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to manage VMware vSphere virtual infrastructure through comprehensive operations including VM power control, snapshot management, resource monitoring, performance analytics, and bulk operations with built-in safety confirmations for destructive actions.
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Dell PowerScale (Isilon) OneFS clusters through over 2,400 tools generated from the REST API specification. It supports managing storage protocols, snapshots, networking, and cluster configurations using natural language.2MIT
Related MCP Connectors
Let AI operate servers without SSH. Choose actions, approve risky changes, and audit every step.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
SaaS intelligence for AI agents. 5 unified tools cover 1,000+ services with 91-96% token savings.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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/spranab/truenas-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server