Add controlled Athena platform operator

This commit is contained in:
Mikei386
2026-08-23 21:10:44 +02:00
parent 2f4bff550e
commit 94f3758795
26 changed files with 1030 additions and 752 deletions
@@ -1,7 +1,7 @@
"""
title: MikeAI Auto Tool Selector
author: MikeAI
version: 1.1.0
version: 2.0.0
description: Selects a small, relevant set of MCP servers for each user request.
"""
@@ -27,7 +27,7 @@ class Filter:
"unraid": "server:mcp:unraid-readonly-local",
"navidrome": "server:mcp:navidrome-local",
"platform": "server:mcp:athena-platform",
"terminal": "server:mcp:athena-terminal-local",
"operator": "server:mcp:athena-operator-local",
}
LABELS = {
@@ -38,7 +38,7 @@ class Filter:
"unraid": "Unraid-Diagnose",
"navidrome": "Navidrome",
"platform": "Athena-Plattformwissen",
"terminal": "Athena-Terminal (begrenzt, nur lesend)",
"operator": "Athena Operator",
}
def __init__(self):
@@ -96,13 +96,14 @@ class Filter:
selected: list[str] = []
terminal = self._matches(
operator = self._matches(
text,
(
r"\bathena[- ]terminal\b",
r"\b(?:athena|ki[- ]host)\b.*\b(?:terminal|shell|kommando|befehl)\b",
r"\b(?:terminal|shell)\b.*\b(?:athena|ki[- ]host)\b",
r"\b(?:ls|tail|grep|rg|cat)\b.*\b(?:athena|ki[- ]host)\b",
r"\bathena[- ]operator\b",
r"\b(?:athena|ki[- ]host)\b.*\b(?:bau|[aä]nder|deploy|install|lad|test|start|stop|restart|konfigurier|aktualisier|entfern|erstell|implementier|entwickel)\w*\b",
r"\b(?:bau|[aä]nder|deploy|install|lad|test|start|stop|restart|konfigurier|aktualisier|entfern|erstell|implementier|entwickel)\w*\b.*\b(?:athena|ki[- ]host)\b",
r"\bmcp\b.*\b(?:bau\w*|implementier\w*|entwickel\w*|integrier\w*)\b",
r"\b(?:bau\w*|implementier\w*|entwickel\w*|integrier\w*)\b.*\bmcp\b",
),
)
platform = self._matches(
@@ -114,8 +115,6 @@ class Filter:
r"\b(?:disaster|bare metal)[- ]recovery\b",
r"\b(?:installations?|reinstall|setup)[- ]skript\b",
r"\bplattform(?:wissen|dokumentation)?\b",
r"\bmcp\b.*\b(?:bau\w*|implementier\w*|entwickel\w*|integrier\w*)\b",
r"\b(?:bau\w*|implementier\w*|entwickel\w*|integrier\w*)\b.*\bmcp\b",
),
)
homeassistant = self._matches(
@@ -168,8 +167,8 @@ class Filter:
# A specialist source is more precise than public web search. Platform
# wins over a generic Docker mention when Athena is explicitly named.
if terminal:
selected.append("terminal")
if operator:
selected.append("operator")
elif platform:
selected.append("platform")
elif homeassistant:
+27 -14
View File
@@ -165,6 +165,18 @@ with con:
connections = json.loads(row[0])
if not isinstance(connections, list):
raise SystemExit("Unbekanntes Format in tool_server.connections.")
before_count = len(connections)
connections = [
connection for connection in connections
if not (
isinstance(connection, dict)
and (
str((connection.get("info") or {}).get("id", "")).lower()
== "athena-terminal-local"
or "mike-ai-mcp-athena-terminal" in str(connection.get("url", "")).lower()
)
)
]
descriptions = {
"web-local": (
"Web (öffentlich, read-only)",
@@ -212,15 +224,16 @@ with con:
"Quellcode dieses Werkzeug statt allgemeiner Websuche verwenden. Keine Issues, "
"Pull Requests, Actions oder Schreibzugriffe.",
),
"athena-terminal-local": (
"Athena Terminal (begrenzt, nur lesend)",
"Nur für gezielte Beweissuche in Athenas versioniertem Stack und einem "
"begrenzten Laufzeitsnapshot. Unterstützt ausschließlich fest erlaubte "
"Lesebefehle und Syntaxprüfung. Kein SSH, Docker, Netzwerk, Schreibzugriff, "
"Reboot, Shutdown, systemctl, Interpreter oder Zugriff auf Secrets.",
"athena-operator-local": (
"Athena Operator",
"Zentrale Bedienebene für Athenas KI-Plattform: MCPs entwickeln und deployen, "
"Docker-Dienste verwalten, Modelle laden und testen, Profile/OpenWebUI ändern, "
"prüfen, dokumentieren, versionieren und Recovery erzeugen. Änderungen benötigen "
"eine inhaltlich gebundene Vorschau und ausdrückliche Bestätigung. Kein freies "
"Terminal und keine SSH-, Netzwerk-, Boot-, Reboot- oder Shutdown-Änderungen.",
),
}
changed = False
changed = len(connections) != before_count
for connection in connections:
if not isinstance(connection, dict):
continue
@@ -244,8 +257,8 @@ with con:
match = "navidrome-local"
elif "mike-ai-mcp-github" in url:
match = "github-local"
elif "mike-ai-mcp-athena-terminal" in url:
match = "athena-terminal-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:
@@ -287,16 +300,16 @@ with con:
isinstance(connection, dict)
and (
str(connection.get("url", "")).lower()
== "http://mike-ai-mcp-athena-terminal:8000/mcp"
== "http://mike-ai-mcp-athena-operator:8000/mcp"
or str((connection.get("info") or {}).get("id", "")).lower()
== "athena-terminal-local"
== "athena-operator-local"
)
for connection in connections
):
name, description = descriptions["athena-terminal-local"]
name, description = descriptions["athena-operator-local"]
connections.append(
{
"url": "http://mike-ai-mcp-athena-terminal:8000/mcp",
"url": "http://mike-ai-mcp-athena-operator:8000/mcp",
"path": "",
"type": "mcp",
"auth_type": "none",
@@ -304,7 +317,7 @@ with con:
"key": "",
"config": {"enable": True, "access_grants": []},
"info": {
"id": "athena-terminal-local",
"id": "athena-operator-local",
"name": name,
"description": description,
},