Logo vun TrueNAS MCP Server

TrueNAS MCP Server

Communautéit
vespo92

A working TrueNAS Core MCP Server

Editeurvespo92
RepositoryTrueNasCoreMCP
SproochPython
Forks
10
Stären
31
Disponibel Tools
0
Transporttypstdio
Kategorien
LizenzMIT
Linken
  • Tools mat KI-Workflows verbannen

    TrueNAS MCP Server stellt MCP-Funktioune bereit, déi vu kompatibele KI-Clienten a KI-Agente kënne benotzt ginn.

  • 0 disponibel Tools

    Kuckt Iech déi opruffbar Aktiounen hei drënner un, mat Nimm a Beschreiwungen, wa se vum Server geliwwert ginn.

  • Konfiguratioun fir ze kopéieren

    Benotzt d'Installatiounsbeispiller, fir dëse Server an Ärem bevorzugte MCP-Client ze konfiguréieren.

  • Indicateure fir Open Source

    31 Stären an 10 Forks aus dem verlinkte Repository.

TrueNAS MCP Server

Python Version MCP Version License PyPI Version

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:

bash
# Run directly without installation
uvx truenas-mcp-server

# Or install globally with uv
uv tool install truenas-mcp-server

Traditional Installation

bash
# With pip
pip install truenas-mcp-server

# Or with pipx for isolated environment
pipx install truenas-mcp-server

From Source

bash
git clone https://github.com/vespo92/TrueNasCoreMCP.git
cd TrueNasCoreMCP
pip install -e .

🔧 Configuration

Environment Variables

Create a .env file or set environment variables:

