Remote Support Start download

TrueNAS with MCP: AI-Powered NAS Management via Natural Language

TrueNASStorageMonitoring
TrueNAS with MCP: AI-Powered NAS Management via Natural Language

Managing storage systems largely consists of recurring tasks: status checks, snapshot creation, share management, user permissions. With the Model Context Protocol (MCP), TrueNAS can be connected to AI assistants that execute these tasks through natural language instructions. Instead of clicking through menus or assembling API calls, administrators state their intentions in plain text.

What Is MCP?

The Model Context Protocol is an open standard from Anthropic that connects AI models with external data sources and tools. MCP defines a unified interface through which an AI assistant can:

  • Read resources (e.g., pool status, disk information)
  • Invoke tools (e.g., create snapshot, restart service)
  • Use prompts (predefined query templates)

The decisive advantage over direct API integration: MCP abstracts the TrueNAS API and provides the AI model with a semantically meaningful interface. The model does not need to know that a snapshot is created via POST /api/v2.0/zfs/snapshot — it simply calls the create_snapshot tool.

Architecture: MCP Server for TrueNAS

The MCP integration consists of three components:

AI Assistant (Claude, GPT, etc.)
        ↕ MCP Protocol (JSON-RPC over stdio/SSE)
MCP Server for TrueNAS
        ↕ REST API (HTTPS)
TrueNAS SCALE/CORE

The MCP server is a lightweight process that acts as a bridge between the AI model and the TrueNAS API. It translates MCP tool calls into TrueNAS API requests and formats the results for the AI model.

Setting Up the MCP Server

The MCP server can run as a Python application or as a container:

# Install MCP server for TrueNAS
pip install truenas-mcp-server

# Create configuration
cat > ~/.config/truenas-mcp/config.json << 'EOF'
{
  "truenas_url": "https://truenas.example.com",
  "api_key": "1-abcdef1234567890",
  "verify_ssl": true,
  "read_only": false,
  "allowed_tools": [
    "get_system_info",
    "get_pool_status",
    "list_datasets",
    "create_snapshot",
    "list_snapshots",
    "get_disk_info",
    "get_smart_status",
    "list_shares",
    "get_alerts",
    "get_replication_status"
  ]
}
EOF

Creating an API Key in TrueNAS

Create a dedicated API key with restricted permissions:

  1. Credentials > API Keys > Add in the TrueNAS web interface
  2. Assign a descriptive name (e.g., mcp-assistant)
  3. Note the generated key — it is displayed only once

Important: Do not use the root API key. Create a user with minimal permissions and generate the key for that user.

Natural Language NAS Management

Status Queries

The most common interaction: administrators querying system status.

Input: “What is the status of pool tank?”

The AI assistant internally calls get_pool_status(pool="tank") and receives:

{
  "name": "tank",
  "status": "ONLINE",
  "scan": {
    "function": "SCRUB",
    "state": "finished",
    "start_time": "2026-04-27T02:00:00",
    "end_time": "2026-04-27T08:34:12",
    "errors": 0
  },
  "topology": {
    "data": [{"type": "RAIDZ2", "disks": 6, "status": "ONLINE"}],
    "log": [{"type": "MIRROR", "disks": 2, "status": "ONLINE"}],
    "special": [{"type": "MIRROR", "disks": 2, "status": "ONLINE"}]
  },
  "usage": {
    "total": "43.7 TiB",
    "used": "31.2 TiB",
    "free": "12.5 TiB",
    "percent_used": 71.4
  }
}

Assistant response: “Pool tank is online and healthy. The last scrub completed successfully on April 27 — no errors. Utilization is at 71.4% (31.2 TiB of 43.7 TiB used). SLOG and Special VDEV are both online in mirror mode.”

Creating Snapshots via Chat

Input: “Create a snapshot of tank/vms named pre-update.”

The assistant executes create_snapshot(dataset="tank/vms", name="pre-update"):

{
  "success": true,
  "snapshot": "tank/vms@pre-update",
  "created": "2026-05-01T10:15:32Z",
  "size": "0 B"
}

Response: “Snapshot tank/vms@pre-update was created successfully. Current size: 0 B (grows as changes are made to the dataset).”

Complex Queries

Input: “Show me all disks with SMART warnings.”

The assistant calls get_smart_status() and filters the results:

Response: “One disk shows SMART warnings: da3 (Serial: WDC-WCC4E1234567) has 3 Reallocated Sectors. The disk has been running for 47,238 hours. I recommend having a replacement on hand soon — the pool is protected against a single disk failure with RAIDZ2, but a second failure would put it at risk.”

