From 3de8cb055a10acbfd55d7900a682acbaac249810 Mon Sep 17 00:00:00 2001 From: Mikei386 <44135113+Mikei386@users.noreply.github.com> Date: Tue, 18 Aug 2026 07:35:49 +0200 Subject: [PATCH] Refactor: Doku-konformes Plugin-Format (DOCTYPE Entities, Method=update, .page-WebUI) --- plugin/mua.plg | 145 ++++++++++++++++++++----------- scripts/{plugin.php => mua.page} | 56 +++++------- 2 files changed, 115 insertions(+), 86 deletions(-) rename scripts/{plugin.php => mua.page} (59%) diff --git a/plugin/mua.plg b/plugin/mua.plg index 84c425a..4386650 100644 --- a/plugin/mua.plg +++ b/plugin/mua.plg @@ -1,36 +1,39 @@ - + + + + + + + +]> - - +### 1.0.0 +- Initial release: 21 Docker, network, and system tools as MCP server over HTTP (Streamable HTTP, port 3002). set -e -PLUGIN_DIR="/usr/local/emhttp/plugins/mua" -CONFIG_DIR="/boot/config/plugins/mua" -GIT_REPO="http://192.168.1.2:4000/michael/MUA-Mikes-Unraid-Agent.git" -TMP_DIR="/tmp/mua-install-$$" - echo "" echo "====================================================" echo " MUA - Mikes Unraid Agent" @@ -38,60 +41,85 @@ echo " Installation" echo "====================================================" echo "" -# 1. Verzeichnisse -mkdir -p "$PLUGIN_DIR/mcp" -mkdir -p "$PLUGIN_DIR/scripts" -mkdir -p "$CONFIG_DIR" +# Verzeichnisse +mkdir -p &emhttpLOC;/mcp +mkdir -p &emhttpLOC;/scripts +mkdir -p &pluginLOC; +mkdir -p /var/log/plugins +touch /var/log/plugins/mua.log + + + + + + + +set -e + +GIT_REPO="http://192.168.1.2:4000/michael/MUA-Mikes-Unraid-Agent.git" +TMP_DIR="/tmp/mua-install-$$" -# 2. Git-Repo klonen echo " Kloniere Repo..." git clone --depth 1 "$GIT_REPO" "$TMP_DIR" 2>&1 | sed 's/^/ /' -# 3. PHP-Dateien installieren +# MCP-Server (PHP) echo " Installiere MCP-Server..." -cp "$TMP_DIR/mcp/server.php" "$PLUGIN_DIR/mcp/" -cp "$TMP_DIR/mcp/helpers.php" "$PLUGIN_DIR/mcp/" -cp "$TMP_DIR/mcp/tools.php" "$PLUGIN_DIR/mcp/" -cp "$TMP_DIR/mcp/selftest.php" "$PLUGIN_DIR/mcp/" -chmod 644 "$PLUGIN_DIR/mcp/"*.php +cp "$TMP_DIR/mcp/server.php" &emhttpLOC;/mcp/ +cp "$TMP_DIR/mcp/helpers.php" &emhttpLOC;/mcp/ +cp "$TMP_DIR/mcp/tools.php" &emhttpLOC;/mcp/ +cp "$TMP_DIR/mcp/selftest.php" &emhttpLOC;/mcp/ +chmod 644 &emhttpLOC;/mcp/*.php -# 4. PHP-Helper (Write-Operationen) +# PHP-Helper (Write-Operationen) echo " Installiere PHP-Helper..." cp "$TMP_DIR/scripts/unraid-docker-mcp-helper.php" /usr/local/bin/ chmod 755 /usr/local/bin/unraid-docker-mcp-helper.php -# 5. WebGUI-Tab +# WebGUI-Tab (.page-Format) echo " Installiere WebGUI-Tab..." -cp "$TMP_DIR/scripts/plugin.php" "$PLUGIN_DIR/plugin.php" -chmod 644 "$PLUGIN_DIR/plugin.php" +cp "$TMP_DIR/scripts/mua.page" &emhttpLOC;/mua.page +chmod 644 &emhttpLOC;/mua.page -# 6. SysVinit-Service +# SysVinit-Service echo " Installiere Service..." cp "$TMP_DIR/scripts/rc.mua" /etc/rc.d/rc.mua chmod 755 /etc/rc.d/rc.mua -# 7. Log-Verzeichnis -mkdir -p /var/log/plugins -touch /var/log/plugins/mua.log +# Cleanup +rm -rf "$TMP_DIR" + + + + + + + +set +e -# 8. Selftest echo " Führe Selftest aus..." -php "$PLUGIN_DIR/mcp/selftest.php" 2>&1 | sed 's/^/ /' +php &emhttpLOC;/mcp/selftest.php 2>&1 | sed 's/^/ /' -# 9. Service starten echo " Starte MCP-Server..." /etc/rc.d/rc.mua start -# 10. Health-Check +# Health-Check sleep 2 -if curl -sf "http://127.0.0.1:3002/health" > /dev/null 2>&1; then +if curl -sf "http://127.0.0.1:3002/health" > /dev/null 2>&1; then echo "" echo " Health-Check: OK" echo "" echo "====================================================" echo " MUA installiert und läuft auf Port 3002" echo " Endpunkt: http://$(hostname -I | awk '{print $1}'):3002/mcp" - echo " WebGUI: Settings > MUA" + echo " WebGUI: Settings > MUA" echo "====================================================" else echo "" @@ -100,14 +128,31 @@ else echo "====================================================" fi -# 11. Cleanup -rm -rf "$TMP_DIR" +exit 0 + + +# Alte Dateien entfernen vor Reinstall +rm -rf &emhttpLOC;/mcp +rm -rf &emhttpLOC;/scripts +rm -f &emhttpLOC;/mua.page +rm -f &emhttpLOC;/plugin.php + + + + + @@ -128,10 +173,10 @@ rm -f /etc/rc.d/rc.mua rm -f /usr/local/bin/unraid-docker-mcp-helper.php # 4. Plugin-Verzeichnis entfernen -rm -rf /usr/local/emhttp/plugins/mua +rm -rf &emhttpLOC; # 5. Config entfernen -rm -rf /boot/config/plugins/mua +rm -rf &pluginLOC; # 6. Logs entfernen rm -f /var/log/plugins/mua.log diff --git a/scripts/plugin.php b/scripts/mua.page similarity index 59% rename from scripts/plugin.php rename to scripts/mua.page index 631abe2..87acb17 100644 --- a/scripts/plugin.php +++ b/scripts/mua.page @@ -1,9 +1,14 @@ +--- +Menu="OtherSettings" +Type="xmenu" +Title="MUA" +Icon="cubes" +--- true, @@ -34,53 +40,34 @@ $health_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); $health_ok = ($health_code === 200); -// PHP-Version $php_version = PHP_VERSION; - -// Tool-Anzahl (aus tools.php) $tool_count = 21; - -// Host-IP $host_ip = $_SERVER['SERVER_ADDR'] ?? '127.0.0.1'; ?> - - - - -MUA - Mikes Unraid Agent - - -

MUA - Mikes Unraid Agent

-
✅ MCP-Server läuft (PID , Port )
+
✅ MCP-Server läuft (PID , Port )
-
❌ MCP-Server läuft nicht — starte mit /etc/rc.d/rc.mua start
+
❌ MCP-Server läuft nicht — starte mit /etc/rc.d/rc.mua start
-
✅ Health-Check: OK
+
✅ Health-Check: OK
-
⚠️ Health-Check: HTTP
+
⚠️ Health-Check: HTTP
-
⚠️ Health-Check: nicht erreichbar
+
⚠️ Health-Check: nicht erreichbar

MCP-Endpunkt

-

+

Transport: Streamable HTTP (POST-only) · JSON-RPC 2.0

Details

@@ -112,6 +99,3 @@ code { background: #f5f5f5; padding: 2px 6px; border-radius: 3px; font-size: 0.9 Netzwerk (6)inventory, list, inspect, host_state, audit_tcp, lan_probe System (1)connection_test - - -