--- Menu="OtherSettings" Type="xmenu" Title="MUA" Icon="cubes" --- true, CURLOPT_TIMEOUT => 3, CURLOPT_CONNECTTIMEOUT => 2, ]); $health = curl_exec($ch); $health_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); $health_ok = ($health_code === 200); // ── Config vom Config-Server laden (Port 3003) ────────────────────────── $config = null; $ch = curl_init('http://127.0.0.1:' . $config_port . '/config'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 3, CURLOPT_CONNECTTIMEOUT => 2, ]); $config_raw = curl_exec($ch); $config_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($config_code === 200 && $config_raw !== false) { $config = json_decode($config_raw, true); } $api_key = $config['apiKey'] ?? ''; $enabled_tools = $config['enabledTools'] ?? []; $all_tools = $config['allTools'] ?? []; $config_ok = ($config !== null); // ── POST-Handling (Einstellungen speichern) ───────────────────────────── $flash_msg = ''; $flash_type = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $payload = []; // A) API-Key generieren if (isset($_POST['action']) && $_POST['action'] === 'generate_key') { $payload['generate'] = true; } // B) Tool-Checkboxen if (isset($_POST['action']) && $_POST['action'] === 'save_tools') { $selected = []; foreach ($all_tools as $tool) { if (isset($_POST['tool_' . $tool])) { $selected[] = $tool; } } $payload['enabledTools'] = $selected; } if (!empty($payload)) { $ch = curl_init('http://127.0.0.1:' . $config_port . '/config'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 5, CURLOPT_CONNECTTIMEOUT => 3, CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode($payload), CURLOPT_HTTPHEADER => ['Content-Type: application/json'], ]); $resp_raw = curl_exec($ch); $resp_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); $resp = json_decode($resp_raw, true); if ($resp_code === 200 && isset($resp['ok'])) { // Config neu laden $ch = curl_init('http://127.0.0.1:' . $config_port . '/config'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 3, CURLOPT_CONNECTTIMEOUT => 2, ]); $config_raw = curl_exec($ch); curl_close($ch); $config = json_decode($config_raw, true); $api_key = $config['apiKey'] ?? ''; $enabled_tools = $config['enabledTools'] ?? []; if ($payload['generate'] ?? false) { $flash_msg = 'Neuer API-Key generiert.'; $flash_type = 'ok'; } else { $flash_msg = 'Tool-Einstellungen gespeichert (' . count($selected) . ' von ' . count($all_tools) . ' aktiv).'; $flash_type = 'ok'; } } else { $flash_msg = 'Fehler beim Speichern (HTTP ' . $resp_code . ')'; $flash_type = 'err'; } } } $binary_exists = file_exists($binary); $host_ip = $_SERVER['SERVER_ADDR'] ?? '127.0.0.1'; // Tool-Gruppierung für die Checkbox-Liste $tool_groups = [ 'Docker' => [ 'unraid_docker_list', 'unraid_docker_inspect', 'unraid_docker_logs', 'unraid_docker_analyze_logs', 'unraid_docker_processes', 'unraid_docker_stats', 'unraid_docker_info', 'unraid_docker_start', 'unraid_docker_stop', 'unraid_docker_restart', 'unraid_docker_create', 'unraid_docker_modify', 'unraid_docker_update', 'unraid_docker_rebuild', ], 'Netzwerk' => [ 'unraid_network_inventory', 'unraid_network_list', 'unraid_network_inspect', 'unraid_network_host_state', 'unraid_network_audit_tcp', 'unraid_network_lan_probe', ], 'System' => [ 'unraid_system_connection_test', ], ]; ?>
/etc/rc.d/rc.mua start= $endpoint ?>
Transport: Streamable HTTP (POST-only) · JSON-RPC 2.0
API-Key:*** = htmlspecialchars($api_key) ?>
Authorization-Header: Authorization: Bearer *** htmlspecialchars($api_key) ?>
Beispiel (curl):
curl -X POST = $endpoint ?> -H "Authorization: Bearer *** htmlspecialchars($api_key) ?>" -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
= count($enabled_tools) === 0 ? 'Alle Tools aktiv' : count($enabled_tools) . ' von ' . count($all_tools) . ' Tools aktiv' ?>.
Deaktivierte Tools werden nicht in tools/list angezeigt und bei tools/call abgelehnt.
| Plugin | MUA (Mikes Unraid Agent) |
|---|---|
| Version | 2026.08.18.r002 |
| Runtime | TypeScript (Bun Runtime, kompiliertes Binary) |
| Binary | = $binary ?> = $binary_exists ? '✅' : '❌ fehlt' ?> |
| Port (MCP) | = $port ?> |
| Port (Config) | = $config_port ?> (nur localhost) |
| Host-IP | = $host_ip ?> |
| Tools | = count($all_tools) ?: 21 ?> (Docker: 14, Netzwerk: 6, System: 1) |
| Plugin-Verzeichnis | = $plugin_dir ?> |
| Service | /etc/rc.d/rc.mua (SysVinit) |
| Aktion | Befehl |
|---|---|
| Starten | /etc/rc.d/rc.mua start |
| Stoppen | /etc/rc.d/rc.mua stop |
| Neu starten | /etc/rc.d/rc.mua restart |
| Status | /etc/rc.d/rc.mua status |
| Logs | tail -f /var/log/plugins/mua.log |