@usex/mikrotik-mcp 3.8.0 → 3.9.1

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 CHANGED
@@ -12753,10 +12753,15 @@ ${result}`;
12753
12753
  },
12754
12754
  async handler(a, ctx) {
12755
12755
  ctx.info("Configuring OpenVPN server");
12756
- const cmd = new Cmd("/interface ovpn-server server set").bool("enabled", a.enabled).opt("certificate", a.certificate).opt("auth", a.auth).opt("cipher", a.cipher).opt("netmask", a.netmask).opt("mode", a.mode).opt("port", a.port).opt("protocol", a.protocol).opt("default-profile", a.default_profile).bool("require-client-certificate", a.require_client_certificate).opt("max-mtu", a.max_mtu).build();
12756
+ const params = () => new Cmd("/interface ovpn-server server set").opt("certificate", a.certificate).opt("auth", a.auth).opt("cipher", a.cipher).opt("netmask", a.netmask).opt("mode", a.mode).opt("port", a.port).opt("protocol", a.protocol).opt("default-profile", a.default_profile).bool("require-client-certificate", a.require_client_certificate).opt("max-mtu", a.max_mtu);
12757
+ const cmd = params().bool("disabled", a.enabled === undefined ? undefined : !a.enabled).build();
12757
12758
  if (cmd === "/interface ovpn-server server set")
12758
12759
  return "No updates specified.";
12759
- const result = await executeMikrotikCommand(cmd, ctx);
12760
+ let result = await executeMikrotikCommand(cmd, ctx);
12761
+ if (a.enabled !== undefined && containsRawParserError(result)) {
12762
+ const legacy = params().bool("enabled", a.enabled).build();
12763
+ result = await executeMikrotikCommand(legacy, ctx);
12764
+ }
12760
12765
  if (looksLikeError(result))
12761
12766
  return `Failed to configure OpenVPN server: ${result}`;
12762
12767
  const details = await executeMikrotikCommand("/interface ovpn-server server print", ctx);
@@ -20038,7 +20043,7 @@ ${details}` : "WireGuard interface created successfully.";
20038
20043
  name: "list_wireguard_interfaces",
20039
20044
  title: "List WireGuard Interfaces",
20040
20045
  annotations: READ,
