@usex/mikrotik-mcp 3.9.0 → 3.10.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/dist/cli.js CHANGED
@@ -1122,8 +1122,7 @@ function indicatesFailure(text) {
1122
1122
  // src/core/routeros-parse.ts
1123
1123
  function parseKeyValues(text) {
1124
1124
  const out = {};
1125
- for (const line of text.split(`
1126
- `)) {
1125
+ for (const line of text.split(/\r?\n/)) {
1127
1126
  const m = line.match(/^\s*([A-Za-z][\w-]*):\s?(.*)$/);
1128
1127
  if (!m)
1129
1128
  continue;
@@ -1368,8 +1367,7 @@ function parseColumnarRecords(lines) {
1368
1367
  return rows;
1369
1368
  }
1370
1369
  function parseRecords(text) {
1371
- const lines = text.split(`
1372
- `).filter((l) => !/^\s*(Flags|Columns):/.test(l));
1370
+ const lines = text.split(/\r?\n/).filter((l) => !/^\s*(Flags|Columns):/.test(l));
1373
1371
  const hasKv = /[A-Za-z][\w.-]*=/.test(text);
1374
1372
  if (hasKv && lines.some((l) => INDEX_LINE.test(l))) {
1375
1373
  const rows = parseDetailRecords(lines);
@@ -12753,10 +12751,15 @@ ${result}`;
12753
12751
  },
12754
12752
  async handler(a, ctx) {
12755
12753
  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();
12754
+ 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);
12755
+ const cmd = params().bool("disabled", a.enabled === undefined ? undefined : !a.enabled).build();
12757
12756
  if (cmd === "/interface ovpn-server server set")
12758
12757
  return "No updates specified.";
12759
- const result = await executeMikrotikCommand(cmd, ctx);
12758
+ let result = await executeMikrotikCommand(cmd, ctx);
12759
+ if (a.enabled !== undefined && containsRawParserError(result)) {
12760
+ const legacy = params().bool("enabled", a.enabled).build();
12761
+ result = await executeMikrotikCommand(legacy, ctx);
12762
+ }
12760
12763
  if (looksLikeError(result))
12761
12764
  return `Failed to configure OpenVPN server: ${result}`;
12762
12765
  const details = await executeMikrotikCommand("/interface ovpn-server server print", ctx);
@@ -23301,7 +23304,7 @@ function registerPrompts(server) {
23301
23304
  // package.json
23302
23305
  var package_default = {
23303
23306
  name: "@usex/mikrotik-mcp",
23304
- version: "3.9.0",
23307
+ version: "3.10.0",
23305
23308
  description: "MCP server for MikroTik RouterOS \u2014 660+ tools over SSH for firewall, NAT, routing, DHCP, DNS, WireGuard, wireless, QoS and more.",
23306
23309
  keywords: [
23307
23310
  "ai",
package/dist/index.js CHANGED
@@ -1107,8 +1107,7 @@ function indicatesFailure(text) {
1107
1107
  // src/core/routeros-parse.ts
1108
1108
  function parseKeyValues(text) {
1109
1109
  const out = {};
1110
- for (const line of text.split(`
1111
- `)) {
1110
+ for (const line of text.split(/\r?\n/)) {
1112
1111
  const m = line.match(/^\s*([A-Za-z][\w-]*):\s?(.*)$/);
1113
1112
  if (!m)
1114
1113
  continue;
@@ -1292,8 +1291,7 @@ function parseColumnarRecords(lines) {
1292
1291
  return rows;
1293
1292
  }
1294
1293
  function parseRecords(text) {
1295
- const lines = text.split(`
1296
- `).filter((l) => !/^\s*(Flags|Columns):/.test(l));
1294
+ const lines = text.split(/\r?\n/).filter((l) => !/^\s*(Flags|Columns):/.test(l));
1297
1295
  const hasKv = /[A-Za-z][\w.-]*=/.test(text);
1298
1296
  if (hasKv && lines.some((l) => INDEX_LINE.test(l))) {
1299
1297
  const rows = parseDetailRecords(lines);
@@ -12765,10 +12763,15 @@ ${result}`;
12765
12763
  },
12766
12764
  async handler(a, ctx) {
12767
12765
  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();
12766
+ 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);
12767
+ const cmd = params().bool("disabled", a.enabled === undefined ? undefined : !a.enabled).build();
12769
12768
  if (cmd === "/interface ovpn-server server set")
12770
12769
  return "No updates specified.";
12771
- const result = await executeMikrotikCommand(cmd, ctx);
12770
+ let result = await executeMikrotikCommand(cmd, ctx);
12771
+ if (a.enabled !== undefined && containsRawParserError(result)) {
12772
+ const legacy = params().bool("enabled", a.enabled).build();
12773
+ result = await executeMikrotikCommand(legacy, ctx);
12774
+ }
12772
12775
  if (looksLikeError(result))
12773
12776
  return `Failed to configure OpenVPN server: ${result}`;
12774
12777
  const details = await executeMikrotikCommand("/interface ovpn-server server print", ctx);
@@ -21704,7 +21707,7 @@ function selectToolModules(filter = {}, catalog = moduleCatalog) {
21704
21707
  // package.json
21705
21708
  var package_default = {
21706
21709
  name: "@usex/mikrotik-mcp",
21707
- version: "3.9.0",
21710
+ version: "3.10.0",
21708
21711
  description: "MCP server for MikroTik RouterOS \u2014 660+ tools over SSH for firewall, NAT, routing, DHCP, DNS, WireGuard, wireless, QoS and more.",
21709
21712
  keywords: [
21710
21713
  "ai",