@mtk-router/router-ssh
v0.1.5
Published
MTK Router Automation Platform — direct SSH to MikroTik RouterOS from Node.js (no mtk-serve / HTTP client).
Maintainers
Readme
@mtk-router/router-ssh
Node.js (18+) — SSH directly to MikroTik RouterOS. No mtk-serve, no baseUrl.
Sources: src/index.mjs uses only TCP SSH (ssh2 client submodule). It does not call fetch, http, https, or axios. (package-lock.json still lists https://registry.npmjs.org/… for installs — that is npm metadata, not runtime code.)
Uses the same environment variables as the Python SDK:
MTK_HOST(default192.168.88.1)MTK_USER(defaultadmin)MTK_PASSWORD(required for password auth)MTK_PORT(default22)MTK_TIMEOUT(seconds, default30)
Full list of MTK_* names (Python CLI, mtk-serve, bootstrap, etc.): docs/ENVIRONMENT.md.
Install
From the repo:
cd clients/node-ssh
npm installIn another project:
"@mtk-router/router-ssh": "file:../mtk-router-setup/clients/node-ssh"Example
import { MtkSshClient } from "@mtk-router/router-ssh";
const c = new MtkSshClient();
await c.connect();
try {
const r = await c.exec("/interface l2tp-client print terse");
console.log(r.stdout);
const vpn = await c.setPolicyRouteGateway("rt_slot_2", "l2tp-uk");
if (!vpn.ok) console.error(vpn.stderr || vpn.stdout);
} finally {
await c.disconnect();
}Scope
This is a small complement to @mtk-router/router-client (REST over mtk-serve). It covers exec and policy-route gateway updates. It does not replicate full discovery, bootstrap, or leases — use Python or mtk-serve for those, or extend this package.
Browser
Not supported — use @mtk-router/router-client with mtk-serve, or a backend that uses this module or Python.
