@usex/mikrotik-mcp 6.14.0 → 6.16.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 (67) hide show
  1. package/dist/cli.js +3366 -527
  2. package/dist/index.d.ts +115 -101
  3. package/dist/index.js +24 -10
  4. package/dist/shared/cli-8hn9vb7c.js +115 -0
  5. package/dist/shared/{cli-rcx7e9h4.js → cli-8j89p9xc.js} +4 -2
  6. package/dist/shared/cli-kb8zq3rx.js +9 -0
  7. package/dist/shared/{cli-w6km895r.js → cli-p7bt2fa3.js} +1 -1
  8. package/dist/shared/{cli-4xzq2n6j.js → cli-rmtax5nd.js} +1 -1
  9. package/dist/shared/{cli-r1ng5cjy.js → cli-rs00sr7q.js} +1 -1
  10. package/dist/shared/{cli-1vn2bbpy.js → cli-vf68spka.js} +5115 -1935
  11. package/dist/shared/cli-znnh8xtd.js +15 -0
  12. package/dist/shared/{library-1swafsvq.js → library-m6wrdeqa.js} +1 -1
  13. package/dist/shared/{library-0qn06vwr.js → library-nbtg49vh.js} +1 -1
  14. package/dist/shared/{library-1nhmbsv0.js → library-rc32xwsh.js} +1 -1
  15. package/dist/shared/{library-2wd7mt3g.js → library-rrzzp9qg.js} +4786 -1581
  16. package/dist/shared/{library-jpmbkkz7.js → library-s31n8vk4.js} +1 -1
  17. package/dist/ui/observability.html +296 -124
  18. package/package.json +25 -17
  19. package/schemas/README.md +5 -5
  20. package/schemas/config.schema.json +288 -6
  21. package/schemas/devtools-manifest.json +301 -5
  22. package/schemas/tool-catalog.json +1116 -42
  23. package/schemas/tools/add_alert_rule.json +1 -1
  24. package/schemas/tools/apply_config_template.json +56 -0
  25. package/schemas/tools/apply_wireless_to_wifi_migration.json +30 -0
  26. package/schemas/tools/deploy_container_stack.json +112 -0
  27. package/schemas/tools/design_zone_firewall.json +81 -0
  28. package/schemas/tools/discover_unmanaged_devices.json +49 -0
  29. package/schemas/tools/enrol_device.json +56 -0
  30. package/schemas/tools/expire_wireguard_users.json +19 -0
  31. package/schemas/tools/export_logs.json +2 -1
  32. package/schemas/tools/find_tools.json +1 -1
  33. package/schemas/tools/firmware_check.json +0 -5
  34. package/schemas/tools/firmware_post_upgrade.json +29 -0
  35. package/schemas/tools/firmware_repo_fetch.json +30 -0
  36. package/schemas/tools/firmware_repo_list.json +7 -0
  37. package/schemas/tools/firmware_stage_from_repo.json +19 -0
  38. package/schemas/tools/follow_ipv6_prefix.json +51 -0
  39. package/schemas/tools/generate_hotspot_vouchers.json +37 -1
  40. package/schemas/tools/get_container_logs.json +20 -0
  41. package/schemas/tools/get_logs.json +2 -1
  42. package/schemas/tools/get_logs_by_severity.json +2 -1
  43. package/schemas/tools/get_logs_by_topic.json +2 -1
  44. package/schemas/tools/get_security_logs.json +2 -1
  45. package/schemas/tools/get_system_events.json +2 -1
  46. package/schemas/tools/list_config_templates.json +7 -0
  47. package/schemas/tools/list_voucher_batches.json +7 -0
  48. package/schemas/tools/list_wireguard_users.json +12 -0
  49. package/schemas/tools/onboard_wireguard_user.json +17 -2
  50. package/schemas/tools/plan_wireless_to_wifi_migration.json +14 -0
  51. package/schemas/tools/protect_hotspot_login.json +32 -0
  52. package/schemas/tools/remove_config_template.json +14 -0
  53. package/schemas/tools/remove_threat_feed.json +1 -0
  54. package/schemas/tools/remove_voucher_batch.json +24 -0
  55. package/schemas/tools/remove_zone_firewall.json +14 -0
  56. package/schemas/tools/revoke_wireguard_user.json +1 -0
  57. package/schemas/tools/run_routeros_command.json +6 -1
  58. package/schemas/tools/save_config_template.json +20 -0
  59. package/schemas/tools/search_logs.json +2 -1
  60. package/schemas/tools/subscribe_threat_feed.json +1 -0
  61. package/schemas/tools/test_alert_channel.json +1 -1
  62. package/schemas/tools/unfollow_ipv6_prefix.json +18 -0
  63. package/schemas/tools/unprotect_hotspot_login.json +7 -0
  64. package/schemas/tools/update_alert_rule.json +1 -1
  65. package/schemas/tools/upgrade_container_image.json +29 -0
  66. package/schemas/tools/validate_routeros_command.json +13 -0
  67. package/scripts/service.ts +242 -34
