OpenWRT SSH MCP Server
Enables remote management of OpenWrt routers via SSH, providing tools for system monitoring, network configuration, WiFi management, firewall rules, DHCP leases, package management with opkg, and OpenThread Border Router configuration for Thread/Matter networks.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@OpenWRT SSH MCP Server show me the current WiFi status and connected clients"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
OpenWRT SSH MCP Server π³
A containerized MCP (Model Context Protocol) server for managing OpenWRT routers via SSH. This server allows AI agents (like Claude) to execute commands and manage OpenWRT routers remotely and securely.
π STATUS: β Fully functional and tested with physical router
β¨ Features
π³ Docker Ready - Optimized image with multi-stage build (271MB)
π Robust Security - Command whitelist, read-only filesystem, audit logging
π οΈ 23 OpenWRT Tools - Complete router management (network, system, Thread, packages, firmware OTA)
π Easy Integration - Compatible with Claude Desktop and VS Code
π Monitoring - Detailed logs of all operations
π MCP Toolkit - Fully compatible with Docker Desktop MCP
π¦ Package Management - Install/remove IPK packages with opkg
π OpenThread OTBR - Support for Thread Border Router
Related MCP server: remote-admin-mcp
Architecture
βββββββββββββββββββββββ
β Claude / VS Code β β Your AI agent
ββββββββββββ¬βββββββββββ
β MCP Protocol (stdio)
β
ββββββββββββΌβββββββββββ
β Docker Container β β MCP Server
β ββββββββββββββββ β
β β MCP Server β β
β β (Python) β β
β ββββββββ¬ββββββββ β
βββββββββββΌββββββββββββ
β SSH
β
βββββββββββΌββββββββββββ
β OpenWRT Router β β Your physical router
β (192.168.1.1) β
βββββββββββββββββββββββFeatures
π Secure SSH authentication (password or key-based)
π οΈ OpenWRT-specific tools (ubus, uci)
β Command validation with whitelist
π Audit logging
π³ Docker support (optional)
π Integration with Claude Desktop and VS Code
Requirements
Python 3.10+
OpenWRT router with SSH enabled
SSH access to router (root user recommended)
Installation
1. Clone or create the project
cd "c:\Users\Luis Antonio\Documents\UNAL\MCPs-OpenWRT"2. Create virtual environment and install dependencies
python -m venv venv
.\venv\Scripts\activate # Windows
pip install -e .3. Configure SSH credentials
# Copy example file
copy .env.example .env
# Edit .env with your router credentials4. Generate and copy SSH key (recommended)
# Generate dedicated key
ssh-keygen -t ed25519 -f ~/.ssh/openwrt_router -C "MCP Server"
# Copy to router
ssh-copy-id -i ~/.ssh/openwrt_router.pub root@192.168.1.1
# Update .env
OPENWRT_KEY_FILE=C:\Users\YOUR_USER\.ssh\openwrt_routerπ§ Configuration
Claude Desktop (Docker)
Includes optimized configuration in claude_desktop_config.json:
{
"mcpServers": {
"openwrt-router-docker": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"--network", "host",
"--env-file", "C:\\Users\\Luis Antonio\\Documents\\UNAL\\MCPs-OpenWRT\\.env",
"--mount", "type=bind,src=C:\\Users\\Luis Antonio\\.ssh,dst=/root/.ssh,readonly",
"openwrt-ssh-mcp:latest"
]
}
}
}VS Code with GitHub Copilot
The project includes complete VS Code configuration:
Option 1: Direct Python (Recommended)
# Open workspace
code mcp-openwrt.code-workspace
# In Copilot Chat (Ctrl+Shift+I):
"What OpenWRT tools do I have available?"Option 2: With Tasks
Terminal > Run Task > "Start MCP Server (Python)"Option 3: Startup Script
.\start-mcp-vscode.ps1Script Helper
Use docker-mcp.ps1 for all operations:
.\docker-mcp.ps1 build # Build image
.\docker-mcp.ps1 run # Run server
.\docker-mcp.ps1 test # Test connection
.\docker-mcp.ps1 logs # View logs
.\docker-mcp.ps1 shell # Open shell
.\docker-mcp.ps1 clean # Clean allπ οΈ Available Tools
System & Network (8 tools)
openwrt_test_connection- Test SSH connectionopenwrt_execute_command- Execute raw command (validated)openwrt_get_system_info- System info (uptime, memory, CPU)openwrt_restart_interface- Restart network interfaceopenwrt_get_wifi_status- WiFi status and clientsopenwrt_list_dhcp_leases- List DHCP clientsopenwrt_get_firewall_rules- View firewall rulesopenwrt_read_config- Read UCI config file
OpenThread Border Router (5 tools)
openwrt_thread_get_state- Current Thread stateopenwrt_thread_create_network- Create new Thread networkopenwrt_thread_get_dataset- Get network credentialsopenwrt_thread_get_info- Complete Thread network infoopenwrt_thread_enable_commissioner- Allow new devices
Package Management (6 tools)
openwrt_opkg_update- Update package listsopenwrt_opkg_install- Install IPK packagesopenwrt_opkg_remove- Remove packagesopenwrt_opkg_list_installed- List installed packagesopenwrt_opkg_info- Detailed package infoopenwrt_opkg_list_available- List available packages
Firmware OTA (4 tools)
openwrt_firmware_version- Current firmware version, board model, release infoopenwrt_firmware_upload- SCP a local.img/.binto/tmp/firmware.imgwith SHA256 checkopenwrt_firmware_verify-sysupgrade -Tto validate without flashingopenwrt_firmware_flash- Flash viasysupgradewith optionalkeep_settings(clean install when false)
π¬ Usage Examples
Once configured, you can ask Claude:
System & Network
"Show me the WiFi status on my router"
"List connected devices"
"Restart the wan interface"
"What's the router's memory usage?"
Package Management
"Update the package repositories"
"Install the luci-app-openthread package"
"Show me installed packages"
"Give me information about the ot-br-posix package"
OpenThread
"Create a Thread network called 'MyHome' on channel 15"
"Show me the Thread network status"
"Enable the commissioner to add new devices"
"Give me the Thread network credentials"
Security
β οΈ IMPORTANT: This server has root access to your router. Make sure to:
Use SSH key authentication (not password)
Keep
.envout of version controlReview commands before production execution
Enable audit logging
Limit SSH access from router to your PC
π Documentation
π Quick Start
QUICKSTART_DOCKER.md - Quick start with Docker
TEST_OPKG.md - Test IPK package management
π Detailed Guides
DOCKER_GUIDE.md - Complete Docker guide
π§ͺ Testing
# Test with helper script
.\docker-mcp.ps1 test
# Test with MCP Inspector
npm install -g @modelcontextprotocol/inspector
npx @modelcontextprotocol/inspector docker run -i --rm openwrt-ssh-mcp:latest
# View logs
.\docker-mcp.ps1 logsπ Implemented Security
β Read-only filesystem - Immutable container
β No capabilities - No special permissions
β SSH keys read-only - Protected keys
β Command whitelist - Only safe commands
β Audit logging - Complete logging
β Volatile tmpfs - /tmp cleaned on restart
β No privilege escalation - No sudo
π― Use Cases
Advanced Workflows
π Automated backup of UCI configurations
π Network monitoring - Connected devices, resource usage
π§ AI-guided troubleshooting
π Automatic documentation of changes
π¨ Network anomaly alerts
π¦ Package management - Install/update software
π Thread configuration - Create and manage Thread/Matter networks
π‘οΈ Security auditing - Review firewall rules
π³ Docker Hub (Optional)
# Publish your image
docker login
docker tag openwrt-ssh-mcp:latest yourusername/openwrt-ssh-mcp:latest
docker push yourusername/openwrt-ssh-mcp:latestπ οΈ Development
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Format code
black .
ruff check --fix .
# Rebuild after changes
.\docker-mcp.ps1 buildπ€ Contributing
Contributions are welcome! Please:
Fork the project
Create a branch for your feature
Commit your changes
Push to the branch
Open a Pull Request
π Resources
π License
MIT
Made with β€οΈ for the OpenWRT and MCP community
Available Tools
19 toolsopenwrt_execute_commandA
Execute a validated shell command on the OpenWRT router. Commands are validated against a security whitelist. Use this for commands not covered by other specialized tools.
Inputs: command (required).
openwrt_get_firewall_rulesB
Get current firewall rules (iptables)
Inputs: no named parameters.
openwrt_get_system_infoA
Get comprehensive system information including board details, uptime, memory usage, and CPU load
Inputs: no named parameters.
openwrt_get_wifi_statusB
Get WiFi status including connected clients and signal strength
Inputs: no named parameters.
openwrt_list_dhcp_leasesB
List all DHCP leases (connected devices with IP/MAC addresses)
Inputs: no named parameters.
openwrt_opkg_infoC
Get detailed information about a specific package
Inputs: package_name (required).
openwrt_opkg_installC
Install a package using opkg
Inputs: package_name (required).
openwrt_opkg_list_availableB
List available packages from repositories (limited to 500 packages)
Inputs: no named parameters.
openwrt_opkg_list_installedB
List all installed packages on the router
Inputs: no named parameters.
openwrt_opkg_removeC
Remove a package using opkg
Inputs: package_name (required).
openwrt_opkg_updateA
Update package lists from repositories (opkg update)
Inputs: no named parameters.
openwrt_read_configA
Read a UCI configuration file. Allowed configs: network, wireless, dhcp, firewall, system
Inputs: config_name (required).
openwrt_restart_interfaceC
Restart a network interface (e.g., wan, lan, wlan0)
Inputs: interface (required).
openwrt_test_connectionB
Test SSH connection to the OpenWRT router
Inputs: no named parameters.
openwrt_thread_create_networkB
Create a new Thread network with specified parameters. This will initialize a new Thread network, configure it, and start it. Returns network credentials including network key and dataset.
Inputs: network_name, channel, panid.
openwrt_thread_enable_commissionerB
Enable Thread Commissioner to allow new devices to join the network. Devices can join using the provided passphrase.
Inputs: passphrase.
openwrt_thread_get_datasetA
Get active Thread dataset (network credentials). Returns dataset in both human-readable and hex format for sharing.
Inputs: no named parameters.
openwrt_thread_get_infoA
Get comprehensive Thread network information including state, channel, PAN ID, network name, IP addresses, neighbors, and children.
Inputs: no named parameters.
openwrt_thread_get_stateA
Get current OpenThread network state (disabled, detached, child, router, leader)
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 19 tools
Every tool has a clearly distinct purpose targeting specific resources and actions in the OpenWRT domain. For example, opkg tools handle package management, Thread tools manage Thread networking, and system tools cover firewall, DHCP, WiFi, etc., with no overlapping functionality. The general execute_command tool is explicitly reserved for commands not covered by specialized tools, preventing confusion.
All tool names follow a consistent verb_noun pattern with the prefix 'openwrt_' (e.g., openwrt_get_firewall_rules, openwrt_opkg_install, openwrt_thread_create_network). This uniform naming convention makes the tool set predictable and easy to navigate, with no deviations in style or structure.
With 19 tools, the count is slightly high but reasonable for the comprehensive scope of OpenWRT router management, covering system info, networking, package management, and Thread networking. It avoids bloat by focusing on core operations, though it could be streamlined by merging some related tools without losing functionality.
The tool surface provides complete coverage for OpenWRT management, including CRUD operations for packages (install, remove, list), system monitoring (info, firewall, WiFi, DHCP), network configuration (restart interface, read config), and Thread networking lifecycle (create, enable, get info). No obvious gaps exist; agents can perform end-to-end tasks without dead ends.
Maintenance
Related MCP Connectors
- DNS-DATA RemoteDeprecatedcom.dns-data
Connect AI assistants to authorized Windows and macOS devices for files, commands, and management.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Let AI operate servers without SSH. Choose actions, approve risky changes, and audit every step.
IP intelligence, network diagnostics, and AI service availability tools for AI agents.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI assistants to monitor and securely manage AsusWRT and AsusWRT-Merlin routers via SSH with allowlisted commands, supporting read-only monitoring and controlled mutations.473MIT
- AlicenseAqualityBmaintenanceEnables AI assistants to manage remote servers via SSH with agentless command execution, file operations, and service management.9MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to read-only monitor iStoreOS/OpenWRT routers via SSH or HTTP/ubus API, providing 31 tools for system status, network info, logs, and plugin status (OpenClash, Passwall, AdGuardHome, etc.).31MIT
- AlicenseNot gradedqualityDmaintenanceAllows you to interact with an OpenWrt router via SSH, enabling command execution, file operations, and system info retrieval.ISC