mikrotik-mcp

WireGuard Management

Tools for managing WireGuard VPN interfaces and peers on MikroTik devices (RouterOS v7+).


Interface Management

mikrotik_create_wireguard_interface

Creates a WireGuard interface on MikroTik device.


mikrotik_list_wireguard_interfaces

Lists WireGuard interfaces on MikroTik device.


mikrotik_get_wireguard_interface

Gets detailed information about a specific WireGuard interface, including the public key.


mikrotik_update_wireguard_interface

Updates an existing WireGuard interface on MikroTik device.


mikrotik_remove_wireguard_interface

Removes a WireGuard interface from MikroTik device. All peers belonging to the interface are removed as well.


mikrotik_enable_wireguard_interface

Enables a disabled WireGuard interface.


mikrotik_disable_wireguard_interface

Disables a WireGuard interface without removing it.


Peer Management

mikrotik_add_wireguard_peer

Adds a WireGuard peer to an interface on MikroTik device.


mikrotik_list_wireguard_peers

Lists WireGuard peers on MikroTik device.


mikrotik_get_wireguard_peer

Gets detailed information about a specific WireGuard peer.


mikrotik_update_wireguard_peer

Updates an existing WireGuard peer on MikroTik device.


mikrotik_remove_wireguard_peer

Removes a WireGuard peer from MikroTik device.


mikrotik_enable_wireguard_peer

Enables a disabled WireGuard peer.


mikrotik_disable_wireguard_peer

Disables a WireGuard peer without removing it.


Client Configuration

mikrotik_generate_wireguard_client_config

Generates a WireGuard client configuration file (wg0.conf format). This tool only formats configuration text — it does not communicate with the router. Use mikrotik_get_wireguard_interface to obtain the server public key, and mikrotik_add_wireguard_peer to register the client’s public key on the server side.


Setting Up a WireGuard Server (Step-by-Step)

To configure a complete WireGuard VPN server, use the individual single-responsibility tools in sequence:

  1. Create the WireGuard interfacemikrotik_create_wireguard_interface
    mikrotik_create_wireguard_interface(name="wg0", listen_port=51820)
    
  2. Assign an IP address to the interfacemikrotik_add_ip_address
    mikrotik_add_ip_address(address="10.0.0.1/24", interface="wg0")
    
  3. Allow incoming WireGuard UDP trafficmikrotik_create_filter_rule
    mikrotik_create_filter_rule(
        chain="input",
        action="accept",
        protocol="udp",
        dst_port="51820",
        comment="WireGuard wg0 input"
    )
    
  4. (Optional) Enable internet access for VPN clients via NATmikrotik_create_nat_rule
    mikrotik_create_nat_rule(
        chain="srcnat",
        action="masquerade",
        out_interface="ether1",
        comment="WireGuard wg0 masquerade"
    )
    
  5. Retrieve the server’s public key for client configuration — mikrotik_get_wireguard_interface
    mikrotik_get_wireguard_interface(name="wg0")
    
  6. Register each client on the server — mikrotik_add_wireguard_peer
    mikrotik_add_wireguard_peer(
        interface="wg0",
        public_key="client-base64pubkey==",
        allowed_address="10.0.0.2/32"
    )
    
  7. Generate the client config filemikrotik_generate_wireguard_client_config
    mikrotik_generate_wireguard_client_config(
        client_private_key="client-base64privkey==",
        client_address="10.0.0.2/24",
        server_public_key="server-base64pubkey==",
        server_endpoint="203.0.113.1"
    )