Docker & Linux Deployment
Single-binary CGO_ENABLED=0 deployment over local --stdio or native Go --http with zero Node.js or supergateway.
The multi-stage build compiles a static CGO_ENABLED=0 pure-Go binary into a single-layer Alpine runtime image measuring 41.5 MB unpacked (11.4 MB compressed). Using RUN --mount=type=bind and setcap cap_net_raw+ep /usr/local/bin/mcp-adv-netutils avoids duplicating the binary across layers while granting raw ICMP/ARP socket privileges to unprivileged USER netutils.
Container & Native Go Quickstart
# Local --stdio mode (zero open ports, zero secrets)
docker run -i --rm ghcr.io/frankxlt/mcp-adv-netutils:latest --stdio
# Static CGO_ENABLED=0 build & HTTP + Cron + /web startup (+ offline tests: go test -race ./...)
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -trimpath -tags netgo -o mcp-adv-netutils .
./mcp-adv-netutils --http --http-addr=:8000 --data-dir=./data --watchlist=./watchlist.yaml
Docker Compose Pattern
Grant NET_RAW for ICMP, path MTU, and ARP probes and mount /data for persistent SQLite storage. On older container kernels (such as Synology DSM 4.4), omit runc exec container healthchecks and monitor GET /healthz externally.
services:
mcp-netutils:
image: ghcr.io/frankxlt/mcp-adv-netutils:latest
restart: unless-stopped
init: true
cap_add: [NET_RAW]
environment: [PASS_HASH=${PASS_HASH}, PATH_SECRET=${PATH_SECRET}, LAN_MCP_TOKEN=${LAN_MCP_TOKEN}]
command: ["--http", "--http-addr=:8000", "--data-dir=/data", "--max-store-mb=256", "--watchlist=/app/watchlist.yaml"]
volumes: ["mcp_netutils_data:/data"]
ports: ["8000:8000"]
Two-Doorway Endpoints & Client Config
| Endpoint | Doorway | Auth & Boundary |
|---|---|---|
/{PATH_SECRET}/mcp | Remote Streamable HTTP | High-entropy secret path + 30m Passphrase Deadbolt |
/lan/{LAN_MCP_TOKEN}/mcp | LAN Streamable HTTP | LAN_MCP_TOKEN + RFC1918 source check + proxy-header reject |
/sse | LAN Legacy SSE | Backward-compatible SSE stream, RFC1918-only & no proxy headers |
/web | Network Studio | Embedded 4-theme browser app with anti-CSRF Origin/Host checks |
/healthz | Liveness Probe | Unauthenticated JSON readiness check for external monitors |
{
"mcpServers": {
"netutils-lan": { "url": "http://netutils.example:8000/lan/TOKEN/mcp" },
"netutils-stdio": { "command": "docker", "args": ["run", "-i", "--rm", "ghcr.io/frankxlt/mcp-adv-netutils:latest", "--stdio"] }
}
}
Network Studio (/web & ./demo/)
Interactive browser console with Apache ECharts SVG graphs, Saved Destinations, goal-grouped checks, and side-by-side Past Run comparisons.
Open /web from any desktop, tablet, or phone browser—or preview offline sample fixtures in the Live Demo (?demo=1)—across four themes (Pure White, Warm Paper, Dark, Dark Paper) and two display densities (Comfortable / Compact).
Workspace Highlights
- Interactive KPI Triage Cards: Clickable, keyboard-accessible summary cards display 24h Uptime % (
—when no scheduled checks exist yet), Active Problems, Saved Destinations, and Saved History Size, jumping directly to the corresponding section. - Pinned Destinations & Above-the-Fold Quick List: Favorite targets appear beside + Add Destination and Scan Pinned at the top of Checks, backed by a compact desktop Saved Destinations list directly beneath Run a Check and the full table below.
- 4 Goal Category Filters: Filter Check Type cleanly across Path & Ping, Web & DNS, Ports & Host, and Wake with context-aware fields for Port Group, Wake MAC chips, and a direct jump link to full subnet scans in Local Network.
- Apache ECharts SVG Visualizations (
renderer: 'svg'): Renders crisp theme-aware path latency & packet-loss whiskers, HTTP/TLS response timing waterfalls, DNS resolver comparison bars, and24h / 7d / 30duptime & response-time timelines. - Chart / Table Toggle & Export Copy: Flip any result card or past-run view between Chart and Table modes, and copy formatted Markdown with Copy Summary or tab-separated rows with Copy Data (TSV).
- Local Network Inventory: Search devices by name, IP, MAC, or vendor, choose a comparison baseline, and filter All, Physical Hardware, Containers & VMs, and Changed vs. Baseline with inline response bars and 1-click
Ping,Check Ports,Wake, andSaveactions. - Schedule & History with Past Run Drawer (
<dialog>): Inspect24h / 7d / 30dtimelines, enable automated 5-minute monitoring via + Enable 5-Min Monitoring, or click any row in Past Check Runs to open a native modal drawer with Run Again & Compare.
All 33 Registered MCP Tools
12 hardened core tools, 6 active L2–L7 probes, 8 multi-probe recipes, 4 cron, destination & archive tools (including manage_saved_destinations), 1 digest renderer, and 2 Deadbolt session controls (33 total registered MCP tools).
Showing 33 of 33 registered MCP tools
1. Hardened Core Tools (12)
| Tool | Layer | Capabilities & Hardening |
|---|---|---|
mac_vendor_lookup | L2 | Embedded 39,800+ IEEE OUI table; classifies physical [UAA] vs virtual [LAA] |
ping | L3 | Per-call Echo ID isolation, IPv4/IPv6 TTL control messages, explicit icmp vs tcp_fallback |
traceroute | L3 | Rejects leading - targets, inserts -- delimiter, bounds concurrent hop PTR lookups |
tcp_port_scan | L4 | Concurrent TCP connect with single-resolution dial and presets (common, homelab, web, iot) |
dns_reverse_batch | L7 | Concurrent reverse PTR resolution capped at 256 validated IPs per call |
wol_wake | L2 | Transmits 102-byte UDP Wake-on-LAN Magic Packet frames (port 7 or 9) |
local_dns_query | L7 | Queries OS local resolvers for A, AAAA, CNAME, MX, NS, PTR, and TXT |
remote_dns_query | L7 | Queries Cloudflare and Google DNS-over-HTTPS (DoH) |
resolve_hostname | L7 | Resolves IPv4, IPv6, or dual-stack host addresses |
whois_query | L7 | Domain registration and registrar metadata lookup via WHOIS |
http_ping | L7 | HTTP timing waterfall (dns, conn, tls, ttfb, total) |
tls_certificate_check | L7 | Verifies against x509.SystemCertPool() + wire intermediates; supports Ed25519 keys |
2. Active L2–L7 Probes (6)
| Tool | Layer | Description |
|---|---|---|
arp_neighbor_sweep | L2 | OS/ARP neighbor discovery (mdlayher/arp) enriched with OUI vendors and UAA/LAA flags |
mtu_path_probe | L3 | Sends DF-bit probes across 1500, 1492, 1420, and 1280 bytes to detect path fragmentation black holes |
mtr_path_quality | L3 | Multi-cycle per-hop loss, min/avg/max RTT, and jitter matrix across the path |
mdns_ssdp_discover | L7 | Bounded mDNS (hashicorp/mdns) and SSDP/UPnP local service discovery |
split_dns_audit | L7 | Audits record parity and TTL drift between internal resolvers and external DoH |
snmp_switch_port | L2 | Read-only SNMP (gosnmp) switch port, VLAN, LLDP, and MAC FDB correlation |
3. Multi-Probe Recipes (8)
| Recipe | Scope | What It Coordinates |
|---|---|---|
recipe_diff_ping | L2–L4 | Parallel 4-stage ladder (NIC → Gateway → WireGuard/WAN → Canary) + ARP + TCP RST/SYN-ACK |
recipe_diff_dns | L7 | Local resolver vs external DoH comparison to isolate split-horizon overrides |
recipe_diff_http | L7 | Direct backend vs external reverse-proxy latency waterfall and status diff |
recipe_diff_snapshot | L2/L3 | Compares live LAN inventory to baseline snapshot showing [+], [-], and [~] deltas |
recipe_host_card | L2–L7 | Single-host summary combining DNS, ICMP/TCP reachability, open ports, TLS, and OUI vendor |
recipe_lan_radar | L2/L3/L7 | ARP sweep + embedded OUI + batch PTR + mDNS/SSDP + SNMP grouped by UAA vs LAA |
recipe_path_autopsy | L3 | Consolidated hop loss/jitter matrix, route trace, and DF-bit path MTU ceiling |
recipe_wake_verify | L2–L4 | Sends Magic Packet to a UAA MAC and polls ARP/ICMP/TCP until online |
4. Saved Destinations, Cron, Digest & Deadbolt Controls (7)
| Tool | Category | Behavior |
|---|---|---|
manage_saved_destinations | Destinations | list | save | delete | run persisted targets with TargetGuard validation and automatic dest_<id> cron watchlist synchronization |
get_cron_status | Cron / Archive | Sub-5ms 24h, 7d, and 30d health strips and active consecutive-failure alert counts |
manage_cron_watchlist | Cron / Archive | Inspects, adds, updates, pauses, resumes, runs, or removes watchlist.yaml entries |
get_job_report | Cron / Archive | Re-pulls any persisted job_id diagnostic run within its 30d expires_at window |
render_run_digest | Digest Renderer | Consolidates and re-renders stored job_id runs into default, quick, rich, or json |
unlock_netutils | Deadbolt | Voice-normalizes passphrase and opens 30-minute Deadbolt window via SHA-256 |
lock_netutils | Deadbolt | Immediately closes the Deadbolt window before the 30-minute timer expires |
MCP & CLI Terminal Output
Three-Tier ASCII formatting (default, quick, rich) and compact json scoped strictly to MCP clients and CLI terminals—while /web renders Apache ECharts SVG graphs and structured tables.
Browser operators in Network Studio (/web) inspect interactive Apache ECharts graphs, sortable tables, and Markdown/TSV exports. For conversational MCP clients and terminal runs (including --run-watchlist-once), pass the style parameter to match the caller viewport:
style | Width / Cap | Formatting Contract | Best Target Client |
|---|---|---|---|
default | 72 cols exact | Single-line header split, severity-sorted rows, and footer job_id | Chat panes, IDE terminals, 900px tablets |
quick | ≤ 40 cols | Borderless compact lines with zero mid-row wrapping | Folded 390px phones and mobile chat |
rich | 76 cols boxed | Double-line TUI frame, sparklines, 30d health bar, and status legend | 1440px+ desktops and CLI postmortems |
json | < 18.5 KB | FAIL → WARN → OK sorted rows; compacts OK rows first if capped | Automated MCP/CI pipelines and /web API |
default, quick, and rich output verbatim inside a fenced text code block so markdown engines never reflow fixed columns.
To inspect an older incident at a different width over MCP without re-sending packets, call render_run_digest with the archived job_id and desired style.
Cron Watchlist & 30d Retention
Scheduled background checks escalating after two consecutive failures, backed by bounded 30-day SQLite WAL storage.
mcp-adv-netutils embeds robfig/cron/v3 (with SkipIfStillRunning overlap protection) to execute watchlist.yaml and synced dest_<id> Saved Destination schedules in --http mode, or once on demand via --run-watchlist-once for external systemd timers.
- Two-Failure Alert Threshold: A single non-OK check records a soft pending state without firing an alert; status escalates only after
>= 2consecutive failed checks. - 30-Day Job Archive (
netutils_jobs.db): Pure-Go SQLite WAL storage (modernc.org/sqlite, read queries via?mode=ro) persists every manual, MCP, Saved Destination, and scheduled check with explicitexpires_attimestamps. - Bounded Storage Retention: Granular healthy
*/5mticks compact across7d → 30dwhile failures keep full diagnostic payloads; an hourly TTL reaper runsPRAGMA incremental_vacuumand enforces--max-store-mb 256.
Default watchlist.yaml Structure
jobs:
- id: wan-canary-ping
schedule: "*/5 * * * *"
tool: recipe_diff_ping
target: "1.1.1.1"
enabled: true
- id: wg-mtu-check
schedule: "*/15 * * * *"
tool: mtu_path_probe
target: "1.1.1.1"
enabled: true
- id: split-dns-diff
schedule: "0 */6 * * *"
tool: recipe_diff_dns
target: "example.com"
enabled: true
- id: edge-http-diff
schedule: "0 */6 * * *"
tool: recipe_diff_http
target: "https://example.com"
enabled: true
Security Architecture
Five fail-closed defense layers isolating remote doorways, LAN-only sockets, browser APIs, target CIDRs, and container privileges.
| Layer | Control | Mechanism |
|---|---|---|
| Layer 1 | 30-Minute PASS_HASH Deadbolt | SHA-256 + voice normalization + crypto/subtle.ConstantTimeCompare; 30m auto-relock and immediate lock_netutils |
| Layer 2 | Two-Doorway Setup | Remote /{PATH_SECRET}/mcp + /web vs LAN /lan/{LAN_MCP_TOKEN}/mcp & /sse rejecting forwarding headers and non-RFC1918 peers |
| Layer 3 | /web/api/* Anti-CSRF & Rebinding | Strict same-origin Origin checks and allowlisted Host header validation |
| Layer 4 | Central TargetGuard & CLI -- | DNS-resolved CIDR checks (--allow-cidrs / --deny-cidrs), mandatory 169.254.0.0/16 block, no-shell -- separation |
| Layer 5 | Unprivileged Runtime | USER netutils, minimal cap_net_raw+ep binary capability, runtime-only secret env vars |
169.254.0.0/16 is unconditionally blocked regardless of allowlist flags, and PASS_HASH stores only a 64-character hex SHA-256 digest—never a plaintext passphrase.
5 Bundled Agent Skills (skills/)
Ready-to-load SKILL.md playbooks in skills/ aligning AI assistants with all 33 MCP tools.
| Skill | Core Tools Covered | Operational Focus |
|---|---|---|
netutils-ascii-display | style, render_run_digest | Picks quick/default/rich/json widths and enforces verbatim fenced terminal output |
netutils-differential-ping | recipe_diff_ping, mtu_path_probe, mtr_path_quality | 4-stage fault isolation, icmp vs tcp_fallback interpretation, PMTUD black holes |
netutils-lan-radar | recipe_lan_radar, recipe_diff_snapshot, recipe_wake_verify | Physical [UAA] vs virtual [LAA] grouping, baseline diffs, & WOL verification |
netutils-split-horizon-web | recipe_diff_dns, recipe_diff_http, unlock_netutils | Internal vs DoH parity, HTTP waterfall bottlenecks, TLS chains, and Deadbolt usage |
netutils-cron-monitor | get_cron_status, manage_cron_watchlist, manage_saved_destinations, get_job_report | 24h/7d/30d strips, dest_<id> sync, two-failure alerting, & 7d → 30d compaction |