@usex/mikrotik-mcp 5.1.0 → 5.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usex/mikrotik-mcp",
3
- "version": "5.1.0",
3
+ "version": "5.3.0",
4
4
  "description": "MCP server for MikroTik RouterOS — 780+ tools over SSH for firewall, NAT, routing, DHCP, DNS, WireGuard, wireless, QoS and more.",
5
5
  "keywords": [
6
6
  "ai",
@@ -74,6 +74,7 @@
74
74
  "prepublish:security": "npm run security:all",
75
75
  "test": "vp test run",
76
76
  "test:watch": "vp test",
77
+ "test:coverage": "vp test --ui --coverage --watch",
77
78
  "release": "release-it",
78
79
  "test:types": "tsc --noEmit",
79
80
  "check": "vp check",
@@ -100,10 +101,12 @@
100
101
  "@types/bun": "latest",
101
102
  "@types/figlet": "^1.7.0",
102
103
  "@types/node": "^26.1.2",
103
- "@types/react": "^19.2.17",
104
- "@types/react-dom": "^19.2.3",
104
+ "@types/react": "^19.2.18",
105
+ "@types/react-dom": "^19.2.4",
105
106
  "@types/ssh2": "^1.15.5",
106
107
  "@types/update-notifier": "^6.0.8",
108
+ "@vitest/coverage-v8": "4.1.10",
109
+ "@vitest/ui": "4.1.10",
107
110
  "bunup": "^0.16.32",
108
111
  "class-variance-authority": "^0.7.1",
109
112
  "clsx": "^2.1.1",
@@ -114,7 +117,7 @@
114
117
  "react": "^19.2.8",
115
118
  "react-dom": "^19.2.8",
116
119
  "recharts": "^3.10.1",
117
- "release-it": "^21.0.0",
120
+ "release-it": "^21.0.1",
118
121
  "sonner": "^2.0.7",
119
122
  "tailwind-merge": "^3.6.0",
120
123
  "tailwindcss": "^4.3.3",
@@ -47,8 +47,20 @@ identical on both ends):
47
47
  accepted from {{peer_address}} on the input chain, and add a NAT _bypass_
48
48
  (accept/no-nat) rule so {{local_subnet}}→{{remote_subnet}} traffic is NOT
49
49
  masqueraded. Apply firewall edits under `enable_safe_mode`.
50
- 7. **Verify** — `get_ipsec_active_peers` and `get_ipsec_installed_sa` to confirm
51
- the tunnel established; `ping` a remote host with src-address in {{local_subnet}}.
50
+ 7. **MTU / MSS** — policy-mode IPsec has no interface whose MTU you can lower, so
51
+ MSS clamping is the _only_ lever, and skipping it is the classic "tunnel is up
52
+ but large transfers hang" failure. ESP tunnel mode costs ~73 bytes (more with
53
+ NAT-T/UDP-4500). Add `create_mangle_rule`: `chain=forward`, `protocol=tcp`,
54
+ `tcp_flags=syn`, `tcp_mss=1400-65535`, `action=change-mss`,
55
+ `new_mss=clamp-to-pmtu` — or a fixed `new_mss=1360` when the path MTU is known
56
+ and PMTU discovery is unreliable. Endpoints size their MSS from their own LAN
57
+ MTU and set DF; without the clamp those packets are dropped in transit and the
58
+ ICMP "fragmentation needed" is usually filtered, so the sender never learns.
59
+ 8. **Verify** — `get_ipsec_active_peers` and `get_ipsec_installed_sa` to confirm
60
+ the tunnel established; `ping` a remote host with src-address in
61
+ {{local_subnet}}. Then repeat with size 1400 and `do-not-fragment` — small
62
+ pings passing while large ones fail means the MSS clamp in step 7 is missing or
63
+ not matching.
52
64
 
53
65
  Present the matching parameter set for the remote engineer and the exact tool
54
66
  calls before applying. Never echo the pre-shared key back in plaintext beyond
@@ -33,7 +33,19 @@ Build order:
33
33
  4. **Enable the server** — `set_l2tp_server` with `enabled=true`,
34
34
  `default_profile=l2tp-profile`, `use_ipsec=required`, and a strong
35
35
  `ipsec_secret` (this is the IPsec pre-shared key clients enter).
36
- `authentication=mschap2`.
36
+ `authentication=mschap2`. Also set on the same call:
37
+ - `max_mtu`/`max_mru` = **1400** (L2TP + IPsec ESP overhead easily exceeds
38
+ 100 bytes; leaving 1450 causes the "connects fine, transfers stall" symptom),
39
+ - `keepalive_timeout` = **30** — dead client sessions otherwise linger and hold
40
+ their pool address until the default timeout expires.
41
+
42
+ The `change_tcp_mss=yes` set on the profile in step 2 makes MSS follow the
43
+ negotiated MTU automatically — that is the PPP-family equivalent of a
44
+ `change-mss` mangle rule, and it is why L2TP does not need one. If clients
45
+ still stall on large transfers, add the mangle rule anyway
46
+ (`create_mangle_rule`: `chain=forward`, `protocol=tcp`, `tcp_flags=syn`,
47
+ `tcp_mss=1400-65535`, `action=change-mss`, `new_mss=clamp-to-pmtu`).
48
+
37
49
  5. **Firewall** — accept UDP 500, UDP 4500, UDP 1701, and IP protocol 50 (ESP)
38
50
  on the input chain from the internet; allow the {{vpn_pool}} range to reach the
39
51
  LAN/internet in the forward chain as required. Apply under `enable_safe_mode`,
