r002: Config-Port 3003→3013 (Port-Konflikt), robustes Fallback
- Config-Server wechselt auf 127.0.0.1:3013 (3003 war belegt) - Binary: Port belegt → Warnung + weiterlaufen (kein Crash) - mua.page: Config-Port 3013 - .txz neu gepackt, SHA256 aktualisiert
This commit is contained in:
BIN
Binary file not shown.
+2
-2
@@ -8,7 +8,7 @@
|
|||||||
<!ENTITY pluginLOC "/boot/config/plugins/&name;">
|
<!ENTITY pluginLOC "/boot/config/plugins/&name;">
|
||||||
<!ENTITY emhttpLOC "/usr/local/emhttp/plugins/&name;">
|
<!ENTITY emhttpLOC "/usr/local/emhttp/plugins/&name;">
|
||||||
<!ENTITY txzURL "http://192.168.1.2:4000/michael/MUA-Mikes-Unraid-Agent/raw/branch/main/dist/mua-2026.08.18.r002-x86_64-1.txz">
|
<!ENTITY txzURL "http://192.168.1.2:4000/michael/MUA-Mikes-Unraid-Agent/raw/branch/main/dist/mua-2026.08.18.r002-x86_64-1.txz">
|
||||||
<!ENTITY txzSHA256 "57da68ccdb04ba8539bcc667b3666745f08aaaa6af84cab10887702950206ec2">
|
<!ENTITY txzSHA256 "826b76d82f2c52e7be032f9db1b363718fe974c80d6c87265f6d50ce29e156be">
|
||||||
]>
|
]>
|
||||||
|
|
||||||
<PLUGIN name="&name;"
|
<PLUGIN name="&name;"
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
### 2026.08.18.r002
|
### 2026.08.18.r002
|
||||||
- API-Key-Authentifizierung (Bearer-Token) für den MCP-HTTP-Endpunkt (Port 3002). /health bleibt offen.
|
- API-Key-Authentifizierung (Bearer-Token) für den MCP-HTTP-Endpunkt (Port 3002). /health bleibt offen.
|
||||||
- Einstellungs-Maske im WebGUI-Tab: API-Key generieren + Tools per Checkbox aktivieren/deaktivieren.
|
- Einstellungs-Maske im WebGUI-Tab: API-Key generieren + Tools per Checkbox aktivieren/deaktivieren.
|
||||||
- Config-Server auf 127.0.0.1:3003 (nur localhost) für WebGUI-Integration.
|
- Config-Server auf 127.0.0.1:3013 (nur localhost) für WebGUI-Integration.
|
||||||
- Tool-Filter: deaktivierte Tools werden in tools/list ausgeblendet und bei tools/call abgelehnt.
|
- Tool-Filter: deaktivierte Tools werden in tools/list ausgeblendet und bei tools/call abgelehnt.
|
||||||
### 2026.08.18.r001
|
### 2026.08.18.r001
|
||||||
- Initial release: 21 Docker, network, and system tools as MCP server over HTTP (Streamable HTTP, port 3002).
|
- Initial release: 21 Docker, network, and system tools as MCP server over HTTP (Streamable HTTP, port 3002).
|
||||||
|
|||||||
+2
-2
@@ -14,13 +14,13 @@ Icon="cubes"
|
|||||||
* A) API-Key generieren (POST /config {generate:true})
|
* A) API-Key generieren (POST /config {generate:true})
|
||||||
* B) Tools per Checkbox aktivieren/deaktivieren (POST /config {enabledTools:[...]})
|
* B) Tools per Checkbox aktivieren/deaktivieren (POST /config {enabledTools:[...]})
|
||||||
*
|
*
|
||||||
* Config-Server: 127.0.0.1:3003 (nur localhost, kein Auth nötig —
|
* Config-Server: 127.0.0.1:3013 (nur localhost, kein Auth nötig —
|
||||||
* WebGUI läuft auf demselben Host und ist selbst authifiziert).
|
* WebGUI läuft auf demselben Host und ist selbst authifiziert).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$plugin_dir = '/usr/local/emhttp/plugins/mua';
|
$plugin_dir = '/usr/local/emhttp/plugins/mua';
|
||||||
$port = 3002;
|
$port = 3002;
|
||||||
$config_port = 3003;
|
$config_port = 3013;
|
||||||
$pidfile = '/var/run/mua.pid';
|
$pidfile = '/var/run/mua.pid';
|
||||||
$binary = '/usr/local/bin/mua';
|
$binary = '/usr/local/bin/mua';
|
||||||
$endpoint = 'http://' . ($_SERVER['SERVER_ADDR'] ?? '127.0.0.1') . ':' . $port . '/mcp';
|
$endpoint = 'http://' . ($_SERVER['SERVER_ADDR'] ?? '127.0.0.1') . ':' . $port . '/mcp';
|
||||||
|
|||||||
+60
-50
@@ -296,66 +296,76 @@ const server = Bun.serve({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── Config-Server (nur localhost:127.0.0.1:3003) ───────────────────────
|
// ── Config-Server (nur localhost:127.0.0.1:3013) ───────────────────────
|
||||||
// Separater Server, nur von localhost erreichbar (WebGUI auf demselben Host).
|
// Separater Server, nur von localhost erreichbar (WebGUI auf demselben Host).
|
||||||
// Kein Header-Spoofing, kein File-Permission-Problem.
|
// Kein Header-Spoofing, kein File-Permission-Problem.
|
||||||
const CONFIG_PORT = Number(process.env["MUA_CONFIG_PORT"] ?? 3003);
|
// Wenn der Port belegt ist: Warnung + weiterlaufen (MCP-Server bleibt up).
|
||||||
const configServer = Bun.serve({
|
const CONFIG_PORT = Number(process.env["MUA_CONFIG_PORT"] ?? 3013);
|
||||||
port: CONFIG_PORT,
|
let configServer: ReturnType<typeof Bun.serve> | null = null;
|
||||||
hostname: "127.0.0.1", // nur localhost
|
try {
|
||||||
idleTimeout: 30,
|
configServer = Bun.serve({
|
||||||
async fetch(req) {
|
port: CONFIG_PORT,
|
||||||
const url = new URL(req.url);
|
hostname: "127.0.0.1", // nur localhost
|
||||||
const path = url.pathname;
|
idleTimeout: 30,
|
||||||
const method = req.method;
|
async fetch(req) {
|
||||||
|
const url = new URL(req.url);
|
||||||
|
const path = url.pathname;
|
||||||
|
const method = req.method;
|
||||||
|
|
||||||
if (path !== "/config") {
|
if (path !== "/config") {
|
||||||
return Response.json({ error: "Not found" }, { status: 404 });
|
return Response.json({ error: "Not found" }, { status: 404 });
|
||||||
}
|
|
||||||
|
|
||||||
// GET: Config lesen
|
|
||||||
if (method === "GET") {
|
|
||||||
return Response.json({
|
|
||||||
apiKey: getApiKey(),
|
|
||||||
enabledTools: getEnabledTools(),
|
|
||||||
allTools: TOOLS.map((t) => t.name),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// POST: Config schreiben
|
|
||||||
if (method === "POST") {
|
|
||||||
let body: Record<string, unknown>;
|
|
||||||
try {
|
|
||||||
body = JSON.parse(await req.text());
|
|
||||||
} catch {
|
|
||||||
return Response.json({ error: "Invalid JSON" }, { status: 400 });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// "generate": neuen API-Key generieren
|
// GET: Config lesen
|
||||||
if (body["generate"] === true) {
|
if (method === "GET") {
|
||||||
setApiKey(randomBytes(32).toString("hex"));
|
return Response.json({
|
||||||
} else if (typeof body["apiKey"] === "string" && (body["apiKey"] as string).length > 0) {
|
apiKey: getApiKey(),
|
||||||
setApiKey(body["apiKey"] as string);
|
enabledTools: getEnabledTools(),
|
||||||
}
|
allTools: TOOLS.map((t) => t.name),
|
||||||
if (Array.isArray(body["enabledTools"])) {
|
});
|
||||||
const tools = (body["enabledTools"] as unknown[])
|
|
||||||
.filter((t): t is string => typeof t === "string");
|
|
||||||
setEnabledTools(tools);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response.json({
|
// POST: Config schreiben
|
||||||
ok: true,
|
if (method === "POST") {
|
||||||
apiKey: getApiKey(),
|
let body: Record<string, unknown>;
|
||||||
enabledTools: getEnabledTools(),
|
try {
|
||||||
});
|
body = JSON.parse(await req.text());
|
||||||
}
|
} catch {
|
||||||
|
return Response.json({ error: "Invalid JSON" }, { status: 400 });
|
||||||
|
}
|
||||||
|
|
||||||
return Response.json({ error: "Method not allowed" }, { status: 405 });
|
// "generate": neuen API-Key generieren
|
||||||
},
|
if (body["generate"] === true) {
|
||||||
});
|
setApiKey(randomBytes(32).toString("hex"));
|
||||||
|
} else if (typeof body["apiKey"] === "string" && (body["apiKey"] as string).length > 0) {
|
||||||
|
setApiKey(body["apiKey"] as string);
|
||||||
|
}
|
||||||
|
if (Array.isArray(body["enabledTools"])) {
|
||||||
|
const tools = (body["enabledTools"] as unknown[])
|
||||||
|
.filter((t): t is string => typeof t === "string");
|
||||||
|
setEnabledTools(tools);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response.json({
|
||||||
|
ok: true,
|
||||||
|
apiKey: getApiKey(),
|
||||||
|
enabledTools: getEnabledTools(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response.json({ error: "Method not allowed" }, { status: 405 });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.warn(
|
||||||
|
`[MUA] WARNUNG: Config-Server konnte nicht gestartet werden (Port ${CONFIG_PORT} belegt?). ` +
|
||||||
|
`Einstellungen über WebGUI sind nicht verfügbar. MCP-Server läuft weiter.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
`[MUA] ${MUA_SERVER_NAME} v${MUA_VERSION} listening on ${HOST}:${PORT} (MCP) + 127.0.0.1:${CONFIG_PORT} (config)`,
|
`[MUA] ${MUA_SERVER_NAME} v${MUA_VERSION} listening on ${HOST}:${PORT} (MCP)` +
|
||||||
|
(configServer ? ` + 127.0.0.1:${CONFIG_PORT} (config)` : " (config: NICHT VERFÜGBAR)"),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Graceful shutdown
|
// Graceful shutdown
|
||||||
|
|||||||
Reference in New Issue
Block a user