opnsense-admin-mcp
v0.2.0MCP server for OPNsense network automation, diagnostics, and admin
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
server_info
Return MCP server version, process start time, config source, and SSH mode. Use this to verify the running code is current after deploying changes, and to confirm how the server is configured (env vars vs config.yaml, ssh-agent vs key file). Returns server metadata including the active OPNsense host and instance identifier.
discover
Discover network topology: nodes, VLANs, interfaces, and gateways. Merges ARP table (SSH), DHCP leases, and static reservations. Each node includes ip, mac, hostname, manufacturer (OUI lookup), source (reservation/lease/arp), and description. Saves snapshot to SQLite and compares with previous snapshot to report topology drift (nodes appearing or disappearing, VLANs added or removed). Read-only — no side effects on the router. Safe to call frequently.
health_check
Run full health check suite across OPNsense and MT6000. Checks: API reachability, VLAN interfaces, routing table, ARP table, hardware flags, link speed, interface errors, internet ping, ntopng active monitor uptime since previous run, and (if MT6000 is configured) bridge VLAN, FDB, eth1 link, MT6000 ping. Saves the run to local SQLite history with router uptime for trend analysis. Any WARN or ERROR result is automatically enriched with trend data from SQLite history so you can distinguish persistent issues from transient spikes. Interface error trends include…
get_status
Show status of key OPNsense services: Kea DHCP, Unbound DNS, BIND, and gateways. Returns a structured dict with service statuses, gateway health (loss/rtt), BIND zones and records. Read-only — no side effects. Call this for a quick overview of router health before digging into specific issues with leases, DNS records, or health checks.
list_leases
List active Kea DHCP leases, optionally filtered by VLAN ID. Returns each lease's IP, MAC, hostname, VLAN, reservation flag, and seconds until expiry. Read-only — no side effects. Use this to discover devices on the network, verify DHCP is working, or find a MAC address for adding a reservation.
| Parameter | Type | Description |
|---|---|---|
vlan |
list_reservations
List all static Kea DHCP reservations. Returns IP, MAC, hostname, subnet, and description for each reservation. Read-only — no side effects. Use this to audit static assignments or check if a device already has a reservation before adding a new one.
list_vlans
List VLANs configured on OPNsense. Returns tag, interface, and description for each VLAN. Read-only — no side effects. Use this to verify VLAN configuration matches the intended network topology.
list_unbound_forwards
List Unbound DNS forward zones. Returns each zone's UUID, domain, server, port, and enabled flag. Read-only — no side effects. Use this to verify DNS forwarding is configured correctly, or to find a zone UUID for deletion.
list_bind_zones
List BIND primary zones on OPNsense. Returns each zone's UUID, name, and enabled flag. Read-only. Use this to see which zones exist before adding or querying records.
list_bind_records
List BIND DNS records, optionally filtered by zone name. Returns each record's UUID, zone, name, type, and value. Read-only — no side effects. Use this to inspect DNS records in a zone, or find a record UUID for deletion. Omit the zone parameter to list all records.
| Parameter | Type | Description |
|---|---|---|
zone |
health_runs
Show recent health check run summaries from the local SQLite database. Returns run ID, timestamp, router uptime, and pass/fail/warn/error counts. Read-only — no side effects. Use this to see health trends over time or find a specific run for deeper investigation.
| Parameter | Type | Description |
|---|---|---|
limit | integer |
health_errors
Show interface error trends over time from the health check database. Each row includes timestamp, interface name, ierrs/idrop/oerrs counts, and the router's uptime_seconds at the time of the check. Use uptime_seconds to correlate error spikes with reboots: if uptime resets (drops significantly) between two snapshots, error counters reset too — a jump in oerrs after a low uptime reading indicates errors accumulated since last boot, not a new deterioration. Stable uptime + rising errors = genuine degradation. Read-only — no side effects. Filter by interfac…
| Parameter | Type | Description |
|---|---|---|
interface | ||
limit | integer |
dig
Run a DNS query via OPNsense using ``dig`` over SSH. Returns raw dig output. Read-only — no side effects. Use this to troubleshoot DNS resolution issues from the router's perspective, or verify that BIND/Unbound are serving expected records.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
port | integer | |
rtype | string | |
server | string |
add_reservation
Add a static DHCP reservation to Kea on OPNsense. Finds the matching subnet automatically from the IP address. After saving, triggers a Kea reconfigure to activate the reservation. Side effects: modifies OPNsense DHCP config, triggers service reload. Use this to assign a fixed IP to a device by MAC address.
| Parameter | Type | Description |
|---|---|---|
ip * | string | |
mac * | string | |
description | string | |
hostname | string |
add_unbound_forward
Add a DNS forward zone to Unbound on OPNsense. After saving, triggers an Unbound reconfigure. Side effects: modifies Unbound config, triggers service reload. Use this to forward queries for a domain to an upstream DNS server (e.g., forward home.arpa to BIND at 127.0.0.1:53530).
| Parameter | Type | Description |
|---|---|---|
domain * | string | |
server * | string | |
port | integer |
del_unbound_forward
Delete a Unbound DNS forward zone by UUID. Side effects: modifies Unbound config. Does NOT trigger reconfigure automatically — call reconfigure("unbound") after if needed. Use this to remove a stale forwarding rule.
| Parameter | Type | Description |
|---|---|---|
uuid * | string |
add_bind_record
Add a DNS record to a BIND zone on OPNsense. Side effects: writes to BIND zone file. Does NOT trigger reconfigure automatically — call reconfigure("unbound") or reconfigure("all") after if needed. Use this to add A, AAAA, CNAME, or other record types to a zone.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
rtype * | string | |
value * | string | |
zone * | string |
del_bind_record
Delete a DNS record from BIND by UUID. Side effects: modifies BIND zone. Does NOT trigger reconfigure. Use this to remove an outdated or incorrect DNS record.
| Parameter | Type | Description |
|---|---|---|
uuid * | string |
reconfigure
Reconfigure and reload a service on OPNsense. Valid values: ``kea`` (DHCP), ``unbound`` (DNS), ``all`` (both). Returns the status of each reconfigured service. Side effects: triggers OPNsense service reload — may briefly interrupt DHCP or DNS. Use after adding reservations, forward zones, or DNS records to activate changes.
| Parameter | Type | Description |
|---|---|---|
service * | string |
ntopng_top_hosts
Top N local hosts by bandwidth from ntopng. Calls ntopng REST API v2 at port 3000 on the OPNsense host. Set NTOPNG_USER / NTOPNG_PASSWORD env vars for credentials (default: admin/admin). Set NTOPNG_PORT to override port (default: 3000). Fetches active hosts per interface, sorts by total bytes, returns top N. Read-only — no side effects.
| Parameter | Type | Description |
|---|---|---|
limit | integer |
ntopng_alerts
Hosts with non-zero alert scores from ntopng (community-compatible). alert/list.lua is enterprise-only. This fetches all active hosts and returns those with score > 0, sorted by score descending. Score reflects ntopng's threat/anomaly detection heuristics. Set NTOPNG_USER / NTOPNG_PASSWORD env vars for credentials (default: admin/admin). Read-only — no side effects.
| Parameter | Type | Description |
|---|---|---|
limit | integer | |
min_score | integer |
list_active_monitors
List all ntopng active monitoring entries (continuous ICMP/HTTP probes). Fetches the current active monitoring config via ntopng REST API v2. Returns all configured hosts with their measurement type, alias, threshold, and last known status. Set NTOPNG_USER / NTOPNG_PASSWORD env vars for credentials (default: admin/admin). Read-only — no side effects.
add_active_monitor
Add a host to ntopng active monitoring. Fetches current config, adds the entry, and imports it back. ``target`` is an IP or hostname. ``measurement`` is ``cicmp`` (continuous ICMP, default), ``http``, or ``https``. ``threshold`` is minimum uptime percentage (default 99). ``granularity`` is ``min`` or ``5mins``. ``ifname`` optionally pins to a specific interface (e.g. ``vlan03``). Key format in ntopng config: ``{measurement}@{target}``. Side effects: modifies ntopng active monitoring configuration.
| Parameter | Type | Description |
|---|---|---|
target * | string | |
granularity | string | |
ifname | string | |
measurement | string | |
threshold | integer |
del_active_monitor
Remove a host from ntopng active monitoring. ``target`` can be the full key (``cicmp@host``), a bare hostname/IP (matched against the ``@host`` suffix of every key), or an exact key. Fetches current config, removes matching entry, and imports it back. Side effects: modifies ntopng active monitoring configuration.
| Parameter | Type | Description |
|---|---|---|
target * | string |
ntopng_monitor_timeseries
Fetch historical time series for an ntopng active monitoring probe. ``target`` is the hostname or IP (e.g. ``mt6000.home.arpa``). ``measurement`` is ``cicmp``, ``http``, or ``https``. ``schema`` selects the metric: - ``val_min`` — uptime percentage (default) - ``cicmp_stats_min`` — ICMP RTT min/max (ms) - ``jitter_stats_min`` — latency and jitter (ms) ``hours`` controls the look-back window (default 24, max 168). Returns series data and per-series statistics (min, max, average, p95). Read-only — no side effects.
| Parameter | Type | Description |
|---|---|---|
target * | string | |
hours | integer | |
measurement | string | |
schema | string |
pf_states
Show active PF firewall state table entries. Runs ``pfctl -ss`` on OPNsense via SSH and returns the top N entries. Also returns total state count from ``pfctl -si``. Read-only — no side effects.
| Parameter | Type | Description |
|---|---|---|
limit | integer |
read_log
Read recent lines from an OPNsense system log. Allowed log names: ``filter`` (PF firewall), ``configd``, ``system``, ``dhcpd``, ``dns``, ``ntopng``. Reads from /var/log/<name>/latest.log. Lines capped at 500. For ``system`` and ``configd`` logs, pass ``date`` as ``YYYY-MM-DD`` to read a specific day's archived log (e.g. ``date="2026-05-13"`` reads ``system_20260513.log``). Omit ``date`` to read latest.log as usual. Read-only — no side effects.
| Parameter | Type | Description |
|---|---|---|
date | string | |
lines | integer | |
log | string |
dns_configs
Return raw on-disk config files for DNS/DHCP services on OPNsense. Reads config files via SSH and returns their contents as strings. ``service`` selects which configs to fetch: - ``kea`` — Kea DHCPv4 + DDNS config files - ``bind`` — BIND named.conf + all zone files under /usr/local/etc/namedb/ - ``unbound`` — Unbound unbound.conf - ``dnsmasq`` — dnsmasq.conf (if installed) - ``all`` — all of the above (default) Use this to inspect actual running config rather than API abstractions — useful for debugging DDNS, zone dele…
| Parameter | Type | Description |
|---|---|---|
service | string |
hw_sensors
Read hardware sensor data from OPNsense via sysctl. Returns CPU temperatures (per-core if coretemp loaded), ACPI thermal zones, CPU time breakdown (idle/user/sys), and memory page stats. Read-only — no side effects.
list_packages
List installed packages and OPNsense plugins. Runs ``pkg info`` on OPNsense via SSH and parses the output into categorized groups. ``filter_type`` accepts: ``all``, ``plugins`` (os-* only), ``opnsense`` (opnsense-* packages), ``base`` (everything else). Returns each package's name, version, and description. Read-only — no side effects.
| Parameter | Type | Description |
|---|---|---|
filter_type | string |
shell_run
Execute a read-only command on OPNsense via SSH (allowlisted). Allowed commands: ``hostname``, ``uptime``, ``uname -a``, ``df -h``, ``free -m``, ``netstat``, ``pkg info``, ``pkg version``, ``service -e``, ``sysctl``, ``pfctl -ss``, ``pfctl -si``, ``pfctl -sr``, ``pftop``, ``curl``, ``ls``, ``grep``, ``cat``, ``head``, ``tail`` (and any command starting with one of these). Returns stdout, stderr, and exit code. Read-only — no side effects. For quick system checks without calling individual diagnostic tools.
| Parameter | Type | Description |
|---|---|---|
command * | string |