Managing Shares

Input: “Create a new SMB share for the dataset tank/dept-finance with read/write access for the group ‘finance’.”

The assistant executes multiple API calls:

  1. Checks whether the dataset exists
  2. Creates the SMB share
  3. Sets the ACLs for the group

Response: “SMB share ‘Finance’ has been created. Path: /mnt/tank/dept-finance. The group ‘finance’ has read/write access. The share is available at \\truenas\Finance.”

Available MCP Tools

A typical MCP server for TrueNAS provides the following tools:

ToolDescriptionRead/Write
get_system_infoSystem information (version, uptime, hardware)Read
get_pool_statusPool status and topologyRead
list_datasetsList all datasets in a poolRead
get_dataset_infoDataset details (quota, compression, etc.)Read
create_snapshotCreate a dataset snapshotWrite
list_snapshotsShow snapshots for a datasetRead
delete_snapshotDelete a snapshotWrite
get_disk_infoDisk details (serial, model, temperature)Read
get_smart_statusSMART status of all disksRead
list_sharesList all shares (SMB, NFS, iSCSI)Read
get_alertsShow active alertsRead
get_replication_statusReplication jobs and their statusRead
restart_serviceRestart a service (SMB, NFS, etc.)Write

Security Considerations

Connecting an AI assistant to a production storage system requires careful security measures.

Principle of Least Privilege

Configure the MCP server with the minimum necessary tools. For a pure monitoring assistant:

{
  "read_only": true,
  "allowed_tools": [
    "get_system_info",
    "get_pool_status",
    "list_datasets",
    "get_disk_info",
    "get_smart_status",
    "get_alerts"
  ]
}

Confirmation Requirement for Destructive Actions

Implement a confirmation layer for write operations:

{
  "confirmation_required": [
    "delete_snapshot",
    "restart_service",
    "delete_share"
  ],
  "auto_approve": [
    "create_snapshot",
    "get_*"
  ]
}

This allows the assistant to create snapshots but requires explicit administrator confirmation before deletion.

Audit Logging

Every MCP action should be logged:

{
  "logging": {
    "enabled": true,
    "log_file": "/var/log/truenas-mcp/audit.log",
    "log_level": "INFO",
    "include_prompts": false,
    "include_responses": true
  }
}

Important: Set include_prompts to false to prevent user queries containing potentially sensitive information from being stored in the log.

Network Isolation

Run the MCP server on the same secured network as the TrueNAS management interface. The MCP server should not be reachable from the internet.

Management VLAN (10.10.1.0/24)
  ├── TrueNAS Management Interface
  ├── MCP Server
  └── Admin Workstations

Practical Scenarios

Scenario 1: Morning Check

An administrator starts the day with an overview:

“Give me the morning report for all TrueNAS systems.”

The assistant queries all configured TrueNAS instances in sequence and delivers:

  • Pool status and utilization
  • Latest scrub results
  • Active alerts
  • Replication status
  • Disk health

Scenario 2: Incident Response

An alert reports a degraded pool:

“Pool tank is degraded — which disk has failed and what is the resilver status?”

The assistant immediately delivers the relevant information without the administrator having to navigate through multiple web interfaces.

Scenario 3: Capacity Planning

“Show me the growth rate of the dataset tank/vms over the last 30 days and estimate when the pool will be full.”

The assistant analyzes snapshot sizes and calculates a trend forecast.

Future Outlook

MCP integration for TrueNAS is still in its early stages, but the direction of development is clear:

  • Proactive recommendations: The assistant recognizes patterns (e.g., regularly filling pools) and suggests actions
  • Multi-system management: A single assistant manages all TrueNAS instances in the organization
  • Automated runbooks: Complex procedures (pool expansion, disk replacement) are defined as MCP workflows
  • Ticket system integration: Alerts automatically become tickets with context and recommended actions

iXsystems is actively working on official MCP integration for TrueNAS SCALE. Until native support arrives, community projects already offer functional MCP servers connected via the TrueNAS REST API.

Conclusion

MCP makes TrueNAS management more accessible and efficient. Routine tasks like status checks and snapshot creation can be completed in seconds via chat, and complex queries no longer require API expertise. The key to secure deployment lies in consistent permissions management, confirmation requirements for destructive actions, and comprehensive audit logging. Setting up MCP today lays the foundation for AI-powered infrastructure management of the future.

More on these topics:

Need IT consulting?

Contact us for a no-obligation consultation on Proxmox, OPNsense, TrueNAS and more.

Get in touch