package/dist/index.d.ts CHANGED
@@ -77,6 +77,120 @@ interface ToolAccess {
77
77
  /** How a device command was actually carried. */
78
78
  type DeviceTransport = "ssh" | "rest" | "mac-telnet";
79
79
  type SendLog = (level: "info" | "error", message: string) => void;
80
+ import { ClientChannel, SFTPWrapper } from "ssh2";
81
+ interface EndpointOptions {
82
+ /** Evaluated at connect time, not at client construction. */
83
+ hosts?: () => string[];
84
+ onAttempt?: (host: string, error?: string) => void;
85
+ onConnected?: (host: string) => () => void;
86
+ }
87
+ interface SSHClientOptions extends EndpointOptions {
88
+ host: string;
89
+ username: string;
90
+ password?: string;
91
+ port?: number;
92
+ keyFilename?: string;
93
+ privateKey?: string;
94
+ /** Passphrase for an encrypted private key. */
95
+ keyPassphrase?: string;
96
+ /** Sign in with an SSH agent: `true` uses `SSH_AUTH_SOCK`, a string is the socket. */
97
+ agent?: boolean | string;
98
+ /** The pinned SHA-256 fingerprint of the host key (`SHA256:…`). */
99
+ hostKeySha256?: string;
100
+ timeoutMs?: number;
101
+ /**
102
+ * Optional SSH jump host (bastion / ProxyJump). When set, `connect()` reaches
103
+ * `host:port` THROUGH this hop: it opens an SSH session to the hop, asks it to
104
+ * `forwardOut` a TCP channel to the target, then runs the real SSH session
105
+ * over that channel. So the target never needs a port exposed to the network —
106
+ * only the bastion is reachable. The hop is itself an SSH endpoint and may
107
+ * carry its own `jump` for a multi-hop chain (A → B → target).
108
+ */
109
+ jump?: SSHClientOptions;
110
+ /** Interval (ms) for SSH keepalive packets. 0 disables (default). */
111
+ keepAliveInterval?: number;
112
+ /** Max consecutive keepalive failures before disconnect. Default: 3. */
113
+ keepAliveCountMax?: number;
114
+ }
115
+ /** Options for one command. `onData` and `signal` serve a live terminal. */
116
+ interface RunOptions {
117
+ /** Stop the command after this long and return what it printed. */
118
+ maxMs?: number;
119
+ /** Receives stdout as it arrives. The full output is still returned. */
120
+ onData?: (text: string) => void;
121
+ /** Aborting stops the command and returns what it printed so far. */
122
+ signal?: AbortSignal;
123
+ }
124
+ declare class MikroTikSSHClient {
125
+ private client;
126
+ /**
127
+ * Open bastion connections, outermost-first, kept alive for the lifetime of
128
+ * the session (the target's transport rides a channel on the last one). Closed
129
+ * in reverse on `disconnect()`.
130
+ */
131
+ private bastions;
132
+ private releases;
133
+ private readonly opts;
134
+ /** Human-readable reason the last `connect()` failed, if it did. */
135
+ lastError?: string;
136
+ connectedHost?: string;
137
+ get isConnected(): boolean;
138
+ constructor(opts: SSHClientOptions);
139
+ /**
140
+ * Establish the SSH connection — directly, or through one or more jump hosts
141
+ * when `opts.jump` is set. Resolves `true` on success, `false` on failure
142
+ * (with the reason on `lastError`).
143
+ */
144
+ connect(): Promise<boolean>;
145
+ /** Retry addresses only during connection setup, never after dispatching a command. */
146
+ private connectEndpoint;
147
+ /**
148
+ * Open one ssh2 connection. When `sock` is given the connection rides that
149
+ * stream (a forwarded channel from a jump host) instead of dialling the
150
+ * network directly. Resolves the ready `Client`; rejects with a clear reason.
151
+ */
152
+ private openClient;
153
+ /**
154
+ * Ask a connected jump host to open a TCP channel to `host:port` and resolve
155
+ * the resulting stream (used as the next hop's transport `sock`).
156
+ *
157
+ * A RouterOS bastion with SSH TCP forwarding disabled (the default) often
158
+ * NEVER answers the channel-open request instead of rejecting it cleanly, so
159
+ * without a timeout this would hang the whole connection (the dashboard sits
160
+ * forever at "connecting…"). The `timeoutMs` guard turns that silent stall
161
+ * into a fast, actionable error; an explicit rejection gets the same hint.
162
+ */
163
+ private forwardOut;
164
+ /** Run a single command on a fresh SSH channel and return its decoded output. */
165
+ run(command: string, opts?: RunOptions): Promise<string>;
166
+ /**
167
+ * Upload a file's bytes to the device over SFTP — the file-transfer subsystem
168
+ * RouterOS exposes on its SSH server. `remotePath` is relative to the SFTP
169
+ * default directory (the flash root), so `config.rsc` lands at the root and
170
+ * appears in `/file`; a path like `disk1/config.rsc` targets external disk.
171
+ * Resolves on success; rejects with a clear reason on failure.
172
+ */
173
+ uploadFile(remotePath: string, data: Buffer): Promise<void>;
174
+ /**
175
+ * Download a file's bytes from the device over SFTP. `remotePath` is relative
176
+ * to the SFTP default directory (the flash root). Resolves with the raw file
177
+ * contents; rejects with a clear reason on failure.
178
+ */
179
+ downloadFile(remotePath: string): Promise<Buffer>;
180
+ /**
181
+ * Open the SFTP subsystem and keep it open, for callers that list, stream or
182
+ * rename files (the dashboard Files page). The caller ends it.
183
+ */
184
+ sftp(): Promise<SFTPWrapper>;
185
+ /** Open a persistent interactive shell channel (used by Safe Mode). */
186
+ shell(opts?: {
187
+ term?: string;
188
+ cols?: number;
189
+ rows?: number;
190
+ }): Promise<ClientChannel>;
191
+ /** Close the SSH connection (and any jump hosts). Safe to call multiple times. */
192
+ disconnect(): void;
193
+ }
80
194
  /**
81
195
  * Execute a RouterOS command and return its raw text output.
82
196
  *
@@ -89,9 +203,7 @@ type SendLog = (level: "info" | "error", message: string) => void;
89
203
  * @param opts `maxMs` caps the one-shot read for interactive/streaming
90
204
  * commands (ping, bandwidth-test) so they can't hang the tool.
91
205
  */
92
- declare function executeMikrotikCommand(command: string, ctx: ToolContext, opts?: {
93
- maxMs?: number;
94
- }): Promise<string>;
206
+ declare function executeMikrotikCommand(command: string, ctx: ToolContext, opts?: RunOptions): Promise<string>;
95
207
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
96
208
  import { CallToolResult as CallToolResult2, ToolAnnotations } from "@modelcontextprotocol/sdk/types.js";
97
209
  import { ZodRawShape } from "zod";
@@ -314,104 +426,6 @@ interface CreatedServer {
314
426
  declare function createServer(opts?: {
315
427
  sendLog?: SendLog;
316
428
  }): CreatedServer;
317
- import { ClientChannel } from "ssh2";
318
- interface EndpointOptions {
319
- /** Evaluated at connect time, not at client construction. */
320
- hosts?: () => string[];
321
- onAttempt?: (host: string, error?: string) => void;
322
- onConnected?: (host: string) => () => void;
323
- }
324
- interface SSHClientOptions extends EndpointOptions {
325
- host: string;
326
- username: string;
327
- password?: string;
328
- port?: number;
329
- keyFilename?: string;
330
- privateKey?: string;
331
- /** Passphrase for an encrypted private key. */
332
- keyPassphrase?: string;
333
- timeoutMs?: number;
334
- /**
335
- * Optional SSH jump host (bastion / ProxyJump). When set, `connect()` reaches
336
- * `host:port` THROUGH this hop: it opens an SSH session to the hop, asks it to
337
- * `forwardOut` a TCP channel to the target, then runs the real SSH session
338
- * over that channel. So the target never needs a port exposed to the network —
339
- * only the bastion is reachable. The hop is itself an SSH endpoint and may
340
- * carry its own `jump` for a multi-hop chain (A → B → target).
341
- */
342
- jump?: SSHClientOptions;
343
- /** Interval (ms) for SSH keepalive packets. 0 disables (default). */
344
- keepAliveInterval?: number;
345
- /** Max consecutive keepalive failures before disconnect. Default: 3. */
346
- keepAliveCountMax?: number;
347
- }
348
- declare class MikroTikSSHClient {
349
- private client;
350
- /**
351
- * Open bastion connections, outermost-first, kept alive for the lifetime of
352
- * the session (the target's transport rides a channel on the last one). Closed
353
- * in reverse on `disconnect()`.
354
- */
355
- private bastions;
356
- private releases;
357
- private readonly opts;
358
- /** Human-readable reason the last `connect()` failed, if it did. */
359
- lastError?: string;
360
- connectedHost?: string;
361
- get isConnected(): boolean;
362
- constructor(opts: SSHClientOptions);
363
- /**
364
- * Establish the SSH connection — directly, or through one or more jump hosts
365
- * when `opts.jump` is set. Resolves `true` on success, `false` on failure
366
- * (with the reason on `lastError`).
367
- */
368
- connect(): Promise<boolean>;
369
- /** Retry addresses only during connection setup, never after dispatching a command. */
370
- private connectEndpoint;
371
- /**
372
- * Open one ssh2 connection. When `sock` is given the connection rides that
373
- * stream (a forwarded channel from a jump host) instead of dialling the
374
- * network directly. Resolves the ready `Client`; rejects with a clear reason.
375
- */
376
- private openClient;
377
- /**
378
- * Ask a connected jump host to open a TCP channel to `host:port` and resolve
379
- * the resulting stream (used as the next hop's transport `sock`).
380
- *
381
- * A RouterOS bastion with SSH TCP forwarding disabled (the default) often
382
- * NEVER answers the channel-open request instead of rejecting it cleanly, so
383
- * without a timeout this would hang the whole connection (the dashboard sits
384
- * forever at "connecting…"). The `timeoutMs` guard turns that silent stall
385
- * into a fast, actionable error; an explicit rejection gets the same hint.
386
- */
387
- private forwardOut;
388
- /** Run a single command on a fresh SSH channel and return its decoded output. */
389
- run(command: string, opts?: {
390
- maxMs?: number;
391
- }): Promise<string>;
392
- /**
393
- * Upload a file's bytes to the device over SFTP — the file-transfer subsystem
394
- * RouterOS exposes on its SSH server. `remotePath` is relative to the SFTP
395
- * default directory (the flash root), so `config.rsc` lands at the root and
396
- * appears in `/file`; a path like `disk1/config.rsc` targets external disk.
397
- * Resolves on success; rejects with a clear reason on failure.
398
- */
399
- uploadFile(remotePath: string, data: Buffer): Promise<void>;
400
- /**
401
- * Download a file's bytes from the device over SFTP. `remotePath` is relative
402
- * to the SFTP default directory (the flash root). Resolves with the raw file
403
- * contents; rejects with a clear reason on failure.
404
- */
405
- downloadFile(remotePath: string): Promise<Buffer>;
406
- /** Open a persistent interactive shell channel (used by Safe Mode). */
407
- shell(opts?: {
408
- term?: string;
409
- cols?: number;
410
- rows?: number;
411
- }): Promise<ClientChannel>;
412
- /** Close the SSH connection (and any jump hosts). Safe to call multiple times. */
413
- disconnect(): void;
414
- }
415
429
  /**
416
430
  * Outcome of {@link SafeModeManager.commit}. `ok` is true ONLY when Safe Mode is
417
431
  * confirmed exited (changes persisted) — callers must check it before telling
package/dist/index.js CHANGED
@@ -70,7 +70,7 @@ import {
70
70
  updateSummaryLine,
71
71
  allToolModules2,
72
72
  selectToolModules2
73
- } from "./shared/library-2wd7mt3g.js";
73
+ } from "./shared/library-rrzzp9qg.js";
74
74
 
75
75
  // node_modules/ajv/dist/compile/codegen/code.js
76
76
  var require_code = __commonJS(function(exports) {
@@ -9905,22 +9905,36 @@ function registerPrompts(server, opts = {}) {
9905
9905
  }
9906
9906
 
9907
9907
  // src/server.ts
9908
+ var AUTO_CORE_ABOVE = 100;
9909
+ function resolveSurface(setting, toolCount) {
9910
+ if (setting !== "auto")
9911
+ return setting;
9912
+ return toolCount > AUTO_CORE_ABOVE ? "core" : "full";
9913
+ }
9908
9914
  var INSTRUCTIONS = `MikroTik RouterOS management over SSH.
9909
9915
 
9916
+ RULE: a tool that is not in your tool list is NOT missing. Every tool of this
9917
+ server runs through \`invoke_tool\`. Call \`find_tools\` to get its name, then
9918
+ \`invoke_tool\`. Never tell the user that a tool is unavailable before
9919
+ \`find_tools\` returned nothing.
9920
+
9910
9921
  This server exposes RouterOS configuration as MCP tools grouped by subsystem:
9911
9922
  interfaces, IP addressing, DHCP, DNS, firewall (filter + NAT), routing, VLANs,
9912
9923
  wireless, WireGuard, queues/QoS, users, logs, backups, PoE, system, network
9913
9924
  tools, bridges, address-lists, scheduler/scripts and certificates.
9914
9925
 
9915
9926
  Tool discovery \u2014 MANDATORY workflow:
9916
- This server has several hundred dedicated tools, but the host only surfaces a
9917
- small subset at a time. You MUST follow this order:
9918
- 1. ALWAYS call \`find_tools\` FIRST \u2014 describe what you want to do and it
9919
- searches the full catalog for the best-matching dedicated tool.
9920
- 2. (Optional) Call \`describe_tool\` to get the exact parameter schema.
9921
- 3. Run it with the \`invoke_tool\` call that \`find_tools\` printed. Call a tool
9922
- by its own name only if it is in your tool list. \`invoke_tool\` applies the
9923
- same validation, risk checks and audit record as a direct call.
9927
+ This server has about a thousand dedicated tools. Your tool list holds only a
9928
+ few of them. You MUST follow this order:
9929
+ 1. ALWAYS call \`find_tools\` FIRST \u2014 describe what you want to do in your own
9930
+ words, in English (translate a request in another language first). It searches the full catalog by words and by meaning and returns
9931
+ tool names with one line each.
9932
+ 2. Call \`describe_tool\` with the name you picked to get its parameters.
9933
+ When \`find_tools\` is sure of the best match, it gives them at once.
9934
+ 3. Run it with \`invoke_tool\`. Call a tool by its own name only if it is in
9935
+ your tool list. \`invoke_tool\` applies the same validation, risk checks
9936
+ and audit record as a direct call, and an argument error returns the
9937
+ parameters so you can correct the call.
9924
9938
  4. ONLY if \`find_tools\` returned ZERO results, run a raw command with
9925
9939
  \`invoke_tool {"name":"run_routeros_command","arguments":{"command":"\u2026"}}\`.
9926
9940
  Dedicated tools have schema validation, structured output, and correct risk
@@ -10118,7 +10132,7 @@ ${note}`;
10118
10132
  deviceDirectory: deviceDirectory(),
10119
10133
  appViews: getConfig2().mcp.appViews,
10120
10134
  readOnly,
10121
- surface: getConfig2().mcp.toolSurface,
10135
+ surface: resolveSurface(getConfig2().mcp.toolSurface, toolModules.reduce((sum, module) => sum + module.length, 0)),
10122
10136
  coreTools: getConfig2().mcp.coreTools.split(",").map((name) => name.trim()).filter(Boolean)
10123
10137
  });
10124
10138
  const promptCount = registerPrompts(server, {
@@ -0,0 +1,115 @@
1
+ // @bun
2
+ import {
3
+ logger,
4
+ UI_DIST_DIR
5
+ } from "./cli-vf68spka.js";
6
+
7
+ // src/observability/remote.ts
8
+ import { readFileSync } from "fs";
9
+ import { join } from "path";
10
+ var {serve } = globalThis.Bun;
11
+ function serverOrigin(server) {
12
+ let url;
13
+ try {
14
+ url = new URL(server);
15
+ } catch {
16
+ throw new Error(`--server must be a URL like http://192.168.1.10:9090 (got "${server}")`);
17
+ }
18
+ if (url.protocol !== "http:" && url.protocol !== "https:")
19
+ throw new Error(`--server must use http or https (got "${url.protocol}")`);
20
+ return url.origin;
21
+ }
22
+ function upstreamUrl(origin, pathAndQuery, ws = false) {
23
+ const url = new URL(pathAndQuery, origin);
24
+ if (ws)
25
+ url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
26
+ return url.href;
27
+ }
28
+ function upstreamHeaders(incoming, token) {
29
+ const out = new Headers(incoming);
30
+ for (const name of ["host", "connection", "authorization", "accept-encoding", "origin"])
31
+ out.delete(name);
32
+ if (token)
33
+ out.set("authorization", `Bearer ${token}`);
34
+ return out;
35
+ }
36
+ function crossOrigin(req) {
37
+ const origin = req.headers.get("origin");
38
+ return origin !== null && origin !== new URL(req.url).origin;
39
+ }
40
+ function localPage(dir = UI_DIST_DIR) {
41
+ try {
42
+ return readFileSync(join(dir, "observability.html"), "utf8");
43
+ } catch {
44
+ return;
45
+ }
46
+ }
47
+ function runRemoteDashboard(options) {
48
+ const origin = serverOrigin(options.server);
49
+ const auth = options.token ? { authorization: `Bearer ${options.token}` } : undefined;
50
+ const server = serve({
51
+ hostname: options.host,
52
+ port: options.port,
53
+ idleTimeout: 0,
54
+ async fetch(req, srv) {
55
+ const url = new URL(req.url);
56
+ const path = url.pathname + url.search;
57
+ if (crossOrigin(req))
58
+ return new Response("Cross-origin operation denied", { status: 403 });
59
+ if (req.headers.get("upgrade")?.toLowerCase() === "websocket") {
60
+ const target = upstreamUrl(origin, path, true);
61
+ return srv.upgrade(req, { data: { target } }) ? undefined : new Response("WebSocket upgrade failed", { status: 400 });
62
+ }
63
+ if (req.method === "GET" && (url.pathname === "/" || url.pathname === "/index.html")) {
64
+ const page = localPage();
65
+ if (page !== undefined)
66
+ return new Response(page, { headers: { "content-type": "text/html; charset=utf-8" } });
67
+ }
68
+ try {
69
+ const res = await fetch(upstreamUrl(origin, path), {
70
+ method: req.method,
71
+ headers: upstreamHeaders(req.headers, options.token),
72
+ body: req.method === "GET" || req.method === "HEAD" ? undefined : req.body,
73
+ redirect: "manual",
74
+ signal: req.signal
75
+ });
76
+ const headers = new Headers(res.headers);
77
+ headers.delete("content-encoding");
78
+ headers.delete("content-length");
79
+ return new Response(res.body, { status: res.status, headers });
80
+ } catch (e) {
81
+ if (req.signal.aborted)
82
+ return new Response(null, { status: 499 });
83
+ const reason = e instanceof Error ? e.message : String(e);
84
+ return new Response(`Cannot reach the MikroTik MCP server at ${origin}: ${reason}`, {
85
+ status: 502
86
+ });
87
+ }
88
+ },
89
+ websocket: {
90
+ open(ws) {
91
+ const upstream = new WebSocket(ws.data.target, { headers: auth });
92
+ ws.data.upstream = upstream;
93
+ upstream.onmessage = (m) => ws.send(m.data);
94
+ upstream.onclose = () => ws.close();
95
+ upstream.onerror = () => ws.close();
96
+ },
97
+ message(ws, message) {
98
+ const upstream = ws.data.upstream;
99
+ if (upstream?.readyState === WebSocket.OPEN)
100
+ upstream.send(message);
101
+ },
102
+ close(ws) {
103
+ ws.data.upstream?.close();
104
+ }
105
+ }
106
+ });
107
+ logger.info(`Remote dashboard ready \u2014 open http://${options.host === "0.0.0.0" ? "localhost" : options.host}:${options.port} ` + `(server ${origin}${options.token ? ", token set" : ""}, page: ` + `${localPage() === undefined ? "the server's \u2014 no local build, run `bun run build:ui` to use this machine's UI" : "this machine's build"})`);
108
+ if (options.host !== "127.0.0.1" && options.host !== "localhost" && options.host !== "::1") {
109
+ logger.warn("The remote dashboard is reachable from other machines and asks for no token of its own: " + "anyone who can open it gets the server's dashboard, including its config editor. " + "Bind it to 127.0.0.1 unless that is intended.");
110
+ }
111
+ return { stop: () => server.stop(true) };
112
+ }
113
+ export {
114
+ runRemoteDashboard
115
+ };
@@ -12,9 +12,10 @@ import {
12
12
  ToolFilterSchema2,
13
13
  AccessConfigSchema2,
14
14
  MikrotikConfigSchema2,
15
+ parseFlags2,
15
16
  getConfigSource2,
16
17
  loadConfig2
17
- } from "./cli-1vn2bbpy.js";
18
+ } from "./cli-vf68spka.js";
18
19
  export {
19
20
  AccessConfigSchema2 as AccessConfigSchema,
20
21
  DEFAULT_BACKUP_DIR2 as DEFAULT_BACKUP_DIR,
@@ -29,5 +30,6 @@ export {
29
30
  SSHConfigSchema2 as SSHConfigSchema,
30
31
  ToolFilterSchema2 as ToolFilterSchema,
31
32
  getConfigSource2 as getConfigSource,
32
- loadConfig2 as loadConfig
33
+ loadConfig2 as loadConfig,
34
+ parseFlags2 as parseFlags
33
35
  };
@@ -0,0 +1,9 @@
1
+ // @bun
2
+ import {
3
+ semanticDocs2,
4
+ toolGatewayTools2
5
+ } from "./cli-vf68spka.js";
6
+ export {
7
+ semanticDocs2 as semanticDocs,
8
+ toolGatewayTools2 as toolGatewayTools
9
+ };
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  openSnapshotStore2
4
- } from "./cli-1vn2bbpy.js";
4
+ } from "./cli-vf68spka.js";
5
5
  export {
6
6
  openSnapshotStore2 as openSnapshotStore
7
7
  };
@@ -4,7 +4,7 @@ import {
4
4
  normalizeExport2,
5
5
  contentSha2,
6
6
  countLines2
7
- } from "./cli-1vn2bbpy.js";
7
+ } from "./cli-vf68spka.js";
8
8
  export {
9
9
  contentSha2 as contentSha,
10
10
  countLines2 as countLines,
@@ -4,7 +4,7 @@ import {
4
4
  allToolModules2,
5
5
  ALWAYS_ON_MODULES2,
6
6
  selectToolModules2
7
- } from "./cli-1vn2bbpy.js";
7
+ } from "./cli-vf68spka.js";
8
8
  export {
9
9
  ALWAYS_ON_MODULES2 as ALWAYS_ON_MODULES,
10
10
  allToolModules2 as allToolModules,