Replace GraphQL Unraid MCP with MUA

This commit is contained in:
Mikei386
2026-08-23 22:08:31 +02:00
parent b723f820bf
commit a3297dbdd9
19 changed files with 84 additions and 76 deletions
+35 -14
View File
@@ -6,6 +6,7 @@ CONTAINER=${OPENWEBUI_CONTAINER:-mike-ai-open-webui}
VOLUME=${OPENWEBUI_VOLUME:-mike-ai_open-webui-data}
FILTER_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/filters" && pwd)
ACTION_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/actions" && pwd)
MUA_MCP_ENV_FILE=${MUA_MCP_ENV_FILE:-/etc/mike-ai/mua-mcp.env}
die() { printf 'FEHLER: %s\n' "$*" >&2; exit 1; }
[[ $EUID -eq 0 ]] || die "Bitte als root ausführen."
@@ -42,7 +43,7 @@ if [[ -s /etc/mike-ai/github-mcp.env ]] && \
grep -Eq '^GITHUB_PERSONAL_ACCESS_TOKEN=.+$' /etc/mike-ai/github-mcp.env; then
github_enabled=true
fi
python3 - "$db" "$FILTER_DIR" "$ACTION_DIR" "${OPENWEBUI_FILTER_OWNER_ID:-}" "$navidrome_enabled" "$github_enabled" <<'PY'
python3 - "$db" "$FILTER_DIR" "$ACTION_DIR" "${OPENWEBUI_FILTER_OWNER_ID:-}" "$navidrome_enabled" "$github_enabled" "$MUA_MCP_ENV_FILE" <<'PY'
import json
import copy
import pathlib
@@ -50,7 +51,10 @@ import sqlite3
import sys
import time
db, filter_dir, action_dir, requested_owner, navidrome_enabled_raw, github_enabled_raw = sys.argv[1:]
(
db, filter_dir, action_dir, requested_owner, navidrome_enabled_raw,
github_enabled_raw, mua_mcp_env_file,
) = sys.argv[1:]
navidrome_enabled = navidrome_enabled_raw.lower() == "true"
github_enabled = github_enabled_raw.lower() == "true"
con = sqlite3.connect(db)
@@ -173,8 +177,9 @@ with con:
isinstance(connection, dict)
and (
str((connection.get("info") or {}).get("id", "")).lower()
== "athena-terminal-local"
in {"athena-terminal-local", "unraid-readonly-local"}
or "mike-ai-mcp-athena-terminal" in str(connection.get("url", "")).lower()
or "mike-ai-mcp-unraid-official" in str(connection.get("url", "")).lower()
)
)
]
@@ -199,14 +204,8 @@ with con:
"konfigurierte Indexer. Keine allgemeine Websuche; Schreibaktionen benötigen "
"Vorschau und Freigabe.",
),
"unraid-readonly-local": (
"Unraid (Systemdiagnose)",
"Bevorzugtes Werkzeug für lesende Unraid-Diagnose: Host, Array, Datenträger, "
"Docker, Shares, Netzwerk, UPS und Logs. Für dieselbe Anfrage nicht zusätzlich "
"MUA aufrufen; MUA nur für dessen spezielle oder freigegebene Verwaltungsaktionen.",
),
"mua-readonly-local": (
"Unraid-Diagnose (MUA read-only)",
"MUA · Unraid-Diagnose (read-only)",
"Automatisch verwendbarer, serverseitig in Open WebUI auf reine Lese- und "
"Diagnosewerkzeuge begrenzter MUA-Zugang. Für Containerbestand, Logs, System, "
"Storage, Shares und Netzwerkstatus. Keine Start/Stop-, Installations-, "
@@ -215,8 +214,8 @@ with con:
"mua": (
"MUA (Unraid-Verwaltung)",
"Nur für ausdrücklich benötigte MUA-spezifische oder freigegebene Unraid-"
"Verwaltungsaktionen. Für reine Statusabfragen und Diagnosen stattdessen "
"Unraid (Systemdiagnose) verwenden; niemals beide parallel ausprobieren.",
"Verwaltungsaktionen. Für reine Statusabfragen und Diagnosen die read-only-"
"MUA-Verbindung verwenden; niemals beide parallel ausprobieren.",
),
"navidrome-local": (
"Navidrome (Musikbibliothek)",
@@ -267,8 +266,6 @@ with con:
match = "github-local"
elif "mike-ai-mcp-athena-operator" in url:
match = "athena-operator-local"
elif "mike-ai-mcp-unraid-official" in url:
match = "unraid-readonly-local"
else:
continue
name, description = descriptions[match]
@@ -289,6 +286,30 @@ with con:
),
None,
)
if mua_source is None and pathlib.Path(mua_mcp_env_file).is_file():
mua_env = {}
for raw_line in pathlib.Path(mua_mcp_env_file).read_text().splitlines():
line = raw_line.strip()
if not line or line.startswith("#") or "=" not in line:
continue
key, value = line.split("=", 1)
mua_env[key.strip()] = value.strip().strip('"').strip("'")
mua_url = mua_env.get("MUA_MCP_URL", "")
mua_token = mua_env.get("MUA_MCP_BEARER_TOKEN", "")
if mua_url and mua_token:
name, description = descriptions["mua"]
mua_source = {
"url": mua_url,
"path": "",
"type": "mcp",
"auth_type": "bearer",
"headers": None,
"key": mua_token,
"config": {"enable": True, "access_grants": []},
"info": {"id": "mua", "name": name, "description": description},
}
connections.append(mua_source)
changed = True
if mua_source is not None:
readonly_functions = ",".join((
"unraid_docker_list", "unraid_docker_inspect", "unraid_docker_logs",