bash
# 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

  1. Log into TrueNAS Web UI
  2. Go to Settings → API Keys
  3. Click Add and create a new API key
  4. Copy the key immediately (it won't be shown again)

Claude Desktop Configuration

Add to your Claude Desktop config (claude_desktop_config.json):

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:

bash
# 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

python
from truenas_mcp_server import TrueNASMCPServer

# Create server instance
server = TrueNASMCPServer()

# Run the server
server.run()

Programmatic Usage

python
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 details
  • get_user - Get specific user information
  • create_user - Create new user account
  • update_user - Modify user properties
  • delete_user - Remove user account

Storage Management

  • list_pools - Show all storage pools
  • get_pool_status - Detailed pool health and statistics
  • list_datasets - List all datasets
  • create_dataset - Create new dataset with options
  • update_dataset - Modify dataset properties
  • delete_dataset - Remove dataset

File Sharing

  • list_smb_shares - Show SMB/CIFS shares
  • create_smb_share - Create Windows share
  • list_nfs_exports - Show NFS exports
  • create_nfs_export - Create NFS export
  • list_iscsi_targets - Show iSCSI targets
  • create_iscsi_target - Create iSCSI target

Snapshot Management

  • list_snapshots - Show snapshots
  • create_snapshot - Create manual snapshot
  • delete_snapshot - Remove snapshot
  • rollback_snapshot - Revert to snapshot
  • clone_snapshot - Clone to new dataset
  • create_snapshot_task - Setup automated snapshots

App Management (TrueNAS SCALE)

  • list_apps - Show all TrueNAS apps with status
  • get_app - Get detailed app information
  • get_app_config - Get full app configuration
  • start_app - Start an app
  • stop_app - Stop an app
  • restart_app - Restart an app
  • redeploy_app - Redeploy after config changes
  • update_app_config - Update app configuration

Incus Instance Management (TrueNAS SCALE)

  • list_instances - Show VMs and containers
  • get_instance - Get instance details
  • start_instance - Start an instance
  • stop_instance - Stop an instance
  • restart_instance - Restart an instance
  • update_instance - Update CPU/memory/autostart
  • list_instance_devices - Show attached devices

Legacy VM Management

  • list_legacy_vms - Show bhyve VMs
  • get_legacy_vm - Get VM details
  • start_legacy_vm - Start a VM
  • stop_legacy_vm - Stop a VM
  • restart_legacy_vm - Restart a VM
  • update_legacy_vm - Update VM configuration
  • get_legacy_vm_status - Get VM status

Debug Tools (Development Mode)

  • debug_connection - Check connection settings
  • test_connection - Verify API connectivity
  • get_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:

ParameterTypeDefaultDescription
limitinteger100Maximum items to return (max: 500)
offsetinteger0Number of items to skip

Response format:

json
{
  "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:

ParameterTypeDefaultDescription
include_rawbooleanfalseInclude 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 details
  • get_instance - Incus instance details
  • get_legacy_vm - Legacy VM details

Dataset Response Control

The list_datasets and get_dataset tools support an additional parameter:

ParameterTypeDefaultDescription
include_childrenbooleantrueInclude 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

bash
# 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

bash
# Run all tests
pytest

# With coverage
pytest --cov=truenas_mcp_server

# Specific test file
pytest tests/test_client.py

Code Quality

bash
# Format code
black truenas_mcp_server

# Lint
flake8 truenas_mcp_server

# Type checking
mypy truenas_mcp_server

📖 Documentation

🤝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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

🙏 Acknowledgments


Made with ❤️ for the TrueNAS community

Installatioun

TypingMind
Viraussetzungen:

Node.js 18+

{
  "mcpServers": {
    "vespo92-truenascoremcp": {
      "command": "uvx",
      "args": [
        "truenas-mcp-server"
      ]
    }
  }
}

TrueNAS MCP Server MCP mat verschiddene KI-Modeller benotzen

TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Soubal TrueNAS MCP Server verbonnen ass, kënnt Dir et mat verschiddene KI-Modeller an TypingMind benotzen, amplaz et fir all Modell separat anzeriichten. Dës MCP-Integratioun leeft lokal iwwer den TypingMind-MCP-Connector op Ärem Apparat.

Ariichtungsuleedung fir de lokale Connector ze benotzen

Benotzt dës Optioun, wann den MCP-Server Zougrëff op lokal Fichieren, Appen oder privat Ressourcen op Ärem Computer brauch.

1

D'MCP-Astellungen opmaachen

Gitt an TypingMind op „Astellungen“, „Erweidert Astellungen“, dann op „Model Context Protocol“ a wielt „Connector ariichten“.

  1. Maacht TypingMind an Ärem Browser op.
  2. Klickt op d'Astellungssymbol.
  3. Gitt op „Erweidert Astellungen“.
  4. Maacht d'Sektioun „Model Context Protocol“ op.
  5. Klickt op „Connector ariichten“ a wielt „Dësen Apparat“.
Ariichtungsbildschierm vum TypingMind-MCP-Connector mat „Dësen Apparat“ ausgewielt
2

De Connector-Befeel ausféieren

Wielt „Dësen Apparat“, kopéiert de Befeel aus TypingMind a féiert en am Terminal aus. Loosst de Prozess lafen, wärend Dir MCP benotzt.

  1. Kopéiert den Ariichtungsbefeel, deen TypingMind uweist.
  2. Maacht Terminal op macOS oder Windows Terminal op Windows op.
  3. Pescht de Befeel an a féiert en aus.
  4. Bestätegt d'Installatioun vum Package, wann den Terminal Iech freet, ob Dir weiderfuere wëllt.
  5. Loosst den Terminal an de Prozess doranner lafen, wärend Dir MCP-Tools benotzt.
3

TrueNAS MCP Server als Server derbäisetzen

Wann de Connector-Status „Prett“ ass, klickt op „Serveren änneren“ a pescht d'MCP-Serverkonfiguratioun an.

  1. Waart, bis de Connector-Status „Prett“ weist.
  2. Klickt op „Serveren änneren“.
  3. Pescht d'MCP-Serverkonfiguratioun vu TrueNAS MCP Server an.
  4. Späichert d'Serverlëscht.
  5. Aktualiséiert, wann Dir kontrolléiere wëllt, ob de Connector nach ëmmer prett ass.
MCP-Astellunge vun TypingMind mat aktivem Server an dem Knäppchen „Serveren änneren“
{
  "mcpServers": {
    "vespo92-truenascoremcp": {
      "command": "npx",
      "args": [
        "-y",
        "truenas-mcp-server"
      ]
    }
  }
}
4

D'Verbindung mat verschiddene Modeller benotzen

Späichert d'Serverlëscht, maacht „Plugins“ op an aktivéiert d'MCP-Tools vu TrueNAS MCP Server. Wielt dann e belibegen ënnerstëtzte KI-Modell an TypingMind a benotzt d'Tools am Chat oder weist se engem KI-Agent zou.

  1. Maacht d'Säit „Plugins“ an TypingMind op.
  2. Aktivéiert d'MCP-Tools vu TrueNAS MCP Server.
  3. Start e Chat a wielt de KI-Modell, deen Dir benotze wëllt.
  4. Benotzt d'MCP-Tools am Chat oder weist se engem KI-Agent zou.
  5. Wiesselt bei Bedarf op en anere KI-Modell, ouni MCP nei ze verbannen.
TypingMind-Chat mat aktivéierte MCP-Tools an engem ausgewielte KI-Modell
Hëlleft Dir mir bei dëser Aufgab mat TrueNAS MCP Server?
TrueNAS MCP Server
Jo. Ech hunn et gelies.
Dat hunn ech mat TrueNAS MCP Server fonnt.

Heefeg gestallte Froen

Fir wat gëtt de MCP-Server TrueNAS MCP Server benotzt?

TrueNAS MCP Server ass e MCP-Server, deen et kompatibele KI-Clienten erlaabt, sech mat externen Tools a Kontext ze verbannen. An TypingMind kënnt Dir dëse MCP-Server eemol derbäisetzen a seng Tools an Ärem KI-Aarbechtsberäich zur Verfügung stellen.

Kann ech TrueNAS MCP Server MCP mat méi KI-Modeller an TypingMind benotzen?

Jo. TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Sou kënnt Dir TrueNAS MCP Server mat verschiddene KI-Modeller wéi Claude, ChatGPT, Gemini oder anere Modeller benotzen, déi Dir an TypingMind konfiguréiert hutt, ouni de MCP-Server fir all Modell separat anzeriichten.

Firwat TrueNAS MCP Server MCP mat TypingMind benotzen?

TypingMind ass eng vun de beschte Benotzeruewerfläche fir LLM-Chat, well et méi KI-Modeller, Prompts, Plugins, KI-Agenten, API-Schlësselen a MCP-Tools an engem Aarbechtsberäich zesummebréngt. Wann TrueNAS MCP Server verbonnen ass, kënnt Dir seng MCP-Tools mat Äre bevorzugte Modeller benotzen a gläichzäiteg Är Chataarbecht an TypingMind organiséieren.

Wéi verbannen ech TrueNAS MCP Server MCP mat TypingMind?

TrueNAS MCP Server leeft iwwer de lokale MCP-Connector vun TypingMind. Dat eegent sech am beschten, wann de MCP-Server Zougrëff op lokal Fichieren, Desktop-Apps, Kommandozeilen-Tools oder privat Ressourcen op Ärem Computer brauch.

Wéi eng Tools stellt TrueNAS MCP Server MCP an TypingMind zur Verfügung?

TrueNAS MCP Server stellt MCP-Funktiounen zur Verfügung, déi Dir op der Plugins-Säit vun TypingMind aktivéiere kënnt, fir se am Chat ze benotzen oder KI-Agenten zouzeweisen.

Muss ech meng API-Schlëssele mat TypingMind deelen, fir TrueNAS MCP Server MCP ze benotzen?

Nee. TypingMind setzt op lokal Veraarbechtung a léisst Iech d'Kontroll iwwer Är Modellubidder, API-Schlësselen, Prompts a MCP-Konfiguratioun. Wann TrueNAS MCP Server eng Authentifizéierung verlaangt, setzt déi néideg Headeren, OAuth-Astellungen oder lokal Konfiguratioun fir dee MCP-Server derbäi, wann Dir d'Verbindung erstallt.

Änlech MCP-Serveren

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