@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.
Files changed (67) hide show
  1. package/dist/cli.js +2509 -614
  2. package/dist/index.d.ts +10 -1
  3. package/dist/index.js +24 -10
  4. package/dist/shared/{cli-b7rbwm6j.js → cli-8hn9vb7c.js} +8 -2
  5. package/dist/shared/{cli-5hgbedxa.js → cli-8j89p9xc.js} +1 -1
  6. package/dist/shared/cli-kb8zq3rx.js +9 -0
  7. package/dist/shared/{cli-57nggfz3.js → cli-p7bt2fa3.js} +1 -1
  8. package/dist/shared/{cli-4aqtcr9k.js → cli-rmtax5nd.js} +1 -1
  9. package/dist/shared/{cli-9x2ne7hp.js → cli-rs00sr7q.js} +1 -1
  10. package/dist/shared/{cli-4n039739.js → cli-vf68spka.js} +5058 -1921
  11. package/dist/shared/cli-znnh8xtd.js +15 -0
  12. package/dist/shared/{library-28w0j1ny.js → library-m6wrdeqa.js} +1 -1
  13. package/dist/shared/{library-nt9fygza.js → library-nbtg49vh.js} +1 -1
  14. package/dist/shared/{library-1sy0ph9r.js → library-rc32xwsh.js} +1 -1
  15. package/dist/shared/{library-7qr2sc9x.js → library-rrzzp9qg.js} +4731 -1569
  16. package/dist/shared/{library-twpgma2r.js → library-s31n8vk4.js} +1 -1
  17. package/dist/ui/observability.html +144 -175
  18. package/package.json +23 -19
  19. package/schemas/README.md +5 -5
  20. package/schemas/config.schema.json +274 -6
  21. package/schemas/devtools-manifest.json +301 -5
  22. package/schemas/tool-catalog.json +1116 -42
  23. package/schemas/tools/add_alert_rule.json +1 -1
  24. package/schemas/tools/apply_config_template.json +56 -0
  25. package/schemas/tools/apply_wireless_to_wifi_migration.json +30 -0
  26. package/schemas/tools/deploy_container_stack.json +112 -0
  27. package/schemas/tools/design_zone_firewall.json +81 -0
  28. package/schemas/tools/discover_unmanaged_devices.json +49 -0
  29. package/schemas/tools/enrol_device.json +56 -0
  30. package/schemas/tools/expire_wireguard_users.json +19 -0
  31. package/schemas/tools/export_logs.json +2 -1
  32. package/schemas/tools/find_tools.json +1 -1
  33. package/schemas/tools/firmware_check.json +0 -5
  34. package/schemas/tools/firmware_post_upgrade.json +29 -0
  35. package/schemas/tools/firmware_repo_fetch.json +30 -0
  36. package/schemas/tools/firmware_repo_list.json +7 -0
  37. package/schemas/tools/firmware_stage_from_repo.json +19 -0
  38. package/schemas/tools/follow_ipv6_prefix.json +51 -0
  39. package/schemas/tools/generate_hotspot_vouchers.json +37 -1
  40. package/schemas/tools/get_container_logs.json +20 -0
  41. package/schemas/tools/get_logs.json +2 -1
  42. package/schemas/tools/get_logs_by_severity.json +2 -1
  43. package/schemas/tools/get_logs_by_topic.json +2 -1
  44. package/schemas/tools/get_security_logs.json +2 -1
  45. package/schemas/tools/get_system_events.json +2 -1
  46. package/schemas/tools/list_config_templates.json +7 -0
  47. package/schemas/tools/list_voucher_batches.json +7 -0
  48. package/schemas/tools/list_wireguard_users.json +12 -0
  49. package/schemas/tools/onboard_wireguard_user.json +17 -2
  50. package/schemas/tools/plan_wireless_to_wifi_migration.json +14 -0
  51. package/schemas/tools/protect_hotspot_login.json +32 -0
  52. package/schemas/tools/remove_config_template.json +14 -0
  53. package/schemas/tools/remove_threat_feed.json +1 -0
  54. package/schemas/tools/remove_voucher_batch.json +24 -0
  55. package/schemas/tools/remove_zone_firewall.json +14 -0
  56. package/schemas/tools/revoke_wireguard_user.json +1 -0
  57. package/schemas/tools/run_routeros_command.json +6 -1
  58. package/schemas/tools/save_config_template.json +20 -0
  59. package/schemas/tools/search_logs.json +2 -1
  60. package/schemas/tools/subscribe_threat_feed.json +1 -0
  61. package/schemas/tools/test_alert_channel.json +1 -1
  62. package/schemas/tools/unfollow_ipv6_prefix.json +18 -0
  63. package/schemas/tools/unprotect_hotspot_login.json +7 -0
  64. package/schemas/tools/update_alert_rule.json +1 -1
  65. package/schemas/tools/upgrade_container_image.json +29 -0
  66. package/schemas/tools/validate_routeros_command.json +13 -0
  67. package/scripts/service.ts +2 -3