@@ -123,11 +123,14 @@ Per side, under Safe Mode (`enable_safe_mode` `device=<name>` → edits → veri
123
123
  WireGuard adds ~60 bytes of overhead. Small pings work but large flows (TLS, file
124
124
  transfer) stall if MTU is wrong:
125
125
 
126
- - Set the wg interface MTU to **1420** (1412 if the WAN is PPPoE) via
126
+ - Set the wg interface MTU to **1420** (1412 if the WAN is PPPoE, 1280 if the path
127
+ is unknown/multi-hop — 1280 is the always-safe floor) via
127
128
  `update_wireguard_interface`.
128
- - Clamp TCP MSS on the `forward` chain (`create_filter_rule` mangle
129
- `action=change-mss new-mss=clamp-to-pmtu tcp-flags=syn`) or set it per the
130
- interface MTU, so TCP sessions negotiate a size that fits.
129
+ - Clamp TCP MSS with `create_mangle_rule` (**not** `create_filter_rule` — only the
130
+ mangle table has `change-mss`): `chain=forward`, `protocol=tcp`,
131
+ `tcp_flags=syn`, `tcp_mss=1400-65535`, `action=change-mss`,
132
+ `new_mss=clamp-to-pmtu`. WireGuard has no per-interface MSS option, so this
133
+ mangle rule is the only place to fix MSS.
131
134
 
132
135
  ## 8. Verify end to end
133
136
 
@@ -42,5 +42,26 @@ Steps:
42
42
  5. **Client config** — call `generate_wireguard_client_config` with the server
43
43
  public key, {{endpoint}}, the listen port, and the assigned client address, and
44
44
  present the resulting `[Interface]/[Peer]` config for the user to import.
45
+ 6. **Keepalive** — set `persistent_keepalive` to `25` on every peer
46
+ (`add_wireguard_peer`/`update_wireguard_peer`) and `client_keepalive=25s` in the
47
+ generated client config. Roaming clients sit behind NAT; a UDP mapping typically
48
+ expires after ~30 s of silence, after which the server cannot reach the client
49
+ until the client speaks first. 25 s keeps the mapping alive.
50
+ 7. **MTU / MSS** — the step most WireGuard deployments skip, and the reason a VPN
51
+ "works" for logins but stalls on file transfers, photo/video uploads and some
52
+ web pages:
53
+ - WireGuard adds ~60 bytes. Set the interface MTU to **1420**
54
+ (`update_wireguard_interface`); use **1412** on a PPPoE WAN, or **1280** when
55
+ the path is unknown — 1280 always fits.
56
+ - MTU alone is not enough. Endpoints derive their TCP MSS from _their own_ NIC
57
+ MTU, so a 1460-byte-MSS session still emits oversized packets with DF set;
58
+ mid-path routers drop rather than fragment and the ICMP "fragmentation needed"
59
+ is often filtered — a PMTU black hole. Clamp it with `create_mangle_rule`:
60
+ `chain=forward`, `protocol=tcp`, `tcp_flags=syn`, `tcp_mss=1400-65535`,
61
+ `action=change-mss`, `new_mss=clamp-to-pmtu`. WireGuard has no per-interface
62
+ MSS setting, so mangle is the only place this can be fixed.
63
+ - Verify: `ping` a host across the tunnel with size 1400 and `do-not-fragment`.
64
+ Small pings succeeding while this fails is the black-hole signature.
45
65
 
46
- Report the server public key, the peer you added, and the full client config.
66
+ Report the server public key, the peer you added, the MTU/MSS/keepalive values
67
+ applied, and the full client config.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "version": "5.1.0",
3
+ "version": "5.3.0",
4
4
  "generated": "by scripts/gen-schemas.ts — do not edit by hand",
5
5
  "toolCount": 885,
6
6
  "tools": [
@@ -24868,7 +24868,7 @@
24868
24868
  "idempotentHint": true,
24869
24869
  "openWorldHint": false
24870
24870
  },
24871
- "description": "Autonomously investigate a network problem across all diagnostic dimensions: connectivity (ping), interface state & error counters, routing table & BGP/OSPF neighbors, firewall rules & hit counters, NAT & connection tracking, ARP/DHCP state, DNS resolution, CPU/memory pressure, system logs, and VPN tunnel state. Correlates the evidence to deliver ranked root-cause hypotheses with confidence levels, plain-language explanations, and exact RouterOS fix commands. Pass an IP address, hostname, or symptom description as the target. For hop-by-hop path analysis use `trace_path`; for log-specific investigation use `correlate_events`; for fix commands only use `suggest_fix`.",
24871
+ "description": "Autonomously investigate a network problem across all diagnostic dimensions: connectivity (ping), interface state & error counters, routing table & BGP/OSPF neighbors, firewall rules & hit counters, NAT & connection tracking, ARP/DHCP state, DNS resolution, CPU/memory pressure, system logs, and VPN tunnel state — including the tunnel MTU / TCP-MSS-clamp / WireGuard-keepalive checks that catch a PMTU black hole (tunnel pings fine but large transfers, uploads and some HTTPS hang). Correlates the evidence to deliver ranked root-cause hypotheses with confidence levels, plain-language explanations, and exact RouterOS fix commands. Pass an IP address, hostname, or symptom description as the target. For hop-by-hop path analysis use `trace_path`; for log-specific investigation use `correlate_events`; for fix commands only use `suggest_fix`.",
24872
24872
  "inputSchema": {
24873
24873
  "$schema": "https://json-schema.org/draft/2020-12/schema",
24874
24874
  "type": "object",