Manage TrueNAS Storage via Natural Language
A production-ready MCP server that lets you manage TrueNAS Core and SCALE storage and virtualization through natural language.
4.1.1Add to Favorites
Why it matters
Control and manage your TrueNAS storage infrastructure, including users, datasets, and shares, using natural language commands. This asset enables seamless interaction with TrueNAS Core via MCP-compatible clients.
Outcomes
What it gets done
Manage TrueNAS users (create, update, delete).
Administer storage pools and datasets.
Configure SMB and NFS file shares.
Automate snapshot creation and management.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-truenas-core-mcp | bash Capabilities
Tools your agent gets
List all users with details
Get information about a specific user
Create a new user account
Modify user properties
Delete a user account
Show all storage pools
Detailed pool status and statistics
List all datasets
Overview
TrueNAS Core MCP Server
An MCP server that connects Claude to TrueNAS Core or SCALE, managing storage pools, datasets, shares, snapshots, and SCALE apps or VMs through natural language. Use it to operate a TrueNAS deployment conversationally instead of the web UI; destructive delete operations stay disabled unless explicitly enabled.
What it does
This MCP server connects Claude or any MCP-compatible client to a TrueNAS Core or SCALE system, letting you control storage and virtualization through natural language instead of the web UI. It auto-detects whether the connected system is Core or SCALE and enables the appropriate feature set automatically.
Universal features available on both variants cover user management (create, update, delete users and permissions), storage management (pools, datasets, volumes with full ZFS support), file sharing (SMB, NFS, and iSCSI share configuration), snapshot management (create, delete, rollback, and automated snapshot tasks), and system monitoring (health, pool status, resource usage). On TrueNAS SCALE (24.04+) it additionally manages Docker Compose-based apps and, on SCALE 25.04+, Incus VMs and containers, plus legacy bhyve virtual machines. Under the hood it uses Pydantic models for type-safe request/response validation, structured production logging, connection pooling with retry logic, comprehensive error handling with detailed recovery guidance, and built-in rate limiting.
When to use - and when NOT to
Use it when you want to operate a TrueNAS deployment conversationally - checking pool health, provisioning datasets, setting up shares, managing snapshots, or controlling SCALE apps and VMs - without switching to the web UI for every action. Destructive operations (deletes) are disabled by default via TRUENAS_ENABLE_DESTRUCTIVE_OPS=false and must be explicitly enabled, so it is designed to be used cautiously against production storage.
It is not a general storage-vendor connector - it is specific to TrueNAS Core/SCALE - and debug tools are gated behind development mode rather than exposed by default.
Capabilities
The tool surface spans user management (list_users, create_user, update_user, delete_user), storage (list_pools, get_pool_status, create_dataset, update_dataset, delete_dataset), file sharing (create_smb_share, create_nfs_export, create_iscsi_target), snapshots (create_snapshot, rollback_snapshot, clone_snapshot, create_snapshot_task), SCALE apps (list_apps, start_app, stop_app, restart_app, update_app_config), Incus instances (start_instance, stop_instance, update_instance), and legacy VMs (start_legacy_vm, stop_legacy_vm, update_legacy_vm). All list_* tools support limit/offset pagination (max 500 items) to control token usage, and get-operations for apps, instances, and VMs support an include_raw parameter to return the full underlying API response for debugging. The list_datasets and get_dataset tools additionally support an include_children parameter to exclude child datasets and reduce response payload size. Beyond the MCP protocol itself, the server can also be used as a standalone Python library via TrueNASMCPServer, or through its async TrueNASClient for custom programmatic integrations.
How to install
The recommended path is running it directly with uvx, no separate install step required:
uvx truenas-mcp-server
After installing, configure it in your Claude Desktop config with TRUENAS_URL and TRUENAS_API_KEY (obtained from TrueNAS Web UI under Settings then API Keys), plus optional flags like TRUENAS_VERIFY_SSL and TRUENAS_LOG_LEVEL. It can also be installed via pip, pipx, or from source with pip install -e . after cloning the repository.
Who it's for
Home-lab and infrastructure operators running TrueNAS Core or SCALE who want to manage storage pools, shares, snapshots, and (on SCALE) apps and VMs conversationally through Claude or another MCP client. The project is released under the MIT License.
Source README
TrueNAS MCP Server
A production-ready Model Context Protocol (MCP) server for TrueNAS Core and SCALE systems. Control and manage your TrueNAS storage and virtualization through natural language with Claude or other MCP-compatible clients.
Automatic variant detection: The server automatically detects whether you're connected to TrueNAS Core or SCALE and enables the appropriate features.
๐ Features
Universal Features (Core & SCALE)
- User Management - Create, update, delete users and manage permissions
- Storage Management - Manage pools, datasets, volumes with full ZFS support
- File Sharing - Configure SMB, NFS, and iSCSI shares
- Snapshot Management - Create, delete, rollback snapshots with automation
- System Monitoring - Check system health, pool status, and resource usage
TrueNAS SCALE Features (24.04+)
Automatically enabled when connected to SCALE
- Apps - Manage Docker Compose-based TrueNAS applications
- Incus Instances - Control Incus VMs and containers (SCALE 25.04+)
- Legacy VMs - Manage bhyve virtual machines
Enterprise Features
- Type-Safe Operations - Full Pydantic models for request/response validation
- Comprehensive Error Handling - Detailed error messages and recovery guidance
- Production Logging - Structured logging with configurable levels
- Connection Pooling - Efficient HTTP connection management with retry logic
- Rate Limiting - Built-in rate limiting to prevent API abuse
- Environment-Based Config - Flexible configuration via environment variables
๐ฆ Installation
Quick Start with uvx (Recommended)
The easiest way to run TrueNAS MCP Server is with uvx:
# Run directly without installation
uvx truenas-mcp-server
# Or install globally with uv
uv tool install truenas-mcp-server
Traditional Installation
# With pip
pip install truenas-mcp-server
# Or with pipx for isolated environment
pipx install truenas-mcp-server
From Source
git clone https://github.com/vespo92/TrueNasCoreMCP.git
cd TrueNasCoreMCP
pip install -e .
๐ง Configuration
Environment Variables
Create a .env file or set environment variables:
# Required
TRUENAS_URL=https://your-truenas-server.local
TRUENAS_API_KEY=your-api-key-here
# Optional
TRUENAS_VERIFY_SSL=true # Verify SSL certificates
TRUENAS_LOG_LEVEL=INFO # Logging level
TRUENAS_ENV=production # Environment (development/staging/production)
TRUENAS_HTTP_TIMEOUT=30 # HTTP timeout in seconds
TRUENAS_ENABLE_DESTRUCTIVE_OPS=false # Enable delete operations
TRUENAS_ENABLE_DEBUG_TOOLS=false # Enable debug tools
Getting Your API Key
- Log into TrueNAS Web UI
- Go to Settings โ API Keys
- Click Add and create a new API key
- Copy the key immediately (it won't be shown again)
Claude Desktop Configuration
Add to your Claude Desktop config (claude_desktop_config.json):
{
"mcpServers": {
"truenas": {
"command": "uvx",
"args": ["truenas-mcp-server"],
"env": {
"TRUENAS_URL": "https://your-truenas-server.local",
"TRUENAS_API_KEY": "your-api-key-here",
"TRUENAS_VERIFY_SSL": "false"
}
}
}
}
Note: This uses uvx to automatically manage the Python environment. Make sure you have uv installed:
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# or
brew install uv
๐ Usage Examples
With Claude Desktop
Once configured, you can interact with TrueNAS using natural language:
"List all storage pools and their health status"
"Create a new dataset called 'backups' in the tank pool with compression"
"Set up an SMB share for the documents dataset"
"Create a snapshot of all datasets in the tank pool"
"Show me users who have sudo privileges"
# TrueNAS SCALE virtualization examples
"List all running apps and their status"
"Get the configuration for the sonarr app"
"Show me all Incus VMs and containers"
"Update the crypto-nodes VM to use 8 CPUs"
"Restart the plex app"
As a Python Library
from truenas_mcp_server import TrueNASMCPServer
# Create server instance
server = TrueNASMCPServer()
# Run the server
server.run()
Programmatic Usage
import asyncio
from truenas_mcp_server.client import TrueNASClient
from truenas_mcp_server.config import Settings
async def main():
# Initialize client
settings = Settings(
truenas_url="https://truenas.local",
truenas_api_key="your-api-key"
)
async with TrueNASClient(settings) as client:
# List pools
pools = await client.get("/pool")
print(f"Found {len(pools)} pools")
# Create a dataset
dataset = await client.post("/pool/dataset", {
"name": "tank/mydata",
"compression": "lz4"
})
print(f"Created dataset: {dataset['name']}")
asyncio.run(main())
๐ ๏ธ Available Tools
User Management
list_users- List all users with detailsget_user- Get specific user informationcreate_user- Create new user accountupdate_user- Modify user propertiesdelete_user- Remove user account
Storage Management
list_pools- Show all storage poolsget_pool_status- Detailed pool health and statisticslist_datasets- List all datasetscreate_dataset- Create new dataset with optionsupdate_dataset- Modify dataset propertiesdelete_dataset- Remove dataset
File Sharing
list_smb_shares- Show SMB/CIFS sharescreate_smb_share- Create Windows sharelist_nfs_exports- Show NFS exportscreate_nfs_export- Create NFS exportlist_iscsi_targets- Show iSCSI targetscreate_iscsi_target- Create iSCSI target
Snapshot Management
list_snapshots- Show snapshotscreate_snapshot- Create manual snapshotdelete_snapshot- Remove snapshotrollback_snapshot- Revert to snapshotclone_snapshot- Clone to new datasetcreate_snapshot_task- Setup automated snapshots
App Management (TrueNAS SCALE)
list_apps- Show all TrueNAS apps with statusget_app- Get detailed app informationget_app_config- Get full app configurationstart_app- Start an appstop_app- Stop an apprestart_app- Restart an appredeploy_app- Redeploy after config changesupdate_app_config- Update app configuration
Incus Instance Management (TrueNAS SCALE)
list_instances- Show VMs and containersget_instance- Get instance detailsstart_instance- Start an instancestop_instance- Stop an instancerestart_instance- Restart an instanceupdate_instance- Update CPU/memory/autostartlist_instance_devices- Show attached devices
Legacy VM Management
list_legacy_vms- Show bhyve VMsget_legacy_vm- Get VM detailsstart_legacy_vm- Start a VMstop_legacy_vm- Stop a VMrestart_legacy_vm- Restart a VMupdate_legacy_vm- Update VM configurationget_legacy_vm_status- Get VM status
Debug Tools (Development Mode)
debug_connection- Check connection settingstest_connection- Verify API connectivityget_server_stats- Server statistics
๐ Pagination and Response Control
All list operations support pagination to reduce token usage when working with LLM clients. Get operations support optional raw API response inclusion for debugging.
Pagination Parameters
All list_* tools support these parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
limit |
integer | 100 | Maximum items to return (max: 500) |
offset |
integer | 0 | Number of items to skip |
Response format:
{
"success": true,
"items": [...],
"metadata": { ... },
"pagination": {
"total": 250,
"limit": 100,
"offset": 0,
"returned": 100,
"has_more": true
}
}
Usage examples:
"List the first 10 datasets" โ limit=10
"Show users 50-100" โ limit=50, offset=50
"Get all SMB shares (up to 500)" โ limit=500
Include Raw API Response
Get operations for apps, instances, and VMs support the include_raw parameter:
| Parameter | Type | Default | Description |
|---|---|---|---|
include_raw |
boolean | false | Include full API response for debugging |
When to use include_raw=true:
- Debugging API response structure
- Accessing fields not included in the formatted response
- Troubleshooting integration issues
Tools supporting include_raw:
get_app- App detailsget_instance- Incus instance detailsget_legacy_vm- Legacy VM details
Dataset Response Control
The list_datasets and get_dataset tools support an additional parameter:
| Parameter | Type | Default | Description |
|---|---|---|---|
include_children |
boolean | true | Include child datasets (can reduce payload significantly) |
Usage:
"List only top-level datasets" โ include_children=false
"Get tank dataset without children" โ include_children=false
๐๏ธ Architecture
truenas_mcp_server/
โโโ __init__.py # Package initialization
โโโ server.py # Main MCP server
โโโ config/ # Configuration management
โ โโโ __init__.py
โ โโโ settings.py # Pydantic settings
โโโ client/ # HTTP client
โ โโโ __init__.py
โ โโโ http_client.py # Async HTTP with retry
โโโ models/ # Data models
โ โโโ __init__.py
โ โโโ base.py # Base models
โ โโโ user.py # User models
โ โโโ storage.py # Storage models
โ โโโ sharing.py # Share models
โ โโโ app.py # App models (SCALE)
โ โโโ instance.py # Incus instance models (SCALE)
โ โโโ vm.py # Legacy VM models
โโโ tools/ # MCP tools
โ โโโ __init__.py
โ โโโ base.py # Base tool class
โ โโโ users.py # User tools
โ โโโ storage.py # Storage tools
โ โโโ sharing.py # Share tools
โ โโโ snapshots.py # Snapshot tools
โ โโโ apps.py # App tools (SCALE)
โ โโโ instances.py # Incus instance tools (SCALE)
โ โโโ vms.py # Legacy VM tools
โโโ exceptions.py # Custom exceptions
๐งช Development
Setup Development Environment
# Clone repository
git clone https://github.com/vespo92/TrueNasCoreMCP.git
cd TrueNasCoreMCP
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e ".[dev]"
Running Tests
# Run all tests
pytest
# With coverage
pytest --cov=truenas_mcp_server
# Specific test file
pytest tests/test_client.py
Code Quality
# Format code
black truenas_mcp_server
# Lint
flake8 truenas_mcp_server
# Type checking
mypy truenas_mcp_server
๐ Documentation
- Installation Guide - Detailed installation instructions
- Quick Start - Get up and running quickly
- Quick Reference - Command reference
- Features Overview - Detailed feature documentation
- API Documentation - Coming soon
๐ค Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Security
- Never commit API keys or credentials
- Use environment variables for sensitive data
- Enable SSL verification in production
- Restrict destructive operations by default
- Report security issues via GitHub Issues
๐ Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
๐ Acknowledgments
- Anthropic for the MCP specification
- TrueNAS for the excellent storage platform
- MCP Python SDK contributors
Made with โค๏ธ for the TrueNAS community
FAQ
Common questions
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.