MUA: Echte Unraid-Plugin-Struktur
- plugin/mua.plg: <!DOCTYPE PLUGIN> XML mit <FILE Run> + <INLINE> - plugin/plugin.json: Metadaten - scripts/rc.mua: SysVinit-Service (statt systemd) - scripts/plugin.php: WebGUI-Tab (Settings > MUA) - README.md: Aktualisiert - Alte Dateien entfernt (MUA.plg, mua.service, install/update/remove.sh)
This commit is contained in:
1 parent
f4e66ea5a1
commit
1f1e67a3ab
10 files changed
+443
-338
No files matched your search
@@ -1,139 +1,101 @@
|
||||
# MUA — Mikes Unraid Agent
|
||||
|
||||
Natives Unraid-Plugin, das 21 Docker-, Netzwerk- und System-Tools als **MCP-Server** (Model Context Protocol) über **HTTP (Streamable HTTP)** exponiert.
|
||||
|
||||
Läuft **lokal auf dem Unraid-Host** — kein SSH, kein Proxy, kein Key-Management.
|
||||
|
||||
## Endpunkt
|
||||
|
||||
```
|
||||
http://<unraid-ip>:3002/mcp
|
||||
```
|
||||
|
||||
- **POST** `/mcp` — JSON-RPC 2.0 (MCP-Requests)
|
||||
- **GET** `/health` — Health-Check
|
||||
- **DELETE** `/mcp` — Session-End
|
||||
|
||||
## Tools (21)
|
||||
|
||||
### Docker (14)
|
||||
| Tool | Beschreibung |
|
||||
|------|-------------|
|
||||
| `unraid_docker_list` | Alle Container mit Runtime-Stats |
|
||||
| `unraid_docker_inspect` | Container-Details |
|
||||
| `unraid_docker_logs` | Container-Logs |
|
||||
| `unraid_docker_analyze_logs` | Log-Analyse (server-seitig) |
|
||||
| `unraid_docker_processes` | Prozesse im Container |
|
||||
| `unraid_docker_stats` | Live-Stats (CPU/RAM/Net) |
|
||||
| `unraid_docker_info` | Docker-Daemon-Info |
|
||||
| `unraid_docker_start` | Container starten |
|
||||
| `unraid_docker_stop` | Container stoppen |
|
||||
| `unraid_docker_restart` | Container neu starten |
|
||||
| `unraid_docker_create` | Container aus Template |
|
||||
| `unraid_docker_modify` | Template ändern |
|
||||
| `unraid_docker_update` | Container aktualisieren |
|
||||
| `unraid_docker_rebuild` | Container neu bauen |
|
||||
|
||||
### Netzwerk (6)
|
||||
| Tool | Beschreibung |
|
||||
|------|-------------|
|
||||
| `unraid_network_inventory` | Netzwerk-Inventur |
|
||||
| `unraid_network_list` | Alle Netzwerke |
|
||||
| `unraid_network_inspect` | Netzwerk-Details |
|
||||
| `unraid_network_host_state` | Host-Netzwerk-Zustand |
|
||||
| `unraid_network_audit_tcp` | TCP-Endpunkte auditieren |
|
||||
| `unraid_network_lan_probe` | Dualstack-Probe |
|
||||
|
||||
### System (1)
|
||||
| Tool | Beschreibung |
|
||||
|------|-------------|
|
||||
| `unraid_system_connection_test` | Verbindungstest |
|
||||
|
||||
## Installation
|
||||
|
||||
### Via Community Apps (Link)
|
||||
1. Community Apps öffnen
|
||||
2. "Add Plugin" → Link: `https://git-192.168.1.2:33/michael/MUA-Mikes-Unraid-Agent`
|
||||
3. Installieren
|
||||
|
||||
### Manuell
|
||||
```bash
|
||||
# Dateien kopieren
|
||||
mkdir -p /usr/local/plugins/mua
|
||||
cp -r mcp scripts /usr/local/plugins/mua/
|
||||
|
||||
# Helper installieren
|
||||
cp scripts/unraid-docker-mcp-helper.php /usr/local/bin/
|
||||
chmod 755 /usr/local/bin/unraid-docker-mcp-helper.php
|
||||
|
||||
# Service installieren
|
||||
cp scripts/mua.service /etc/systemd/system/
|
||||
systemctl daemon-reload
|
||||
systemctl enable --now mua.service
|
||||
|
||||
# Health-Check
|
||||
curl http://127.0.0.1:3002/health
|
||||
```
|
||||
|
||||
## Anbindung an MCP-Client
|
||||
|
||||
### Beispiel: Hermes Agent (config.yaml)
|
||||
```yaml
|
||||
mcp_servers:
|
||||
mua:
|
||||
url: http://192.168.1.2:3002/mcp
|
||||
transport: http
|
||||
```
|
||||
|
||||
### Beispiel: curl
|
||||
```bash
|
||||
# Initialize
|
||||
curl -X POST http://192.168.1.2:3002/mcp \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'
|
||||
|
||||
# Tools auflisten
|
||||
curl -X POST http://192.168.1.2:3002/mcp \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Mcp-Session-Id: <session-id>" \
|
||||
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
|
||||
|
||||
# Tool aufrufen
|
||||
curl -X POST http://192.168.1.2:3002/mcp \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Mcp-Session-Id: <session-id>" \
|
||||
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"unraid_docker_list","arguments":{}}}'
|
||||
```
|
||||
|
||||
## Selftest
|
||||
|
||||
```bash
|
||||
php /usr/local/plugins/mua/mcp/selftest.php
|
||||
```
|
||||
Natives Unraid-Plugin: 21 Docker-, Netzwerk- und System-Tools als MCP-Server (Streamable HTTP) auf Port 3002.
|
||||
|
||||
## Architektur
|
||||
|
||||
```
|
||||
MCP-Client (z.B. llama.cpp auf 196)
|
||||
│
|
||||
│ HTTP (Streamable HTTP)
|
||||
▼
|
||||
http://192.168.1.2:3002/mcp (MUA Plugin auf Unraid)
|
||||
│
|
||||
│ lokal (kein SSH)
|
||||
▼
|
||||
/usr/bin/docker, /usr/bin/ip, /usr/bin/ss, /usr/bin/php
|
||||
llama.cpp (196) → HTTP → http://192.168.1.2:3002/mcp (MUA Plugin auf Unraid)
|
||||
```
|
||||
|
||||
## Port
|
||||
Kein SSH, kein Proxy, kein Key-Management (nur URL + API-Key).
|
||||
|
||||
- **3002** (3000 ist belegt von `theippenguin/unraid-mcp`)
|
||||
## Unraid-Plugin-Struktur
|
||||
|
||||
## Git
|
||||
```
|
||||
MUA-Mikes-Unraid-Agent/
|
||||
├── plugin/
|
||||
│ ├── mua.plg # Unraid-Plugin-File (XML, <!DOCTYPE PLUGIN>)
|
||||
│ └── plugin.json # Metadaten (Name, Version, Pfade)
|
||||
├── mcp/
|
||||
│ ├── server.php # MCP-Server (Streamable HTTP, JSON-RPC 2.0)
|
||||
│ ├── helpers.php # Helper-Funktionen (Docker, Netzwerk, System)
|
||||
│ ├── tools.php # 21 Tool-Definitionen
|
||||
│ └── selftest.php # Selftest (12 Tests)
|
||||
├── scripts/
|
||||
│ ├── rc.mua # SysVinit-Service-Script
|
||||
│ ├── plugin.php # WebGUI-Tab (Settings > MUA)
|
||||
│ └── unraid-docker-mcp-helper.php # Write-Operationen (DockerClient)
|
||||
└── README.md
|
||||
```
|
||||
|
||||
- Repo: `michael/MUA-Mikes-Unraid-Agent.git`
|
||||
- Zugang: `git@192.168.1.2:33` (SSH-Key `ha_agent`)
|
||||
- Updates: Neuer Commit + Push
|
||||
## Installation
|
||||
|
||||
### Über Unraid-Plugin-Installer
|
||||
|
||||
```bash
|
||||
# .plg-File herunterladen und installieren
|
||||
wget -O /tmp/mua.plg "http://192.168.1.2:4000/michael/MUA-Mikes-Unraid-Agent/raw/branch/main/plugin/mua.plg"
|
||||
# Im Unraid-WebGUI: Settings > Plugins > Install from URL
|
||||
# URL: http://192.168.1.2:4000/michael/MUA-Mikes-Unraid-Agent/raw/branch/main/plugin/mua.plg
|
||||
```
|
||||
|
||||
### Manuell
|
||||
|
||||
```bash
|
||||
# Repo klonen
|
||||
git clone git@192.168.1.2:33/michael/MUA-Mikes-Unraid-Agent.git /tmp/mua
|
||||
|
||||
# Dateien installieren
|
||||
mkdir -p /usr/local/emhttp/plugins/mua/{mcp,scripts}
|
||||
cp /tmp/mua/mcp/*.php /usr/local/emhttp/plugins/mua/mcp/
|
||||
cp /tmp/mua/scripts/plugin.php /usr/local/emhttp/plugins/mua/
|
||||
cp /tmp/mua/scripts/rc.mua /etc/rc.d/rc.mua
|
||||
chmod 755 /etc/rc.d/rc.mua
|
||||
cp /tmp/mua/scripts/unraid-docker-mcp-helper.php /usr/local/bin/
|
||||
chmod 755 /usr/local/bin/unraid-docker-mcp-helper.php
|
||||
|
||||
# Selftest
|
||||
php /usr/local/emhttp/plugins/mua/mcp/selftest.php
|
||||
|
||||
# Starten
|
||||
/etc/rc.d/rc.mua start
|
||||
```
|
||||
|
||||
## Verwaltung
|
||||
|
||||
| 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` |
|
||||
| WebGUI | Settings > MUA |
|
||||
|
||||
## MCP-Endpunkt
|
||||
|
||||
- **URL:** `http://<unraid-ip>:3002/mcp`
|
||||
- **Transport:** Streamable HTTP (POST-only)
|
||||
- **Protokoll:** JSON-RPC 2.0
|
||||
- **Session:** `Mcp-Session-Id` Header
|
||||
|
||||
## Tools (21)
|
||||
|
||||
| Kategorie | Tools |
|
||||
|---|---|
|
||||
| **Docker (14)** | list, inspect, logs, analyze_logs, processes, stats, info, start, stop, restart, create, modify, update, rebuild |
|
||||
| **Netzwerk (6)** | inventory, list, inspect, host_state, audit_tcp, lan_probe |
|
||||
| **System (1)** | connection_test |
|
||||
|
||||
## Konformität
|
||||
|
||||
- ✅ Echte Unraid-Plugin-Struktur (`<!DOCTYPE PLUGIN>`, `<FILE Run="/bin/bash">` + `<INLINE>`)
|
||||
- ✅ SysVinit-Service (`/etc/rc.d/rc.mua`) statt systemd
|
||||
- ✅ WebGUI-Tab (`launch="Settings/MUA"`)
|
||||
- ✅ Standard-Pfade (`/usr/local/emhttp/plugins/mua`, `/boot/config/plugins/mua`)
|
||||
- ✅ Selftest (12/12)
|
||||
- ✅ PHP 8.4-kompatibel
|
||||
|
||||
## Lizenz
|
||||
|
||||
|
||||
Reference in new issue
Block a user