@@ -10,7 +10,8 @@
10
10
  "type": "string"
11
11
  },
12
12
  "time_filter": {
13
- "type": "string"
13
+ "type": "string",
14
+ "pattern": "^\\d+(?:[wdhms](?:\\d+[wdhms])*)?$"
14
15
  },
15
16
  "message_filter": {
16
17
  "type": "string"
@@ -8,7 +8,8 @@
8
8
  "enum": ["debug", "info", "warning", "error", "critical"]
9
9
  },
10
10
  "time_filter": {
11
- "type": "string"
11
+ "type": "string",
12
+ "pattern": "^\\d+(?:[wdhms](?:\\d+[wdhms])*)?$"
12
13
  },
13
14
  "limit": {
14
15
  "type": "integer",
@@ -7,7 +7,8 @@
7
7
  "type": "string"
8
8
  },
9
9
  "time_filter": {
10
- "type": "string"
10
+ "type": "string",
11
+ "pattern": "^\\d+(?:[wdhms](?:\\d+[wdhms])*)?$"
11
12
  },
12
13
  "limit": {
13
14
  "type": "integer",
@@ -4,7 +4,8 @@
4
4
  "type": "object",
5
5
  "properties": {
6
6
  "time_filter": {
7
- "type": "string"
7
+ "type": "string",
8
+ "pattern": "^\\d+(?:[wdhms](?:\\d+[wdhms])*)?$"
8
9
  },
9
10
  "limit": {
10
11
  "type": "integer",
@@ -7,7 +7,8 @@
7
7
  "type": "string"
8
8
  },
9
9
  "time_filter": {
10
- "type": "string"
10
+ "type": "string",
11
+ "pattern": "^\\d+(?:[wdhms](?:\\d+[wdhms])*)?$"
11
12
  },
12
13
  "limit": {
13
14
  "type": "integer",
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "list_config_templates",
4
+ "type": "object",
5
+ "properties": {},
6
+ "additionalProperties": false
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "list_voucher_batches",
4
+ "type": "object",
5
+ "properties": {},
6
+ "additionalProperties": false
7
+ }
@@ -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
- "description": "Tunnel IP to assign the client, e.g. '10.20.0.50'"
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", "address", "endpoint", "allowed_ips", "keepalive"],
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
+ }
@@ -5,6 +5,7 @@
5
5
  "properties": {
6
6
  "name": {
7
7
  "type": "string",
8
+ "pattern": "^[A-Za-z0-9][\\w.-]{0,40}$",
8
9
  "description": "The feed id used when subscribing"
9
10
  }
10
11
  },
@@ -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
+ }
@@ -5,6 +5,7 @@
5
5
  "properties": {
6
6
  "user": {
7
7
  "type": "string",
8
+ "minLength": 1,
8
9
  "description": "The user label used at onboarding"
9
10
  }
10
11
  },
@@ -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
+ }
@@ -7,7 +7,8 @@
7
7
  "type": "string"
8
8
  },
9
9
  "time_filter": {
10
- "type": "string"
10
+ "type": "string",
11
+ "pattern": "^\\d+(?:[wdhms](?:\\d+[wdhms])*)?$"
11
12
  },
12
13
  "case_sensitive": {
13
14
  "default": false,
@@ -5,6 +5,7 @@
5
5
  "properties": {
6
6
  "name": {
7
7
  "type": "string",
8
+ "pattern": "^[A-Za-z0-9][\\w.-]{0,40}$",
8
9
  "description": "Short feed id, e.g. 'spamhaus-drop'"
9
10
  },
10
11
  "url": {
@@ -5,7 +5,7 @@
5
5
  "properties": {
6
6
  "channel": {
7
7
  "type": "string",
8
- "enum": ["slack", "discord", "ntfy", "webhook", "mcp"],
8
+ "enum": ["slack", "discord", "ntfy", "telegram", "email", "webhook", "mcp"],
9
9
  "description": "Which configured channel to test."
10
10
  }
11
11
  },
@@ -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,7 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "unprotect_hotspot_login",
4
+ "type": "object",
5
+ "properties": {},
6
+ "additionalProperties": false
7
+ }
@@ -16,7 +16,7 @@
16
16
  "type": "array",
17
17
  "items": {
18
18
  "type": "string",
19
- "enum": ["slack", "discord", "ntfy", "webhook", "mcp"]
19
+ "enum": ["slack", "discord", "ntfy", "telegram", "email", "webhook", "mcp"]
20
20
  }
21
21
  },
22
22
  "severity": {
@@ -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
+ }
@@ -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\nEnvironment=MIKROTIK_LOG_LEVEL=warn\n\n[Install]\nWantedBy=default.target\n`;
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.replace("/", "%2f")}/latest`,
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
  }),