Labsco
teefloo logo

AsusWRT MCP Server

β˜… 1

from teefloo

Model Context Protocol server for secure AsusWRT router administration via SSH. Provides 42+ read-only monitoring tools and guarded mutation tools for managing AsusWRT/Merlin routers.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedAccount requiredNeeds API keys

AsusWRT MCP Server

Python 3.11+ MIT License Project Status: Active

mcp-name: io.github.teefloo/asuswrt-mcp

Model Context Protocol (MCP) server for secure, controlled administration of AsusWRT and AsusWRT-Merlin routers via SSH.

Overview

This MCP server provides AI assistants (like Claude, Cursor, etc.) with a safe interface to monitor and manage AsusWRT routers. It operates exclusively over SSH using allowlisted operationsβ€”no arbitrary command execution, no firmware modifications, and no factory resets.

Features

Read-Only Monitoring (42 tools)

CategoryTools
Identity & HealthRouter model, firmware version, uptime, load, memory
NetworkLAN/WAN details, DNS config, IPv6 status, routing table
ClientsConnected clients, DHCP leases, ARP neighbors
WirelessRadio status, SSIDs, guest networks, client counts per band
ServicesRunning processes, open ports, cron jobs
StorageUSB devices, mounts, partitions, filesystem usage
SecurityUPnP, DDNS, Samba status, conntrack usage
VPNOpenVPN server, WireGuard, VPN client profiles
AdministrationWeb admin ports, SSH/telnet access settings
DiagnosticsSSH TCP/banner/auth diagnostics, config snapshot

Mutation Tools (with safety guards)

All mutation tools require:

  • confirm: true parameter
  • ASUSWRT_ALLOW_MUTATIONS=true environment variable
  • Support for dry_run: true to preview changes
ToolDescription
asuswrt_restart_serviceRestart allowlisted services (httpd, firewall, wireless, dnsmasq, etc.)
asuswrt_dhcp_serverEnable/disable DHCP server
asuswrt_upnpEnable/disable UPnP
asuswrt_radioEnable/disable Wi-Fi radio bands
asuswrt_guest_wifiEnable/disable guest Wi-Fi
asuswrt_guest_lan_accessToggle LAN access for guest Wi-Fi
asuswrt_port_forwardingList, add, remove, enable/disable port forwarding rules
asuswrt_vpn_serverEnable/disable OpenVPN server
asuswrt_parental_accessList, block, unblock, remove parental control rules
asuswrt_parental_block_allToggle block-all mode
asuswrt_dhcp_reservationList, add, remove DHCP static reservations

Safety Model

  • No arbitrary SSH: Only allowlisted commands are executed via NVRAM and service calls
  • No firmware operations: No flash, reset, or bootloader access
  • Secret redaction: Passwords and sensitive data are never exposed in tool responses
  • Dry-run support: Every mutation can be previewed before applying
  • Confirmation required: Mutations require explicit confirm=True
  • SSH-only transport: No exposure of the router's web API

Development

Run tests

pip install -e ".[dev]"
pytest

Run with live router integration tests

ASUSWRT_TEST_ROUTER=1 pytest

Project Structure

asuswrt-mcp/
β”œβ”€β”€ src/asuswrt_mcp/
β”‚   β”œβ”€β”€ server.py          # FastMCP entrypoint & tool definitions
β”‚   β”œβ”€β”€ service.py         # Business logic & router operations
β”‚   β”œβ”€β”€ config.py          # Settings management
β”‚   β”œβ”€β”€ clients/
β”‚   β”‚   └── ssh.py         # SSH client wrapper
β”‚   β”œβ”€β”€ nvram.py           # NVRAM parsing utilities
β”‚   β”œβ”€β”€ ssh_parsers.py     # Output parsers for SSH commands
β”‚   β”œβ”€β”€ security.py        # Mutation guards & redaction
β”‚   β”œβ”€β”€ validators.py      # Input validation
β”‚   β”œβ”€β”€ responses.py       # Tool response formatting
β”‚   β”œβ”€β”€ errors.py          # Custom exceptions
β”‚   └── serialization.py   # Safe serialization
β”œβ”€β”€ tests/                 # Test suite (69 tests)
β”œβ”€β”€ .env.example           # Example configuration
β”œβ”€β”€ pyproject.toml         # Project metadata
└── README.md              # This file

License

MIT License - see LICENSE for details.

Acknowledgments