20041
- description: "Lists WireGuard tunnel interfaces (`/interface wireguard print`). Returns each interface's" + " name, listen-port, public-key, MTU, and running/disabled status." + " Supports filtering by name substring (name_filter), disabled-only, or running-only." + " For the peer table use list_wireguard_peers." + " Use the name from this output with get_wireguard_interface or update_wireguard_interface.",
20046
+ description: "`list_wireguard_interfaces` \u2014 READ / list / show / inspect all WireGuard tunnel interfaces" + " (`/interface wireguard print`). The go-to tool to read the current WireGuard state on a" + " device. Returns each interface's name, listen-port, public-key, MTU, and running/disabled" + " status. Filter by name substring (name_filter), disabled-only, or running-only." + " For one interface's full detail use get_wireguard_interface; for the peer table use" + " list_wireguard_peers; for interfaces AND peers in one call use get_wireguard_status.",
20042
20047
  inputSchema: {
20043
20048
  name_filter: z108.string().optional(),
20044
20049
  disabled_only: z108.boolean().default(false),
@@ -20063,7 +20068,7 @@ ${result}`;
20063
20068
  name: "get_wireguard_interface",
20064
20069
  title: "Get WireGuard Interface Details",
20065
20070
  annotations: READ,
20066
- description: "Retrieves full detail of a single WireGuard tunnel interface (`/interface wireguard print detail`)" + " looked up by name. Returns listen-port, private-key, public-key, MTU, running state, and comment." + " For the peer table use get_wireguard_peer." + " Use list_wireguard_interfaces to discover available interface names.",
20071
+ description: "`get_wireguard_interface` \u2014 READ / get / show the full detail of ONE WireGuard tunnel interface" + " (`/interface wireguard print detail`) looked up by name. Returns listen-port, private-key," + " public-key, MTU, running state, and comment. To list all interfaces use" + " list_wireguard_interfaces; for that interface's peers use list_wireguard_peers; for" + " interfaces AND peers in one call use get_wireguard_status.",
20067
20072
  inputSchema: { name: z108.string() },
20068
20073
  async handler(a, ctx) {
20069
20074
  ctx.info(`Getting WireGuard interface details: name=${a.name}`);
@@ -20073,6 +20078,31 @@ ${result}`;
20073
20078
  ${result}`;
20074
20079
  }
20075
20080
  }),
20081
+ defineTool({
20082
+ name: "get_wireguard_status",
20083
+ title: "Get WireGuard Status (Interfaces + Peers)",
20084
+ annotations: READ,
20085
+ description: "`get_wireguard_status` \u2014 READ the current WireGuard state on a device in ONE call: ALL tunnel" + " interfaces AND ALL peers together. Use this FIRST to inspect / show / check WireGuard before" + " changing anything (e.g. to read public keys, see which side initiates, or confirm the tunnel" + " is up). Interfaces report name, listen-port, public-key, MTU and running state; peers report" + " .id, interface, public-key, allowed-address, endpoint/current-endpoint, last-handshake time" + " and rx/tx bytes. Combines list_wireguard_interfaces + list_wireguard_peers; optionally filter" + " both to one interface with interface_filter.",
20086
+ inputSchema: {
20087
+ interface_filter: z108.string().optional().describe("Limit to one interface name, e.g. 'wg-mesh'")
20088
+ },
20089
+ async handler(a, ctx) {
20090
+ ctx.info("Reading WireGuard status (interfaces + peers)");
20091
+ const ifFilters = a.interface_filter ? [`name="${a.interface_filter}"`] : [];
20092
+ const peerFilters = a.interface_filter ? [`interface="${a.interface_filter}"`] : [];
20093
+ const interfaces = await executeMikrotikCommand(`/interface wireguard print${whereClause(ifFilters)}`, ctx);
20094
+ const peers = await executeMikrotikCommand(`/interface wireguard peers print${whereClause(peerFilters)}`, ctx);
20095
+ const ifBlock = isEmpty(interfaces) ? "(none)" : interfaces;
20096
+ const peerBlock = isEmpty(peers) ? "(none)" : peers;
20097
+ return `WIREGUARD INTERFACES:
20098
+
20099
+ ${ifBlock}
20100
+
20101
+ WIREGUARD PEERS:
20102
+
20103
+ ${peerBlock}`;
20104
+ }
20105
+ }),
20076
20106
  defineTool({
20077
20107
  name: "update_wireguard_interface",
20078
20108
  title: "Update WireGuard Interface",
@@ -20185,7 +20215,7 @@ ${details}` : "WireGuard peer added successfully.";
20185
20215
  name: "list_wireguard_peers",
20186
20216
  title: "List WireGuard Peers",
20187
20217
  annotations: READ,
20188
- description: "Lists all WireGuard peer entries (`/interface wireguard peers print`)." + " Returns each peer's .id, interface, public-key, allowed-address, endpoint, last-handshake time, and rx/tx byte counters." + " Filter by interface name (interface_filter) or disabled-only." + " For the interface table use list_wireguard_interfaces." + " Use the .id from this output with get_wireguard_peer, update_wireguard_peer, remove_wireguard_peer," + " enable_wireguard_peer, or disable_wireguard_peer.",
20218
+ description: "`list_wireguard_peers` \u2014 READ / list / show / inspect all WireGuard peers" + " (`/interface wireguard peers print`). Use this to read which peers are configured and" + " whether the tunnel is up (handshake). Returns each peer's .id, interface, public-key," + " allowed-address, endpoint/current-endpoint, last-handshake time, and rx/tx byte counters." + " Filter by interface name (interface_filter) or disabled-only. For the interface table use" + " list_wireguard_interfaces; for one peer's full detail use get_wireguard_peer; for interfaces" + " AND peers in one call use get_wireguard_status. Use the .id from this output with" + " update_wireguard_peer, remove_wireguard_peer, enable_wireguard_peer, or disable_wireguard_peer.",
20189
20219
  inputSchema: {
20190
20220
  interface_filter: z108.string().optional(),
20191
20221
  disabled_only: z108.boolean().default(false)
@@ -20207,7 +20237,7 @@ ${result}`;
20207
20237
  name: "get_wireguard_peer",
20208
20238
  title: "Get WireGuard Peer Details",
20209
20239
  annotations: READ,
20210
- description: "Retrieves full detail of a single WireGuard peer (`/interface wireguard peers print detail`) by its .id." + " Returns public-key, allowed-address, endpoint, preshared-key presence, last-handshake time, and rx/tx bytes." + " For the interface table use get_wireguard_interface." + ` Use list_wireguard_peers to obtain peer .id values.
20240
+ description: "`get_wireguard_peer` \u2014 READ / get / show the full detail of ONE WireGuard peer" + " (`/interface wireguard peers print detail`) by its .id. Returns public-key, allowed-address," + " endpoint/current-endpoint, preshared-key presence, last-handshake time, and rx/tx bytes." + " To list all peers use list_wireguard_peers; for interfaces AND peers in one call use" + ` get_wireguard_status.
20211
20241
 
20212
20242
  ` + `Notes:
20213
20243
  ` + ' peer_id: the .id from list_wireguard_peers, format "*N" or "N" e.g. "*2"',
@@ -23276,7 +23306,7 @@ function registerPrompts(server) {
23276
23306
  // package.json
23277
23307
  var package_default = {
23278
23308
  name: "@usex/mikrotik-mcp",
23279
- version: "3.8.0",
23309
+ version: "3.9.1",
23280
23310
  description: "MCP server for MikroTik RouterOS \u2014 660+ tools over SSH for firewall, NAT, routing, DHCP, DNS, WireGuard, wireless, QoS and more.",
23281
23311
  keywords: [
23282
23312
  "ai",
package/dist/index.js CHANGED
@@ -12765,10 +12765,15 @@ ${result}`;
12765
12765
  },
12766
12766
  async handler(a, ctx) {
12767
12767
  ctx.info("Configuring OpenVPN server");
12768
- const cmd = new Cmd("/interface ovpn-server server set").bool("enabled", a.enabled).opt("certificate", a.certificate).opt("auth", a.auth).opt("cipher", a.cipher).opt("netmask", a.netmask).opt("mode", a.mode).opt("port", a.port).opt("protocol", a.protocol).opt("default-profile", a.default_profile).bool("require-client-certificate", a.require_client_certificate).opt("max-mtu", a.max_mtu).build();
12768
+ const params = () => new Cmd("/interface ovpn-server server set").opt("certificate", a.certificate).opt("auth", a.auth).opt("cipher", a.cipher).opt("netmask", a.netmask).opt("mode", a.mode).opt("port", a.port).opt("protocol", a.protocol).opt("default-profile", a.default_profile).bool("require-client-certificate", a.require_client_certificate).opt("max-mtu", a.max_mtu);
12769
+ const cmd = params().bool("disabled", a.enabled === undefined ? undefined : !a.enabled).build();
12769
12770
  if (cmd === "/interface ovpn-server server set")
12770
12771
  return "No updates specified.";
12771
- const result = await executeMikrotikCommand(cmd, ctx);
12772
+ let result = await executeMikrotikCommand(cmd, ctx);
12773
+ if (a.enabled !== undefined && containsRawParserError(result)) {
12774
+ const legacy = params().bool("enabled", a.enabled).build();
12775
+ result = await executeMikrotikCommand(legacy, ctx);
12776
+ }
12772
12777
  if (looksLikeError(result))
12773
12778
  return `Failed to configure OpenVPN server: ${result}`;
12774
12779
  const details = await executeMikrotikCommand("/interface ovpn-server server print", ctx);
@@ -20050,7 +20055,7 @@ ${details}` : "WireGuard interface created successfully.";
20050
20055
  name: "list_wireguard_interfaces",
20051
20056
  title: "List WireGuard Interfaces",
20052
20057
  annotations: READ,
20053
- description: "Lists WireGuard tunnel interfaces (`/interface wireguard print`). Returns each interface's" + " name, listen-port, public-key, MTU, and running/disabled status." + " Supports filtering by name substring (name_filter), disabled-only, or running-only." + " For the peer table use list_wireguard_peers." + " Use the name from this output with get_wireguard_interface or update_wireguard_interface.",
20058
+ description: "`list_wireguard_interfaces` \u2014 READ / list / show / inspect all WireGuard tunnel interfaces" + " (`/interface wireguard print`). The go-to tool to read the current WireGuard state on a" + " device. Returns each interface's name, listen-port, public-key, MTU, and running/disabled" + " status. Filter by name substring (name_filter), disabled-only, or running-only." + " For one interface's full detail use get_wireguard_interface; for the peer table use" + " list_wireguard_peers; for interfaces AND peers in one call use get_wireguard_status.",
20054
20059
  inputSchema: {
20055
20060
  name_filter: z109.string().optional(),
20056
20061
  disabled_only: z109.boolean().default(false),
@@ -20075,7 +20080,7 @@ ${result}`;
20075
20080
  name: "get_wireguard_interface",
20076
20081
  title: "Get WireGuard Interface Details",
20077
20082
  annotations: READ,
20078
- description: "Retrieves full detail of a single WireGuard tunnel interface (`/interface wireguard print detail`)" + " looked up by name. Returns listen-port, private-key, public-key, MTU, running state, and comment." + " For the peer table use get_wireguard_peer." + " Use list_wireguard_interfaces to discover available interface names.",
20083
+ description: "`get_wireguard_interface` \u2014 READ / get / show the full detail of ONE WireGuard tunnel interface" + " (`/interface wireguard print detail`) looked up by name. Returns listen-port, private-key," + " public-key, MTU, running state, and comment. To list all interfaces use" + " list_wireguard_interfaces; for that interface's peers use list_wireguard_peers; for" + " interfaces AND peers in one call use get_wireguard_status.",
20079
20084
  inputSchema: { name: z109.string() },
20080
20085
  async handler(a, ctx) {
20081
20086
  ctx.info(`Getting WireGuard interface details: name=${a.name}`);
@@ -20085,6 +20090,31 @@ ${result}`;
20085
20090
  ${result}`;
20086
20091
  }
20087
20092
  }),
20093
+ defineTool({
20094
+ name: "get_wireguard_status",
20095
+ title: "Get WireGuard Status (Interfaces + Peers)",
20096
+ annotations: READ,
20097
+ description: "`get_wireguard_status` \u2014 READ the current WireGuard state on a device in ONE call: ALL tunnel" + " interfaces AND ALL peers together. Use this FIRST to inspect / show / check WireGuard before" + " changing anything (e.g. to read public keys, see which side initiates, or confirm the tunnel" + " is up). Interfaces report name, listen-port, public-key, MTU and running state; peers report" + " .id, interface, public-key, allowed-address, endpoint/current-endpoint, last-handshake time" + " and rx/tx bytes. Combines list_wireguard_interfaces + list_wireguard_peers; optionally filter" + " both to one interface with interface_filter.",
20098
+ inputSchema: {
20099
+ interface_filter: z109.string().optional().describe("Limit to one interface name, e.g. 'wg-mesh'")
20100
+ },
20101
+ async handler(a, ctx) {
20102
+ ctx.info("Reading WireGuard status (interfaces + peers)");
20103
+ const ifFilters = a.interface_filter ? [`name="${a.interface_filter}"`] : [];
20104
+ const peerFilters = a.interface_filter ? [`interface="${a.interface_filter}"`] : [];
20105
+ const interfaces = await executeMikrotikCommand(`/interface wireguard print${whereClause(ifFilters)}`, ctx);
20106
+ const peers = await executeMikrotikCommand(`/interface wireguard peers print${whereClause(peerFilters)}`, ctx);
20107
+ const ifBlock = isEmpty(interfaces) ? "(none)" : interfaces;
20108
+ const peerBlock = isEmpty(peers) ? "(none)" : peers;
20109
+ return `WIREGUARD INTERFACES:
20110
+
20111
+ ${ifBlock}
20112
+
20113
+ WIREGUARD PEERS:
20114
+
20115
+ ${peerBlock}`;
20116
+ }
20117
+ }),
20088
20118
  defineTool({
20089
20119
  name: "update_wireguard_interface",
20090
20120
  title: "Update WireGuard Interface",
@@ -20197,7 +20227,7 @@ ${details}` : "WireGuard peer added successfully.";
20197
20227
  name: "list_wireguard_peers",
20198
20228
  title: "List WireGuard Peers",
20199
20229
  annotations: READ,
20200
- description: "Lists all WireGuard peer entries (`/interface wireguard peers print`)." + " Returns each peer's .id, interface, public-key, allowed-address, endpoint, last-handshake time, and rx/tx byte counters." + " Filter by interface name (interface_filter) or disabled-only." + " For the interface table use list_wireguard_interfaces." + " Use the .id from this output with get_wireguard_peer, update_wireguard_peer, remove_wireguard_peer," + " enable_wireguard_peer, or disable_wireguard_peer.",
20230
+ description: "`list_wireguard_peers` \u2014 READ / list / show / inspect all WireGuard peers" + " (`/interface wireguard peers print`). Use this to read which peers are configured and" + " whether the tunnel is up (handshake). Returns each peer's .id, interface, public-key," + " allowed-address, endpoint/current-endpoint, last-handshake time, and rx/tx byte counters." + " Filter by interface name (interface_filter) or disabled-only. For the interface table use" + " list_wireguard_interfaces; for one peer's full detail use get_wireguard_peer; for interfaces" + " AND peers in one call use get_wireguard_status. Use the .id from this output with" + " update_wireguard_peer, remove_wireguard_peer, enable_wireguard_peer, or disable_wireguard_peer.",
20201
20231
  inputSchema: {
20202
20232
  interface_filter: z109.string().optional(),
20203
20233
  disabled_only: z109.boolean().default(false)
@@ -20219,7 +20249,7 @@ ${result}`;
20219
20249
  name: "get_wireguard_peer",
20220
20250
  title: "Get WireGuard Peer Details",
20221
20251
  annotations: READ,
20222
- description: "Retrieves full detail of a single WireGuard peer (`/interface wireguard peers print detail`) by its .id." + " Returns public-key, allowed-address, endpoint, preshared-key presence, last-handshake time, and rx/tx bytes." + " For the interface table use get_wireguard_interface." + ` Use list_wireguard_peers to obtain peer .id values.
20252
+ description: "`get_wireguard_peer` \u2014 READ / get / show the full detail of ONE WireGuard peer" + " (`/interface wireguard peers print detail`) by its .id. Returns public-key, allowed-address," + " endpoint/current-endpoint, preshared-key presence, last-handshake time, and rx/tx bytes." + " To list all peers use list_wireguard_peers; for interfaces AND peers in one call use" + ` get_wireguard_status.
20223
20253
 
20224
20254
  ` + `Notes:
20225
20255
  ` + ' peer_id: the .id from list_wireguard_peers, format "*N" or "N" e.g. "*2"',
@@ -21679,7 +21709,7 @@ function selectToolModules(filter = {}, catalog = moduleCatalog) {
21679
21709
  // package.json
21680
21710
  var package_default = {
21681
21711
  name: "@usex/mikrotik-mcp",
21682
- version: "3.8.0",
21712
+ version: "3.9.1",
21683
21713
  description: "MCP server for MikroTik RouterOS \u2014 660+ tools over SSH for firewall, NAT, routing, DHCP, DNS, WireGuard, wireless, QoS and more.",
21684
21714
  keywords: [
21685
21715
  "ai",