Add isolated Navidrome MCP service

This commit is contained in:
Mikei386
2026-08-23 15:06:32 +02:00
parent fea4a83582
commit 9ccb23cc5e
9 changed files with 108 additions and 3 deletions
+42 -2
View File
@@ -35,14 +35,17 @@ backup=$volume_path/webui.db.before-filter-install-$stamp
cp -a "$db" "$backup"
rm -f "$volume_path/webui.db-wal" "$volume_path/webui.db-shm"
python3 - "$db" "$FILTER_DIR" "$ACTION_DIR" "${OPENWEBUI_FILTER_OWNER_ID:-}" <<'PY'
navidrome_enabled=false
[[ -s /etc/mike-ai/navidrome-mcp.env ]] && navidrome_enabled=true
python3 - "$db" "$FILTER_DIR" "$ACTION_DIR" "${OPENWEBUI_FILTER_OWNER_ID:-}" "$navidrome_enabled" <<'PY'
import json
import pathlib
import sqlite3
import sys
import time
db, filter_dir, action_dir, requested_owner = sys.argv[1:]
db, filter_dir, action_dir, requested_owner, navidrome_enabled_raw = sys.argv[1:]
navidrome_enabled = navidrome_enabled_raw.lower() == "true"
con = sqlite3.connect(db)
columns = {row[1] for row in con.execute("pragma table_info(function)")}
required = {
@@ -182,6 +185,13 @@ with con:
"Verwaltungsaktionen. Für reine Statusabfragen und Diagnosen stattdessen "
"Unraid (Systemdiagnose) verwenden; niemals beide parallel ausprobieren.",
),
"navidrome-local": (
"Navidrome (Musikbibliothek)",
"Nur für die persönliche Navidrome-Musikbibliothek: Titel, Alben, Künstler, "
"Playlists, Favoriten und Hörverlauf. Nicht für Sonarr/Radarr, allgemeine "
"Websuche oder Audioausgabe auf dem KI-Host. Wegen des großen Werkzeugkatalogs "
"nur bei Musikaufgaben aktivieren.",
),
}
changed = False
for connection in connections:
@@ -203,6 +213,8 @@ with con:
match = "homeassistant-local"
elif "mike-ai-mcp-arr" in url:
match = "arr-local"
elif "mike-ai-mcp-navidrome" in url:
match = "navidrome-local"
elif "mike-ai-mcp-unraid-official" in url:
match = "unraid-readonly-local"
else:
@@ -212,6 +224,34 @@ with con:
info["name"] = name
info["description"] = description
changed = True
if navidrome_enabled and not any(
isinstance(connection, dict)
and (
str(connection.get("url", "")).lower()
== "http://mike-ai-mcp-navidrome:3000/mcp"
or str((connection.get("info") or {}).get("id", "")).lower()
== "navidrome-local"
)
for connection in connections
):
name, description = descriptions["navidrome-local"]
connections.append(
{
"url": "http://mike-ai-mcp-navidrome:3000/mcp",
"path": "",
"type": "mcp",
"auth_type": "none",
"headers": None,
"key": "",
"config": {"enable": True, "access_grants": []},
"info": {
"id": "navidrome-local",
"name": name,
"description": description,
},
}
)
changed = True
if changed:
con.execute(
"""