Skip to content

Conversation

@alexlmiller
Copy link
Contributor

Hi @vespo92,

I've been using your TrueNAS MCP server and wanted to contribute back some enhancements that expand its scope to cover the full TrueNAS Community Edition ecosystem (both Core and SCALE) as I'm running Scale and particularly wanted it to cover apps/vms as well

Assuming you're interested in broadening this, I'm planning on continuing to add functionality, particularly around replication management and backups. Would love to hear your thoughts on the direction. Happy to make any adjustments based on your feedback!

What This PR Adds

SCALE Virtualization Tools (22 new tools)

Category Tools Description
Apps 8 tools Docker Compose app management (list, start, stop, restart, config, redeploy)
Incus Instances 7 tools VM and container management (list, start, stop, update, devices)
Legacy VMs 7 tools bhyve VM management for backward compatibility

Automatic Variant Detection

  • The server auto-detects whether it's connected to TrueNAS Core or SCALE
  • Universal features (storage, users, sharing, snapshots) work on both platforms
  • SCALE-specific tools are only registered when connected to a SCALE system

API Quirk Handling

  • Added post_raw() method to handle TrueNAS APIs that expect plain string bodies instead of JSON objects (e.g., /app/config, /virt/instance/start)

Testing

I've tested against SCALE 25.04 and 25.10

alexlmiller and others added 4 commits December 11, 2025 14:27
Adds comprehensive support for managing Apps, Incus instances (VMs and
Containers), and Legacy VMs on TrueNAS SCALE.

New tools:
- AppTools: list_apps, get_app, get_app_config, start_app, stop_app,
  restart_app, redeploy_app, update_app_config
- InstanceTools: list_instances, get_instance, start_instance,
  stop_instance, restart_instance, update_instance, list_instance_devices
- LegacyVMTools: list_legacy_vms, get_legacy_vm, start_legacy_vm,
  stop_legacy_vm, restart_legacy_vm, update_legacy_vm, get_legacy_vm_status

Key features:
- Handles TrueNAS API quirks (plain string bodies for /virt/instance/start
  and /app/config endpoints)
- Async operation polling for start/stop operations
- Memory handling in bytes for Incus instances
- Full Pydantic models for type safety

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Adds comprehensive tests for AppTools, InstanceTools, and LegacyVMTools
that run against actual TrueNAS servers.

Tests verify:
- List operations for apps, instances, and legacy VMs
- Get operations for individual resources
- Proper error handling for nonexistent resources
- API quirk handling (plain string body for /app/config)

All 13 tests passing against TrueNAS SCALE 25.04 (lev-nas).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Update description to include TrueNAS SCALE support
- Add Virtualization section to Features
- Document all App, Instance, and Legacy VM tools
- Update architecture diagram with new files
- Add SCALE-specific usage examples

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add TrueNASVariant enum (CORE, SCALE, UNKNOWN)
- Add detect_variant() method to client that queries /system/info
- Falls back to checking /app endpoint if version string is ambiguous
- Conditionally register tools based on detected variant:
  - Universal tools (users, storage, sharing, snapshots) on both
  - SCALE-only tools (apps, instances, vms) only on SCALE
- Update README to clarify Core vs SCALE feature support

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@vespo92 vespo92 merged commit 231d8d3 into vespo92:main Dec 12, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants