@usex/mikrotik-mcp 6.0.0 → 6.1.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.
@@ -14845,13 +14845,13 @@ async function undoMigration(id, confirm, selected) {
14845
14845
  throw new Error("Undo lost Safe Mode or exceeded its time budget.");
14846
14846
  await checkedRead(item.undo, createContext(undefined, device));
14847
14847
  }
14848
- const beforeTarget = (await import("./library-8mh5hjvp.js")).openSnapshotStore;
14849
- const db = await beforeTarget((await import("./library-h50w7j79.js")).DEFAULT_SNAPSHOT_DB);
14848
+ const beforeTarget = (await import("./library-ph2n6fjm.js")).openSnapshotStore;
14849
+ const db = await beforeTarget((await import("./library-53nrt1xj.js")).DEFAULT_SNAPSHOT_DB);
14850
14850
  try {
14851
14851
  const original = db.get(p.snapshots.target);
14852
14852
  if (!original)
14853
14853
  throw new Error("Original target snapshot unavailable.");
14854
- const { normalizeExport } = await import("./library-m19hkdpp.js");
14854
+ const { normalizeExport } = await import("./library-039808cq.js");
14855
14855
  if (normalizeExport((await migrationInventory(device)).export) !== normalizeExport(original.body))
14856
14856
  throw new Error("Target differs from its backup. Undo verification failed.");
14857
14857
  } finally {
@@ -26675,8 +26675,29 @@ function orMatch(field, values, op = "~") {
26675
26675
  return `(${terms.join(" or ")})`;
26676
26676
  }
26677
26677
  // src/utils/redact-secrets.ts
26678
- var SENSITIVE_KEYS = ["password", "shared-secret", "secret"];
26679
- var REDACT_RE = new RegExp(`(?<![\\w-])(${SENSITIVE_KEYS.join("|")})="[^"]*"`, "g");
26678
+ var SENSITIVE_KEYS = [
26679
+ "password",
26680
+ "shared-secret",
26681
+ "secret",
26682
+ "passphrase",
26683
+ "wpa-pre-shared-key",
26684
+ "wpa2-pre-shared-key",
26685
+ "private-pre-shared-key",
26686
+ "management-protection-key",
26687
+ "nv2-preshared-key",
26688
+ "mschapv2-password",
26689
+ "static-key-0",
26690
+ "static-key-1",
26691
+ "static-key-2",
26692
+ "static-key-3",
26693
+ "eap-password",
26694
+ "ft-rrb-key",
26695
+ "key0",
26696
+ "key1",
26697
+ "key2",
26698
+ "key3"
26699
+ ];
26700
+ var REDACT_RE = new RegExp(`(?<![\\w-])(${SENSITIVE_KEYS.join("|")})=(?:"(?:\\\\[\\s\\S]|[^"\\\\])*"|[^\\s"]+)`, "g");
26680
26701
  function redactSecrets(text) {
26681
26702
  return text.replace(REDACT_RE, '$1="***"');
26682
26703
  }
@@ -27154,7 +27175,7 @@ var cache3 = null;
27154
27175
  async function gateway() {
27155
27176
  if (cache3)
27156
27177
  return cache3;
27157
- const { moduleCatalog } = await import("./library-gpedv6x6.js");
27178
+ const { moduleCatalog } = await import("./library-7nnp4ntt.js");
27158
27179
  const forIndex = [];
27159
27180
  const byName = new Map;
27160
27181
  for (const mod of moduleCatalog) {
@@ -49639,7 +49660,7 @@ var riskByTool = null;
49639
49660
  async function riskIndex() {
49640
49661
  if (riskByTool)
49641
49662
  return riskByTool;
49642
- const { moduleCatalog } = await import("./library-gpedv6x6.js");
49663
+ const { moduleCatalog } = await import("./library-7nnp4ntt.js");
49643
49664
  const index = new Map;
49644
49665
  for (const mod of moduleCatalog) {
49645
49666
  for (const tool of mod.tools)
@@ -57593,10 +57614,6 @@ ${doomed}`;
57593
57614
 
57594
57615
  // src/tools/wireless.ts
57595
57616
  var V7_WIFI = ["/interface wifi", "/interface wifiwave2"];
57596
- function commandUnsupported2(result) {
57597
- const t = result.toLowerCase();
57598
- return t.includes("bad command name") || t.includes("failure:") || t.includes("no such command prefix") || t.includes("invalid command name");
57599
- }
57600
57617
  async function detectWirelessInterfaceType(ctx) {
57601
57618
  ctx.info("Detecting wireless interface type");
57602
57619
  const interfaceTypes = [
@@ -57605,15 +57622,22 @@ async function detectWirelessInterfaceType(ctx) {
57605
57622
  "/interface wireless",
57606
57623
  "/interface wlan"
57607
57624
  ];
57625
+ let supportedPath = null;
57608
57626
  for (const interfaceType of interfaceTypes) {
57609
57627
  const result = await executeMikrotikCommand2(`${interfaceType} print count-only`, ctx);
57610
- if (result && !commandUnsupported2(result)) {
57628
+ if (commandUnsupported(result))
57629
+ continue;
57630
+ if (!/^\d+$/.test(result.trim())) {
57631
+ throw new Error(`Failed to detect wireless support: ${redactSecrets(result) || "empty response"}`);
57632
+ }
57633
+ supportedPath ??= interfaceType;
57634
+ if (Number(result.trim()) > 0) {
57611
57635
  ctx.info(`Detected wireless interface type: ${interfaceType}`);
57612
57636
  return interfaceType;
57613
57637
  }
57614
57638
  }
57615
57639
  ctx.info("No wireless interface type detected");
57616
- return null;
57640
+ return supportedPath;
57617
57641
  }
57618
57642
  var wirelessTools = [
57619
57643
  defineTool2({
@@ -57697,7 +57721,7 @@ ${details}`;
57697
57721
  name: "list_wireless_interfaces",
57698
57722
  title: "List Wireless Interfaces",
57699
57723
  annotations: READ,
57700
- description: "Lists all wireless interfaces (`/interface wifi`, `/interface wifiwave2`, `/interface wireless`, `/interface wlan`) \u2014 probes every supported command path and aggregates results. " + "Filters by name_filter (substring match), disabled_only, or running_only. " + "For full property detail on a single interface use get_wireless_interface; to see currently connected clients use get_wireless_registration_table. " + "Falls back to `/interface print` with debugging info when no wireless interfaces match, to help identify the correct path on the device.",
57724
+ description: "Lists all wireless interfaces (`/interface wifi`, `/interface wifiwave2`, `/interface wireless`, `/interface wlan`) \u2014 probes every supported command path and aggregates results. " + "Returns detail including SSID, security/authentication types and configured channel settings, with secrets redacted. " + "Filters by name_filter (RouterOS regular expression), disabled_only, or running_only. " + "Configured frequencies are NOT proof of the current operating channel; use get_wireless_interface_status. " + "For full property detail on a single interface use get_wireless_interface; to see currently connected clients use get_wireless_registration_table. " + "Falls back to `/interface print` with debugging info when no wireless interfaces match, to help identify the correct path on the device.",
57701
57725
  inputSchema: {
57702
57726
  name_filter: string().optional(),
57703
57727
  disabled_only: boolean().default(false),
@@ -57716,19 +57740,23 @@ ${details}`;
57716
57740
  for (const interfaceType of interfaceTypesToTry) {
57717
57741
  const filters = [];
57718
57742
  if (a.name_filter)
57719
- filters.push(`name~"${a.name_filter}"`);
57743
+ filters.push(`name~${quoteValue(a.name_filter)}`);
57720
57744
  if (a.disabled_only)
57721
57745
  filters.push("disabled=yes");
57722
57746
  if (a.running_only)
57723
57747
  filters.push("running=yes");
57724
- let cmd = `${interfaceType} print`;
57748
+ const cmd = new Cmd(`${interfaceType} print detail`);
57725
57749
  if (filters.length)
57726
- cmd += ` where ${filters.join(" and ")}`;
57727
- const result = await executeMikrotikCommand2(cmd, ctx);
57728
- if (result && result.trim() !== "" && !commandUnsupported2(result)) {
57750
+ cmd.raw(`where ${filters.join(" and ")}`);
57751
+ const result = await executeMikrotikCommand2(cmd.build(), ctx);
57752
+ if (commandUnsupported(result))
57753
+ continue;
57754
+ if (looksLikeError(result))
57755
+ return `Failed to list wireless interfaces: ${redactSecrets(result)}`;
57756
+ if (!isEmpty(result)) {
57729
57757
  workingTypes.push(interfaceType);
57730
57758
  allResults.push(`=== ${interfaceType.toUpperCase()} ===
57731
- ${result}`);
57759
+ ${redactSecrets(result)}`);
57732
57760
  }
57733
57761
  }
57734
57762
  if (allResults.length) {
@@ -57754,19 +57782,54 @@ NOTE: If you see wireless interfaces above, they might be using a different comm
57754
57782
  name: "get_wireless_interface",
57755
57783
  title: "Get Wireless Interface Details",
57756
57784
  annotations: READ,
57757
- description: "Retrieves the full detail of one named wireless interface (`<auto-detected path> print detail where name=...`), " + "probing `/interface wifi`, `/interface wifiwave2`, `/interface wireless`, and `/interface wlan` in order. " + "Use when you need all properties of a single interface; for a summary of all interfaces use list_wireless_interfaces. " + "Returns the complete property set for the named interface, or an error if not found.",
57758
- inputSchema: { name: string() },
57785
+ description: "Retrieves the full detail of one named wireless interface (`<auto-detected path> print detail where name=...`), " + "probing `/interface wifi`, `/interface wifiwave2`, `/interface wireless`, and `/interface wlan` in order. " + "Use to inspect SSID, security.authentication-types (allowed WPA2/WPA3 methods), profile references, country and channel settings. " + "On modern Wi-Fi since RouterOS 7.15 print detail includes inherited values; on older releases also read actual-configuration. " + "Allowed authentication types do not prove which method a client negotiated; missing values do not prove an open network. " + "For the ACTUAL operating channel use get_wireless_interface_status, not the configured frequency list. Secrets are redacted.",
57786
+ inputSchema: { name: string().trim().min(1) },
57759
57787
  async handler(a, ctx) {
57760
57788
  ctx.info(`Getting wireless interface details: name=${a.name}`);
57761
57789
  const interfaceType = await detectWirelessInterfaceType(ctx);
57762
57790
  if (!interfaceType)
57763
57791
  return "Error: No wireless interface support detected on this device.";
57764
- const result = await executeMikrotikCommand2(`${interfaceType} print detail where name="${a.name}"`, ctx);
57792
+ const result = await executeMikrotikCommand2(new Cmd(`${interfaceType} print detail`).raw("where").set("name", a.name).build(), ctx);
57793
+ if (looksLikeError(result))
57794
+ return `Failed to read wireless interface: ${redactSecrets(result)}`;
57765
57795
  if (isEmpty(result))
57766
57796
  return `Wireless interface '${a.name}' not found.`;
57797
+ let details = redactSecrets(result);
57798
+ if (V7_WIFI.includes(interfaceType)) {
57799
+ const inherited = await executeMikrotikCommand2(new Cmd(`${interfaceType} actual-configuration print detail`).raw("where").set("name", a.name).build(), ctx);
57800
+ if (!commandUnsupported(inherited)) {
57801
+ if (looksLikeError(inherited))
57802
+ return `Failed to read effective Wi-Fi configuration: ${redactSecrets(inherited)}`;
57803
+ if (!isEmpty(inherited))
57804
+ details += `
57805
+
57806
+ ACTUAL CONFIGURATION (older RouterOS):
57807
+ ${redactSecrets(inherited)}`;
57808
+ }
57809
+ }
57767
57810
  return `WIRELESS INTERFACE DETAILS:
57768
57811
 
57769
- ${result}`;
57812
+ ${details}
57813
+
57814
+ Configured frequencies are allowed choices, not the actual operating channel. Use get_wireless_interface_status for runtime evidence.`;
57815
+ }
57816
+ }),
57817
+ defineTool2({
57818
+ name: "get_wireless_interface_status",
57819
+ title: "Get Actual Wi-Fi Channel and Runtime Status",
57820
+ annotations: READ,
57821
+ description: "Reads one non-disruptive runtime snapshot (`<auto-detected Wi-Fi path> monitor <interface> once`). " + "Supports modern /interface wifi, older wifiwave2 and legacy wireless. Returns actual channel/frequency/width, " + "state and radio statistics when reported by the driver; disabled/inactive radios may not have a current channel. " + "Does NOT scan, disconnect clients or change settings. Pair with get_wireless_interface and get_wireless_security_profile " + "for SSID and configured WPA2/WPA3 security; never invent unavailable runtime fields.",
57822
+ inputSchema: { interface: string().trim().min(1) },
57823
+ async handler(a, ctx) {
57824
+ const path = await detectWirelessInterfaceType(ctx);
57825
+ if (!path)
57826
+ return "Error: No wireless interface support detected on this device.";
57827
+ const result = await executeMikrotikCommand2(new Cmd(`${path} monitor`).raw(quoteValue(a.interface)).raw("once").build(), ctx);
57828
+ if (looksLikeError(result) || isEmpty(result))
57829
+ return `Failed to read Wi-Fi runtime status: ${redactSecrets(result) || "empty response"}`;
57830
+ return `WI-FI RUNTIME STATUS (${path}):
57831
+
57832
+ ${redactSecrets(result)}`;
57770
57833
  }
57771
57834
  }),
57772
57835
  defineTool2({
@@ -57826,23 +57889,50 @@ ${result}`;
57826
57889
  defineTool2({
57827
57890
  name: "scan_wireless_networks",
57828
57891
  title: "Scan for Nearby Wireless Networks",
57829
- annotations: READ,
57830
- description: "Scans for visible nearby wireless networks/SSIDs/APs in range (`<auto-detected path> scan <interface> duration=<n>`). " + "Use to discover external networks \u2014 not to list connected clients. " + "For currently associated client stations use get_wireless_registration_table instead. " + "`interface` is the local wireless interface name to scan from (e.g. `wlan1`); `duration` is scan time in seconds (default 5). " + "Returns raw scan output from the device.",
57892
+ annotations: WRITE,
57893
+ description: "Scans for visible nearby wireless networks/SSIDs/APs in range (`<auto-detected path> scan <interface> duration=<n>`). " + "DISRUPTIVE: scanning can temporarily disconnect clients. Requires explicit user approval (confirm=true). " + "Use to discover external networks \u2014 not to list connected clients or read the actual channel without disruption. " + "For non-disruptive current-channel evidence use get_wireless_interface_status; for modern RF channel load use scan_wifi_channels. " + "For currently associated client stations use get_wireless_registration_table instead. " + "`interface` is the local wireless interface name to scan from (e.g. `wlan1`); `duration` is scan time in seconds (default 5). " + "Returns raw scan output from the device.",
57831
57894
  inputSchema: {
57832
- interface: string(),
57833
- duration: number().int().default(5)
57895
+ interface: string().trim().min(1),
57896
+ duration: number().int().min(1).max(30).default(5),
57897
+ confirm: boolean().default(false).describe("Explicit user approval for a scan that can disconnect Wi-Fi clients.")
57834
57898
  },
57835
57899
  async handler(a, ctx) {
57900
+ if (!a.confirm)
57901
+ return "Error: Wireless scan can disconnect clients. Obtain explicit user approval and set confirm=true; use get_wireless_interface_status for a non-disruptive read.";
57836
57902
  ctx.info(`Scanning wireless networks on interface: ${a.interface}`);
57837
57903
  const interfaceType = await detectWirelessInterfaceType(ctx);
57838
57904
  if (!interfaceType)
57839
57905
  return "Error: No wireless interface support detected on this device.";
57840
- const scanCmd = new Cmd(`${interfaceType} scan`).raw(quoteValue(a.interface)).set("duration", a.duration).build();
57906
+ const scanCmd = new Cmd(`${interfaceType} scan`).raw(quoteValue(a.interface)).set("duration", `${a.duration}s`).build();
57841
57907
  const result = await executeMikrotikCommand2(scanCmd, ctx);
57842
57908
  if (looksLikeError(result))
57843
57909
  return `Failed to scan wireless networks: ${result}`;
57844
57910
  return `WIRELESS NETWORK SCAN RESULTS:
57845
57911
 
57912
+ ${result}`;
57913
+ }
57914
+ }),
57915
+ defineTool2({
57916
+ name: "scan_wifi_channels",
57917
+ title: "Survey Modern Wi-Fi Channel Load (Disruptive)",
57918
+ annotations: WRITE,
57919
+ description: "Runs a bounded /interface wifi (or wifiwave2) frequency-scan to measure channel load, networks, noise floor and signal levels. " + "Modern Wi-Fi equivalent of a legacy frequency survey, NOT /interface wireless frequency-monitor. " + "DISCONNECTS associated clients/station during the scan; obtain explicit user approval and set confirm=true. " + "Never use during a strictly read-only/non-disruptive audit; get_wireless_interface_status reads the current channel safely. " + "Does not auto-tune or modify configuration; frequency-scan availability depends on RouterOS/driver.",
57920
+ inputSchema: {
57921
+ interface: string().trim().min(1),
57922
+ duration: number().int().min(1).max(30).default(5),
57923
+ confirm: boolean().default(false).describe("Explicit user approval to temporarily disconnect Wi-Fi clients.")
57924
+ },
57925
+ async handler(a, ctx) {
57926
+ if (!a.confirm)
57927
+ return "Error: Frequency scan disconnects clients. Obtain explicit user approval and set confirm=true.";
57928
+ const path = await detectWirelessInterfaceType(ctx);
57929
+ if (!path || !V7_WIFI.includes(path))
57930
+ return "Error: Modern Wi-Fi frequency-scan is unavailable; this tool requires /interface wifi or /interface wifiwave2.";
57931
+ const result = await executeMikrotikCommand2(new Cmd(`${path} frequency-scan`).raw(quoteValue(a.interface)).set("duration", `${a.duration}s`).build(), ctx);
57932
+ if (looksLikeError(result) || isEmpty(result))
57933
+ return `Failed to survey Wi-Fi channels: ${result || "empty response"}`;
57934
+ return `WI-FI CHANNEL SURVEY (${path}):
57935
+
57846
57936
  ${result}`;
57847
57937
  }
57848
57938
  }),
@@ -57859,15 +57949,17 @@ ${result}`;
57859
57949
  const interfaceType = await detectWirelessInterfaceType(ctx);
57860
57950
  if (!interfaceType)
57861
57951
  return "Error: No wireless interface support detected on this device.";
57862
- let cmd = `${interfaceType} registration-table print`;
57952
+ const cmd = new Cmd(`${interfaceType} registration-table print detail`);
57863
57953
  if (a.interface)
57864
- cmd += ` where interface="${a.interface}"`;
57865
- const result = await executeMikrotikCommand2(cmd, ctx);
57954
+ cmd.raw("where").set("interface", a.interface);
57955
+ const result = await executeMikrotikCommand2(cmd.build(), ctx);
57956
+ if (looksLikeError(result))
57957
+ return `Failed to read wireless clients: ${redactSecrets(result)}`;
57866
57958
  if (isEmpty(result))
57867
57959
  return "No wireless clients registered.";
57868
57960
  return `WIRELESS REGISTRATION TABLE:
57869
57961
 
57870
- ${result}`;
57962
+ ${redactSecrets(result)}`;
57871
57963
  }
57872
57964
  }),
57873
57965
  defineTool2({
@@ -57895,9 +57987,9 @@ ${interfaceResult}
57895
57987
  Detected Wireless Interface Type: ${wirelessType || "None detected"}
57896
57988
 
57897
57989
  Compatibility Notes:
57898
- - RouterOS v7.x uses '/interface wifi' (newest system)
57899
- - RouterOS v7.x also supports '/interface wifiwave2' (alternative)
57900
- - RouterOS v6.x uses '/interface wireless' (legacy system)
57990
+ - RouterOS v7.13+ modern drivers use '/interface wifi'
57991
+ - Earlier modern drivers use '/interface wifiwave2'
57992
+ - Legacy drivers use '/interface wireless' on RouterOS v6 OR v7
57901
57993
  - Older versions may use '/interface wlan'
57902
57994
 
57903
57995
  USAGE EXAMPLES:
@@ -57911,74 +58003,76 @@ For legacy systems:
57911
58003
  }),
57912
58004
  defineTool2({
57913
58005
  name: "create_wireless_security_profile",
57914
- title: "Create Wireless Security Profile (Legacy v6 Only \u2014 Not Implemented)",
58006
+ title: "Create Wireless Security Profile (Not Implemented)",
57915
58007
  annotations: WRITE,
57916
- description: "Stub for creating a `/interface wireless security-profiles` entry \u2014 a RouterOS v6 concept that does not exist in v7. " + "On RouterOS v7 devices (`/interface wifi` or `/interface wifiwave2`) always returns a not-supported message; security is configured directly on the interface. " + "On v6 this is also not implemented and returns an error. " + "For v6 interface creation with a security profile use create_wireless_interface (security_profile arg); for v7, security is configured directly on the interface but is not exposed by this server's wireless tools.",
58008
+ description: "Not implemented: creating modern wifi/wifiwave2 security or legacy wireless security-profiles presets. " + "For read-only security inspection use list_wireless_security_profiles, get_wireless_security_profile and get_wireless_interface.",
57917
58009
  inputSchema: { name: string() },
57918
- async handler(_a, ctx) {
57919
- const interfaceType = await detectWirelessInterfaceType(ctx);
57920
- if (interfaceType && V7_WIFI.includes(interfaceType)) {
57921
- return "Security profiles are not used in RouterOS v7.x. Configure security directly on the wireless interface.";
57922
- }
57923
- return "Legacy security profile creation not implemented in this version.";
58010
+ async handler() {
58011
+ return "Error: Security profile creation is not implemented. Use list_wireless_security_profiles or get_wireless_security_profile for read-only inspection.";
57924
58012
  }
57925
58013
  }),
57926
58014
  defineTool2({
57927
58015
  name: "list_wireless_security_profiles",
57928
- title: "List Wireless Security Profiles (Legacy v6 Only \u2014 Not Implemented)",
58016
+ title: "List Wi-Fi Security Profiles (Modern and Legacy)",
57929
58017
  annotations: READ,
57930
- description: "Stub for listing `/interface wireless security-profiles` entries \u2014 a RouterOS v6 concept that does not exist in v7. " + "On RouterOS v7 devices always returns a not-supported message; on v6 also not implemented. " + "To inspect current wireless interface configuration (including security) use list_wireless_interfaces or get_wireless_interface instead.",
58018
+ description: "Reads modern /interface wifi security (or wifiwave2 security) and legacy /interface wireless security-profiles, auto-detected. " + "Returns authentication-types (allowed WPA2/WPA3 methods), ciphers, management protection, WPS and EAP settings where available. " + "Passwords, passphrases and pre-shared keys are redacted. Profiles are presets, not proof of effective interface settings; " + "pair with get_wireless_interface to see assigned profiles and overrides. Does not modify the router.",
57931
58019
  async handler(_a, ctx) {
57932
58020
  const interfaceType = await detectWirelessInterfaceType(ctx);
57933
- if (interfaceType && V7_WIFI.includes(interfaceType)) {
57934
- return "Security profiles are not used in RouterOS v7.x. Security is configured directly on wireless interfaces.";
57935
- }
57936
- return "Legacy security profile listing not implemented in this version.";
58021
+ if (!interfaceType)
58022
+ return "Error: No wireless interface support detected on this device.";
58023
+ const menu = V7_WIFI.includes(interfaceType) ? "security" : "security-profiles";
58024
+ const result = await executeMikrotikCommand2(new Cmd(`${interfaceType} ${menu} print detail`).build(), ctx);
58025
+ if (looksLikeError(result))
58026
+ return `Failed to list Wi-Fi security profiles: ${redactSecrets(result)}`;
58027
+ if (isEmpty(result))
58028
+ return "No Wi-Fi security profiles configured. Security may be set directly on an interface.";
58029
+ return `WI-FI SECURITY PROFILES (${interfaceType}):
58030
+
58031
+ ${redactSecrets(result)}`;
57937
58032
  }
57938
58033
  }),
57939
58034
  defineTool2({
57940
58035
  name: "get_wireless_security_profile",
57941
- title: "Get Wireless Security Profile (Legacy v6 Only \u2014 Not Implemented)",
58036
+ title: "Get Wi-Fi Security Profile (Modern and Legacy)",
57942
58037
  annotations: READ,
57943
- description: "Stub for retrieving a named `/interface wireless security-profiles` entry \u2014 a RouterOS v6 concept that does not exist in v7. " + "On RouterOS v7 devices always returns a not-supported message; on v6 also not implemented. " + "Use get_wireless_interface to inspect the security settings on a v7 wireless interface instead.",
57944
- inputSchema: { name: string() },
57945
- async handler(_a, ctx) {
58038
+ description: "Reads one named modern wifi/wifiwave2 security profile or legacy wireless security-profiles entry. " + "Shows configured WPA2/WPA3 authentication methods, encryption, WPS and management protection where available; secrets are redacted. " + "Use the profile name returned by list_wireless_security_profiles or get_wireless_interface. " + "An interface override takes precedence over a profile; missing authentication fields do not prove an open network.",
58039
+ inputSchema: { name: string().trim().min(1) },
58040
+ async handler(a, ctx) {
57946
58041
  const interfaceType = await detectWirelessInterfaceType(ctx);
57947
- if (interfaceType && V7_WIFI.includes(interfaceType)) {
57948
- return "Security profiles are not used in RouterOS v7.x. Check security configuration on wireless interfaces directly.";
57949
- }
57950
- return "Legacy security profile details not implemented in this version.";
58042
+ if (!interfaceType)
58043
+ return "Error: No wireless interface support detected on this device.";
58044
+ const menu = V7_WIFI.includes(interfaceType) ? "security" : "security-profiles";
58045
+ const result = await executeMikrotikCommand2(new Cmd(`${interfaceType} ${menu} print detail`).raw("where").set("name", a.name).build(), ctx);
58046
+ if (looksLikeError(result))
58047
+ return `Failed to read Wi-Fi security profile: ${redactSecrets(result)}`;
58048
+ if (isEmpty(result))
58049
+ return `Wi-Fi security profile '${a.name}' not found.`;
58050
+ return `WI-FI SECURITY PROFILE (${interfaceType}):
58051
+
58052
+ ${redactSecrets(result)}`;
57951
58053
  }
57952
58054
  }),
57953
58055
  defineTool2({
57954
58056
  name: "remove_wireless_security_profile",
57955
- title: "Remove Wireless Security Profile (Legacy v6 Only \u2014 Not Implemented)",
58057
+ title: "Remove Wireless Security Profile (Not Implemented)",
57956
58058
  annotations: DESTRUCTIVE,
57957
- description: "Stub for deleting a named `/interface wireless security-profiles` entry \u2014 a RouterOS v6 concept that does not exist in v7. " + "On RouterOS v7 devices always returns a not-supported message; on v6 also not implemented. " + "To delete a wireless interface entirely use remove_wireless_interface; to change security settings use update_wireless_interface.",
58059
+ description: "Not implemented: deleting modern wifi/wifiwave2 security or legacy wireless security-profiles presets. " + "Use list_wireless_security_profiles or get_wireless_security_profile for read-only inspection.",
57958
58060
  inputSchema: { name: string() },
57959
- async handler(_a, ctx) {
57960
- const interfaceType = await detectWirelessInterfaceType(ctx);
57961
- if (interfaceType && V7_WIFI.includes(interfaceType)) {
57962
- return "Security profiles are not used in RouterOS v7.x. Security is configured directly on wireless interfaces.";
57963
- }
57964
- return "Legacy security profile removal not implemented in this version.";
58061
+ async handler() {
58062
+ return "Error: Security profile removal is not implemented. Use get_wireless_security_profile for read-only inspection.";
57965
58063
  }
57966
58064
  }),
57967
58065
  defineTool2({
57968
58066
  name: "set_wireless_security_profile",
57969
- title: "Assign Security Profile to Wireless Interface (Legacy v6 Only \u2014 Not Implemented)",
58067
+ title: "Assign Security Profile to Wireless Interface (Not Implemented)",
57970
58068
  annotations: WRITE,
57971
- description: "Stub for assigning a named security profile to a v6 `/interface wireless` interface \u2014 a RouterOS v6 concept that does not exist in v7. " + "On RouterOS v7 devices always returns a not-supported message because security is set directly on the interface. " + "On v6 also not implemented. " + "To update a wireless interface's settings on supported versions use update_wireless_interface.",
58069
+ description: "Not implemented: assigning a modern wifi/wifiwave2 security profile. " + "For legacy wireless only, update_wireless_interface supports security_profile. " + "Use get_wireless_interface and get_wireless_security_profile to inspect settings without changes.",
57972
58070
  inputSchema: {
57973
58071
  interface_name: string(),
57974
58072
  security_profile: string()
57975
58073
  },
57976
- async handler(_a, ctx) {
57977
- const interfaceType = await detectWirelessInterfaceType(ctx);
57978
- if (interfaceType && V7_WIFI.includes(interfaceType)) {
57979
- return "Security profiles are not used in RouterOS v7.x. Configure security directly on the wireless interface.";
57980
- }
57981
- return "Legacy security profile setting not implemented in this version.";
58074
+ async handler() {
58075
+ return "Error: Security profile assignment is not implemented here. Legacy wireless supports update_wireless_interface(security_profile=...); modern security is read-only in these tools.";
57982
58076
  }
57983
58077
  }),
57984
58078
  defineTool2({
@@ -58093,7 +58187,7 @@ ${details}`;
58093
58187
  const filter = a.search ? ` where name~${quoteValue(a.search)}` : "";
58094
58188
  for (const path of countryPaths) {
58095
58189
  const result = await executeMikrotikCommand2(`${path} country print${filter}`, ctx);
58096
- if (result && !commandUnsupported2(result) && !looksLikeError(result)) {
58190
+ if (result && !commandUnsupported(result) && !looksLikeError(result)) {
58097
58191
  if (isEmpty(result))
58098
58192
  continue;
58099
58193
  return `WI-FI REGULATORY COUNTRIES:
@@ -58125,7 +58219,7 @@ var wifiOptimizerTools = [
58125
58219
  name: "tune_wifi_channel",
58126
58220
  title: "Survey & Tune Wi-Fi Channel",
58127
58221
  annotations: WRITE,
58128
- description: "Runs an RF survey on a wireless radio (`/interface wireless frequency-monitor`, blocking for " + "`duration`), finds the least-congested channel, and reports a before/after. DEFAULTS TO A DRY " + "RUN (`apply=false`) \u2014 it surveys and recommends; set `apply=true` to set the radio to the best " + "frequency (`/interface wireless set`). Targets the LEGACY wireless stack; for wifiwave2 " + "(`/interface wifi`) tune via those tools. Returns the per-channel usage finding and the chosen " + "frequency.",
58222
+ description: "Runs an RF survey on a wireless radio (`/interface wireless frequency-monitor`, blocking for " + "`duration`), finds the least-congested channel, and reports a before/after. DEFAULTS TO A DRY " + "RUN (`apply=false`) \u2014 it surveys and recommends; set `apply=true` to set the radio to the best " + "frequency (`/interface wireless set`). Targets ONLY the LEGACY wireless stack, including legacy drivers on v7; " + "for modern wifi/wifiwave2 use get_wireless_interface_status for a non-disruptive current-channel read or " + "scan_wifi_channels for an explicitly approved, disruptive channel-load survey (no auto-tuning). Returns the per-channel usage finding and the chosen " + "frequency.",
58129
58223
  inputSchema: {
58130
58224
  interface: string().describe("Wireless interface, e.g. 'wlan1'"),
58131
58225
  duration: string().default("5").describe("Survey duration in seconds"),
@@ -59486,7 +59580,7 @@ var moduleCatalog2 = [
59486
59580
  label: "Wireless",
59487
59581
  slug: "wireless",
59488
59582
  group: "Interfaces",
59489
- description: "Wireless interfaces, security profiles and access lists (legacy + wifiwave2).",
59583
+ description: "Wi-Fi SSID/security profiles, non-disruptive runtime channel monitoring and approved RF surveys (wifi, wifiwave2 and legacy wireless). Legacy access-list tools are stubs.",
59490
59584
  tools: wirelessTools
59491
59585
  },
59492
59586
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usex/mikrotik-mcp",
3
- "version": "6.0.0",
3
+ "version": "6.1.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",
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 961 tools: `name`, `risk`, `title`, `description`, and input JSON Schema. |
10
+ | `tool-catalog.json` | Every one of the 963 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:
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "format": 1,
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "modules": [
5
5
  {
6
6
  "slug": "client-check",
@@ -267,16 +267,18 @@
267
267
  "slug": "wireless",
268
268
  "label": "Wireless",
269
269
  "group": "Interfaces",
270
- "description": "Wireless interfaces, security profiles and access lists (legacy + wifiwave2).",
270
+ "description": "Wi-Fi SSID/security profiles, non-disruptive runtime channel monitoring and approved RF surveys (wifi, wifiwave2 and legacy wireless). Legacy access-list tools are stubs.",
271
271
  "alwaysOn": false,
272
272
  "tools": [
273
273
  "create_wireless_interface",
274
274
  "list_wireless_interfaces",
275
275
  "get_wireless_interface",
276
+ "get_wireless_interface_status",
276
277
  "remove_wireless_interface",
277
278
  "enable_wireless_interface",
278
279
  "disable_wireless_interface",
279
280
  "scan_wireless_networks",
281
+ "scan_wifi_channels",
280
282
  "get_wireless_registration_table",
281
283
  "check_wireless_support",
282
284
  "create_wireless_security_profile",
@@ -3136,6 +3138,18 @@
3136
3138
  "automatic": true
3137
3139
  }
3138
3140
  },
3141
+ {
3142
+ "name": "get_wireless_interface_status",
3143
+ "module": "wireless",
3144
+ "group": "Interfaces",
3145
+ "noDevice": false,
3146
+ "requires": null,
3147
+ "ui": {
3148
+ "resourceUri": "ui://mikrotik/records.html?v=2",
3149
+ "visibility": ["model", "app"],
3150
+ "automatic": true
3151
+ }
3152
+ },
3139
3153
  {
3140
3154
  "name": "remove_wireless_interface",
3141
3155
  "module": "wireless",
@@ -3168,6 +3182,14 @@
3168
3182
  "requires": null,
3169
3183
  "ui": null
3170
3184
  },
3185
+ {
3186
+ "name": "scan_wifi_channels",
3187
+ "module": "wireless",
3188
+ "group": "Interfaces",
3189
+ "noDevice": false,
3190
+ "requires": null,
3191
+ "ui": null
3192
+ },
3171
3193
  {
3172
3194
  "name": "get_wireless_registration_table",
3173
3195
  "module": "wireless",