-
Notifications
You must be signed in to change notification settings - Fork 414
MCP Bridge
Martin Gergeleit edited this page Mar 4, 2026
·
1 revision
The ESP32 NAT Router includes an MCP (Model Context Protocol) server (esp_nat_bridge.py) that allows AI assistants like Claude to configure and monitor the router programmatically. The bridge connects to the router's remote console via telnet and exposes tools covering all router functionality, including live network capture with tcpdump analysis.
pip install fastmcp telnetlib3The router must have the remote console enabled with a password set:
set_router_password mypassword
remote_console enable
Set environment variables to point the bridge at your router:
export ESP_NAT_HOST=192.168.4.1 # Router IP address (default)
export ESP_NAT_PORT=2323 # Remote console port (default)
export ESP_NAT_PASSWORD=mypassword # Remote console password# stdio mode (for MCP clients like Claude Code)
python esp_nat_bridge.py
# HTTP transport
python esp_nat_bridge.py --transport streamable-http --port 8000Add the bridge to your Claude Code MCP settings (~/.claude/claude_desktop_config.json or project .mcp.json):
{
"mcpServers": {
"esp32-router": {
"command": "python",
"args": ["esp_nat_bridge.py"],
"env": {
"ESP_NAT_HOST": "192.168.4.1",
"ESP_NAT_PASSWORD": "mypassword"
}
}
}
}| Category | Tools | Description |
|---|---|---|
| Status |
show_status, show_config, show_mappings, show_acl
|
View router state and configuration |
| Info |
get_heap_info, get_version, get_byte_counts, wifi_scan, ping
|
System info and diagnostics |
| WiFi STA |
set_sta, set_sta_static, set_sta_mac
|
Upstream WiFi configuration (incl. WPA2-Enterprise) |
| WiFi AP |
set_ap, set_ap_ip, set_ap_dns, set_ap_mac, set_ap_hidden
|
Access point configuration |
| DHCP |
add_dhcp_reservation, delete_dhcp_reservation
|
Fixed IP assignments by MAC |
| Port Forwarding |
add_portmap, delete_portmap
|
NAT port mapping rules (STA or VPN interface) |
| Firewall |
acl_add, acl_delete, acl_clear, acl_clear_stats
|
ACL rule management |
| PCAP |
pcap_set_mode, pcap_status, pcap_set_snaplen
|
Packet capture control |
| Network Trace | network_trace |
Live capture with local tcpdump analysis |
| Network |
set_ttl, get_ttl, reset_byte_counts
|
TTL override, byte counters |
| System | restart |
Device management |
| Raw | raw_command |
Send any CLI command directly (disabled) |