MikroTik MCP Server
Provides tools for managing MikroTik routers running RouterOS 6 and 7, including device management, firewall, DHCP, VPN (IPsec, L2TP, WireGuard), configuration profiles, backup/restore, audit logging, and fleet management.
Click on "Install 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., "@MikroTik MCP ServerList my MikroTik devices"
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.
MikroTik MCP Server
A robust Model Context Protocol (MCP) server for managing MikroTik routers running RouterOS 6 and 7. Provides seamless connectivity via SSH, Telnet, or API with automatic command adaptation.
π Quick Start (Python - Recommended)
Python version is simpler and easier to deploy!
1. Install
pip install -e .2. Configure
Copy and edit the example configuration:
cp devices.json.example devices.json
# Edit devices.json with your router details3. Add to Claude Desktop
Add to your Claude Desktop config (%APPDATA%\Claude\claude_desktop_config.json):
{
"mcpServers": {
"mikrotik": {
"command": "python",
"args": ["-m", "mikrotik_mcp.server"]
}
}
}4. Start Using
Restart Claude Desktop and try:
List my MikroTik devices
Connect to router-main and show system infoπ Read Full Python Documentation β
β¨ Features
46+ MCP Tools: Complete router management suite
Multi-Protocol Support: SSH (recommended), API, Telnet
RouterOS 6 & 7 Compatible: Automatic command adaptation
Advanced Features:
Firewall management (filter, NAT, address lists)
DHCP server configuration
VPN setup (IPsec, L2TP, WireGuard)
Configuration profiles
Backup/restore
Audit logging
Fleet management
π¦ Installation Options
Python (Recommended)
# Windows
install-python.bat
# Linux/macOS
chmod +x install-python.sh
./install-python.shTypeScript (Advanced)
npm install
npm run buildπ§ MCP Tools Available
Device Management (13 tools)
list_devices- List all configured routersconnect_device- Establish connectionexecute_command- Run any RouterOS commandget_system_info- System resourcesget_interfaces- Network interfacesget_firewall_rules- Firewall configurationbackup_config- Export configurationAnd more...
Firewall Management (5 tools)
firewall_add_filter_rule- Add filter rulesfirewall_add_nat_rule- Configure NATfirewall_add_address_list- Manage address listsfirewall_get_address_list- View address listsfirewall_remove_rule- Remove rules
DHCP Management (5 tools)
dhcp_create_server- Create DHCP serverdhcp_add_network- Configure networkdhcp_add_static_lease- Add static leasesdhcp_create_pool- Create IP poolsdhcp_get_servers- List DHCP servers
VPN Management (8 tools)
IPsec:
vpn_add_ipsec_peer,vpn_get_ipsec_peersL2TP:
vpn_add_l2tp_user,vpn_configure_l2tp_server,vpn_get_l2tp_connectionsWireGuard:
vpn_add_wireguard_interface,vpn_add_wireguard_peer,vpn_get_wireguard_interfacesGeneric:
vpn_get_ppp_secrets
Configuration Profiles (6 tools)
profile_list- List available profilesprofile_get- Get profile detailsprofile_preview- Preview commandsprofile_apply- Apply profile to deviceprofile_validate- Validate profileprofile_save_current- Save device config as profile
Advanced Features (9 tools)
execute_batch_commands- Run multiple commandsget_fleet_status- Multi-device overviewexecute_on_all_devices- Run command on allcompare_configs- Compare two devicesget_command_history- Audit log accessget_device_audit_stats- Device statisticsget_connection_stats- Connection metricsexport_config- Export without savingrestore_config- Restore from backup
π Project Structure
mikrotik_mcp/
βββ server.py # Main MCP server
βββ device_manager.py # Device lifecycle management
βββ models.py # Pydantic data models
βββ connections/ # SSH, Telnet, API implementations
βββ modules/ # Feature modules
β βββ firewall.py # Firewall management
β βββ dhcp.py # DHCP management
β βββ vpn.py # VPN management
β βββ profiles.py # Configuration profiles
βββ audit.py # Audit logging
βββ cache.py # Response caching
βββ retry.py # Connection retry logic
βββ logger.py # Structured loggingπ Security
Never commit
devices.jsonor.env(already in.gitignore)Use SSH instead of Telnet (encrypted)
Store passwords in environment variables
Enable audit logging for compliance
Regularly update RouterOS firmware
π Documentation
Python Documentation - Detailed Python setup and usage
Quick Start Guide - Get running in 5 minutes
Troubleshooting - Common issues and solutions
Manual - Complete reference guide
Implementation Status - Current progress
π§ͺ Testing
# Run tests
pytest
# With coverage
pytest --cov=mikrotik_mcp --cov-report=html
# Specific test
pytest tests/test_device_manager.pyπ€ Contributing
Contributions welcome! Please:
Fork the repository
Create a feature branch
Make your changes
Add tests
Submit a pull request
π License
MIT License - See LICENSE file for details
π Credits
Built with:
MCP SDK - Model Context Protocol
Paramiko - SSH client
telnetlib3 - Telnet client
routeros-api - MikroTik API
Pydantic - Data validation
π Support
For issues:
Check Troubleshooting Guide
Review Documentation
Check existing GitHub issues
Create a new issue with details
πΊοΈ Roadmap
Basic device management
SSH/API/Telnet support
RouterOS 6/7 compatibility
Firewall management
DHCP management
VPN management (IPsec, L2TP, WireGuard)
Configuration profiles
Audit logging
Wireless management
Queue management
Hotspot management
User management
Backup scheduling
SSH key authentication
Web-based dashboard
Happy routing! π
For detailed setup and usage, see the Python Documentation.
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/stormbliss/Mikrotik-MCP-Server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server