@usex/mikrotik-mcp 6.15.0 → 6.16.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/dist/cli.js +2509 -614
- package/dist/index.d.ts +10 -1
- package/dist/index.js +24 -10
- package/dist/shared/{cli-b7rbwm6j.js → cli-8hn9vb7c.js} +8 -2
- package/dist/shared/{cli-5hgbedxa.js → cli-8j89p9xc.js} +1 -1
- package/dist/shared/cli-kb8zq3rx.js +9 -0
- package/dist/shared/{cli-57nggfz3.js → cli-p7bt2fa3.js} +1 -1
- package/dist/shared/{cli-4aqtcr9k.js → cli-rmtax5nd.js} +1 -1
- package/dist/shared/{cli-9x2ne7hp.js → cli-rs00sr7q.js} +1 -1
- package/dist/shared/{cli-4n039739.js → cli-vf68spka.js} +5058 -1921
- package/dist/shared/cli-znnh8xtd.js +15 -0
- package/dist/shared/{library-28w0j1ny.js → library-m6wrdeqa.js} +1 -1
- package/dist/shared/{library-nt9fygza.js → library-nbtg49vh.js} +1 -1
- package/dist/shared/{library-1sy0ph9r.js → library-rc32xwsh.js} +1 -1
- package/dist/shared/{library-7qr2sc9x.js → library-rrzzp9qg.js} +4731 -1569
- package/dist/shared/{library-twpgma2r.js → library-s31n8vk4.js} +1 -1
- package/dist/ui/observability.html +144 -175
- package/package.json +23 -19
- package/schemas/README.md +5 -5
- package/schemas/config.schema.json +274 -6
- package/schemas/devtools-manifest.json +301 -5
- package/schemas/tool-catalog.json +1116 -42
- package/schemas/tools/add_alert_rule.json +1 -1
- package/schemas/tools/apply_config_template.json +56 -0
- package/schemas/tools/apply_wireless_to_wifi_migration.json +30 -0
- package/schemas/tools/deploy_container_stack.json +112 -0
- package/schemas/tools/design_zone_firewall.json +81 -0
- package/schemas/tools/discover_unmanaged_devices.json +49 -0
- package/schemas/tools/enrol_device.json +56 -0
- package/schemas/tools/expire_wireguard_users.json +19 -0
- package/schemas/tools/export_logs.json +2 -1
- package/schemas/tools/find_tools.json +1 -1
- package/schemas/tools/firmware_check.json +0 -5
- package/schemas/tools/firmware_post_upgrade.json +29 -0
- package/schemas/tools/firmware_repo_fetch.json +30 -0
- package/schemas/tools/firmware_repo_list.json +7 -0
- package/schemas/tools/firmware_stage_from_repo.json +19 -0
- package/schemas/tools/follow_ipv6_prefix.json +51 -0
- package/schemas/tools/generate_hotspot_vouchers.json +37 -1
- package/schemas/tools/get_container_logs.json +20 -0
- package/schemas/tools/get_logs.json +2 -1
- package/schemas/tools/get_logs_by_severity.json +2 -1
- package/schemas/tools/get_logs_by_topic.json +2 -1
- package/schemas/tools/get_security_logs.json +2 -1
- package/schemas/tools/get_system_events.json +2 -1
- package/schemas/tools/list_config_templates.json +7 -0
- package/schemas/tools/list_voucher_batches.json +7 -0
- package/schemas/tools/list_wireguard_users.json +12 -0
- package/schemas/tools/onboard_wireguard_user.json +17 -2
- package/schemas/tools/plan_wireless_to_wifi_migration.json +14 -0
- package/schemas/tools/protect_hotspot_login.json +32 -0
- package/schemas/tools/remove_config_template.json +14 -0
- package/schemas/tools/remove_threat_feed.json +1 -0
- package/schemas/tools/remove_voucher_batch.json +24 -0
- package/schemas/tools/remove_zone_firewall.json +14 -0
- package/schemas/tools/revoke_wireguard_user.json +1 -0
- package/schemas/tools/run_routeros_command.json +6 -1
- package/schemas/tools/save_config_template.json +20 -0
- package/schemas/tools/search_logs.json +2 -1
- package/schemas/tools/subscribe_threat_feed.json +1 -0
- package/schemas/tools/test_alert_channel.json +1 -1
- package/schemas/tools/unfollow_ipv6_prefix.json +18 -0
- package/schemas/tools/unprotect_hotspot_login.json +7 -0
- package/schemas/tools/update_alert_rule.json +1 -1
- package/schemas/tools/upgrade_container_image.json +29 -0
- package/schemas/tools/validate_routeros_command.json +13 -0
- package/scripts/service.ts +2 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "list_wireguard_users",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"interface": {
|
|
7
|
+
"description": "Only users of this WireGuard interface",
|
|
8
|
+
"type": "string"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"additionalProperties": false
|
|
12
|
+
}
|
|
@@ -9,11 +9,26 @@
|
|
|
9
9
|
},
|
|
10
10
|
"user": {
|
|
11
11
|
"type": "string",
|
|
12
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9._@-]{0,62}$",
|
|
12
13
|
"description": "User/device label, e.g. 'alice-laptop'"
|
|
13
14
|
},
|
|
14
15
|
"address": {
|
|
16
|
+
"description": "Tunnel IP for the client, e.g. '10.20.0.50'. Omit to take the lowest free one.",
|
|
17
|
+
"type": "string"
|
|
18
|
+
},
|
|
19
|
+
"expires": {
|
|
20
|
+
"description": "Last day the user may connect, e.g. '2026-12-31'",
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"save": {
|
|
24
|
+
"default": false,
|
|
25
|
+
"description": "Write <user>.conf and a <user>.png QR code on the MCP host",
|
|
26
|
+
"type": "boolean"
|
|
27
|
+
},
|
|
28
|
+
"email_to": {
|
|
29
|
+
"description": "Email the profile to this address (needs the alert email channel)",
|
|
15
30
|
"type": "string",
|
|
16
|
-
"
|
|
31
|
+
"pattern": "^[^\\s<>@,;]+@[^\\s<>@,;]+$"
|
|
17
32
|
},
|
|
18
33
|
"endpoint": {
|
|
19
34
|
"type": "string",
|
|
@@ -34,6 +49,6 @@
|
|
|
34
49
|
"type": "string"
|
|
35
50
|
}
|
|
36
51
|
},
|
|
37
|
-
"required": ["interface", "user", "
|
|
52
|
+
"required": ["interface", "user", "save", "endpoint", "allowed_ips", "keepalive"],
|
|
38
53
|
"additionalProperties": false
|
|
39
54
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "plan_wireless_to_wifi_migration",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"save": {
|
|
7
|
+
"default": false,
|
|
8
|
+
"description": "Store the plan on the MCP host for apply_wireless_to_wifi_migration",
|
|
9
|
+
"type": "boolean"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"required": ["save"],
|
|
13
|
+
"additionalProperties": false
|
|
14
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "protect_hotspot_login",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"per_minute": {
|
|
7
|
+
"default": 30,
|
|
8
|
+
"type": "integer",
|
|
9
|
+
"minimum": 5,
|
|
10
|
+
"maximum": 600
|
|
11
|
+
},
|
|
12
|
+
"burst": {
|
|
13
|
+
"default": 15,
|
|
14
|
+
"type": "integer",
|
|
15
|
+
"minimum": 1,
|
|
16
|
+
"maximum": 200
|
|
17
|
+
},
|
|
18
|
+
"block_minutes": {
|
|
19
|
+
"default": 10,
|
|
20
|
+
"type": "integer",
|
|
21
|
+
"minimum": 1,
|
|
22
|
+
"maximum": 1440
|
|
23
|
+
},
|
|
24
|
+
"apply": {
|
|
25
|
+
"default": false,
|
|
26
|
+
"description": "false = show the rules; true = add them",
|
|
27
|
+
"type": "boolean"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"required": ["per_minute", "burst", "block_minutes", "apply"],
|
|
31
|
+
"additionalProperties": false
|
|
32
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "remove_config_template",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"name": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,40}$",
|
|
9
|
+
"description": "Template name"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"required": ["name"],
|
|
13
|
+
"additionalProperties": false
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "remove_voucher_batch",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"batch": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,30}$",
|
|
9
|
+
"description": "The batch name"
|
|
10
|
+
},
|
|
11
|
+
"include_used": {
|
|
12
|
+
"default": false,
|
|
13
|
+
"description": "Also remove vouchers that were used",
|
|
14
|
+
"type": "boolean"
|
|
15
|
+
},
|
|
16
|
+
"apply": {
|
|
17
|
+
"default": false,
|
|
18
|
+
"description": "false = count only; true = remove",
|
|
19
|
+
"type": "boolean"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"required": ["batch", "include_used", "apply"],
|
|
23
|
+
"additionalProperties": false
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "remove_zone_firewall",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"apply": {
|
|
7
|
+
"default": false,
|
|
8
|
+
"description": "false = count only; true = remove",
|
|
9
|
+
"type": "boolean"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"required": ["apply"],
|
|
13
|
+
"additionalProperties": false
|
|
14
|
+
}
|
|
@@ -6,8 +6,13 @@
|
|
|
6
6
|
"command": {
|
|
7
7
|
"type": "string",
|
|
8
8
|
"description": "Full RouterOS CLI command exactly as typed, e.g. '/ip address print'"
|
|
9
|
+
},
|
|
10
|
+
"check_syntax": {
|
|
11
|
+
"default": true,
|
|
12
|
+
"description": "Parse the command on the router first and refuse it when it is not valid",
|
|
13
|
+
"type": "boolean"
|
|
9
14
|
}
|
|
10
15
|
},
|
|
11
|
-
"required": ["command"],
|
|
16
|
+
"required": ["command", "check_syntax"],
|
|
12
17
|
"additionalProperties": false
|
|
13
18
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "save_config_template",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"name": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,40}$",
|
|
9
|
+
"description": "Template name"
|
|
10
|
+
},
|
|
11
|
+
"content": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"minLength": 1,
|
|
14
|
+
"maxLength": 200000,
|
|
15
|
+
"description": "RouterOS script text with {{variable}} places"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"required": ["name", "content"],
|
|
19
|
+
"additionalProperties": false
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "unfollow_ipv6_prefix",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"interface": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "Interface of the DHCPv6 client"
|
|
9
|
+
},
|
|
10
|
+
"list": {
|
|
11
|
+
"default": "isp-prefix",
|
|
12
|
+
"type": "string",
|
|
13
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,30}$"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"required": ["interface", "list"],
|
|
17
|
+
"additionalProperties": false
|
|
18
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "upgrade_container_image",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"name": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,40}$",
|
|
9
|
+
"description": "Container name"
|
|
10
|
+
},
|
|
11
|
+
"stop": {
|
|
12
|
+
"default": false,
|
|
13
|
+
"description": "Stop the container first when it runs",
|
|
14
|
+
"type": "boolean"
|
|
15
|
+
},
|
|
16
|
+
"accept_data_loss": {
|
|
17
|
+
"default": false,
|
|
18
|
+
"description": "Allow the upgrade of a container that has no mount",
|
|
19
|
+
"type": "boolean"
|
|
20
|
+
},
|
|
21
|
+
"apply": {
|
|
22
|
+
"default": false,
|
|
23
|
+
"description": "false = show the plan; true = upgrade",
|
|
24
|
+
"type": "boolean"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"required": ["name", "stop", "accept_data_loss", "apply"],
|
|
28
|
+
"additionalProperties": false
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "validate_routeros_command",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"command": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "A RouterOS command, or a script of several lines"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"required": ["command"],
|
|
12
|
+
"additionalProperties": false
|
|
13
|
+
}
|
package/scripts/service.ts
CHANGED
|
@@ -187,7 +187,7 @@ export function psQuote(value: string): string {
|
|
|
187
187
|
|
|
188
188
|
/** Render a per-user Linux unit with loopback listeners and restart supervision. */
|
|
189
189
|
export function linuxUnit(state: ServiceState): string {
|
|
190
|
-
return `[Unit]\nDescription=MikroTik MCP shared service\nAfter=network.target\n\n[Service]\nType=simple\nWorkingDirectory=${systemdQuote(state.cwd)}\nExecStart=${[state.bun, state.cli, ...state.args].map((arg) => systemdQuote(arg, true)).join(" ")}\nRestart=always\nRestartSec=5\nTimeoutStopSec=30\nUMask=0077\
|
|
190
|
+
return `[Unit]\nDescription=MikroTik MCP shared service\nAfter=network.target\n\n[Service]\nType=simple\nWorkingDirectory=${systemdQuote(state.cwd)}\nExecStart=${[state.bun, state.cli, ...state.args].map((arg) => systemdQuote(arg, true)).join(" ")}\nRestart=always\nRestartSec=5\nTimeoutStopSec=30\nUMask=0077\n\n[Install]\nWantedBy=default.target\n`;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
/** Create a password-free, current-user Windows logon task with bounded restart retries. */
|
|
@@ -512,7 +512,7 @@ async function inspect(state: ServiceState): Promise<ServiceReport> {
|
|
|
512
512
|
};
|
|
513
513
|
const latest = async (): Promise<string | undefined> => {
|
|
514
514
|
const response = await fetch(
|
|
515
|
-
`https://registry.npmjs.org/${PACKAGE.
|
|
515
|
+
`https://registry.npmjs.org/${PACKAGE.replaceAll("/", "%2f")}/latest`,
|
|
516
516
|
{
|
|
517
517
|
signal: AbortSignal.timeout(2500),
|
|
518
518
|
},
|
|
@@ -814,7 +814,6 @@ async function register(state: ServiceState): Promise<void> {
|
|
|
814
814
|
ExitTimeOut: 30,
|
|
815
815
|
ThrottleInterval: 10,
|
|
816
816
|
Umask: 63,
|
|
817
|
-
EnvironmentVariables: { MIKROTIK_LOG_LEVEL: "warn" },
|
|
818
817
|
StandardOutPath: join(state.cwd, "service.stdout.log"),
|
|
819
818
|
StandardErrorPath: join(state.cwd, "service.stderr.log"),
|
|
820
819
|
}),
|