Connect MikroTik to AI — no API service, no open port
Your MikroTik router is the centre of most networks, yet almost every question about it still means opening a terminal. With the YasnaMCP MikroTik connector, the router itself connects securely to the assistant: ask “is the firewall configured correctly?”, “which clients are on Wi-Fi?” or “block this address for an hour” in plain language.
The architectural point matters: nothing is enabled on the router. No api, no www-ssl, no listening port. The router dials out to YasnaMCP, exactly as it already does for WireGuard — so no new inbound door is opened into your network.
Step 1 — create a connector in the panel, then paste its token here
The router joins your own organisation, so it starts with a connector you create in the YasnaMCP panel. Three steps, under a minute:
Create the connector
Sign in to the YasnaMCP panel with your organisation’s account and open Connectors. Create a new connector and name it whatever you like — the name is free and is what appears in your connector list.
Copy its token
The panel shows a token starting with ymc_ct_. Copy it: it authorises this router to join your organisation, and handing it out is like handing out a building key.
Enter the router name and the token below
The token is checked against YasnaMCP immediately. A valid one returns a ready-to-paste install command and confirms your organisation; a wrong or revoked one is reported here, not after installing on the router.
کلید اتصال روتر خود را بگیرید
نام سایت یا شعبه را وارد کنید؛ یک کلید یکتا برای همین روتر ساخته میشود و فرمان نصب، آمادهٔ کپی تحویل داده میشود.
- در WebFig یا WinBox روتر،
New Terminalرا باز کنید. - هر دو خط زیر را یکجا بچسبانید و Enter بزنید.
- پایان کار: پیام
YasnaMCP connector installedرا میبینید.
این کلید به روتر شما تعلق دارد؛ در اختیار دیگران نگذارید. برای ابطال، تیم YasnaMCP میتواند توکن را باطل کند و روتر با فرمان بعدی از دسترس خارج میشود.
Step 2 — run the command on the router
Open a RouterOS terminal
In WebFig press New Terminal, or open New Terminal in WinBox. A full administrator account is required: the installer creates a script, a scheduler and a downloaded file.
Paste the two lines together
The first line stores three values in the router’s own environment; the second fetches the installer from the site and runs it. Paste both lines at once:
:global YasnaEdge "https://humanfree.ir/mt"; :global YasnaDevice "mt-xxxxxxxxxx"; :global YasnaToken "ysm_...";
/tool fetch url=("https://humanfree.ir/mt/install/yasna-mt-install.rsc") dst-path="yasna-mt-install.rsc" check-certificate=yes; :delay 1s; /import file-name="yasna-mt-install.rsc"
The values above are a sample; copy the real ones from the Step 1 card. The installer finishes by reporting the router id, the access level and the operations it may run.
What it creates on the router
Three objects and nothing else: the script yasna-mt-agent, a scheduler of the same name that runs one cycle every few seconds, and a downloaded install file. The script runs with read,write,policy,test,ftp,sensitive so that reads, command execution and backups are possible.
/system ntp client set enabled=yes servers=pool.ntp.orgStep 3 — confirm the connection
Run the self-test
It reports RouterOS version, clock, the service URL, scheduler state, connectivity and the connector’s most recent log lines:
/system script run yasna-mt-selftest
What you see in YasnaMCP
The router appears in the control panel as its own connector, with its name, board model and RouterOS version. “Online” next to the name means the whole path works. Changing configuration needs two permissions at once: the grant in the panel, and write access on the router itself.
What the assistant can do with a router
- State: identity, resources (CPU, RAM, storage), board health, RouterOS and package versions, clock and NTP
- Network: interfaces and counters, bridges, VLANs, WireGuard interfaces and their peers
- Addressing and routing: addresses, ARP, routes, static DNS
- DHCP: servers, networks and leases
- Firewall: filter/nat/mangle/raw rules as JSON, plus address-list management with timeouts
- Monitoring: ping and traceroute from the router, Netwatch, queues, wireless registration
- Maintenance: configuration export, backup, update check, controlled reboot
- Anything else: by running a RouterOS command directly (
mikrotik.cli) — full coverage, including menus added after this connector shipped
Requirements
- RouterOS 7 (version 6 is not supported; the connector relies on version 7 scripting and JSON)
- A correct router clock — NTP solves it
- Outbound HTTPS from the router; a WireGuard tunnel is equally fine
- Full administrator access for the initial install
- A YasnaMCP panel account that may create connectors (needed for the token)
- No extra package, no container and no external disk — which is why it also runs on mipsbe and arm32 boards
Security and control
- No service and no listening port is enabled on the router; only an outbound connection
- Every router has its own key; leaking one does not expose the others
- A router enrolled here is read-only by default; changing configuration needs a deliberate grant
- The operation allow-list is enforced on the server and re-checked on the router
- The key can be revoked at any moment; the router is refused on its next call
- Every call is recorded in the panel, in the service log and in the router log (topic
yasnamcp)
Download the install files
The two-line command is all you normally need. If you want to keep the files, or install on a network without internet access, the current build is here:
- yasna-mt-install.rsc — installer and upgrader
- yasna-mt-agent.rsc — the agent itself, for a manual install
- yasna-mt-selftest.rsc — diagnostics
- yasna-mt-uninstall.rsc — full removal
FAQ
Do I have to enable the MikroTik API service?
No. This connector never uses /ip service api or REST. The router is only an outbound client.
What happens if the router loses internet?
Nothing breaks. The router keeps trying every few seconds and resumes by itself. Meanwhile an assistant call answers “the router is offline” instead of an obscure failure.
How do I widen or narrow the access?
Two layers: the grant in the YasnaMCP panel, and the operation allow-list on the router. A router enrolled here is read-only; opening configuration changes is a deliberate act by the YasnaMCP team or the router’s administrator.
How do I remove it?
Run yasna-mt-uninstall to delete the scheduler, scripts and install files, then revoke the key. Leaving the key unrevoked does not harm the router, but it is a leaked credential.
Which MikroTik models are supported?
Any device running RouterOS 7 — hAP and hEX through CCR and CHR, on any architecture (arm64, arm32, mipsbe, x86).