truenas-mcp
TrueNAS MCP Server
Read-only MCP server for TrueNAS Scale debugging. Runs directly on TrueNAS and provides:
k3s tools — kubectl get/describe/logs/events/top wrapped as MCP tools
TrueNAS API — whitelisted
midclt callmethods for system info, apps, pools
No destructive operations. Every tool is read-only.
Quick Start
# Install
pip install git+https://github.com/a-simple-test-organization/truenas-mcp.git
# Run (no auth)
MCP_PORT=38888 python -m truenas_mcp.server
# Starts on http://0.0.0.0:38888/mcp
# Health check
curl http://localhost:38888/health
# → {"status": "ok", "auth_enabled": false}Authentication
Set MCP_TOKEN to enable Bearer token auth. Then all requests must include Authorization: Bearer <token>.
# Generate a token
openssl rand -hex 32
# Run with auth
MCP_TOKEN="your-token-here" MCP_PORT=38888 python -m truenas_mcp.serverClient configuration (e.g. OpenClaw, Claude Code, OpenCode):
{
"mcpServers": {
"truenas": {
"url": "http://192.168.2.48:38888/mcp",
"headers": {
"Authorization": "Bearer your-token-here"
}
}
}
}The /health endpoint is always available without authentication.
systemd Deployment
# Copy the unit file
cp deploy/truenas-mcp.service /etc/systemd/system/
# Edit Environment=MCP_TOKEN= to set your token
vim /etc/systemd/system/truenas-mcp.service
# Enable and start
systemctl daemon-reload
systemctl enable --now truenas-mcp.service
# Check
systemctl status truenas-mcp
journalctl -u truenas-mcp -fMCP Tools
k3s (9 tools)
Tool | Description |
| Get resources (pods, deployments, nodes, ...) |
| Detailed resource description |
| Container logs |
| Cluster events |
| Node status |
| Resource usage by pod |
| Resource usage by node |
| Available API types |
| Quick all-pods overview |
TrueNAS (2 tools)
Tool | Description |
| Call whitelisted TrueNAS API method |
| Call with arguments |
Debugging Slow App Startup
1. pod_status_summary
2. kubectl_events(all_namespaces=True)
3. kubectl_describe(resource_type="pod", name="<slow-pod>", namespace="ix-<app>")
4. kubectl_logs(pod_name="<slow-pod>", namespace="ix-<app>")
5. midclt_call(method="chart.release.query")Environment Variables
Variable | Default | Description |
| auto (PATH + fallbacks) | Path to k3s binary |
| auto (PATH + fallbacks) | Path to midclt binary |
|
| HTTP listen port |
|
| HTTP listen host |
|
| Streamable HTTP endpoint path |
| (empty = no auth) | Bearer token for authentication |
License
MIT