release r010 add Unraid health and Community Apps tools
This commit is contained in:
1 parent
e586b22b13
commit
771b8c43a1
14 files changed
+831
-33
No files matched your search
+146
-1
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* MUA — Mikes Unraid Agent
|
||||
* tools.ts — MCP Tool-Definitionen (23 Tools)
|
||||
* tools.ts — MCP Tool-Definitionen
|
||||
*
|
||||
* Portiert von mcp/tools.php. Schema: unraid_<kategorie>_<aktion>
|
||||
* Kategorien: docker (14), network (6), system (2).
|
||||
@@ -21,6 +21,10 @@ import {
|
||||
validateName,
|
||||
runShell,
|
||||
runReadOnlyCommand,
|
||||
runStatusHelper,
|
||||
searchCommunityApps,
|
||||
previewCommunityAppInstall,
|
||||
installCommunityApp,
|
||||
} from "./helpers";
|
||||
|
||||
export interface ToolDef {
|
||||
@@ -38,6 +42,7 @@ const CRITICAL_TOOLS = new Set([
|
||||
"unraid_docker_update",
|
||||
"unraid_docker_rebuild",
|
||||
"unraid_system_shell",
|
||||
"unraid_ca_install",
|
||||
]);
|
||||
const WRITE_TOOLS = new Set([
|
||||
"unraid_docker_start",
|
||||
@@ -47,6 +52,8 @@ const WRITE_TOOLS = new Set([
|
||||
const ACTIVE_TOOLS = new Set([
|
||||
"unraid_network_audit_tcp",
|
||||
"unraid_network_lan_probe",
|
||||
"unraid_ca_search",
|
||||
"unraid_ca_install_preview",
|
||||
]);
|
||||
|
||||
export function getToolRisk(name: string): ToolRisk {
|
||||
@@ -158,6 +165,13 @@ export const TOOLS: ToolDef[] = [
|
||||
inputSchema: empty,
|
||||
handler: () => dockerExec(`info --format '{{json .}}'`),
|
||||
},
|
||||
{
|
||||
name: "unraid_docker_update_status",
|
||||
description:
|
||||
"Read Unraid's cached Docker image update state and return a compact per-container summary. Does not pull or update images.",
|
||||
inputSchema: empty,
|
||||
handler: () => runStatusHelper("docker-update-status"),
|
||||
},
|
||||
{
|
||||
name: "unraid_docker_start",
|
||||
description: "Start a Docker container.",
|
||||
@@ -248,6 +262,75 @@ export const TOOLS: ToolDef[] = [
|
||||
handler: (a) => runPhpHelper("rebuild", validateName(a["container"], "container")),
|
||||
},
|
||||
|
||||
// ── Community Applications ──────────────────────────────────────────
|
||||
{
|
||||
name: "unraid_ca_search",
|
||||
description:
|
||||
"Search the official Unraid Community Applications feed. Returns compact app metadata and a stable app_id; does not install anything.",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
query: str("Application name, image, repository or purpose"),
|
||||
limit: int("Maximum results (1-25, default 10)"),
|
||||
},
|
||||
required: ["query"],
|
||||
additionalProperties: false,
|
||||
},
|
||||
handler: (a) => searchCommunityApps(String(a["query"] ?? ""), Number(a["limit"] ?? 10)),
|
||||
},
|
||||
{
|
||||
name: "unraid_ca_install_preview",
|
||||
description:
|
||||
"Prepare and preview installation of an exact Community Applications entry as an Unraid GUI-managed container. Returns a short-lived approval ticket and performs no writes.",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
app_id: str("Exact app_id returned by unraid_ca_search"),
|
||||
container_name: str("New unique Unraid container name"),
|
||||
overrides: {
|
||||
type: "object",
|
||||
additionalProperties: { type: "string" },
|
||||
description: "Optional Config Target to value overrides, e.g. {\"8080\":\"18080\"}",
|
||||
},
|
||||
start_after_install: bool("Start the container after installation (default false)"),
|
||||
},
|
||||
required: ["app_id", "container_name"],
|
||||
additionalProperties: false,
|
||||
},
|
||||
handler: (a) => previewCommunityAppInstall(
|
||||
String(a["app_id"] ?? ""),
|
||||
String(a["container_name"] ?? ""),
|
||||
a["overrides"] ?? {},
|
||||
Boolean(a["start_after_install"] ?? false),
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "unraid_ca_install",
|
||||
description:
|
||||
"CRITICAL: Install a previously previewed Community Applications entry. Writes an Unraid user template, pulls the image and creates the container so it remains manageable through the Unraid GUI. Requires an exact, unexpired approval ticket and confirm=true.",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
app_id: str("Exact app_id returned by unraid_ca_search"),
|
||||
container_name: str("New unique Unraid container name"),
|
||||
overrides: { type: "object", additionalProperties: { type: "string" } },
|
||||
start_after_install: bool("Start the container after installation"),
|
||||
confirm: bool("Must be true after explicit user approval"),
|
||||
approval_ticket: str("Ticket returned by unraid_ca_install_preview"),
|
||||
},
|
||||
required: ["app_id", "container_name", "confirm", "approval_ticket"],
|
||||
additionalProperties: false,
|
||||
},
|
||||
handler: (a) => installCommunityApp(
|
||||
String(a["app_id"] ?? ""),
|
||||
String(a["container_name"] ?? ""),
|
||||
a["overrides"] ?? {},
|
||||
Boolean(a["start_after_install"] ?? false),
|
||||
Boolean(a["confirm"] ?? false),
|
||||
String(a["approval_ticket"] ?? ""),
|
||||
),
|
||||
},
|
||||
|
||||
// ── Netzwerk (6) ──────────────────────────────────────────────────────
|
||||
{
|
||||
name: "unraid_network_inventory",
|
||||
@@ -323,6 +406,68 @@ export const TOOLS: ToolDef[] = [
|
||||
},
|
||||
|
||||
// ── System (3) ────────────────────────────────────────────────────────
|
||||
{
|
||||
name: "unraid_system_health",
|
||||
description:
|
||||
"Get compact host health: uptime, load averages, logical CPUs, memory use and available temperature sensors.",
|
||||
inputSchema: empty,
|
||||
handler: () => runStatusHelper("system-health"),
|
||||
},
|
||||
{
|
||||
name: "unraid_storage_status",
|
||||
description:
|
||||
"Get compact Unraid array, parity, pool and disk status including disabled, missing or invalid disk alerts. Serial numbers are omitted.",
|
||||
inputSchema: empty,
|
||||
handler: () => runStatusHelper("storage-status"),
|
||||
},
|
||||
{
|
||||
name: "unraid_disk_health",
|
||||
description:
|
||||
"Get compact cached SMART health and important error/wear attributes for one disk or all disks. Does not start a SMART test or spin up disks explicitly.",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: { disk: str("Optional Unraid disk or pool member name, e.g. disk1") },
|
||||
additionalProperties: false,
|
||||
},
|
||||
handler: (a) => runStatusHelper("disk-health", typeof a["disk"] === "string" ? a["disk"] : ""),
|
||||
},
|
||||
{
|
||||
name: "unraid_notifications_list",
|
||||
description:
|
||||
"List recent Unraid notifications with compact, secret-redacted subjects and descriptions.",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
limit: int("Number of notifications (1-50, default 20)"),
|
||||
importance: { type: "string", enum: ["all", "normal", "warning", "alert"] },
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
handler: (a) => runStatusHelper(
|
||||
"notifications",
|
||||
String(Math.max(1, Math.min(50, Number(a["limit"] ?? 20)))),
|
||||
String(a["importance"] ?? "all"),
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "unraid_shares_list",
|
||||
description:
|
||||
"List Unraid shares with pool placement and compact capacity information. Does not list files or file contents.",
|
||||
inputSchema: empty,
|
||||
handler: () => runStatusHelper("shares-list"),
|
||||
},
|
||||
{
|
||||
name: "unraid_share_inspect",
|
||||
description:
|
||||
"Inspect one Unraid share's allocation, pool/cache placement and capacity. Does not list or read files.",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: { share: str("Exact Unraid share name") },
|
||||
required: ["share"],
|
||||
additionalProperties: false,
|
||||
},
|
||||
handler: (a) => runStatusHelper("share-inspect", String(a["share"] ?? "")),
|
||||
},
|
||||
{
|
||||
name: "unraid_system_connection_test",
|
||||
description:
|
||||
|
||||
Reference in new issue
Block a user