@usex/mikrotik-mcp 3.56.0 → 3.57.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
@@ -1155,9 +1155,9 @@ var pkg = JSON.parse(readFileSync2(join2(PROJECT_ROOT, "package.json"), "utf-8")
1155
1155
  var VERSION = pkg.version ?? "0.0.0";
1156
1156
  var WEBSITE_URL = pkg.homepage ?? "";
1157
1157
  var LOGO_URL = pkg.logoIcon ?? "";
1158
- var SERVER_TITLE = pkg.name ?? "mcp-mikrotik";
1158
+ var SERVER_TITLE = "MikroTik MCP";
1159
1159
  var SERVER_DESCRIPTION = pkg.description ?? "";
1160
- var SERVER_NAME = "mcp-mikrotik";
1160
+ var SERVER_NAME = "mikrotik-mcp";
1161
1161
  var PKG_META = pkg;
1162
1162
 
1163
1163
  // src/observability/drift-routes.ts
@@ -2625,13 +2625,25 @@ function substitute(body, vars) {
2625
2625
  return typeof v === "object" ? JSON.stringify(v) : String(v);
2626
2626
  });
2627
2627
  }
2628
- function registerPrompts(server) {
2628
+ function deviceArgDescription(directory) {
2629
+ if (directory && directory.length > 0) {
2630
+ const rows = directory.map((d) => `\u2022 ${d.key}${d.label && d.label !== d.key ? ` ("${d.label}")` : ""} \u2192 ${d.target}${d.isDefault ? " [default]" : ""}`).join(`
2631
+ `);
2632
+ return "Which configured MikroTik device to run this workflow on. " + `Pass the EXACT config key or its label. Configured devices:
2633
+ ` + `${rows}
2634
+ ` + "Omit to use the default device.";
2635
+ }
2636
+ return "Which configured MikroTik device to run this workflow on. Omit to use the default device.";
2637
+ }
2638
+ function registerPrompts(server, opts = {}) {
2629
2639
  let files;
2630
2640
  try {
2631
2641
  files = readdirSync2(PROMPTS_DIR).filter((f) => f.endsWith(".md"));
2632
2642
  } catch {
2633
2643
  return 0;
2634
2644
  }
2645
+ const multiDevice = opts.deviceNames && opts.deviceNames.length > 1;
2646
+ const selectorNames = multiDevice ? [...new Set([...opts.deviceNames, ...opts.deviceAliases ?? []])] : [];
2635
2647
  let count = 0;
2636
2648
  for (const file of files) {
2637
2649
  let parsed;
@@ -2650,6 +2662,10 @@ function registerPrompts(server) {
2650
2662
  const s = z2.string().describe(arg.description ?? "");
2651
2663
  argsSchema[arg.name] = arg.required ? s : s.optional();
2652
2664
  }
2665
+ const hasOwnDevice = parsed.arguments.some((a) => a.name === "device" || a.name === "device_a");
2666
+ if (multiDevice && !hasOwnDevice) {
2667
+ argsSchema.device = z2.enum(selectorNames).optional().describe(deviceArgDescription(opts.deviceDirectory));
2668
+ }
2653
2669
  server.registerPrompt(parsed.name, { title: parsed.title, description: parsed.description, argsSchema }, (args) => ({
2654
2670
  messages: [
2655
2671
  {
@@ -2728,8 +2744,8 @@ function createServer(opts = {}) {
2728
2744
  icons: [
2729
2745
  {
2730
2746
  src: LOGO_URL,
2731
- mimeType: "image/png",
2732
- sizes: ["192x192"],
2747
+ mimeType: "image/svg+xml",
2748
+ sizes: ["any"],
2733
2749
  theme: "light"
2734
2750
  }
2735
2751
  ]
@@ -2751,7 +2767,11 @@ function createServer(opts = {}) {
2751
2767
  appViews: getConfig().mcp.appViews,
2752
2768
  readOnly
2753
2769
  });
2754
- const promptCount = registerPrompts(server);
2770
+ const promptCount = registerPrompts(server, {
2771
+ deviceNames: names,
2772
+ deviceAliases: deviceLabels(),
2773
+ deviceDirectory: deviceDirectory()
2774
+ });
2755
2775
  const uiViewCount = registerUiResources(server);
2756
2776
  installToolPagination(server, getConfig().mcp.toolPageSize);
2757
2777
  return { server, toolCount, promptCount, uiViewCount, readOnly };
package/dist/index.d.ts CHANGED
@@ -324,5 +324,5 @@ declare class SafeModeManager {
324
324
  declare function getSafeModeManager(deviceName: string): SafeModeManager;
325
325
  declare const allToolModules: ToolModule[];
326
326
  declare const VERSION: string;
327
- declare const SERVER_NAME = "mcp-mikrotik";
327
+ declare const SERVER_NAME = "mikrotik-mcp";
328
328
  export { setConfig, resolveDeviceName, registerTools, loadConfig, listDevices, getSafeModeManager, getDevice, getConfig, executeMikrotikCommand, defineTool, createServer, allToolModules, VERSION, ToolModule, ToolContext, SafeModeManager, SERVER_NAME, RegisterableTool, MikrotikConfigSchema, MikrotikConfig, MikroTikSSHClient, DeviceConfigSchema, DeviceConfig };
package/dist/index.js CHANGED
@@ -89,13 +89,25 @@ function substitute(body, vars) {
89
89
  return typeof v === "object" ? JSON.stringify(v) : String(v);
90
90
  });
91
91
  }
92
- function registerPrompts(server) {
92
+ function deviceArgDescription(directory) {
93
+ if (directory && directory.length > 0) {
94
+ const rows = directory.map((d) => `\u2022 ${d.key}${d.label && d.label !== d.key ? ` ("${d.label}")` : ""} \u2192 ${d.target}${d.isDefault ? " [default]" : ""}`).join(`
95
+ `);
96
+ return "Which configured MikroTik device to run this workflow on. " + `Pass the EXACT config key or its label. Configured devices:
97
+ ` + `${rows}
98
+ ` + "Omit to use the default device.";
99
+ }
100
+ return "Which configured MikroTik device to run this workflow on. Omit to use the default device.";
101
+ }
102
+ function registerPrompts(server, opts = {}) {
93
103
  let files;
94
104
  try {
95
105
  files = readdirSync(PROMPTS_DIR).filter((f) => f.endsWith(".md"));
96
106
  } catch {
97
107
  return 0;
98
108
  }
109
+ const multiDevice = opts.deviceNames && opts.deviceNames.length > 1;
110
+ const selectorNames = multiDevice ? [...new Set([...opts.deviceNames, ...opts.deviceAliases ?? []])] : [];
99
111
  let count = 0;
100
112
  for (const file of files) {
101
113
  let parsed;
@@ -114,6 +126,10 @@ function registerPrompts(server) {
114
126
  const s = z.string().describe(arg.description ?? "");
115
127
  argsSchema[arg.name] = arg.required ? s : s.optional();
116
128
  }
129
+ const hasOwnDevice = parsed.arguments.some((a) => a.name === "device" || a.name === "device_a");
130
+ if (multiDevice && !hasOwnDevice) {
131
+ argsSchema.device = z.enum(selectorNames).optional().describe(deviceArgDescription(opts.deviceDirectory));
132
+ }
117
133
  server.registerPrompt(parsed.name, { title: parsed.title, description: parsed.description, argsSchema }, (args) => ({
118
134
  messages: [
119
135
  {
@@ -137,9 +153,9 @@ var pkg = JSON.parse(readFileSync2(join2(PROJECT_ROOT, "package.json"), "utf-8")
137
153
  var VERSION = pkg.version ?? "0.0.0";
138
154
  var WEBSITE_URL = pkg.homepage ?? "";
139
155
  var LOGO_URL = pkg.logoIcon ?? "";
140
- var SERVER_TITLE = pkg.name ?? "mcp-mikrotik";
156
+ var SERVER_TITLE = "MikroTik MCP";
141
157
  var SERVER_DESCRIPTION = pkg.description ?? "";
142
- var SERVER_NAME = "mcp-mikrotik";
158
+ var SERVER_NAME = "mikrotik-mcp";
143
159
 
144
160
  // src/server.ts
145
161
  var INSTRUCTIONS = `MikroTik RouterOS management over SSH.
@@ -203,8 +219,8 @@ function createServer(opts = {}) {
203
219
  icons: [
204
220
  {
205
221
  src: LOGO_URL,
206
- mimeType: "image/png",
207
- sizes: ["192x192"],
222
+ mimeType: "image/svg+xml",
223
+ sizes: ["any"],
208
224
  theme: "light"
209
225
  }
210
226
  ]
@@ -226,7 +242,11 @@ function createServer(opts = {}) {
226
242
  appViews: getConfig().mcp.appViews,
227
243
  readOnly
228
244
  });
229
- const promptCount = registerPrompts(server);
245
+ const promptCount = registerPrompts(server, {
246
+ deviceNames: names,
247
+ deviceAliases: deviceLabels(),
248
+ deviceDirectory: deviceDirectory()
249
+ });
230
250
  const uiViewCount = registerUiResources(server);
231
251
  installToolPagination(server, getConfig().mcp.toolPageSize);
232
252
  return { server, toolCount, promptCount, uiViewCount, readOnly };