index.mdβ’5.54 kB
# TrueNAS Core MCP Server
Production-ready Model Context Protocol (MCP) server for TrueNAS Core - Control your NAS through natural language with Claude and other AI assistants.
## Overview
The TrueNAS Core MCP Server enables AI assistants like Claude to interact with your TrueNAS system through natural language, providing:
- **Storage Management**: Create, manage, and monitor ZFS pools and datasets
- **User Management**: Comprehensive user and group administration
- **Sharing**: Configure SMB, NFS, and iSCSI shares
- **Snapshots**: Automated snapshot management and scheduling
- **Production-Ready**: Built-in caching, rate limiting, metrics, and security
## Key Features
### π Performance
- **Smart Caching**: Configurable TTL-based caching with LRU eviction
- **Rate Limiting**: Token bucket algorithm protects your TrueNAS API
- **Connection Pooling**: Efficient HTTP connection management
- **Async Architecture**: Fully asynchronous for maximum throughput
### π Security
- **Audit Logging**: Complete audit trail of all operations
- **Input Validation**: Path traversal and injection protection
- **Authentication**: Secure API key management
- **Rate Limiting**: Prevent API abuse
### π Observability
- **Prometheus Metrics**: Full observability with counters, gauges, and histograms
- **Structured Logging**: JSON-formatted logs for easy parsing
- **Health Checks**: Built-in health and readiness endpoints
- **Performance Tracking**: Detailed timing metrics for all operations
### π‘οΈ Reliability
- **Circuit Breaker**: Automatic failure detection and recovery
- **Retry Logic**: Exponential backoff with jitter
- **Error Handling**: Comprehensive exception hierarchy
- **Type Safety**: Full type hints and Pydantic validation
## Quick Start
### Installation
```bash
# Using pip
pip install truenas-mcp-server
# Using pipx (recommended)
pipx install truenas-mcp-server
# Using uvx (no installation required)
uvx truenas-mcp-server
```
### Configuration
Create a `.env` file:
```env
TRUENAS_URL=https://your-truenas-server
TRUENAS_API_KEY=your-api-key-here
TRUENAS_VERIFY_SSL=true
LOG_LEVEL=INFO
ENABLE_CACHE=true
CACHE_TTL=300
RATE_LIMIT_PER_MINUTE=60
```
### Running the Server
```bash
truenas-mcp-server
```
## Architecture
```
βββββββββββββββββββββββββββββββββββββββββββββββ
β Claude / AI Assistant β
βββββββββββββββββββ¬ββββββββββββββββββββββββββββ
β MCP Protocol
βββββββββββββββββββΌββββββββββββββββββββββββββββ
β TrueNAS MCP Server β
β ββββββββββββ βββββββββββ ββββββββββββββ β
β β Cache β β Rate β β Metrics β β
β β Layer β β Limiter β β Collector β β
β ββββββββββββ βββββββββββ ββββββββββββββ β
β ββββββββββββββββββββββββββββββββββββββββ β
β β Tools Layer β β
β β Storage β Users β Sharing β Snapshotsβ β
β ββββββββββββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββββββββββββββββββ β
β β HTTP Client β β
β β Connection Pool β Retry β Auth β β
β ββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββ¬ββββββββββββββββββββββββββββ
β HTTPS API
βββββββββββββββββββΌββββββββββββββββββββββββββββ
β TrueNAS Core Server β
βββββββββββββββββββββββββββββββββββββββββββββββ
```
## Use Cases
### 1. Storage Management
"Create a new dataset named 'backups' on pool 'tank' with compression enabled"
### 2. Snapshot Management
"Create a snapshot of tank/data and schedule daily snapshots"
### 3. User Administration
"Create a new user 'john' with home directory and add to 'developers' group"
### 4. Share Configuration
"Set up an SMB share for /mnt/tank/data accessible by the team"
## Documentation
- [Installation Guide](guides/INSTALL.md)
- [Quick Start Guide](guides/QUICKSTART.md)
- [Feature Overview](FEATURES.md)
- [API Reference](api/client.md)
- [Troubleshooting](troubleshooting.md)
## Requirements
- Python 3.10 or higher
- TrueNAS Core 13.0 or higher
- Valid TrueNAS API key
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines.
## License
MIT License - see [LICENSE](https://github.com/vespo92/TrueNasCoreMCP/blob/main/LICENSE)
## Support
- GitHub Issues: https://github.com/vespo92/TrueNasCoreMCP/issues
- Documentation: https://github.com/vespo92/TrueNasCoreMCP/wiki