@usex/mikrotik-mcp 5.8.0 → 5.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -1
- package/dist/cli.js +653 -332
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/shared/{library-hsq1a106.js → library-cv5qe3zh.js} +1 -1
- package/dist/shared/{library-srhzw8ym.js → library-kpx18cna.js} +187 -16
- package/dist/ui/aaa.html +5 -2
- package/dist/ui/connected-devices.html +5 -2
- package/dist/ui/dashboard.html +5 -2
- package/dist/ui/fabric.html +123 -0
- package/dist/ui/firewall-audit.html +9 -6
- package/dist/ui/firewall.html +6 -3
- package/dist/ui/interfaces.html +19 -16
- package/dist/ui/investigations.html +123 -0
- package/dist/ui/observability.html +75 -71
- package/dist/ui/operations.html +123 -0
- package/dist/ui/records.html +6 -3
- package/dist/ui/reports.html +123 -0
- package/dist/ui/round-trip.html +123 -0
- package/dist/ui/service-health.html +123 -0
- package/package.json +1 -1
- package/schemas/tool-catalog.json +1 -1
- /package/dist/shared/{cli-ejryxvb3.js → cli-k3m3pxn8.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -212,6 +212,8 @@ interface RegisterableTool {
|
|
|
212
212
|
annotations: ToolAnnotations;
|
|
213
213
|
inputSchema?: ZodRawShape;
|
|
214
214
|
description: string;
|
|
215
|
+
/** Server-only tools do not participate in device access checks. */
|
|
216
|
+
noDevice?: boolean;
|
|
215
217
|
/** Present when the tool renders an MCP App view. */
|
|
216
218
|
ui?: UiLink;
|
|
217
219
|
/** Device requirements, if the tool declared any. */
|
package/dist/index.js
CHANGED
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
updateSummaryLine,
|
|
63
63
|
allToolModules2,
|
|
64
64
|
selectToolModules2
|
|
65
|
-
} from "./shared/library-
|
|
65
|
+
} from "./shared/library-kpx18cna.js";
|
|
66
66
|
|
|
67
67
|
// node_modules/ajv/dist/compile/codegen/code.js
|
|
68
68
|
var require_code = __commonJS(function(exports) {
|
|
@@ -11073,12 +11073,117 @@ function indicatesFailure(text) {
|
|
|
11073
11073
|
return /^Failed\b/.test(firstLine) || /\(line \d+ column \d+\)/.test(text);
|
|
11074
11074
|
}
|
|
11075
11075
|
|
|
11076
|
+
// src/core/report-views.ts
|
|
11077
|
+
var REPORT_VIEW_TOOLS = {
|
|
11078
|
+
investigations: [
|
|
11079
|
+
"create_investigation",
|
|
11080
|
+
"get_investigation",
|
|
11081
|
+
"list_investigations",
|
|
11082
|
+
"inspect_flow_path",
|
|
11083
|
+
"list_client_flow_candidates"
|
|
11084
|
+
],
|
|
11085
|
+
"round-trip": ["trace_round_trip"],
|
|
11086
|
+
"service-health": [
|
|
11087
|
+
"create_service_contract",
|
|
11088
|
+
"list_service_contracts",
|
|
11089
|
+
"list_service_probe_targets",
|
|
11090
|
+
"run_service_contract",
|
|
11091
|
+
"service_contract_history",
|
|
11092
|
+
"audit_service_contracts"
|
|
11093
|
+
],
|
|
11094
|
+
fabric: ["map_l2_fabric", "locate_host_port"],
|
|
11095
|
+
operations: [
|
|
11096
|
+
"plan_changes",
|
|
11097
|
+
"apply_plan",
|
|
11098
|
+
"begin_transaction",
|
|
11099
|
+
"add_transaction_step",
|
|
11100
|
+
"verify_transaction",
|
|
11101
|
+
"commit_transaction",
|
|
11102
|
+
"abort_transaction",
|
|
11103
|
+
"plan_rollout",
|
|
11104
|
+
"rollout_status",
|
|
11105
|
+
"config_check_drift",
|
|
11106
|
+
"diff_config_snapshots",
|
|
11107
|
+
"get_access_scope",
|
|
11108
|
+
"safe_mode_status",
|
|
11109
|
+
"packet_capture_status"
|
|
11110
|
+
],
|
|
11111
|
+
reports: [
|
|
11112
|
+
"diagnose",
|
|
11113
|
+
"trace_path",
|
|
11114
|
+
"correlate_events",
|
|
11115
|
+
"suggest_fix",
|
|
11116
|
+
"run_compliance_audit",
|
|
11117
|
+
"audit_fleet",
|
|
11118
|
+
"audit_known_vulnerabilities",
|
|
11119
|
+
"audit_certificate_expiry",
|
|
11120
|
+
"audit_firewall_hardening",
|
|
11121
|
+
"audit_firewall_default_deny",
|
|
11122
|
+
"audit_address_list_enforcement",
|
|
11123
|
+
"audit_kernel_ip_hardening",
|
|
11124
|
+
"audit_ipv6_firewall_baseline",
|
|
11125
|
+
"audit_ssh_hardening",
|
|
11126
|
+
"audit_ip_service_exposure",
|
|
11127
|
+
"audit_connection_tracking_helpers",
|
|
11128
|
+
"audit_management_plane_exposure",
|
|
11129
|
+
"audit_account_hygiene",
|
|
11130
|
+
"audit_certificate_hygiene",
|
|
11131
|
+
"audit_network_segmentation",
|
|
11132
|
+
"audit_dns_resolver_exposure",
|
|
11133
|
+
"run_security_hardening_audit",
|
|
11134
|
+
"run_capsman_audit",
|
|
11135
|
+
"audit_capsman_coverage",
|
|
11136
|
+
"report_weak_signal_clients",
|
|
11137
|
+
"audit_capsman_load",
|
|
11138
|
+
"audit_capsman_ft",
|
|
11139
|
+
"audit_capsman_ha",
|
|
11140
|
+
"simulate_packet",
|
|
11141
|
+
"simulate_change",
|
|
11142
|
+
"simulate_suite",
|
|
11143
|
+
"explain_rule_reachability",
|
|
11144
|
+
"run_policy_check",
|
|
11145
|
+
"check_policy_snapshot",
|
|
11146
|
+
"explain_policy_finding",
|
|
11147
|
+
"explain_device",
|
|
11148
|
+
"explain_section",
|
|
11149
|
+
"diff_explanations",
|
|
11150
|
+
"flow_top_talkers",
|
|
11151
|
+
"analyze_flows",
|
|
11152
|
+
"forecast_link_saturation"
|
|
11153
|
+
]
|
|
11154
|
+
};
|
|
11155
|
+
var REPORT_VIEW_META = "mikrotik/reportView";
|
|
11156
|
+
var byTool = new Map(Object.entries(REPORT_VIEW_TOOLS).flatMap(([kind, names]) => names.map((name) => [name, kind])));
|
|
11157
|
+
function reportViewForTool(name) {
|
|
11158
|
+
return byTool.get(name);
|
|
11159
|
+
}
|
|
11160
|
+
function buildReportView(kind, tool, title, device, raw, structured) {
|
|
11161
|
+
let data = structured;
|
|
11162
|
+
if (data === undefined) {
|
|
11163
|
+
try {
|
|
11164
|
+
data = JSON.parse(raw);
|
|
11165
|
+
} catch {
|
|
11166
|
+
data = null;
|
|
11167
|
+
}
|
|
11168
|
+
}
|
|
11169
|
+
return {
|
|
11170
|
+
__mikrotikView: "report",
|
|
11171
|
+
kind,
|
|
11172
|
+
tool,
|
|
11173
|
+
title,
|
|
11174
|
+
device: device ?? "default",
|
|
11175
|
+
raw,
|
|
11176
|
+
data,
|
|
11177
|
+
generatedAt: new Date().toISOString()
|
|
11178
|
+
};
|
|
11179
|
+
}
|
|
11180
|
+
|
|
11076
11181
|
// src/core/ui-meta.ts
|
|
11077
11182
|
var UI_META_KEY = "ui";
|
|
11078
11183
|
var UI_RESOURCE_URI_LEGACY_KEY = "ui/resourceUri";
|
|
11079
11184
|
var OPENAI_OUTPUT_TEMPLATE_KEY = "openai/outputTemplate";
|
|
11080
11185
|
function uiViewUri(id) {
|
|
11081
|
-
return `ui://mikrotik/${id}.html`;
|
|
11186
|
+
return `ui://mikrotik/${id}.html?v=2`;
|
|
11082
11187
|
}
|
|
11083
11188
|
function toolUiMeta(ui) {
|
|
11084
11189
|
const meta = {
|
|
@@ -11089,6 +11194,12 @@ function toolUiMeta(ui) {
|
|
|
11089
11194
|
return meta;
|
|
11090
11195
|
}
|
|
11091
11196
|
|
|
11197
|
+
// src/core/tool-pattern.ts
|
|
11198
|
+
function globMatch(pattern, name) {
|
|
11199
|
+
const rx = new RegExp(`^${pattern.toLowerCase().replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*")}$`);
|
|
11200
|
+
return rx.test(name.toLowerCase());
|
|
11201
|
+
}
|
|
11202
|
+
|
|
11092
11203
|
// src/core/access.ts
|
|
11093
11204
|
var RISK_ORDER = [
|
|
11094
11205
|
"READ",
|
|
@@ -11104,10 +11215,6 @@ var RISK_RANK = {
|
|
|
11104
11215
|
DESTRUCTIVE: 2,
|
|
11105
11216
|
DANGEROUS: 3
|
|
11106
11217
|
};
|
|
11107
|
-
function globMatch(pattern, name) {
|
|
11108
|
-
const rx = new RegExp(`^${pattern.toLowerCase().replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*")}$`);
|
|
11109
|
-
return rx.test(name.toLowerCase());
|
|
11110
|
-
}
|
|
11111
11218
|
function matchesAny(patterns, name) {
|
|
11112
11219
|
return (patterns ?? []).some((p) => globMatch(p, name));
|
|
11113
11220
|
}
|
|
@@ -11137,7 +11244,20 @@ function evaluateAccess(policy, req) {
|
|
|
11137
11244
|
reason: `Tool '${req.tool}' is outside the active access scope${where}. ` + `Allowed: ${s.tools.join(", ")}.`
|
|
11138
11245
|
};
|
|
11139
11246
|
}
|
|
11247
|
+
if ((s.toolAllowGroups ?? []).some((group) => !matchesAny(group, req.tool))) {
|
|
11248
|
+
return {
|
|
11249
|
+
allowed: false,
|
|
11250
|
+
rule: "tool",
|
|
11251
|
+
reason: `Tool '${req.tool}' does not satisfy every configured and session tool allow-list${where}.`
|
|
11252
|
+
};
|
|
11253
|
+
}
|
|
11140
11254
|
if (req.device !== undefined) {
|
|
11255
|
+
if (s.noDevices)
|
|
11256
|
+
return {
|
|
11257
|
+
allowed: false,
|
|
11258
|
+
rule: "device",
|
|
11259
|
+
reason: `No devices remain in the intersection of the configured and session access scopes${where}.`
|
|
11260
|
+
};
|
|
11141
11261
|
if ((s.denyDevices ?? []).some((d) => d.toLowerCase() === req.device.toLowerCase())) {
|
|
11142
11262
|
return {
|
|
11143
11263
|
allowed: false,
|
|
@@ -11176,7 +11296,14 @@ function narrowScope(base, requested) {
|
|
|
11176
11296
|
return b.filter((x) => lower.has(x.toLowerCase()));
|
|
11177
11297
|
};
|
|
11178
11298
|
out.devices = intersect(base.devices, requested.devices);
|
|
11299
|
+
if (base.noDevices || requested.noDevices || base.devices?.length && requested.devices?.length && !out.devices?.length)
|
|
11300
|
+
out.noDevices = true;
|
|
11179
11301
|
out.tools = requested.tools && requested.tools.length > 0 ? requested.tools : base.tools;
|
|
11302
|
+
const groups = [...base.toolAllowGroups ?? [], ...requested.toolAllowGroups ?? []];
|
|
11303
|
+
if (base.tools?.length && requested.tools?.length)
|
|
11304
|
+
groups.push(base.tools);
|
|
11305
|
+
if (groups.length)
|
|
11306
|
+
out.toolAllowGroups = [...new Map(groups.map((g) => [JSON.stringify(g), g])).values()];
|
|
11180
11307
|
out.denyDevices = [...new Set([...base.denyDevices ?? [], ...requested.denyDevices ?? []])];
|
|
11181
11308
|
out.denyTools = [...new Set([...base.denyTools ?? [], ...requested.denyTools ?? []])];
|
|
11182
11309
|
if (out.denyDevices.length === 0)
|
|
@@ -11211,14 +11338,17 @@ function adoptConfiguredPolicy() {
|
|
|
11211
11338
|
}
|
|
11212
11339
|
onConfigChanged(adoptConfiguredPolicy);
|
|
11213
11340
|
adoptConfiguredPolicy();
|
|
11214
|
-
function
|
|
11341
|
+
function previewAccessPolicy(policy) {
|
|
11215
11342
|
if (!sessionNarrowing)
|
|
11216
|
-
return
|
|
11343
|
+
return policy;
|
|
11217
11344
|
return {
|
|
11218
11345
|
enabled: true,
|
|
11219
|
-
scope: narrowScope(
|
|
11346
|
+
scope: narrowScope(policy.scope, sessionNarrowing)
|
|
11220
11347
|
};
|
|
11221
11348
|
}
|
|
11349
|
+
function getAccessPolicy() {
|
|
11350
|
+
return previewAccessPolicy(basePolicy);
|
|
11351
|
+
}
|
|
11222
11352
|
function narrowSession(requested) {
|
|
11223
11353
|
sessionNarrowing = sessionNarrowing ? narrowScope(sessionNarrowing, requested) : narrowScope(basePolicy.scope, requested);
|
|
11224
11354
|
return getAccessPolicy().scope;
|
|
@@ -12386,6 +12516,9 @@ var UI_OUTPUT_SCHEMA = object({}).passthrough();
|
|
|
12386
12516
|
function effectiveUi(def) {
|
|
12387
12517
|
if (def.ui)
|
|
12388
12518
|
return { ui: def.ui, auto: false };
|
|
12519
|
+
const report = reportViewForTool(def.name);
|
|
12520
|
+
if (report)
|
|
12521
|
+
return { ui: { resourceUri: uiViewUri(report), visibility: ["model"] }, auto: true };
|
|
12389
12522
|
if (def.annotations.readOnlyHint === true && AUTO_RECORDS_VERB.test(def.name)) {
|
|
12390
12523
|
return { ui: { resourceUri: uiViewUri("records"), visibility: ["model", "app"] }, auto: true };
|
|
12391
12524
|
}
|
|
@@ -12466,6 +12599,7 @@ function defineTool2(def) {
|
|
|
12466
12599
|
description: def.description,
|
|
12467
12600
|
annotations: def.annotations,
|
|
12468
12601
|
inputSchema: def.inputSchema,
|
|
12602
|
+
noDevice: def.noDevice,
|
|
12469
12603
|
ui: def.ui,
|
|
12470
12604
|
requires: def.requires,
|
|
12471
12605
|
handler: def.handler,
|
|
@@ -12564,10 +12698,9 @@ function defineTool2(def) {
|
|
|
12564
12698
|
return { content: [{ type: "text", text: out.text }], isError: true };
|
|
12565
12699
|
}
|
|
12566
12700
|
if (auto && !out.structuredContent) {
|
|
12567
|
-
const
|
|
12568
|
-
|
|
12569
|
-
|
|
12570
|
-
}
|
|
12701
|
+
const report = reportViewForTool(def.name);
|
|
12702
|
+
const view = report ? buildReportView(report, def.name, def.title, deviceName, out.text) : buildRecordsView(def.name, def.title, out.text, new Date().toISOString());
|
|
12703
|
+
out.structuredContent = view;
|
|
12571
12704
|
}
|
|
12572
12705
|
const result = {
|
|
12573
12706
|
content: [{ type: "text", text: out.text }]
|
|
@@ -12576,6 +12709,12 @@ function defineTool2(def) {
|
|
|
12576
12709
|
result.structuredContent = out.structuredContent;
|
|
12577
12710
|
hasStructured = true;
|
|
12578
12711
|
}
|
|
12712
|
+
const report = auto && reportViewForTool(def.name);
|
|
12713
|
+
if (report && out.structuredContent?.__mikrotikView !== "report") {
|
|
12714
|
+
result._meta = {
|
|
12715
|
+
[REPORT_VIEW_META]: buildReportView(report, def.name, def.title, deviceName, out.text, out.structuredContent)
|
|
12716
|
+
};
|
|
12717
|
+
}
|
|
12579
12718
|
if (deviceStamp)
|
|
12580
12719
|
result.content.push({ type: "text", text: deviceStamp });
|
|
12581
12720
|
return result;
|
|
@@ -12633,7 +12772,7 @@ function defineTool2(def) {
|
|
|
12633
12772
|
inputSchema,
|
|
12634
12773
|
annotations: { ...def.annotations, title: def.title },
|
|
12635
12774
|
...ui ? { _meta: toolUiMeta(ui) } : {},
|
|
12636
|
-
...ui
|
|
12775
|
+
...ui ? { outputSchema: UI_OUTPUT_SCHEMA } : {}
|
|
12637
12776
|
}, callback);
|
|
12638
12777
|
}
|
|
12639
12778
|
};
|
|
@@ -17330,6 +17469,36 @@ var UI_VIEWS = [
|
|
|
17330
17469
|
id: "aaa",
|
|
17331
17470
|
name: "MikroTik RADIUS & User Manager",
|
|
17332
17471
|
description: "Full RADIUS client + built-in User Manager RADIUS server management: servers, users, " + "profiles, limitations, NAS clients, assignments, sessions and settings, with add/edit/remove."
|
|
17472
|
+
},
|
|
17473
|
+
{
|
|
17474
|
+
id: "investigations",
|
|
17475
|
+
name: "MikroTik Client Investigations",
|
|
17476
|
+
description: "Client attachment, router-scoped evidence, exported flow interfaces and unresolved visibility gaps."
|
|
17477
|
+
},
|
|
17478
|
+
{
|
|
17479
|
+
id: "round-trip",
|
|
17480
|
+
name: "MikroTik Round-trip Lab",
|
|
17481
|
+
description: "Forward and return snapshot paths with named interfaces, modelled boundaries and unknown hops. Not live packet proof."
|
|
17482
|
+
},
|
|
17483
|
+
{
|
|
17484
|
+
id: "service-health",
|
|
17485
|
+
name: "MikroTik Service Health",
|
|
17486
|
+
description: "Approved endpoint checks, contract definitions and historical PASS/FAIL/UNKNOWN evidence from the MCP host."
|
|
17487
|
+
},
|
|
17488
|
+
{
|
|
17489
|
+
id: "fabric",
|
|
17490
|
+
name: "MikroTik Layer-2 Fabric",
|
|
17491
|
+
description: "Bridge-port occupancy, attached clients and inferred access/uplink roles."
|
|
17492
|
+
},
|
|
17493
|
+
{
|
|
17494
|
+
id: "operations",
|
|
17495
|
+
name: "MikroTik Change Operations",
|
|
17496
|
+
description: "Read-only presentation of plans, transaction results, rollout progress, scope and drift. No apply/commit controls."
|
|
17497
|
+
},
|
|
17498
|
+
{
|
|
17499
|
+
id: "reports",
|
|
17500
|
+
name: "MikroTik Evidence Reports",
|
|
17501
|
+
description: "Readable diagnostic, compliance, security, simulation and traffic reports with searchable evidence and JSON export."
|
|
17333
17502
|
}
|
|
17334
17503
|
];
|
|
17335
17504
|
function placeholderHtml(view) {
|
|
@@ -22843,7 +23012,7 @@ var cache2 = null;
|
|
|
22843
23012
|
async function gateway() {
|
|
22844
23013
|
if (cache2)
|
|
22845
23014
|
return cache2;
|
|
22846
|
-
const { moduleCatalog } = await import("./library-
|
|
23015
|
+
const { moduleCatalog } = await import("./library-cv5qe3zh.js");
|
|
22847
23016
|
const forIndex = [];
|
|
22848
23017
|
const byName = new Map;
|
|
22849
23018
|
for (const mod of moduleCatalog) {
|
|
@@ -34258,7 +34427,7 @@ ${DATASET_NOTE}`;
|
|
|
34258
34427
|
function renderScope(scope) {
|
|
34259
34428
|
const lines = [];
|
|
34260
34429
|
lines.push(` max risk : ${scope.maxRisk ?? "(no ceiling)"}`);
|
|
34261
|
-
lines.push(` devices : ${scope.devices && scope.devices.length > 0 ? scope.devices.join(", ") : "(all configured)"}`);
|
|
34430
|
+
lines.push(` devices : ${scope.noDevices ? "(none: scopes do not overlap)" : scope.devices && scope.devices.length > 0 ? scope.devices.join(", ") : "(all configured)"}`);
|
|
34262
34431
|
if (scope.denyDevices && scope.denyDevices.length > 0) {
|
|
34263
34432
|
lines.push(` denied devs : ${scope.denyDevices.join(", ")}`);
|
|
34264
34433
|
}
|
|
@@ -34266,6 +34435,8 @@ function renderScope(scope) {
|
|
|
34266
34435
|
if (scope.denyTools && scope.denyTools.length > 0) {
|
|
34267
34436
|
lines.push(` denied tools: ${scope.denyTools.join(", ")}`);
|
|
34268
34437
|
}
|
|
34438
|
+
for (const group of scope.toolAllowGroups ?? [])
|
|
34439
|
+
lines.push(` also match : ${group.join(", ")}`);
|
|
34269
34440
|
lines.push(` expires : ${scope.expiresAt ? new Date(scope.expiresAt).toISOString() : "(never)"}`);
|
|
34270
34441
|
if (scope.label)
|
|
34271
34442
|
lines.push(` label : ${scope.label}`);
|
|
@@ -44819,7 +44990,7 @@ var riskByTool = null;
|
|
|
44819
44990
|
async function riskIndex() {
|
|
44820
44991
|
if (riskByTool)
|
|
44821
44992
|
return riskByTool;
|
|
44822
|
-
const { moduleCatalog } = await import("./library-
|
|
44993
|
+
const { moduleCatalog } = await import("./library-cv5qe3zh.js");
|
|
44823
44994
|
const index = new Map;
|
|
44824
44995
|
for (const mod of moduleCatalog) {
|
|
44825
44996
|
for (const tool of mod.tools)
|
package/dist/ui/aaa.html
CHANGED
|
@@ -106,10 +106,13 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
106
106
|
- omitted: host decides border`)}),R({method:U(`ui/request-display-mode`),params:R({mode:vh.describe(`The display mode being requested.`)})});var Fh=R({mode:vh.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough(),Ih=B([U(`model`),U(`app`)]).describe(`Tool visibility scope - who can access the tool.`);R({resourceUri:M().optional(),visibility:L(Ih).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
107
107
|
- "model": Tool visible to and callable by the agent
|
|
108
108
|
- "app": Tool callable by the app from this server only`),csp:fc().optional(),permissions:fc().optional()}),R({mimeTypes:L(M()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),R({method:U(`ui/download-file`),params:R({contents:L(B([Lu,Ru])).describe(`Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.`)})}),R({method:U(`ui/message`),params:R({role:U(`user`).describe(`Message role, currently only "user" is supported.`),content:L(zu).describe(`Message content blocks (text, image, etc.).`)})}),R({method:U(`ui/notifications/sandbox-resource-ready`),params:R({html:M().describe(`HTML content to load into the inner iframe.`),sandbox:M().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:Ch.optional().describe(`CSP configuration from resource metadata.`),permissions:wh.optional().describe(`Sandbox permissions from resource metadata.`)})});var Lh=R({method:U(`ui/notifications/tool-result`),params:Ju.describe(`Standard MCP tool execution result.`)}),Rh=R({toolInfo:R({id:yl.optional().describe(`JSON-RPC id of the tools/call request.`),tool:Gu.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:_h.optional().describe(`Current color theme preference.`),styles:kh.optional().describe(`Style configuration for theming the app.`),displayMode:vh.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:L(vh).optional().describe(`Display modes the host supports.`),containerDimensions:B([R({height:P().describe(`Fixed container height in pixels.`)}),R({maxHeight:B([P(),ac()]).optional().describe(`Maximum container height in pixels.`)})]).and(B([R({width:P().describe(`Fixed container width in pixels.`)}),R({maxWidth:B([P(),ac()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
109
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:M().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:M().optional().describe(`User's timezone in IANA format.`),userAgent:M().optional().describe(`Host application identifier.`),platform:B([U(`web`),U(`desktop`),U(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:R({touch:F().optional().describe(`Whether the device supports touch input.`),hover:F().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:R({top:P().describe(`Top safe area inset in pixels.`),right:P().describe(`Right safe area inset in pixels.`),bottom:P().describe(`Bottom safe area inset in pixels.`),left:P().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough(),zh=R({method:U(`ui/notifications/host-context-changed`),params:Rh.describe(`Partial context update containing only changed fields.`)});R({method:U(`ui/update-model-context`),params:R({content:L(zu).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:V(M(),I().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),R({method:U(`ui/initialize`),params:R({appInfo:Ml.describe(`App identification (name and version).`),appCapabilities:Ph.describe(`Features and capabilities this app provides.`),protocolVersion:M().describe(`Protocol version this app supports.`)})});var Bh=R({protocolVersion:M().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:Ml.describe(`Host application identification and version.`),hostCapabilities:Nh.describe(`Features and capabilities provided by the host.`),hostContext:Rh.describe(`Rich context about the host environment.`)}).passthrough(),Vh={target:`draft-2020-12`};async function Hh(e,t){let n=e[`~standard`];if(n.jsonSchema)return n.jsonSchema[t](Vh);throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function Uh(e,t,n=``){let r=await e[`~standard`].validate(t);if(r.issues){let e=r.issues.map(e=>{let t=e.path?.map(e=>typeof e==`object`?e.key:e).join(`.`);return t?`${t}: ${e.message}`:e.message}).join(`; `);throw Error(n+e)}return r.value}function Wh(){let e=document.documentElement.getAttribute(`data-theme`);return e===`dark`||e===`light`?e:document.documentElement.classList.contains(`dark`)?`dark`:`light`}function Gh(e){let t=document.documentElement;t.setAttribute(`data-theme`,e),t.style.colorScheme=e}function Kh(e,t=document.documentElement){for(let[n,r]of Object.entries(e))r!==void 0&&t.style.setProperty(n,r)}function qh(e){if(document.getElementById(`__mcp-host-fonts`))return;let t=document.createElement(`style`);t.id=`__mcp-host-fonts`,t.textContent=e,document.head.appendChild(t)}function Jh(e,t){let n={...e,...t};return t.experimental!==void 0&&(n.experimental={...e.experimental,...t.experimental}),t.tools!==void 0&&(n.tools={...e.tools,...t.tools}),n}var Yh=class e extends Gm{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new uh;_methods=new dh;setRequestHandler=(...e)=>{let[t,...n]=ph(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=ph(`notification`,e)??e;this._methods.claim(t,`setNotificationHandler`),super.setNotificationHandler.call(this,t,...n)};removeRequestHandler=e=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=e=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:Th,toolinputpartial:Eh,toolresult:Lh,toolcancelled:Dh,hostcontextchanged:zh};static ONE_SHOT_EVENTS=new Set([`toolinput`,`toolinputpartial`,`toolresult`,`toolcancelled`]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let n=`[ext-apps] "${String(t)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(n);console.warn(n)}setEventHandler(e,t){t&&this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.setHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},t=>{let n=t;e===`hostcontextchanged`&&(this._hostContext={...this._hostContext,...n}),this._events.dispatch(e,n)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,n){t&&n&&console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t={},n={autoResize:!0}){super(n),this._appInfo=e,this._appCapabilities=t,this.options=n,this._methods.replace(`notifications/cancelled`),this._methods.replace(`notifications/progress`),!n.allowUnsafeEval&&w({jitless:!0}),this.replaceRequestHandler(`ping`,e=>(console.log(`Received ping:`,e.params),{})),this.setEventHandler(`hostcontextchanged`,void 0)}buildContext(e){return e}registerAppCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after transport is established`);this._appCapabilities=Jh(this._appCapabilities,e)}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,i=()=>{r._initializedSent&&r._appCapabilities.tools?.listChanged&&r.sendToolListChanged()},a=t.inputSchema!==void 0,o={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(e){Object.assign(this,e),i()},remove(){r._registeredTools[e]===o&&(delete r._registeredTools[e],i())},handler:async(t,r)=>{if(!o.enabled)throw Error(`Tool ${e} is disabled`);let i;if(a){let a=o.inputSchema;i=await n(a?await Uh(a,t??{},`Invalid input for tool ${e}: `):t??{},r)}else i=await n(r);return o.outputSchema&&!i.isError&&(i.structuredContent=await Uh(o.outputSchema,i.structuredContent,`Invalid output for tool ${e}: `)),i}};return this._registeredTools[e]=o,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),i(),o}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let n=this._registeredTools[e.name];if(!n)throw Error(`Tool ${e.name} not found`);return n.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([e,t])=>t.enabled).map(async([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?await Hh(t.inputSchema,`input`):{type:`object`,properties:{}}};return t.outputSchema&&(n.outputSchema=await Hh(t.outputSchema,`output`)),t.annotations&&(n.annotations=t.annotations),t._meta&&(n._meta=t._meta),n}))}))}async sendToolListChanged(e={}){this._assertInitialized(`sendToolListChanged`),await this.notification({method:`notifications/tools/list_changed`,params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler(`toolinput`)}set ontoolinput(e){this.setEventHandler(`toolinput`,e)}get ontoolinputpartial(){return this.getEventHandler(`toolinputpartial`)}set ontoolinputpartial(e){this.setEventHandler(`toolinputpartial`,e)}get ontoolresult(){return this.getEventHandler(`toolresult`)}set ontoolresult(e){this.setEventHandler(`toolresult`,e)}get ontoolcancelled(){return this.getEventHandler(`toolcancelled`)}set ontoolcancelled(e){this.setEventHandler(`toolcancelled`,e)}get onhostcontextchanged(){return this.getEventHandler(`hostcontextchanged`)}set onhostcontextchanged(e){this.setEventHandler(`hostcontextchanged`,e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced(`onteardown`,this._onteardown,e),this._onteardown=e,this.replaceRequestHandler(`ui/resource-teardown`,{params:Ah.shape.params,result:jh},(e,t)=>{if(!this._onteardown)throw Error(`No onteardown handler set`);return this._onteardown(e,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(`tools/call`,(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced(`onlisttools`,this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler(`tools/list`,(e,t)=>{if(!this._onlisttools)throw Error(`No onlisttools handler set`);return this._onlisttools(e.params,t)})}assertCapabilityForMethod(e){if(e===`sampling/createMessage`&&!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`)}assertRequestHandlerCapability(e){switch(e){case`tools/call`:case`tools/list`:if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;default:return}}assertNotificationCapability(e){}async callServerTool(e,t){if(this._assertInitialized(`callServerTool`),typeof e==`string`)throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:`tools/call`,params:e},{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized(`readServerResource`),await this.request({method:`resources/read`,params:e},t)}async listServerResources(e,t){return this._assertInitialized(`listServerResources`),await this.request({method:`resources/list`,params:e},t)}async createSamplingMessage(e,t){return this._assertInitialized(`createSamplingMessage`),await this.request({method:`sampling/createMessage`,params:e},t)}sendMessage(e,t){return this._assertInitialized(`sendMessage`),this.request({method:`ui/message`,params:e},Sh,t)}sendLog(e){return this.notification({method:`notifications/message`,params:e})}updateModelContext(e,t){return this._assertInitialized(`updateModelContext`),this.request({method:`ui/update-model-context`,params:e},El,t)}openLink(e,t){return this._assertInitialized(`openLink`),this.request({method:`ui/open-link`,params:e},bh,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized(`downloadFile`),this.request({method:`ui/download-file`,params:e},xh,t)}requestTeardown(e={}){return this.notification({method:`ui/notifications/request-teardown`,params:e})}requestDisplayMode(e,t){return this._assertInitialized(`requestDisplayMode`),this.request({method:`ui/request-display-mode`,params:e},Fh,t)}sendSizeChanged(e){return this.notification({method:`ui/notifications/size-changed`,params:e})}setupSizeChangedNotifications(){let e=!1,t=0,n=0,r=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;let r=document.documentElement,i=r.style.height;r.style.height=`max-content`;let a=Math.ceil(r.getBoundingClientRect().height);r.style.height=i;let o=Math.ceil(window.innerWidth);(o!==t||a!==n)&&(t=o,n=a,this.sendSizeChanged({width:o,height:a}))}))};r();let i=new ResizeObserver(r);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(e=new gh(window.parent,window.parent),t){if(this.transport)throw Error(`App is already connected. Call close() before connecting again.`);this._initializedSent=!1;try{await super.connect(e);let n=await this.request({method:`ui/initialize`,params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:hh}},Bh,t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:`ui/notifications/initialized`}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(e){throw this.close(),e}}};function $(e,t={},...n){let r=document.createElement(e);for(let[e,n]of Object.entries(t))e===`class`?r.className=n:r.setAttribute(e,n);for(let e of n.flat())e!==!1&&e!=null&&r.append(e instanceof Node?e:document.createTextNode(String(e)));return r}function Xh(e,t,n={}){let r=$(`button`,{class:`btn${n.class?` ${n.class}`:``}`,...n.title?{title:n.title}:{}});return r.textContent=e,n.disabled&&(r.disabled=!0),r.addEventListener(`click`,t),r}function Zh(e){e.onhostcontextchanged=e=>{if(e.theme&&Gh(e.theme),e.styles?.variables&&Kh(e.styles.variables),e.styles?.css?.fonts&&qh(e.styles.css.fonts),e.safeAreaInsets){let{top:t,right:n,bottom:r,left:i}=e.safeAreaInsets;document.body.style.padding=`${t+16}px ${n+16}px ${r+16}px ${i+16}px`}},Gh(Wh())}var Qh=1e4;async function $h(e,t,n){try{return await e.connect(void 0,{timeout:Qh}),console.warn(`[${t}] connected`,{host:e.getHostVersion(),caps:e.getHostCapabilities()}),!0}catch(e){console.error(`[${t}] connect failed`,e);let r=e instanceof Error&&/timed?\s*out/i.test(e.message)?`The MCP App host did not respond — make sure your client supports MCP Apps (ext-apps).`:`Connection failed: ${e instanceof Error?e.message:String(e)}`;return n.replaceChildren($(`div`,{class:`skeleton`},r)),!1}}var eg=[{slug:`radius`,label:`RADIUS Servers`,idKey:`.id`,toggle:!0,columns:[{key:`address`,label:`Address`},{key:`service`,label:`Service`},{key:`authentication-port`,label:`Auth`},{key:`accounting-port`,label:`Acct`},{key:`_status`,label:`Status`}],fields:[{key:`address`,label:`Address`,required:!0},{key:`secret`,label:`Secret`,type:`password`,required:!0},{key:`service`,label:`Service`,required:!0,placeholder:`login,ppp,hotspot,…`},{key:`authentication-port`,label:`Auth port`,type:`number`,placeholder:`1812`},{key:`accounting-port`,label:`Acct port`,type:`number`,placeholder:`1813`},{key:`timeout`,label:`Timeout`,placeholder:`300ms`},{key:`src-address`,label:`Src address`},{key:`realm`,label:`Realm`},{key:`called-id`,label:`Called ID`},{key:`domain`,label:`Domain`},{key:`protocol`,label:`Protocol`,type:`select`,options:[`udp`,`radsec`]},{key:`certificate`,label:`Certificate`},{key:`accounting-backup`,label:`Acct backup`,type:`bool`},{key:`comment`,label:`Comment`},{key:`disabled`,label:`Disabled`,type:`bool`}]},{slug:`um-users`,label:`Users`,idKey:`name`,toggle:!0,columns:[{key:`name`,label:`Name`},{key:`group`,label:`Group`},{key:`shared-users`,label:`Shared`},{key:`comment`,label:`Comment`},{key:`_status`,label:`Status`}],fields:[{key:`name`,label:`Name`,required:!0},{key:`password`,label:`Password`,type:`password`,required:!0},{key:`group`,label:`Group`},{key:`shared-users`,label:`Shared users`,type:`number`},{key:`attributes`,label:`Attributes`},{key:`caller-id`,label:`Caller ID`},{key:`otp-secret`,label:`OTP secret`,type:`password`},{key:`comment`,label:`Comment`},{key:`disabled`,label:`Disabled`,type:`bool`}]},{slug:`um-profiles`,label:`Profiles`,idKey:`name`,columns:[{key:`name`,label:`Name`},{key:`validity`,label:`Validity`},{key:`price`,label:`Price`},{key:`starts-when`,label:`Starts`}],fields:[{key:`name`,label:`Name`,required:!0},{key:`name-for-users`,label:`Display name`},{key:`validity`,label:`Validity`,placeholder:`30d`},{key:`price`,label:`Price`,type:`number`},{key:`starts-when`,label:`Starts when`,type:`select`,options:[`assigned`,`first-auth`]},{key:`override-shared-users`,label:`Override shared`},{key:`comment`,label:`Comment`}]},{slug:`um-limitations`,label:`Limitations`,idKey:`name`,columns:[{key:`name`,label:`Name`},{key:`rate-limit-rx`,label:`Rate ↓`},{key:`rate-limit-tx`,label:`Rate ↑`},{key:`transfer-limit`,label:`Transfer`},{key:`uptime-limit`,label:`Uptime`}],fields:[{key:`name`,label:`Name`,required:!0},{key:`rate-limit-rx`,label:`Download rate`,placeholder:`10M`},{key:`rate-limit-tx`,label:`Upload rate`,placeholder:`10M`},{key:`rate-limit-min-rx`,label:`Min ↓ (CIR)`},{key:`rate-limit-min-tx`,label:`Min ↑ (CIR)`},{key:`rate-limit-burst-rx`,label:`Burst ↓`},{key:`rate-limit-burst-tx`,label:`Burst ↑`},{key:`rate-limit-priority`,label:`Priority`,type:`number`},{key:`transfer-limit`,label:`Transfer cap`,placeholder:`10G`},{key:`uptime-limit`,label:`Uptime cap`,placeholder:`1d`},{key:`comment`,label:`Comment`}]},{slug:`um-routers`,label:`NAS Clients`,idKey:`name`,toggle:!0,columns:[{key:`name`,label:`Name`},{key:`address`,label:`Address`},{key:`coa-port`,label:`CoA`},{key:`_status`,label:`Status`}],fields:[{key:`name`,label:`Name`,required:!0},{key:`address`,label:`Address`,required:!0},{key:`shared-secret`,label:`Shared secret`,type:`password`,required:!0},{key:`coa-port`,label:`CoA port`,type:`number`},{key:`protocol`,label:`Protocol`},{key:`comment`,label:`Comment`},{key:`disabled`,label:`Disabled`,type:`bool`}]},{slug:`um-user-profiles`,label:`Assignments`,idKey:`.id`,addOnly:!0,columns:[{key:`user`,label:`User`},{key:`profile`,label:`Profile`},{key:`state`,label:`State`}],fields:[{key:`user`,label:`User`,required:!0},{key:`profile`,label:`Profile`,required:!0}]},{slug:`um-sessions`,label:`Sessions`,idKey:`.id`,readonly:!0,columns:[{key:`user`,label:`User`},{key:`calling-station-id`,label:`Caller`},{key:`started`,label:`Started`},{key:`uptime`,label:`Uptime`},{key:`status`,label:`Status`}],fields:[]}],tg={slug:`settings`,label:`Settings`},ng=e=>eg.find(t=>t.slug===e),rg=e=>(e.flags??``).includes(`X`)||e.disabled===`yes`,ig=document.getElementById(`app`),ag=new Yh({name:`mikrotik-aaa`,version:`1.0.0`}),og=`radius`,sg=!0,cg=[],lg=null,ug={},dg=null,fg=!1,pg=null;function mg(e){return e?.structuredContent}function hg(e){if(!e||e.__mikrotikView!==`aaa-section`)return;typeof e.slug==`string`&&(og=e.slug),sg=e.available!==!1,cg=e.rows??[];let t=e.lastOp;pg=t&&!t.ok?t.message:null}function gg(e){if(!e||e.__mikrotikView!==`aaa-settings`)return;dg={radiusIncoming:e.radiusIncoming??{},umAvailable:e.umAvailable!==!1,umSettings:e.umSettings??{}};let t=e.lastOp;pg=t&&!t.ok?t.message:null}async function _g(e){og=e,lg=null,pg=null,fg=!0,Dg();try{hg(mg(await ag.callServerTool({name:`get_aaa_section`,arguments:{slug:e}})))}catch(e){pg=String(e)}finally{fg=!1,Dg()}}async function vg(){og=`settings`,pg=null,fg=!0,Dg();try{gg(mg(await ag.callServerTool({name:`get_aaa_settings`,arguments:{}})))}catch(e){pg=String(e)}finally{fg=!1,Dg()}}async function yg(e,t){if(!fg){fg=!0,pg=null,Dg();try{hg(mg(await ag.callServerTool({name:`aaa_mutate`,arguments:{op:e,slug:og,...t}}))),lg=null}catch(e){pg=String(e)}finally{fg=!1,Dg()}}}async function bg(e,t){if(!fg){fg=!0,pg=null,Dg();try{gg(mg(await ag.callServerTool({name:`set_aaa_settings`,arguments:{target:e,fields:t}})))}catch(e){pg=String(e)}finally{fg=!1,Dg()}}}function xg(e){if(e.type===`bool`||e.type===`select`){let t=$(`select`,{class:`aaa-input`}),n=e.type===`bool`?[``,`no`,`yes`]:[``,...e.options??[]];for(let e of n){let n=$(`option`,{value:e},e||`—`);t.append(n)}return t.value=ug[e.key]??``,t.addEventListener(`change`,()=>{ug[e.key]=t.value}),t}let t=$(`input`,{class:`aaa-input`,type:e.type===`password`?`password`:e.type===`number`?`number`:`text`,placeholder:e.placeholder??(e.type===`password`?`(unchanged)`:``)});return t.value=ug[e.key]??``,t.addEventListener(`input`,()=>{ug[e.key]=t.value}),t}function Sg(e){let t=$(`div`,{class:`aaa-form-grid`},...e.fields.map(e=>$(`label`,{class:`aaa-field`},$(`span`,{class:`aaa-field-label`},`${e.label}${e.required&&lg===`new`?` *`:``}`),xg(e)))),n=Xh(lg===`new`?`Create`:`Save`,()=>{lg===`new`?yg(`add`,{fields:{...ug}}):yg(`update`,{id:lg,fields:{...ug}})},{class:`primary`}),r=Xh(`Cancel`,()=>{lg=null,Dg()});return $(`div`,{class:`aaa-form`},$(`div`,{class:`aaa-form-title`},lg===`new`?`New ${e.label}`:`Edit ${lg}`),t,$(`div`,{class:`aaa-form-actions`},n,r))}function Cg(e,t){lg=t[e.idKey],ug={};for(let n of e.fields)n.type!==`password`&&(n.key===`disabled`?ug.disabled=rg(t)?`yes`:`no`:t[n.key]!=null&&(ug[n.key]=t[n.key]));Dg()}function wg(e){let t=$(`div`,{class:`aaa-row aaa-head`},...e.columns.map(e=>$(`span`,{},e.label)),$(`span`,{class:`aaa-actions`},e.readonly?``:`Actions`)),n=cg.map(t=>{let n=t[e.idKey],r=rg(t),i=e.columns.map(e=>e.key===`_status`?$(`span`,{},$(`span`,{class:`aaa-badge ${r?`off`:`on`}`},r?`disabled`:`enabled`)):$(`span`,{class:`aaa-cell`,title:t[e.key]??``},t[e.key]??``)),a=[];return e.readonly||(e.toggle&&a.push(Xh(r?`Enable`:`Disable`,()=>void yg(`toggle`,{id:n,enable:r}))),e.addOnly||a.push(Xh(`Edit`,()=>Cg(e,t))),a.push(Xh(`Remove`,()=>void yg(`remove`,{id:n}),{class:`danger`}))),$(`div`,{class:`aaa-row${r?` is-off`:``}`},...i,$(`span`,{class:`aaa-actions`},...a))});return $(`div`,{class:`aaa-table`,style:`--cols:${e.columns.length}`},t,...n)}function Tg(e,t,n,r,i){let a={},o=$(`div`,{class:`aaa-form-grid`},...n.map(e=>{let n=$(`label`,{class:`aaa-field`},$(`span`,{class:`aaa-field-label`},e.label)),r;if(e.type===`bool`){let t=$(`select`,{class:`aaa-input`});for(let e of[``,`no`,`yes`])t.append($(`option`,{value:e},e||`(unchanged)`));t.addEventListener(`change`,()=>{a[e.key]=t.value}),r=t}else{let n=$(`input`,{class:`aaa-input`,type:e.type===`number`?`number`:`text`,placeholder:t[e.key]??e.placeholder??``});n.addEventListener(`input`,()=>{a[e.key]=n.value}),r=n}return n.append(r),n})),s=$(`div`,{class:`aaa-current`},n.map(e=>`${e.label}: ${t[e.key]??`—`}`).join(` · `)),c=$(`div`,{class:`aaa-form-actions`},Xh(`Save`,()=>void bg(r,a),{class:`primary`}),i??null);return $(`div`,{class:`aaa-card`},$(`div`,{class:`aaa-form-title`},e),s,o,c)}function Eg(){return dg?$(`div`,{class:`aaa-settings`},Tg(`RADIUS Incoming (CoA listener)`,dg.radiusIncoming,[{key:`accept`,label:`Accept CoA`,type:`bool`},{key:`port`,label:`CoA port`,type:`number`,placeholder:`3799`}],`radius-incoming`,Xh(`Reset counters`,()=>void bg(`radius-reset-counters`,{}))),dg.umAvailable?Tg(`User Manager (built-in RADIUS server)`,dg.umSettings,[{key:`enabled`,label:`Enabled`,type:`bool`},{key:`use-profiles`,label:`Use profiles`,type:`bool`},{key:`certificate`,label:`Certificate`},{key:`authentication-port`,label:`Auth port`,type:`number`},{key:`accounting-port`,label:`Acct port`,type:`number`}],`um-settings`):$(`div`,{class:`aaa-card`},$(`div`,{class:`aaa-form-title`},`User Manager`),$(`div`,{class:`muted`},`The user-manager package is not installed on this device.`))):$(`div`,{class:`muted`},`Loading settings…`)}function Dg(){let e=$(`div`,{class:`aaa-tabs`},...[...eg,tg].map(e=>$(`button`,{class:`aaa-tab${og===e.slug?` is-active`:``}`},e.label)));[...e.children].forEach((e,t)=>{let n=[...eg,tg][t];e.addEventListener(`click`,()=>{n.slug===`settings`?vg():_g(n.slug)})});let t=[$(`div`,{class:`aaa-titlebar`},$(`div`,{class:`aaa-title`},`RADIUS & User Manager`)),e];if(pg&&t.push($(`div`,{class:`aaa-error`},pg)),og===`settings`)t.push(Eg());else{let e=ng(og);if(!e)t.push($(`div`,{class:`muted`},`Unknown section.`));else if(!sg)t.push($(`div`,{class:`aaa-notice`},`User Manager is not installed on this device. Install the user-manager package (System → Packages) and reboot.`));else{let n=$(`div`,{class:`aaa-bar`});n.append($(`span`,{class:`muted`},`${cg.length} row(s)`)),n.append($(`span`,{class:`spacer`})),n.append(Xh(`↻ Refresh`,()=>void _g(og))),e.readonly||n.append(Xh(`+ Add`,()=>{lg=`new`,ug={},Dg()},{class:`primary`})),t.push(n),lg&&t.push(Sg(e)),t.push(cg.length||!e?wg(e):$(`div`,{class:`muted`},`No rows.`))}}ig.replaceChildren($(`div`,{class:`aaa-wrap`},...t))}ag.ontoolresult=e=>{let t=e.structuredContent;t?.__mikrotikView===`aaa-settings`?gg(t):hg(t),Dg()},ag.ontoolinput=()=>Dg(),Zh(ag),Dg(),$h(ag,`aaa`,ig);
|
|
109
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:M().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:M().optional().describe(`User's timezone in IANA format.`),userAgent:M().optional().describe(`Host application identifier.`),platform:B([U(`web`),U(`desktop`),U(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:R({touch:F().optional().describe(`Whether the device supports touch input.`),hover:F().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:R({top:P().describe(`Top safe area inset in pixels.`),right:P().describe(`Right safe area inset in pixels.`),bottom:P().describe(`Bottom safe area inset in pixels.`),left:P().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough(),zh=R({method:U(`ui/notifications/host-context-changed`),params:Rh.describe(`Partial context update containing only changed fields.`)});R({method:U(`ui/update-model-context`),params:R({content:L(zu).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:V(M(),I().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),R({method:U(`ui/initialize`),params:R({appInfo:Ml.describe(`App identification (name and version).`),appCapabilities:Ph.describe(`Features and capabilities this app provides.`),protocolVersion:M().describe(`Protocol version this app supports.`)})});var Bh=R({protocolVersion:M().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:Ml.describe(`Host application identification and version.`),hostCapabilities:Nh.describe(`Features and capabilities provided by the host.`),hostContext:Rh.describe(`Rich context about the host environment.`)}).passthrough(),Vh={target:`draft-2020-12`};async function Hh(e,t){let n=e[`~standard`];if(n.jsonSchema)return n.jsonSchema[t](Vh);throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function Uh(e,t,n=``){let r=await e[`~standard`].validate(t);if(r.issues){let e=r.issues.map(e=>{let t=e.path?.map(e=>typeof e==`object`?e.key:e).join(`.`);return t?`${t}: ${e.message}`:e.message}).join(`; `);throw Error(n+e)}return r.value}function Wh(){let e=document.documentElement.getAttribute(`data-theme`);return e===`dark`||e===`light`?e:document.documentElement.classList.contains(`dark`)?`dark`:`light`}function Gh(e){let t=document.documentElement;t.setAttribute(`data-theme`,e),t.style.colorScheme=e}function Kh(e,t=document.documentElement){for(let[n,r]of Object.entries(e))r!==void 0&&t.style.setProperty(n,r)}function qh(e){if(document.getElementById(`__mcp-host-fonts`))return;let t=document.createElement(`style`);t.id=`__mcp-host-fonts`,t.textContent=e,document.head.appendChild(t)}function Jh(e,t){let n={...e,...t};return t.experimental!==void 0&&(n.experimental={...e.experimental,...t.experimental}),t.tools!==void 0&&(n.tools={...e.tools,...t.tools}),n}var Yh=class e extends Gm{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new uh;_methods=new dh;setRequestHandler=(...e)=>{let[t,...n]=ph(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=ph(`notification`,e)??e;this._methods.claim(t,`setNotificationHandler`),super.setNotificationHandler.call(this,t,...n)};removeRequestHandler=e=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=e=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:Th,toolinputpartial:Eh,toolresult:Lh,toolcancelled:Dh,hostcontextchanged:zh};static ONE_SHOT_EVENTS=new Set([`toolinput`,`toolinputpartial`,`toolresult`,`toolcancelled`]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let n=`[ext-apps] "${String(t)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(n);console.warn(n)}setEventHandler(e,t){t&&this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.setHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},t=>{let n=t;e===`hostcontextchanged`&&(this._hostContext={...this._hostContext,...n}),this._events.dispatch(e,n)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,n){t&&n&&console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t={},n={autoResize:!0}){super(n),this._appInfo=e,this._appCapabilities=t,this.options=n,this._methods.replace(`notifications/cancelled`),this._methods.replace(`notifications/progress`),!n.allowUnsafeEval&&w({jitless:!0}),this.replaceRequestHandler(`ping`,e=>(console.log(`Received ping:`,e.params),{})),this.setEventHandler(`hostcontextchanged`,void 0)}buildContext(e){return e}registerAppCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after transport is established`);this._appCapabilities=Jh(this._appCapabilities,e)}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,i=()=>{r._initializedSent&&r._appCapabilities.tools?.listChanged&&r.sendToolListChanged()},a=t.inputSchema!==void 0,o={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(e){Object.assign(this,e),i()},remove(){r._registeredTools[e]===o&&(delete r._registeredTools[e],i())},handler:async(t,r)=>{if(!o.enabled)throw Error(`Tool ${e} is disabled`);let i;if(a){let a=o.inputSchema;i=await n(a?await Uh(a,t??{},`Invalid input for tool ${e}: `):t??{},r)}else i=await n(r);return o.outputSchema&&!i.isError&&(i.structuredContent=await Uh(o.outputSchema,i.structuredContent,`Invalid output for tool ${e}: `)),i}};return this._registeredTools[e]=o,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),i(),o}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let n=this._registeredTools[e.name];if(!n)throw Error(`Tool ${e.name} not found`);return n.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([e,t])=>t.enabled).map(async([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?await Hh(t.inputSchema,`input`):{type:`object`,properties:{}}};return t.outputSchema&&(n.outputSchema=await Hh(t.outputSchema,`output`)),t.annotations&&(n.annotations=t.annotations),t._meta&&(n._meta=t._meta),n}))}))}async sendToolListChanged(e={}){this._assertInitialized(`sendToolListChanged`),await this.notification({method:`notifications/tools/list_changed`,params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler(`toolinput`)}set ontoolinput(e){this.setEventHandler(`toolinput`,e)}get ontoolinputpartial(){return this.getEventHandler(`toolinputpartial`)}set ontoolinputpartial(e){this.setEventHandler(`toolinputpartial`,e)}get ontoolresult(){return this.getEventHandler(`toolresult`)}set ontoolresult(e){this.setEventHandler(`toolresult`,e)}get ontoolcancelled(){return this.getEventHandler(`toolcancelled`)}set ontoolcancelled(e){this.setEventHandler(`toolcancelled`,e)}get onhostcontextchanged(){return this.getEventHandler(`hostcontextchanged`)}set onhostcontextchanged(e){this.setEventHandler(`hostcontextchanged`,e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced(`onteardown`,this._onteardown,e),this._onteardown=e,this.replaceRequestHandler(`ui/resource-teardown`,{params:Ah.shape.params,result:jh},(e,t)=>{if(!this._onteardown)throw Error(`No onteardown handler set`);return this._onteardown(e,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(`tools/call`,(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced(`onlisttools`,this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler(`tools/list`,(e,t)=>{if(!this._onlisttools)throw Error(`No onlisttools handler set`);return this._onlisttools(e.params,t)})}assertCapabilityForMethod(e){if(e===`sampling/createMessage`&&!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`)}assertRequestHandlerCapability(e){switch(e){case`tools/call`:case`tools/list`:if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;default:return}}assertNotificationCapability(e){}async callServerTool(e,t){if(this._assertInitialized(`callServerTool`),typeof e==`string`)throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:`tools/call`,params:e},{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized(`readServerResource`),await this.request({method:`resources/read`,params:e},t)}async listServerResources(e,t){return this._assertInitialized(`listServerResources`),await this.request({method:`resources/list`,params:e},t)}async createSamplingMessage(e,t){return this._assertInitialized(`createSamplingMessage`),await this.request({method:`sampling/createMessage`,params:e},t)}sendMessage(e,t){return this._assertInitialized(`sendMessage`),this.request({method:`ui/message`,params:e},Sh,t)}sendLog(e){return this.notification({method:`notifications/message`,params:e})}updateModelContext(e,t){return this._assertInitialized(`updateModelContext`),this.request({method:`ui/update-model-context`,params:e},El,t)}openLink(e,t){return this._assertInitialized(`openLink`),this.request({method:`ui/open-link`,params:e},bh,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized(`downloadFile`),this.request({method:`ui/download-file`,params:e},xh,t)}requestTeardown(e={}){return this.notification({method:`ui/notifications/request-teardown`,params:e})}requestDisplayMode(e,t){return this._assertInitialized(`requestDisplayMode`),this.request({method:`ui/request-display-mode`,params:e},Fh,t)}sendSizeChanged(e){return this.notification({method:`ui/notifications/size-changed`,params:e})}setupSizeChangedNotifications(){let e=!1,t=0,n=0,r=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;let r=document.documentElement,i=r.style.height;r.style.height=`max-content`;let a=Math.ceil(r.getBoundingClientRect().height);r.style.height=i;let o=Math.ceil(window.innerWidth);(o!==t||a!==n)&&(t=o,n=a,this.sendSizeChanged({width:o,height:a}))}))};r();let i=new ResizeObserver(r);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(e=new gh(window.parent,window.parent),t){if(this.transport)throw Error(`App is already connected. Call close() before connecting again.`);this._initializedSent=!1;try{await super.connect(e);let n=await this.request({method:`ui/initialize`,params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:hh}},Bh,t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:`ui/notifications/initialized`}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(e){throw this.close(),e}}};function $(e,t={},...n){let r=document.createElement(e);for(let[e,n]of Object.entries(t))e===`class`?r.className=n:r.setAttribute(e,n);for(let e of n.flat())e!==!1&&e!=null&&r.append(e instanceof Node?e:document.createTextNode(String(e)));return r}function Xh(e,t,n={}){let r=$(`button`,{class:`btn${n.class?` ${n.class}`:``}`,type:`button`,...n.title?{title:n.title}:{}});return r.textContent=e,n.disabled&&(r.disabled=!0),r.addEventListener(`click`,t),r}function Zh(e){e.onhostcontextchanged=e=>{if(e.theme&&Gh(e.theme),e.styles?.variables&&Kh(e.styles.variables),e.styles?.css?.fonts&&qh(e.styles.css.fonts),e.safeAreaInsets){let{top:t,right:n,bottom:r,left:i}=e.safeAreaInsets;document.body.style.padding=`${t+16}px ${n+16}px ${r+16}px ${i+16}px`}},Gh(Wh())}var Qh=1e4;function $h(){let e=`http://www.w3.org/2000/svg`,t=document.createElementNS(e,`svg`);for(let[e,n]of Object.entries({viewBox:`0 0 24 24`,width:`20`,height:`20`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"aria-hidden":`true`}))t.setAttribute(e,n);let n=document.createElementNS(e,`path`);return n.setAttribute(`d`,`M6 7v4a6 6 0 0 0 6 6m6-10v4a6 6 0 0 1-6 6m0 0v3M4 3h4v4H4zm12 0h4v4h-4zM10 20h4v3h-4z`),t.append(n),t}function eg(e,t){document.documentElement.dataset.mcpView=t,e.classList.add(`app`),document.getElementById(`mcp-app-masthead`)?.remove(),e.before($(`header`,{id:`mcp-app-masthead`,class:`mcp-masthead`},$(`span`,{class:`mcp-mark`},$h()),$(`div`,{},$(`span`,{class:`mcp-brand`},`MikroTik `,$(`b`,{},`MCP`)),$(`p`,{class:`mcp-context`},{dashboard:`Device health`,records:`Data explorer`,interfaces:`Interface inventory`,firewall:`Firewall policy`,"firewall-audit":`Security findings`,"connected-devices":`Client inventory`,aaa:`Identity & access`,investigations:`Client investigations`,"round-trip":`Round-trip lab`,"service-health":`Service health`,fabric:`Layer-2 fabric`,operations:`Change operations`,reports:`Evidence reports`}[t]??`Tool workspace`)),$(`span`,{class:`mcp-response-label`},`TOOL RESPONSE`)))}async function tg(e,t,n,r){eg(n,t);let i=!1,a=!1,o,s=()=>{o!==void 0&&clearTimeout(o),o=void 0},c=(e,t,r,i=!1)=>{n.replaceChildren($(`section`,{class:`app-result`,role:i?`alert`:`status`},$(`h2`,{class:`app-result__title`},e),$(`p`,{class:`app-result__message`},t),r?$(`pre`,{class:`app-result__detail`},r):null))};e.ontoolresult=e=>{if(a)return;i=!0,s();let t=(e.content??[]).flatMap(e=>e.type===`text`?[e.text]:[]).join(`
|
|
110
|
+
`).trim();if(e.isError){c(`Tool failed`,`The tool returned an error. No successful result is available.`,t,!0);return}try{if(r(e.structuredContent,e))return;let n=e.structuredContent;t||n?c(`Tool result`,`The response is shown below; it does not use this view's interactive format.`,[t,n?JSON.stringify(n,null,2):``].filter(Boolean).join(`
|
|
111
|
+
|
|
112
|
+
`)):c(`No data returned`,e.content?.some(e=>e.type!==`text`)?`The tool returned non-text content. Open the original tool response in your client.`:`The tool completed without text or structured data.`)}catch{c(`Unable to display result`,`The tool returned an invalid view payload.`,t,!0)}},e.ontoolcancelled=e=>{a||(i=!0,s(),c(`Tool cancelled`,e.reason||`The host cancelled this tool call.`))};let l=e.onteardown;e.onteardown=(e,t)=>(a=!0,s(),l?.(e,t)??{});let u=e.onclose;e.onclose=()=>{!a&&!i&&c(`Host disconnected`,`The connection closed before a tool result arrived.`,void 0,!0),a=!0,s(),u?.()};try{if(await e.connect(void 0,{timeout:Qh}),a)return!1;let n=e.getHostContext?.();return n&&e.onhostcontextchanged?.(n),i||(o=setTimeout(()=>{c(`Still awaiting the tool result`,`The host is connected, but has not delivered a result. Check the original tool response or your client's MCP connection. Do not repeat a configuration-changing call just to refresh this view. Late results will still appear here.`)},15e3)),console.warn(`[${t}] connected`,{host:e.getHostVersion(),caps:e.getHostCapabilities()}),!0}catch(e){return s(),!a&&(a=!0,console.error(`[${t}] connect failed`,e),c(`Cannot connect to the host`,e instanceof Error&&/timed?\s*out/i.test(e.message)?`The MCP App host did not respond — make sure your client supports MCP Apps (ext-apps).`:`Connection failed: ${e instanceof Error?e.message:String(e)}`,void 0,!0),!1)}}var ng=[{slug:`radius`,label:`RADIUS Servers`,idKey:`.id`,toggle:!0,columns:[{key:`address`,label:`Address`},{key:`service`,label:`Service`},{key:`authentication-port`,label:`Auth`},{key:`accounting-port`,label:`Acct`},{key:`_status`,label:`Status`}],fields:[{key:`address`,label:`Address`,required:!0},{key:`secret`,label:`Secret`,type:`password`,required:!0},{key:`service`,label:`Service`,required:!0,placeholder:`login,ppp,hotspot,…`},{key:`authentication-port`,label:`Auth port`,type:`number`,placeholder:`1812`},{key:`accounting-port`,label:`Acct port`,type:`number`,placeholder:`1813`},{key:`timeout`,label:`Timeout`,placeholder:`300ms`},{key:`src-address`,label:`Src address`},{key:`realm`,label:`Realm`},{key:`called-id`,label:`Called ID`},{key:`domain`,label:`Domain`},{key:`protocol`,label:`Protocol`,type:`select`,options:[`udp`,`radsec`]},{key:`certificate`,label:`Certificate`},{key:`accounting-backup`,label:`Acct backup`,type:`bool`},{key:`comment`,label:`Comment`},{key:`disabled`,label:`Disabled`,type:`bool`}]},{slug:`um-users`,label:`Users`,idKey:`name`,toggle:!0,columns:[{key:`name`,label:`Name`},{key:`group`,label:`Group`},{key:`shared-users`,label:`Shared`},{key:`comment`,label:`Comment`},{key:`_status`,label:`Status`}],fields:[{key:`name`,label:`Name`,required:!0},{key:`password`,label:`Password`,type:`password`,required:!0},{key:`group`,label:`Group`},{key:`shared-users`,label:`Shared users`,type:`number`},{key:`attributes`,label:`Attributes`},{key:`caller-id`,label:`Caller ID`},{key:`otp-secret`,label:`OTP secret`,type:`password`},{key:`comment`,label:`Comment`},{key:`disabled`,label:`Disabled`,type:`bool`}]},{slug:`um-profiles`,label:`Profiles`,idKey:`name`,columns:[{key:`name`,label:`Name`},{key:`validity`,label:`Validity`},{key:`price`,label:`Price`},{key:`starts-when`,label:`Starts`}],fields:[{key:`name`,label:`Name`,required:!0},{key:`name-for-users`,label:`Display name`},{key:`validity`,label:`Validity`,placeholder:`30d`},{key:`price`,label:`Price`,type:`number`},{key:`starts-when`,label:`Starts when`,type:`select`,options:[`assigned`,`first-auth`]},{key:`override-shared-users`,label:`Override shared`},{key:`comment`,label:`Comment`}]},{slug:`um-limitations`,label:`Limitations`,idKey:`name`,columns:[{key:`name`,label:`Name`},{key:`rate-limit-rx`,label:`Rate ↓`},{key:`rate-limit-tx`,label:`Rate ↑`},{key:`transfer-limit`,label:`Transfer`},{key:`uptime-limit`,label:`Uptime`}],fields:[{key:`name`,label:`Name`,required:!0},{key:`rate-limit-rx`,label:`Download rate`,placeholder:`10M`},{key:`rate-limit-tx`,label:`Upload rate`,placeholder:`10M`},{key:`rate-limit-min-rx`,label:`Min ↓ (CIR)`},{key:`rate-limit-min-tx`,label:`Min ↑ (CIR)`},{key:`rate-limit-burst-rx`,label:`Burst ↓`},{key:`rate-limit-burst-tx`,label:`Burst ↑`},{key:`rate-limit-priority`,label:`Priority`,type:`number`},{key:`transfer-limit`,label:`Transfer cap`,placeholder:`10G`},{key:`uptime-limit`,label:`Uptime cap`,placeholder:`1d`},{key:`comment`,label:`Comment`}]},{slug:`um-routers`,label:`NAS Clients`,idKey:`name`,toggle:!0,columns:[{key:`name`,label:`Name`},{key:`address`,label:`Address`},{key:`coa-port`,label:`CoA`},{key:`_status`,label:`Status`}],fields:[{key:`name`,label:`Name`,required:!0},{key:`address`,label:`Address`,required:!0},{key:`shared-secret`,label:`Shared secret`,type:`password`,required:!0},{key:`coa-port`,label:`CoA port`,type:`number`},{key:`protocol`,label:`Protocol`},{key:`comment`,label:`Comment`},{key:`disabled`,label:`Disabled`,type:`bool`}]},{slug:`um-user-profiles`,label:`Assignments`,idKey:`.id`,addOnly:!0,columns:[{key:`user`,label:`User`},{key:`profile`,label:`Profile`},{key:`state`,label:`State`}],fields:[{key:`user`,label:`User`,required:!0},{key:`profile`,label:`Profile`,required:!0}]},{slug:`um-sessions`,label:`Sessions`,idKey:`.id`,readonly:!0,columns:[{key:`user`,label:`User`},{key:`calling-station-id`,label:`Caller`},{key:`started`,label:`Started`},{key:`uptime`,label:`Uptime`},{key:`status`,label:`Status`}],fields:[]}],rg={slug:`settings`,label:`Settings`},ig=e=>ng.find(t=>t.slug===e),ag=e=>(e.flags??``).includes(`X`)||e.disabled===`yes`,og=document.getElementById(`app`),sg=new Yh({name:`mikrotik-aaa`,version:`1.0.0`}),cg=`radius`,lg=!0,ug=[],dg=null,fg={},pg=null,mg=!1,hg=null;function gg(e){return e?.structuredContent}function _g(e){if(!e||e.__mikrotikView!==`aaa-section`)return;typeof e.slug==`string`&&(cg=e.slug),lg=e.available!==!1,ug=e.rows??[];let t=e.lastOp;hg=t&&!t.ok?t.message:null}function vg(e){if(!e||e.__mikrotikView!==`aaa-settings`)return;pg={radiusIncoming:e.radiusIncoming??{},umAvailable:e.umAvailable!==!1,umSettings:e.umSettings??{}};let t=e.lastOp;hg=t&&!t.ok?t.message:null}async function yg(e){cg=e,dg=null,hg=null,mg=!0,kg();try{_g(gg(await sg.callServerTool({name:`get_aaa_section`,arguments:{slug:e}})))}catch(e){hg=String(e)}finally{mg=!1,kg()}}async function bg(){cg=`settings`,hg=null,mg=!0,kg();try{vg(gg(await sg.callServerTool({name:`get_aaa_settings`,arguments:{}})))}catch(e){hg=String(e)}finally{mg=!1,kg()}}async function xg(e,t){if(!mg){mg=!0,hg=null,kg();try{_g(gg(await sg.callServerTool({name:`aaa_mutate`,arguments:{op:e,slug:cg,...t}}))),dg=null}catch(e){hg=String(e)}finally{mg=!1,kg()}}}async function Sg(e,t){if(!mg){mg=!0,hg=null,kg();try{vg(gg(await sg.callServerTool({name:`set_aaa_settings`,arguments:{target:e,fields:t}})))}catch(e){hg=String(e)}finally{mg=!1,kg()}}}function Cg(e){if(e.type===`bool`||e.type===`select`){let t=$(`select`,{class:`aaa-input`}),n=e.type===`bool`?[``,`no`,`yes`]:[``,...e.options??[]];for(let e of n){let n=$(`option`,{value:e},e||`—`);t.append(n)}return t.value=fg[e.key]??``,t.addEventListener(`change`,()=>{fg[e.key]=t.value}),t}let t=$(`input`,{class:`aaa-input`,type:e.type===`password`?`password`:e.type===`number`?`number`:`text`,placeholder:e.placeholder??(e.type===`password`?`(unchanged)`:``)});return t.value=fg[e.key]??``,t.addEventListener(`input`,()=>{fg[e.key]=t.value}),t}function wg(e){let t=$(`div`,{class:`aaa-form-grid`},...e.fields.map(e=>$(`label`,{class:`aaa-field`},$(`span`,{class:`aaa-field-label`},`${e.label}${e.required&&dg===`new`?` *`:``}`),Cg(e)))),n=Xh(dg===`new`?`Create`:`Save`,()=>{dg===`new`?xg(`add`,{fields:{...fg}}):xg(`update`,{id:dg,fields:{...fg}})},{class:`primary`}),r=Xh(`Cancel`,()=>{dg=null,kg()});return $(`div`,{class:`aaa-form`},$(`div`,{class:`aaa-form-title`},dg===`new`?`New ${e.label}`:`Edit ${dg}`),t,$(`div`,{class:`aaa-form-actions`},n,r))}function Tg(e,t){dg=t[e.idKey],fg={};for(let n of e.fields)n.type!==`password`&&(n.key===`disabled`?fg.disabled=ag(t)?`yes`:`no`:t[n.key]!=null&&(fg[n.key]=t[n.key]));kg()}function Eg(e){let t=$(`div`,{class:`aaa-row aaa-head`},...e.columns.map(e=>$(`span`,{},e.label)),$(`span`,{class:`aaa-actions`},e.readonly?``:`Actions`)),n=ug.map(t=>{let n=t[e.idKey],r=ag(t),i=e.columns.map(e=>e.key===`_status`?$(`span`,{},$(`span`,{class:`aaa-badge ${r?`off`:`on`}`},r?`disabled`:`enabled`)):$(`span`,{class:`aaa-cell`,title:t[e.key]??``},t[e.key]??``)),a=[];return e.readonly||(e.toggle&&a.push(Xh(r?`Enable`:`Disable`,()=>void xg(`toggle`,{id:n,enable:r}))),e.addOnly||a.push(Xh(`Edit`,()=>Tg(e,t))),a.push(Xh(`Remove`,()=>void xg(`remove`,{id:n}),{class:`danger`}))),$(`div`,{class:`aaa-row${r?` is-off`:``}`},...i,$(`span`,{class:`aaa-actions`},...a))});return $(`div`,{class:`aaa-table`,style:`--cols:${e.columns.length}`},t,...n)}function Dg(e,t,n,r,i){let a={},o=$(`div`,{class:`aaa-form-grid`},...n.map(e=>{let n=$(`label`,{class:`aaa-field`},$(`span`,{class:`aaa-field-label`},e.label)),r;if(e.type===`bool`){let t=$(`select`,{class:`aaa-input`});for(let e of[``,`no`,`yes`])t.append($(`option`,{value:e},e||`(unchanged)`));t.addEventListener(`change`,()=>{a[e.key]=t.value}),r=t}else{let n=$(`input`,{class:`aaa-input`,type:e.type===`number`?`number`:`text`,placeholder:t[e.key]??e.placeholder??``});n.addEventListener(`input`,()=>{a[e.key]=n.value}),r=n}return n.append(r),n})),s=$(`div`,{class:`aaa-current`},n.map(e=>`${e.label}: ${t[e.key]??`—`}`).join(` · `)),c=$(`div`,{class:`aaa-form-actions`},Xh(`Save`,()=>void Sg(r,a),{class:`primary`}),i??null);return $(`div`,{class:`aaa-card`},$(`div`,{class:`aaa-form-title`},e),s,o,c)}function Og(){return pg?$(`div`,{class:`aaa-settings`},Dg(`RADIUS Incoming (CoA listener)`,pg.radiusIncoming,[{key:`accept`,label:`Accept CoA`,type:`bool`},{key:`port`,label:`CoA port`,type:`number`,placeholder:`3799`}],`radius-incoming`,Xh(`Reset counters`,()=>void Sg(`radius-reset-counters`,{}))),pg.umAvailable?Dg(`User Manager (built-in RADIUS server)`,pg.umSettings,[{key:`enabled`,label:`Enabled`,type:`bool`},{key:`use-profiles`,label:`Use profiles`,type:`bool`},{key:`certificate`,label:`Certificate`},{key:`authentication-port`,label:`Auth port`,type:`number`},{key:`accounting-port`,label:`Acct port`,type:`number`}],`um-settings`):$(`div`,{class:`aaa-card`},$(`div`,{class:`aaa-form-title`},`User Manager`),$(`div`,{class:`muted`},`The user-manager package is not installed on this device.`))):$(`div`,{class:`muted`},`Loading settings…`)}function kg(){let e=$(`div`,{class:`aaa-tabs`},...[...ng,rg].map(e=>$(`button`,{class:`aaa-tab${cg===e.slug?` is-active`:``}`},e.label)));[...e.children].forEach((e,t)=>{let n=[...ng,rg][t];e.addEventListener(`click`,()=>{n.slug===`settings`?bg():yg(n.slug)})});let t=[$(`header`,{class:`aaa-titlebar`},$(`h1`,{class:`aaa-title`},`RADIUS & User Manager`)),e];if(hg&&t.push($(`div`,{class:`aaa-error`},hg)),cg===`settings`)t.push(Og());else{let e=ig(cg);if(!e)t.push($(`div`,{class:`muted`},`Unknown section.`));else if(!lg)t.push($(`div`,{class:`aaa-notice`},`User Manager is not installed on this device. Install the user-manager package (System → Packages) and reboot.`));else{let n=$(`div`,{class:`aaa-bar`});n.append($(`span`,{class:`muted`},`${ug.length} row(s)`)),n.append($(`span`,{class:`spacer`})),n.append(Xh(`↻ Refresh`,()=>void yg(cg))),e.readonly||n.append(Xh(`+ Add`,()=>{dg=`new`,fg={},kg()},{class:`primary`})),t.push(n),dg&&t.push(wg(e)),t.push(ug.length||!e?Eg(e):$(`div`,{class:`muted`},`No rows.`))}}og.replaceChildren($(`div`,{class:`aaa-wrap`},...t))}function Ag(e){if(!e||typeof e!=`object`)return!1;let t=e;if(t?.__mikrotikView===`aaa-settings`)vg(t);else if(t.__mikrotikView===`aaa-section`)_g(t);else return!1;return kg(),!0}Zh(sg),kg(),tg(sg,`aaa`,og,Ag);
|
|
110
113
|
</script>
|
|
111
114
|
<style>
|
|
112
|
-
:root{--bg:#0b0d10;--surface:#14181d;--surface-2:#1b2027;--border:#2a313a;--text:#e8eaed;--text-dim:#9aa0a6;--accent:#7c9cff;--danger:#f2685a;--ok:#4ade80}@media (prefers-color-scheme:light){:root{--bg:#fff;--surface:#f6f8fa;--surface-2:#eef1f4;--border:#d8dee4;--text:#1c2024;--text-dim:#5b6470;--accent:#3b5bdb}}*{box-sizing:border-box}body{background:var(--bg);color:var(--text);margin:0;font:13px/1.5 system-ui,-apple-system,Segoe UI,sans-serif}.muted{color:var(--text-dim)}.aaa-wrap{padding:4px 2px 16px}.aaa-titlebar{padding:6px 8px 10px}.aaa-title{font-size:15px;font-weight:600}.aaa-tabs{border-bottom:1px solid var(--border);flex-wrap:wrap;gap:2px;margin-bottom:12px;display:flex}.aaa-tab{appearance:none;color:var(--text-dim);font:inherit;cursor:pointer;background:0 0;border:none;border-bottom:2px solid #0000;margin-bottom:-1px;padding:7px 11px;font-size:12.5px}.aaa-tab:hover{color:var(--text)}.aaa-tab.is-active{color:var(--text);border-bottom-color:var(--accent)}.aaa-bar{align-items:center;gap:8px;padding:0 8px 10px;display:flex}.aaa-bar .spacer{flex:1}.btn{font:inherit;color:var(--text);background:var(--surface-2);border:1px solid var(--border);cursor:pointer;border-radius:8px;padding:4px 10px;font-size:12px}.btn:hover{border-color:var(--accent)}.btn.primary{border-color:color-mix(in srgb, var(--accent) 55%, var(--border));color:var(--accent)}.btn.danger{border-color:color-mix(in srgb, var(--danger) 45%, var(--border));color:var(--danger)}.aaa-error{color:var(--danger);background:color-mix(in srgb, var(--danger) 12%, transparent);border:1px solid color-mix(in srgb, var(--danger) 35%, var(--border));border-radius:8px;margin:0 8px 10px;padding:8px 10px;font-size:12px}.aaa-notice{color:var(--text-dim);background:var(--surface);border:1px solid var(--border);border-radius:10px;margin:0 8px;padding:14px;font-size:12.5px}.aaa-table{padding:0 8px}.aaa-row{grid-template-columns:repeat(var(--cols), minmax(70px, 1fr)) minmax(150px, auto);border-radius:8px;align-items:center;gap:8px;padding:7px 8px;font-size:12.5px;display:grid}.aaa-row.aaa-head{color:var(--text-dim);text-transform:uppercase;letter-spacing:.04em;font-size:10.5px}.aaa-row:not(.aaa-head):hover{background:var(--surface)}.aaa-row.is-off .aaa-cell{color:var(--text-dim)}.aaa-cell{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.aaa-actions{justify-content:flex-end;gap:5px;display:flex}.aaa-actions .btn{padding:3px 8px}.aaa-badge{border-radius:100px;padding:1px 7px;font-size:10.5px;display:inline-block}.aaa-badge.on{background:color-mix(in srgb, var(--ok) 20%, transparent);color:var(--ok)}.aaa-badge.off{background:color-mix(in srgb, var(--text-dim) 22%, transparent);color:var(--text-dim)}.aaa-form,.aaa-card{border:1px solid var(--border);background:var(--surface-2);border-radius:10px;margin:0 8px 12px;padding:12px}.aaa-form-title{margin-bottom:10px;font-size:12.5px;font-weight:600}.aaa-current{color:var(--text-dim);margin-bottom:10px;font-size:11.5px}.aaa-form-grid{grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:9px 12px;display:grid}.aaa-field{flex-direction:column;gap:3px;display:flex}.aaa-field-label{color:var(--text-dim);font-size:11px}.aaa-input{font:inherit;color:var(--text);background:var(--bg);border:1px solid var(--border);border-radius:7px;padding:5px 8px;font-size:12.5px}.aaa-input:focus{border-color:var(--accent);outline:none}.aaa-form-actions{align-items:center;gap:8px;margin-top:12px;display:flex}.aaa-settings{flex-direction:column;gap:4px;display:flex}
|
|
115
|
+
.app-result{border:1px solid var(--color-border-primary,#8886);background:var(--color-background-secondary,transparent);color:var(--color-text-primary,inherit);border-radius:12px;padding:20px}.app-result__title{margin:0 0 8px;font-size:16px;font-weight:600}.app-result__message{margin:0;font-size:13px;line-height:1.6}.app-result__detail{border:1px solid var(--color-border-primary,#8886);max-height:420px;font:12px/1.6 var(--font-mono,monospace);white-space:pre-wrap;overflow-wrap:anywhere;border-radius:8px;margin:16px 0 0;padding:12px;overflow:auto}html[data-mcp-view]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--mt-bg:var(--color-background-primary,#101c2e);--mt-surface:var(--color-background-secondary,#17263b);--mt-surface-2:var(--color-background-tertiary,#20324a);--mt-border:var(--color-border-primary,#304660);--mt-text:var(--color-text-primary,#dae6f4);--mt-text-dim:var(--color-text-secondary,#a6b9ce);--mt-text-faint:var(--color-text-tertiary,#91a8c1);--mt-accent:var(--color-accent-primary,#9ebfee);--mt-good:#69d6c3;--mt-warn:#e5b56f;--mt-bad:#f18b94;--mt-radius:16px;--mt-radius-sm:10px;--mt-sans:var(--font-sans,"Avenir Next", "Segoe UI", sans-serif);--mt-display:var(--font-sans,"Avenir Next", "Segoe UI", sans-serif);--mt-mono:var(--font-mono,"SFMono-Regular", Consolas, monospace);--bg:var(--mt-bg);--surface:var(--mt-surface);--surface-2:var(--mt-surface-2);--border:var(--mt-border);--text:var(--mt-text);--text-dim:var(--mt-text-dim);--accent:var(--mt-accent);--danger:var(--mt-bad);--ok:var(--mt-good);--rx:var(--mt-good);--tx:var(--mt-accent)}html[data-mcp-view][data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--mt-bg:var(--color-background-primary,#f3f6fa);--mt-surface:var(--color-background-secondary,#fff);--mt-surface-2:var(--color-background-tertiary,#e9eff6);--mt-border:var(--color-border-primary,#c8d5e3);--mt-text:var(--color-text-primary,#20334d);--mt-text-dim:var(--color-text-secondary,#4b6480);--mt-text-faint:var(--color-text-tertiary,#5b728c);--mt-accent:var(--color-accent-primary,#325f9c);--mt-good:#157d6b;--mt-warn:#956313;--mt-bad:#b53446}html[data-mcp-view] body{background:var(--mt-bg);color:var(--mt-text);font:13px/1.6 var(--mt-sans);-webkit-font-smoothing:antialiased;margin:0;padding:20px}html[data-mcp-view] :where(*){box-sizing:border-box}html[data-mcp-view] body #app{gap:20px;width:100%;min-width:0;max-width:1120px;margin:0 auto;animation:.22s ease-out both workspace-arrive;display:grid}html[data-mcp-view] body #app>*{min-width:0}.mcp-masthead{border-bottom:1px solid var(--mt-border);align-items:center;gap:12px;width:100%;max-width:1120px;margin:0 auto 22px;padding-bottom:18px;display:flex}.mcp-mark{border:1px solid var(--mt-border);background:var(--mt-surface);width:38px;height:38px;color:var(--mt-accent);border-radius:12px;flex:none;place-items:center;display:grid}.mcp-brand{letter-spacing:-.02em;font-size:13px;font-weight:650}.mcp-brand b{color:var(--mt-accent)}.mcp-context{color:var(--mt-text-dim);margin:0;font-size:11px}.mcp-response-label{font:9px var(--mt-mono);letter-spacing:.12em;color:var(--mt-text-faint);margin-left:auto}body #app :where(.hd,.aaa-titlebar){border:1px solid var(--mt-border);border-radius:var(--mt-radius);background-color:var(--mt-surface);background-image:radial-gradient(color-mix(in srgb, var(--mt-border) 60%, transparent) .7px, transparent .7px);overflow-wrap:anywhere;background-size:16px 16px;flex-wrap:wrap;align-items:center;gap:16px;padding:22px;display:flex;position:relative}body #app :where(.hd__title,.aaa-title,.toolbar .title){font:650 clamp(19px, 3.8vw, 25px)/1.25 var(--mt-display);letter-spacing:-.035em;margin:0}body #app .hd__sub{color:var(--mt-text-dim);font:11px/1.7 var(--mt-mono);margin:6px 0 0}body #app .hd__dot{background:var(--mt-accent);box-shadow:0 0 0 6px color-mix(in srgb, var(--mt-accent) 10%, transparent)}body #app :where(.grid,.if-grid,.aaa-form-grid){grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr));gap:16px;display:grid}body #app :where(.card,.aaa-card,.aaa-form,.f-card){border:1px solid var(--mt-border);border-radius:var(--mt-radius);background:var(--mt-surface);min-width:0;margin:0;padding:20px}body #app .card__label{color:var(--mt-text-dim);font:11px/1.5 var(--mt-sans);letter-spacing:.03em;text-transform:none;margin:0 0 10px}body #app .card__value{font:550 27px/1.3 var(--mt-mono);letter-spacing:-.04em;overflow-wrap:anywhere}body #app .card__value small{font-size:12px}body #app :where(.toolbar,.aaa-bar){border:1px solid var(--mt-border);border-radius:var(--mt-radius);background:var(--mt-surface);flex-wrap:wrap;align-items:center;gap:10px;margin:0;padding:12px;display:flex}body #app .toolbar .grow{flex:200px;min-width:min(100%,200px)}body #app :where(.btn,.aaa-tab){border:1px solid var(--mt-border);background:var(--mt-surface-2);min-height:34px;color:var(--mt-text);font:500 12px/1.4 var(--mt-sans);cursor:pointer;border-radius:10px;justify-content:center;align-items:center;gap:7px;margin:0;padding:7px 12px;transition:background .14s,border-color .14s,transform .14s;display:inline-flex}body #app :where(.btn,.aaa-tab):hover:not(:disabled){border-color:var(--mt-accent);background:color-mix(in srgb, var(--mt-accent) 14%, var(--mt-surface));transform:translateY(-1px)}body #app :where(.btn,.aaa-tab):active:not(:disabled){transform:translateY(0)}body #app :where(.btn,.aaa-tab):disabled{opacity:.5;cursor:not-allowed}body #app :where(.btn.is-active,.btn.primary,.aaa-tab.is-active){border-color:color-mix(in srgb, var(--mt-accent) 70%, var(--mt-border));color:var(--mt-accent);background:color-mix(in srgb, var(--mt-accent) 12%, var(--mt-surface))}body #app :where(.btn-danger,.btn.danger){color:var(--mt-bad);border-color:color-mix(in srgb, var(--mt-bad) 50%, var(--mt-border));background:color-mix(in srgb, var(--mt-bad) 8%, var(--mt-surface))}body #app .btn.ok{color:var(--mt-good)}body #app :where(.search,.aaa-input){border:1px solid var(--mt-border);background:var(--mt-bg);width:100%;min-width:0;min-height:36px;color:var(--mt-text);font:12px/1.5 var(--mt-sans);border-radius:10px;padding:8px 12px}body #app :where(button,input,select,textarea,summary,[tabindex]):focus-visible{outline:2px solid var(--mt-accent);outline-offset:3px}body #app :where(.pill,.chip,.badge,.aaa-badge,.act){font:10px/1.4 var(--mt-mono);overflow-wrap:anywhere;border-radius:7px;max-width:100%;padding:4px 9px}body #app :where(.tablewrap,.table,.aaa-table){border:1px solid var(--mt-border);border-radius:var(--mt-radius);background:var(--mt-surface);width:100%;min-width:0;padding:0;overflow:auto}body #app :where(table.tbl th,table.tbl td){border-bottom:1px solid color-mix(in srgb, var(--mt-border) 65%, transparent);padding:12px 16px;font-size:11px;line-height:1.6}body #app table.tbl thead th{background:var(--mt-surface-2);font:600 11px var(--mt-sans);height:42px}body #app table.tbl tbody tr:nth-child(2n){background:color-mix(in srgb, var(--mt-surface-2) 30%, transparent)}body #app table.tbl tbody tr:hover{background:color-mix(in srgb, var(--mt-accent) 12%, var(--mt-surface))}body #app :where(.kv__body,details.kv){background:var(--mt-surface);border:1px solid var(--mt-border);border-radius:var(--mt-radius);overflow:hidden}body #app .kv__body{grid-template-columns:minmax(100px,.45fr) minmax(0,1fr)}body #app .kv__body>div{padding:12px 16px;font-size:11px;line-height:1.6}body #app details.kv .kv__body{border:0;border-top:1px solid var(--mt-border);border-radius:0}body #app details.kv>summary{padding:16px 20px;font-size:12px}body #app :where(.foot,.totals){color:var(--mt-text-faint);border-top:1px solid var(--mt-border);gap:12px;padding:12px 0;font-size:10px}body #app :where(.skeleton,.empty,.loading,.aaa-notice){border:1px dashed var(--mt-border);border-radius:var(--mt-radius);color:var(--mt-text-dim);background:var(--mt-surface);text-align:center;padding:36px 24px;font-size:12px}body #app pre.raw{white-space:pre-wrap;overflow-wrap:anywhere;padding:20px;font-size:11px;line-height:1.85}body #app .drawer{gap:16px;padding:20px}body #app .drawer__hd{flex-wrap:wrap}body #app .if-card{border-top:3px solid var(--mt-border);gap:20px}body #app .if-card:has(.dot.is-up){border-top-color:var(--mt-good)}body #app .if-card__top{flex-wrap:wrap;gap:10px}body #app .if-card__name{font-size:15px}body #app .if-card__meta{grid-template-columns:minmax(45px,.3fr) minmax(0,1fr);gap:8px 14px}body #app .f-list{grid-template-columns:repeat(auto-fit,minmax(min(100%,340px),1fr));gap:16px;margin:0;display:grid}body #app .f-card{border-top-width:3px}body #app .f-card.is-bad{border-top-color:var(--mt-bad)}body #app .f-card.is-warn{border-top-color:var(--mt-warn)}body #app .f-body{margin-top:14px}body #app .f-detail{font-size:12px;line-height:1.7}body #app .f-fix{margin-top:10px;font-size:11px}body #app .f-actions{margin-top:18px}body #app .aaa-wrap{gap:18px;min-width:0;padding:0;display:grid}body #app .aaa-tabs{border:1px solid var(--mt-border);border-radius:var(--mt-radius);background:var(--mt-surface);gap:8px;margin:0;padding:8px}body #app .aaa-tab{font-size:11px}body #app .aaa-row{min-width:max(100%, calc(var(--cols) * 105px + 190px));border-bottom:1px solid var(--mt-border);border-radius:0;gap:12px;padding:12px 16px;font-size:11px}body #app .aaa-head{background:var(--mt-surface-2)}body #app .aaa-actions,body #app .aaa-field{gap:8px}body #app .aaa-form-title{margin-bottom:16px;font-size:14px}body #app .aaa-settings{gap:16px}body #app .aaa-error{margin:0;padding:16px}body #app .row{border-bottom:1px solid var(--mt-border);border-radius:0;grid-template-columns:105px minmax(150px,1.4fr) 145px 85px 100px 165px;gap:14px;min-width:840px;padding:13px 16px;font-size:11px}body #app .row.header{background:var(--mt-surface-2);font:600 10px var(--mt-sans)}body #app .detail{border:1px solid var(--mt-border);border-radius:var(--mt-radius);background:var(--mt-surface);padding:22px}body #app .detail-title{margin-bottom:6px;font-size:19px}body #app .detail-sub{margin-bottom:22px}body #app .rates{font:15px var(--mt-mono);flex-wrap:wrap;gap:24px;margin:0 0 18px}body #app .traffic-chart{background-image:radial-gradient(var(--mt-border) .75px, transparent .75px);background-size:16px 16px;max-width:none;height:200px}body #app .app-result{border-color:var(--mt-border);background:var(--mt-surface);color:var(--mt-text);padding:26px}body #app .app-result[role=alert]{border-top:3px solid var(--mt-bad)}body #app .app-result__title{font-family:var(--mt-display);letter-spacing:-.025em;font-size:20px}body #app .app-result__message{color:var(--mt-text-dim);font-size:12px}body #app .app-result__detail{background:var(--mt-bg);border-color:var(--mt-border);font:11px/1.8 var(--mt-mono)}@keyframes workspace-arrive{0%{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}@media (width<=520px){html[data-mcp-view] body{padding:12px}html[data-mcp-view] body #app{gap:16px}.mcp-masthead{gap:10px;margin-bottom:16px}.mcp-response-label{letter-spacing:.04em;font-size:8px}body #app :where(.hd,.aaa-titlebar,.card,.f-card,.aaa-card,.aaa-form){padding:16px}body #app .kv__body{grid-template-columns:minmax(80px,.4fr) minmax(0,1fr)}body #app .kv__body>div{padding:10px 12px}body #app .if-grid{grid-template-columns:minmax(0,1fr)}}@media (prefers-reduced-motion:reduce){html[data-mcp-view] body #app,body #app *,body #app :before,body #app :after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}:root{--bg:#0b0d10;--surface:#14181d;--surface-2:#1b2027;--border:#2a313a;--text:#e8eaed;--text-dim:#9aa0a6;--accent:#7c9cff;--danger:#f2685a;--ok:#4ade80}@media (prefers-color-scheme:light){:root{--bg:#fff;--surface:#f6f8fa;--surface-2:#eef1f4;--border:#d8dee4;--text:#1c2024;--text-dim:#5b6470;--accent:#3b5bdb}}*{box-sizing:border-box}body{background:var(--bg);color:var(--text);margin:0;font:13px/1.5 system-ui,-apple-system,Segoe UI,sans-serif}.muted{color:var(--text-dim)}.aaa-wrap{padding:4px 2px 16px}.aaa-titlebar{padding:6px 8px 10px}.aaa-title{font-size:15px;font-weight:600}.aaa-tabs{border-bottom:1px solid var(--border);flex-wrap:wrap;gap:2px;margin-bottom:12px;display:flex}.aaa-tab{appearance:none;color:var(--text-dim);font:inherit;cursor:pointer;background:0 0;border:none;border-bottom:2px solid #0000;margin-bottom:-1px;padding:7px 11px;font-size:12.5px}.aaa-tab:hover{color:var(--text)}.aaa-tab.is-active{color:var(--text);border-bottom-color:var(--accent)}.aaa-bar{align-items:center;gap:8px;padding:0 8px 10px;display:flex}.aaa-bar .spacer{flex:1}.btn{font:inherit;color:var(--text);background:var(--surface-2);border:1px solid var(--border);cursor:pointer;border-radius:8px;padding:4px 10px;font-size:12px}.btn:hover{border-color:var(--accent)}.btn.primary{border-color:color-mix(in srgb, var(--accent) 55%, var(--border));color:var(--accent)}.btn.danger{border-color:color-mix(in srgb, var(--danger) 45%, var(--border));color:var(--danger)}.aaa-error{color:var(--danger);background:color-mix(in srgb, var(--danger) 12%, transparent);border:1px solid color-mix(in srgb, var(--danger) 35%, var(--border));border-radius:8px;margin:0 8px 10px;padding:8px 10px;font-size:12px}.aaa-notice{color:var(--text-dim);background:var(--surface);border:1px solid var(--border);border-radius:10px;margin:0 8px;padding:14px;font-size:12.5px}.aaa-table{padding:0 8px}.aaa-row{grid-template-columns:repeat(var(--cols), minmax(70px, 1fr)) minmax(150px, auto);border-radius:8px;align-items:center;gap:8px;padding:7px 8px;font-size:12.5px;display:grid}.aaa-row.aaa-head{color:var(--text-dim);text-transform:uppercase;letter-spacing:.04em;font-size:10.5px}.aaa-row:not(.aaa-head):hover{background:var(--surface)}.aaa-row.is-off .aaa-cell{color:var(--text-dim)}.aaa-cell{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.aaa-actions{justify-content:flex-end;gap:5px;display:flex}.aaa-actions .btn{padding:3px 8px}.aaa-badge{border-radius:100px;padding:1px 7px;font-size:10.5px;display:inline-block}.aaa-badge.on{background:color-mix(in srgb, var(--ok) 20%, transparent);color:var(--ok)}.aaa-badge.off{background:color-mix(in srgb, var(--text-dim) 22%, transparent);color:var(--text-dim)}.aaa-form,.aaa-card{border:1px solid var(--border);background:var(--surface-2);border-radius:10px;margin:0 8px 12px;padding:12px}.aaa-form-title{margin-bottom:10px;font-size:12.5px;font-weight:600}.aaa-current{color:var(--text-dim);margin-bottom:10px;font-size:11.5px}.aaa-form-grid{grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:9px 12px;display:grid}.aaa-field{flex-direction:column;gap:3px;display:flex}.aaa-field-label{color:var(--text-dim);font-size:11px}.aaa-input{font:inherit;color:var(--text);background:var(--bg);border:1px solid var(--border);border-radius:7px;padding:5px 8px;font-size:12.5px}.aaa-input:focus{border-color:var(--accent);outline:none}.aaa-form-actions{align-items:center;gap:8px;margin-top:12px;display:flex}.aaa-settings{flex-direction:column;gap:4px;display:flex}
|
|
113
116
|
/*$vite$:1*/
|
|
114
117
|
</style>
|
|
115
118
|
</head>
|