@usex/mikrotik-mcp 4.7.0 → 4.9.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 (45) hide show
  1. package/README.md +35 -28
  2. package/dist/cli.js +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/shared/{cli-38m6waxx.js → cli-s2s6hryh.js} +4689 -3226
  5. package/dist/shared/{cli-jd7xqp2f.js → cli-xfa5x65h.js} +1 -1
  6. package/dist/shared/{library-31wz8hdh.js → library-6zh75zhp.js} +1 -1
  7. package/dist/shared/{library-fs4nps73.js → library-wm3vc8kq.js} +4689 -3226
  8. package/package.json +1 -1
  9. package/prompts/security-hardening-sweep.md +132 -0
  10. package/prompts/setup-eoip-tunnel-between-sites.md +119 -0
  11. package/prompts/setup-gre-tunnel-between-sites.md +163 -0
  12. package/prompts/setup-ipip-tunnel-between-sites.md +110 -0
  13. package/prompts/setup-openvpn-tunnel-between-sites.md +136 -0
  14. package/prompts/setup-sstp-tunnel-between-sites.md +136 -0
  15. package/prompts/setup-tunnel-between-sites.md +55 -8
  16. package/prompts/setup-v2ray-container-proxy.md +203 -0
  17. package/prompts/setup-vxlan-tunnel-between-sites.md +129 -0
  18. package/prompts/setup-wireguard-tunnel-between-sites.md +183 -0
  19. package/schemas/README.md +1 -1
  20. package/schemas/tool-catalog.json +658 -2
  21. package/schemas/tools/add_firewall_default_deny.json +25 -0
  22. package/schemas/tools/apply_security_hardening_fixes.json +25 -0
  23. package/schemas/tools/audit_account_hygiene.json +7 -0
  24. package/schemas/tools/audit_address_list_enforcement.json +7 -0
  25. package/schemas/tools/audit_certificate_hygiene.json +7 -0
  26. package/schemas/tools/audit_connection_tracking_helpers.json +7 -0
  27. package/schemas/tools/audit_dns_resolver_exposure.json +7 -0
  28. package/schemas/tools/audit_firewall_default_deny.json +7 -0
  29. package/schemas/tools/audit_ip_service_exposure.json +7 -0
  30. package/schemas/tools/audit_ipv6_firewall_baseline.json +7 -0
  31. package/schemas/tools/audit_kernel_ip_hardening.json +7 -0
  32. package/schemas/tools/audit_management_plane_exposure.json +7 -0
  33. package/schemas/tools/audit_network_segmentation.json +7 -0
  34. package/schemas/tools/audit_ssh_hardening.json +7 -0
  35. package/schemas/tools/bootstrap_ipv6_firewall_baseline.json +25 -0
  36. package/schemas/tools/enforce_address_list_blocking.json +25 -0
  37. package/schemas/tools/fix_certificate_crl_policy.json +25 -0
  38. package/schemas/tools/fix_password_policy.json +25 -0
  39. package/schemas/tools/harden_connection_tracking_helpers.json +25 -0
  40. package/schemas/tools/harden_dns_resolver_exposure.json +25 -0
  41. package/schemas/tools/harden_ip_service_exposure.json +25 -0
  42. package/schemas/tools/harden_kernel_ip_settings.json +25 -0
  43. package/schemas/tools/harden_management_plane_exposure.json +25 -0
  44. package/schemas/tools/harden_ssh_service.json +25 -0
  45. package/schemas/tools/run_security_hardening_audit.json +29 -0
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: setup-vxlan-tunnel-between-sites
3
+ title: Build a VXLAN overlay between two (or more) MikroTik devices
4
+ description: Configure a VXLAN L2 overlay across MikroTik routers — VNI, VTEP peering, bridging, MTU — for multi-site / multi-tenant L2. Honest about RouterOS VTEP tooling limits; recommends EoIP for a simple two-site link.
5
+ arguments:
6
+ - name: device_a
7
+ description: First configured device (config key or label from list_mikrotik_devices), e.g. site-a.
8
+ required: false
9
+ - name: device_b
10
+ description: Second configured device, e.g. site-b.
11
+ required: false
12
+ - name: vni
13
+ description: VXLAN Network Identifier (VNI, 1–16777215). MUST match on every VTEP in this overlay. Omit to let you pick one.
14
+ required: false
15
+ - name: port
16
+ description: VXLAN UDP port. Default 8472 (Linux/MikroTik); 4789 is the IANA standard. Pick one that suits the path.
17
+ required: false
18
+ ---
19
+
20
+ You are building a **VXLAN Layer-2 overlay across MikroTik routers** this server can
21
+ reach. VXLAN encapsulates Ethernet in **UDP** and identifies each virtual segment by
22
+ a 24-bit **VNI**, so it scales to millions of segments and — unlike EoIP — is
23
+ naturally **multipoint** (three+ sites on one overlay) and firewall-friendly (it's
24
+ just UDP). Two honest caveats up front, state them to the user:
25
+
26
+ 1. **For a simple TWO-site L2 link, EoIP is usually the better fit** (fewer moving
27
+ parts, built-in keepalive + IPsec option). Use VXLAN when you need **multipoint**
28
+ or many segments. If the user only wants two sites bridged, recommend
29
+ `setup-eoip-tunnel-between-sites` unless they specifically want VXLAN.
30
+ 2. **RouterOS unicast VXLAN needs per-peer VTEP entries** (`/interface vxlan vteps`).
31
+ This MCP's `create_vxlan_tunnel` builds the VXLAN interface and its options but
32
+ does **not** expose a dedicated add-VTEP tool. So for static-unicast peering you
33
+ will add the remote VTEPs with the raw command tool (`run_routeros_command` /
34
+ the raw-command escape hatch) — call this out and get approval, or use a
35
+ **multicast** group for flood/learn if the WAN path carries multicast (rare across
36
+ the internet).
37
+
38
+ Drive each device via the `device` argument. Confirm the plan before any change.
39
+
40
+ Device A: {{device_a}}
41
+ Device B: {{device_b}}
42
+ VNI: {{vni}}
43
+ UDP port: {{port}}
44
+
45
+ ## 0. Discover and confirm (FIRST)
46
+
47
+ - `list_mikrotik_devices`; resolve the endpoints — never substitute a similar name;
48
+ ask which devices if omitted. VXLAN can span more than two, so ask for the full
49
+ VTEP list if it's a multipoint overlay.
50
+ - Because VXLAN is UDP, each VTEP just needs to reach the others' public IP on the
51
+ chosen `port` — NAT-friendly (unlike GRE/EoIP protocol 47). Note each site's
52
+ reachable source IP (the local VTEP address).
53
+ - **L2 safety:** as with EoIP, VXLAN stretches a broadcast domain — decide the single
54
+ DHCP authority, enable STP, and warn about loops before bridging.
55
+
56
+ ## 1. Facts (read-only, per device)
57
+
58
+ Per side (`device=<name>`): `get_system_identity`, `list_interfaces`,
59
+ `list_ip_addresses`, `get_routing_table`, `get_ip_cloud`. Record each VTEP's source
60
+ IP/interface, WAN MTU, target bridge, and the segment to carry.
61
+
62
+ ## 2. Plan
63
+
64
+ Pick `vni`={{vni}} (identical on every VTEP), `port`={{port}} or 8472, and the local
65
+ source address/interface for each VTEP. Confirm interface names (`vxlan<vni>`) and
66
+ the peer VTEP IP list with the user.
67
+
68
+ ## 3. Create the VXLAN interface (each device)
69
+
70
+ On each device: `create_vxlan_tunnel` — `name`=`vxlan{{vni}}`, `vni`={{vni}},
71
+ `port`={{port}}, `local_address`=this site's VTEP source IP (or `interface`=source
72
+ interface), `mtu` per step 6. (`vteps_ip_version` if you're doing IPv6 VTEPs.)
73
+
74
+ ## 4. Peer the VTEPs (the multipoint step)
75
+
76
+ For **static unicast** (internet-friendly): on each device add every OTHER site's
77
+ VTEP as a remote VTEP under this VXLAN interface. Since there's no dedicated tool,
78
+ use the raw-command tool with the user's approval, e.g.
79
+ `/interface vxlan vteps add interface=vxlan{{vni}} remote-ip=<peer VTEP IP>` — repeat
80
+ for each peer, on each device (full mesh). For **multicast** flood/learn instead,
81
+ set the multicast group on the interface (only viable if the path carries multicast).
82
+
83
+ ## 5. Bridge the overlay (L2 step)
84
+
85
+ Add the VXLAN interface as a **bridge port** on the LAN bridge that owns the segment,
86
+ on every site. Enable **STP/RSTP**. Do not put an IP on the VXLAN interface (it's a
87
+ bridge member). One DHCP authority for the stretched segment.
88
+
89
+ ## 6. MTU / MSS (VXLAN eats 50 bytes)
90
+
91
+ VXLAN adds a **50-byte** header (UDP+VXLAN+inner-Ethernet). If the WAN MTU is 1500,
92
+ either raise the underlay MTU/L2MTU to ~1550 (if the path supports jumbo) or lower
93
+ the guests' effective MTU / clamp MSS so encapsulated frames don't fragment. This is
94
+ the #1 VXLAN gotcha — verify with a large-frame test.
95
+
96
+ ## 7. Firewall — safely, per device
97
+
98
+ Per side under Safe Mode: `input` accept `protocol=udp dst-port={{port}}` (or 8472)
99
+ from each peer VTEP IP. Bridged traffic is `forward` (allow if `use-ip-firewall`).
100
+ VXLAN has **no built-in encryption** — if the underlay is untrusted, run VXLAN over
101
+ an IPsec transport policy (protect UDP/{{port}} between the VTEPs) or inside another
102
+ encrypted tunnel; call this out.
103
+
104
+ ## 8. Verify
105
+
106
+ - `get_vxlan_tunnel` each device: interface up, VNI/port correct, VTEP peers present.
107
+ - L2 proof: a host at one site ARP-resolves and `ping`s a host at another **in the
108
+ same subnet**, no router hop; DHCP from the designated server reaches all sites.
109
+ - Large-frame test to confirm MTU (step 6).
110
+
111
+ ## Bypassing country / DPI restrictions (legitimate circumvention)
112
+
113
+ Lawful privacy/accessibility only. VXLAN is plain UDP on a fixed port, so:
114
+
115
+ 1. **Move `port` to a common UDP port** (e.g. 443) so it blends with QUIC-like
116
+ traffic; update every VTEP to match.
117
+ 2. **Encrypt the underlay** (IPsec transport for UDP/{{port}}), both to protect and
118
+ to ride ESP/4500 where raw UDP is inspected.
119
+ 3. If VXLAN itself is blocked, **carry the bridge over OpenVPN-TAP/443** (L2, HTTPS-
120
+ like — see `setup-openvpn-tunnel-between-sites`).
121
+ 4. Advanced obfuscation (XRay/Reality, sing-box, obfs4) via `/container` — not native.
122
+ Never present obfuscation as a guarantee.
123
+
124
+ ---
125
+
126
+ Report per device: VXLAN interface, VNI, port, local VTEP IP, peer VTEP list, bridge
127
+ joined, STP status, MTU/MSS, and verification results — noting any raw-command steps
128
+ used for VTEP peering. State which device each change ran on. Never apply changes the
129
+ user hasn't approved.
@@ -0,0 +1,183 @@
1
+ ---
2
+ name: setup-wireguard-tunnel-between-sites
3
+ title: Build a WireGuard tunnel between two MikroTik devices
4
+ description: Configure BOTH routers of a WireGuard site-to-site tunnel from one conversation — keys, peers, addressing, routes, firewall, MTU/MSS — then verify end to end. Includes DPI-resistant / censorship-bypass transport options.
5
+ arguments:
6
+ - name: device_a
7
+ description: First configured device (config key or label from list_mikrotik_devices), e.g. site-a.
8
+ required: false
9
+ - name: device_b
10
+ description: Second configured device, e.g. site-b.
11
+ required: false
12
+ - name: tunnel_subnet
13
+ description: Small transit subnet for the tunnel link itself in CIDR, e.g. 10.255.255.0/30 (A=.1, B=.2). Omit to let you pick one that doesn't collide with either LAN.
14
+ required: false
15
+ - name: listen_port
16
+ description: UDP port WireGuard listens on. Default 13231. Consider 443/53/500 to survive restrictive networks (see the bypass section).
17
+ required: false
18
+ ---
19
+
20
+ You are building a **WireGuard site-to-site tunnel between two MikroTik routers**
21
+ this server can both reach. WireGuard is the right default for MikroTik↔MikroTik:
22
+ modern crypto (Curve25519 / ChaCha20-Poly1305), stateless, tiny, and roams across
23
+ IP changes. You will drive **both** routers in one flow via the `device` argument.
24
+ Precision matters — a single mismatched key, allowed-address, or MTU silently
25
+ breaks the tunnel. Confirm the plan before any change; never write without approval.
26
+
27
+ Device A: {{device_a}}
28
+ Device B: {{device_b}}
29
+ Transit subnet: {{tunnel_subnet}}
30
+ Listen port: {{listen_port}}
31
+
32
+ ## 0. Discover and confirm both endpoints (do this FIRST)
33
+
34
+ - Call `list_mikrotik_devices` to enumerate the configured routers (key, label,
35
+ transport target, default).
36
+ - Resolve `{{device_a}}` / `{{device_b}}` against that inventory. If either is
37
+ missing or ambiguous, STOP and show the list — never substitute a similar name
38
+ (these are different physical routers). If either was omitted, ask the user which
39
+ two devices to connect.
40
+ - Only one of the two ends needs a reachable public endpoint. Determine which side
41
+ is publicly reachable (static WAN IP or DDNS) — that side is the **responder**;
42
+ the other becomes the **initiator** and uses `persistent-keepalive` to hold the
43
+ path open through NAT. If **both** are behind NAT with no port-forward, say so:
44
+ a plain WireGuard tunnel can't form — you'd need a relay/VPS or a reachable side.
45
+
46
+ ## 1. Gather the facts (read-only, per device)
47
+
48
+ For each of {{device_a}} and {{device_b}}, with `device=<name>`:
49
+ `get_system_identity`, `list_interfaces`, `list_ip_addresses`, `get_routing_table`,
50
+ and `get_ip_cloud` (for a DDNS name if there's no static WAN). Record each side's:
51
+ public/WAN address (or DDNS), the WAN interface and its MTU, and the **LAN
52
+ subnet(s)** to route. Verify the two LANs do **not overlap** — if they do, WireGuard
53
+ allowed-address routing is ambiguous and you must NAT one side or renumber; flag it.
54
+
55
+ ## 2. Pick non-colliding addressing
56
+
57
+ - Transit subnet: `{{tunnel_subnet}}` or a /30 that collides with neither LAN
58
+ (e.g. `10.255.255.0/30`). A=`.1`, B=`.2`.
59
+ - Confirm the plan back to the user: interface names (`wg-<peer>`), listen ports,
60
+ transit IPs, and which LAN each side will advertise.
61
+
62
+ ## 3. Create the WireGuard interfaces and exchange keys
63
+
64
+ - On EACH side: `create_wireguard_interface` (`device=<name>`, name e.g.
65
+ `wg-{{device_b}}` on A and `wg-{{device_a}}` on B, `listen_port`={{listen_port}}
66
+ or 13231). RouterOS auto-generates the private key and derives the public key.
67
+ - Read each side's **public key** with `get_wireguard_interface` (`device=<name>`).
68
+ You will cross-feed these: A's peer uses **B's** public key and vice-versa. Never
69
+ transmit or log the private keys — they never leave their router.
70
+ - `add_ip_address` the transit IP on each wg interface (A: `10.255.255.1/30` on
71
+ `wg-...`; B: `10.255.255.2/30`).
72
+
73
+ ## 4. Add the peers (the exact, symmetric part)
74
+
75
+ On **A** (`device={{device_a}}`): `add_wireguard_peer`
76
+
77
+ - `interface` = A's wg interface
78
+ - `public_key` = **B's** public key
79
+ - `allowed_address` = the transit peer + **B's LAN(s)**, e.g.
80
+ `10.255.255.2/32,192.168.20.0/24` (comma-separated; this is WireGuard's crypto-
81
+ routing table — it must list every subnet you expect to reach through B)
82
+ - `endpoint_address` = B's public IP/DDNS, `endpoint_port` = B's listen port
83
+ (set these on whichever side is the initiator; the responder can omit them)
84
+ - `persistent_keepalive` = `25` on the side behind NAT (the initiator) so the
85
+ mapping stays open
86
+ - optional `preshared_key` = the SAME 32-byte PSK on both peers for an extra
87
+ symmetric layer (post-quantum-ish defense-in-depth; must match exactly).
88
+
89
+ On **B** (`device={{device_b}}`): mirror it — `public_key` = **A's**,
90
+ `allowed_address` = `10.255.255.1/32,<A's LAN>`, endpoint pointing at A **only if**
91
+ A is the reachable side.
92
+
93
+ ## 5. Route each far LAN over the tunnel
94
+
95
+ `allowed-address` governs what WireGuard will _cryptographically_ accept, but you
96
+ still need an IP route so RouterOS _sends_ far-LAN traffic into the interface:
97
+
98
+ - On A: `add_route` (`device={{device_a}}`) `dst-address=<B's LAN>`,
99
+ `gateway=<A's wg interface>`.
100
+ - On B: mirror with A's LAN.
101
+ (The transit /30 already has a connected route from step 3.)
102
+
103
+ ## 6. Firewall — safely, per device
104
+
105
+ Per side, under Safe Mode (`enable_safe_mode` `device=<name>` → edits → verify →
106
+ `commit_safe_mode`; Safe Mode is per-device so each commits independently):
107
+
108
+ - `input` chain: accept `protocol=udp dst-port=<listen_port>` from the far side's
109
+ WAN (or from any, if the endpoint is dynamic) — place it **above** any default
110
+ drop.
111
+ - `forward` chain: accept traffic between the two LANs in both directions; if there
112
+ is a default-deny, add explicit accepts for `src`/`dst` of each LAN over the wg
113
+ interface.
114
+ - Do NOT masquerade the tunnel subnet unless you deliberately want NAT (it breaks
115
+ return routing for site-to-site).
116
+
117
+ ## 7. MTU / MSS (the silent-failure trap)
118
+
119
+ WireGuard adds ~60 bytes of overhead. Small pings work but large flows (TLS, file
120
+ transfer) stall if MTU is wrong:
121
+
122
+ - Set the wg interface MTU to **1420** (1412 if the WAN is PPPoE) via
123
+ `update_wireguard_interface`.
124
+ - Clamp TCP MSS on the `forward` chain (`create_filter_rule` mangle
125
+ `action=change-mss new-mss=clamp-to-pmtu tcp-flags=syn`) or set it per the
126
+ interface MTU, so TCP sessions negotiate a size that fits.
127
+
128
+ ## 8. Verify end to end
129
+
130
+ - From A (`ping` `device={{device_a}}`): ping B's transit IP (`10.255.255.2`), then
131
+ a host in B's LAN with `src_address` = A's LAN IP. Repeat from B.
132
+ - `list_wireguard_peers` / `get_wireguard_status` on each side: confirm a recent
133
+ **last-handshake** and rx/tx counters climbing. No handshake ⇒ firewall/endpoint/
134
+ key/allowed-address mismatch — check in that order.
135
+ - Large-payload test: ping with size 1400 and `do-not-fragment`; if it fails,
136
+ revisit MTU/MSS (step 7).
137
+
138
+ ## Bypassing country / DPI restrictions (legitimate censorship circumvention)
139
+
140
+ Some networks block or throttle VPNs. The following are for lawful privacy /
141
+ accessibility on links you're authorized to use — comply with local law and any
142
+ service terms. From least to most evasive:
143
+
144
+ 1. **Port camouflage.** Move `listen_port` to a port that's rarely filtered:
145
+ `443` (HTTPS/QUIC), `53` (DNS), `123` (NTP), or `500`. UDP/443 often survives
146
+ because it looks like QUIC. Cheapest change; update the peer `endpoint_port` on
147
+ the other side to match. _Caveat: this hides the port, not the handshake._
148
+ 2. **DPI fingerprinting reality.** WireGuard's first handshake message has a fixed,
149
+ recognizable shape, so deep-packet-inspection can block it regardless of port.
150
+ RouterOS has **no native WireGuard obfuscation** (no obfs4/wstunnel/Shadowsocks/
151
+ XRay). To defeat DPI you must wrap the tunnel in something that looks benign:
152
+ 3. **Wrap WireGuard inside a TLS-looking tunnel.** Bring up an **SSTP** tunnel
153
+ (PPP-over-TLS on **TCP 443** — indistinguishable from HTTPS to most DPI) between
154
+ the sites with `create_sstp_client`/the SSTP server tools, then either route the
155
+ far LANs directly over SSTP, or run the WireGuard endpoint _across_ the SSTP link
156
+ so the WG handshake never touches the open internet. **OpenVPN in TCP/443 mode**
157
+ (`create_ovpn_client`, `tls`) is an equivalent camouflage. This trades throughput
158
+ (TCP-in-TCP) for reachability.
159
+ 4. **IPsec IKEv2 as an alternative fingerprint.** If WireGuard specifically is
160
+ blocked, an IKEv2 tunnel over **UDP 4500 (NAT-T)** presents a different signature
161
+ and is often allowed; use the `setup-ipsec-site-to-site` flow. GRE-over-IPsec
162
+ (`ipsec_secret`) rides ESP and is another option.
163
+ 5. **Advanced obfuscation via a RouterOS container.** For hostile DPI (active
164
+ probing, protocol allow-lists), the strong tools — **XRay/VLESS+Reality,
165
+ sing-box, Shadowsocks, obfs4** — aren't native. Run one in a RouterOS
166
+ **`/container`** (or on a VPS you control) and route the site tunnel through it;
167
+ WireGuard then rides an already-obfuscated transport. Call this out as the
168
+ heavier, most robust option and confirm the device has container support and
169
+ spare resources before proposing it.
170
+ 6. **Keepalive + MTU hygiene under hostile networks.** Keep `persistent-keepalive`
171
+ low (15–25 s) so aggressive NATs don't reap the mapping, and set MTU
172
+ conservatively (fragmentation-sensitive DPI drops oversized handshakes).
173
+
174
+ Recommend the lightest option that works for the user's threat model (start at #1,
175
+ escalate to #3, reserve #5 for active blocking), explain the throughput/complexity
176
+ trade-off, and never present obfuscation as a guarantee — it is an arms race.
177
+
178
+ ---
179
+
180
+ Report, per side: interface name, public key (never the private key), listen port,
181
+ transit IP, peer allowed-address, routes and firewall rules added, the MTU/MSS
182
+ settings, and the verification results (handshake time, ping). State plainly which
183
+ device each change ran on. Never apply changes the user hasn't approved.
package/schemas/README.md CHANGED
@@ -7,7 +7,7 @@ edit by hand — regenerate instead.
7
7
  | File | Contents |
8
8
  |------|----------|
9
9
  | `config.schema.json` | The runtime configuration object (env vars / CLI flags). |
10
- | `tool-catalog.json` | Every one of the 794 tools: `name`, `risk`, `title`, `description`, and input JSON Schema. |
10
+ | `tool-catalog.json` | Every one of the 819 tools: `name`, `risk`, `title`, `description`, and input JSON Schema. |
11
11
  | `tools/<name>.json` | The input JSON Schema for a single tool. |
12
12
 
13
13
  `risk` is derived from the MCP tool annotations: