netdiag-mcp
Run on-demand, read-only network diagnostics from one MCP server.
Resolve DNS records (A/AAAA/MX/TXT/NS/CNAME/SOA/PTR/CAA), optionally via a specific resolver and over plain DNS, DoT, or DoH.
Check DNSSEC validation via the AD bit using a known-validating resolver.
Ping hosts/IPs and get fixed-cycle
mtrhop/loss path reports.Test whether a single TCP port is open.
Check HTTP status, redirects, and latency, and fetch textual/JSON/XML response bodies up to 1 MiB.
Inspect TLS certificates: subject, issuer, validity, and SANs.
Look up WHOIS domain information and ASN/country/org information for IPs or AS numbers.
Get current date/time/weekday in an IANA timezone, plus UTC and epoch.
Check server health, version, available wrapped binaries, configured
http_getauth prefixes, and NAT64 prefix.
It is intentionally single-target and read-only, not a batch or port-scanning tool.
Queries Cloudflare's 1.1.1.1 as a default validating resolver for DNS and DNSSEC checks; also used as a smoke-test target.
Uses Cloudflare's public DNS resolver (1.1.1.1) as a default validating resolver for DNS lookups and DNSSEC AD-bit validation checks, and cites Cloudflare-fronted origins as an example of CDN SNI behaviour in the README.
Click on "Deploy 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., "@netdiag-mcp check if port 443 is open on example.com"
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.
netdiag-mcp
English | 日本語
MCP server for on-demand network diagnostics — DNS lookups (with a DNSSEC AD-bit check), ping, an mtr-based path report, TCP port checks, HTTP status/redirect checks, TLS certificate inspection, and WHOIS, all from one server.
Built for triaging "can't reach X" / "is DNS propagated yet" reports without shelling into a jump host for each one-off dig/ping/curl.
Tools
Tool | Purpose |
| Resolve a DNS record via |
| Query a known-validating resolver and report whether the AD bit is set (plain/DoT/DoH) — the only reliable way to confirm DNSSEC validation, since an RRSIG being present in a plain |
| ICMP ping (count clamped to 1-10) |
| Hop-by-hop path/loss report via |
| Is a TCP port open — a plain socket connect, not a port scan |
| HEAD/GET a URL and report status, redirect chain, and latency |
| GET a URL and return the body. Textual types only ( |
| Fetch the certificate a host presents and report subject/issuer/validity/SANs |
| WHOIS lookup for a domain |
| ASN + country-code lookup for an IP, or org info for an AS number, via Team Cymru's whois service — no API key or GeoIP database needed |
| Current date, time and weekday in an IANA timezone — the weekday is returned as data because deriving it from a date is arithmetic that fails silently. Also reports UTC and epoch, so it doubles as a clock check |
| Version and which wrapped binaries ( |
All tools are read-only and single-target (no batch/sweep mode) — this is a
convenience wrapper around checks an operator would run by hand, not a
scanning tool. nmap-style multi-host/multi-port scanning is intentionally
out of scope; deliberately probing many hosts or ports is a different,
higher-blast-radius action that deserves its own tooling and approval flow.
tcp_port_check, http_check, http_get and tls_cert_check use Python's
own socket/ssl/httpx stack rather than shelling out to nc/curl/openssl,
so those four tools work even on a host with only the dig/ping/mtr/whois
binaries installed (or none of them — health_check reports which are
missing without failing the whole server).
dns_lookup/dnssec_check support DNS-over-TLS and DNS-over-HTTPS via
transport="dot"/"doh" (dig's +tls/+https). This needs dig from
BIND 9.18+ — an older dig rejects the flag outright rather than silently
falling back to plain DNS, so a stale binary fails loudly instead of giving
a false sense of having checked over an encrypted transport.
tls_cert_check/http_check against a bare IP address can fail TLS
handshake with a "handshake failure" or similar error on SNI-hosted /
CDN-fronted origins (e.g. behind Cloudflare) — TLS's SNI extension only
carries hostnames, so an IP literal can't route to the right certificate on
a shared edge. This is normal TLS behavior, not a tool bug; check by
hostname when the target is CDN-fronted.
Related MCP server: Keel
Setup
1. System dependencies
dns_lookup, dnssec_check, ping_host, traceroute_path and
whois_lookup shell out to dig, ping, mtr and whois respectively.
Install whichever of these you want available:
# Debian/Ubuntu
sudo apt install dnsutils iputils-ping mtr-tiny whoismtr needs raw-socket access. Debian/Ubuntu's mtr-tiny package grants
cap_net_raw to the mtr-packet helper at install time, so it normally
works for an unprivileged service user without further setup — verify with
getcap "$(command -v mtr-packet)" if traceroute_path reports a socket
permission error. Without that capability, traceroute_path fails cleanly
with a ToolError rather than crashing the server.
2. Install
pip install netdiag-mcp
# or
uv tool install netdiag-mcp3. Claude Code (plugin)
This repository doubles as a single-plugin marketplace, so Claude Code can install the server for you:
/plugin marketplace add shigechika/netdiag-mcp
/plugin install netdiag-mcp@netdiag-mcpThe plugin launches uvx netdiag-mcp. No environment variables are required — the
only prerequisite is the system dependencies above, and the TCP, HTTP and TLS
checks work even without them.
uvx must be on the PATH of the process that runs Claude Code — a login
shell usually has it, but a GUI-launched app may not; install
uv system-wide if the plugin fails to start.
4. Claude Code (manual)
claude mcp add netdiag -- netdiag-mcpNo environment variables are required.
5. Codex
codex mcp add netdiag -- netdiag-mcpAny other MCP client that launches stdio servers works the same way: give it
netdiag-mcp as the command.
Optional: credentials for http_get
http_get can send an Authorization header to URLs under a configured https
prefix, for reading a protected JSON endpoint without handing the credential to
the model. Set NETDIAG_HTTP_AUTH to a JSON object mapping prefix to header
value:
NETDIAG_HTTP_AUTH='{"https://reports.example.ac.jp/daily/": "Bearer <token>"}'The header is chosen per request and per redirect hop by comparing the parsed URL (https only, exact host and port, path prefix on a
/boundary). A redirect to anywhere else drops it, along with any cookie set while it was attached.user@hostURLs never match, and neither does a path with anything beyond letters, digits,.,_,~,-and/(no%,;or./..segments), so a server cannot normalise a matched URL out of the prefix. The longest matching prefix wins; two prefixes that differ only in case,:443or a trailing dot are rejected as duplicates. Values must be printable ASCII.netdiag-mcp never puts the value into its own output, errors or
health_check; the result's status line saysauth=appliedwhen the final hop carried it, andhealth_checklists the configured prefixes in canonical form (not the values). Errors name a bad prefix by position, not by text. A response body under the prefix has the value (and its token part) masked as[redacted], but an endpoint that transforms it (for example base64) would still reveal it, so point a prefix only at endpoints you control.A malformed value fails loudly:
http_getreturns an error andhealth_checkreportsdegraded.It is read from the environment only. If several instances run as the same user (for example one open to many users and one restricted), set it only in the environment of the instance that should send it — a file would be shared by all of them.
Optional: NAT64 on an IPv6-only host
On a host with IPv6 only, names already work through the network's DNS64, but
an IPv4 literal such as 192.0.2.33 fails with "Network is unreachable". Set
NETDIAG_NAT64_PREFIX to the network's NAT64 prefix (RFC 6052, /96 only, bits 64-71 zero):
NETDIAG_NAT64_PREFIX=64:ff9b::/96ping_host,traceroute_path,tcp_port_check,tls_cert_check,http_check,http_getand theresolverofdns_lookup/dnssec_checkthen reach an IPv4 literal through the address synthesized from the prefix (IPv4 loopback is used as is). The output still names the IPv4 target and says which address was used:via NAT64 <address>for ping, traceroute, the TCP and TLS checks and the DNS resolver, and avia NAT64: <IPv4> -> <IPv6>line for the connectionshttp_check/http_getopened (their URLs stay IPv4).For HTTP the
Hostheader stays the IPv4 literal, and for https the certificate is still checked against it.http_getrefuses an address under the configured prefix or the well-known prefix64:ff9b::/96when the IPv4 address it carries is blocked (or is0.0.0.0), so a DNS64 answer under one of them cannot reach a metadata endpoint either. The well-known prefix is checked whether or not the variable is set. Any other prefix, the RFC 8215 local-use64:ff9b:1::/48included, is covered only when it is the one configured, because its layout depends on the network.Only the TCP connection changes, so proxies from the environment or the system settings (with
NO_PROXY) work as before; a proxy given as an IPv4 literal is reached through NAT64 too, except one on IPv4 loopback.Unset, IPv4 literals are used as given. A malformed value makes the affected tools return an error and
health_checkreportdegraded.
CLI
netdiag-mcp --version # print version
netdiag-mcp --check # report missing binaries and a malformed NETDIAG_HTTP_AUTH or NETDIAG_NAT64_PREFIX (exit 0 when all binaries are present and the settings, if any, parse)Security notes
Every external-binary call passes an argv list (never a shell string), so no tool argument can break out into shell syntax.
Hostname/IP and port arguments are validated and size/range-clamped before use — tool input is model-driven and treated as untrusted, the same as any other tool-calling surface.
tcp_port_checkconnects to exactly one host:port per call; there is no loop or range argument, by design.The optional
http_getcredential never leaves the configured https prefix and netdiag-mcp never prints it; a response body that echoes it is the server's doing (see above).
Development
Live smoke test
Unit tests check logic against fixtures; they cannot tell you that a tool has
stopped returning real data (a dead dig/ping/mtr/whois binary, a
broken TLS trust store, a network that blocks outbound ICMP). scripts/ smoke_test.py runs every registered tool against real public endpoints
and fails on empty, malformed or error answers:
uv run python scripts/smoke_test.py
uv run python scripts/smoke_test.py --only ping --tracebackNo inventory, so every target is a fixed public endpoint — Cloudflare's
1.1.1.1and IANA'sexample.com(reserved for documentation/testing use, RFC 2606). This server takes no config and has nothing to discover a target from, unlike a device-fleet MCP server in this family.tests/test_smoke_probes.pyis the offline half: it only checks that every registered tool has a probe spec (and vice versa), so CI catches a tool added without deciding how anyone would know it works, without needing network access.
License
MIT
Available Tools
12 toolsasn_lookupA
ASN + country-code lookup for an IP, or org info for an AS number (e.g. AS15169 or 15169).
Via Team Cymru's whois service — no API key or GeoIP database needed. Takes an IP literal or AS number, not a hostname; resolve first with dns_lookup if you only have a name.
Inputs: target (required). Returns: result
current_timeA
Current date, time and weekday in an IANA timezone (e.g. "Asia/Tokyo").
Call this rather than deriving the weekday from a date yourself — that is calendar arithmetic and it fails silently. Returns the date, the 24h time, the weekday in English and Japanese, the offset, UTC and the epoch, so it also serves as a clock check on this server.
Inputs: timezone.
dns_lookupA
Resolve a DNS record via dig. record_type: A/AAAA/MX/TXT/NS/CNAME/SOA/PTR/CAA.
Pass resolver to query a specific nameserver instead of the host default (e.g. to check whether a change has propagated to a given resolver). transport: "plain" (UDP/TCP 53, default), "dot" (DNS-over-TLS, 853) or "doh" (DNS-over-HTTPS, 443). Requires dig from BIND 9.18+; an older dig rejects dot/doh outright instead of silently querying over plain DNS.
Inputs: hostname (required), resolver, transport, record_type. Returns: result
dnssec_checkA
Check whether a name validates DNSSEC against a known-validating resolver (AD bit).
transport: "plain" (default), "dot" or "doh" — compare validation over plain DNS vs. an encrypted transport when port 53 may be intercepted.
Inputs: hostname (required), resolver, transport. Returns: result
health_checkA
Service health: version, wrapped binaries on PATH, the http_get auth prefixes and the NAT64 prefix.
Returns a fixed shape (status/service/version + backend fields) so a monitoring caller never has to branch on missing keys. status is "healthy" when every wrapped binary is found and NETDIAG_HTTP_AUTH and NETDIAG_NAT64_PREFIX (if set) parse, "degraded" otherwise (the affected tools fail at call time). http_auth lists the configured URL prefixes, never the header values. nat64 shows the prefix IPv4 literals are reached through on an IPv6-only host (null when unset).
Inputs: no named parameters.
http_checkB
HEAD/GET a URL and report status, redirect chain and latency.
Inputs: url (required), timeout. Returns: result
http_getA
GET a URL and return the response body (text/JSON/XML only, capped at max_bytes, hard cap 1 MiB).
Use this to read a JSON endpoint or inspect an error page. For status/latency only, use http_check instead.
Inputs: url (required), timeout, max_bytes. Returns: result
ping_hostB
ICMP ping a host or IP. count is clamped to 1-10.
Inputs: host (required), count. Returns: result
tcp_port_checkA
Check whether a TCP port is open (plain socket connect, no port scanning).
Inputs: host (required), port (required), timeout. Returns: result
tls_cert_checkA
Fetch the TLS certificate presented on host:port and report subject/issuer/validity/SANs.
Inputs: host (required), port. Returns: result
traceroute_pathB
Path/MTU-style hop report via mtr --report (fixed cycles, not a live run). cycles clamped 1-10.
Inputs: host (required), cycles. Returns: result
whois_lookupC
WHOIS lookup for a domain.
Inputs: domain (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Each tool targets a distinct diagnostic purpose: DNS resolution, DNSSEC validation, HTTP status/body, ICMP, TCP ports, TLS certs, traceroute, WHOIS, ASN, health, and time. The closest overlaps, http_check vs http_get and dns_lookup vs dnssec_check, are explicitly differentiated in their descriptions.
All names use snake_case and are readable, but the verb placement is mixed: most are noun_verb (dns_lookup, http_check), while ping_host is verb_noun and traceroute_path/current_time are noun phrases. The convention is serviceable but not fully predictable.
Twelve tools is well-scoped for a network diagnostics server, covering common checks without excessive breadth. Each tool appears to earn its place by covering a distinct diagnostic category.
The surface covers the core network diagnostic workflows: DNS, DNSSEC, HTTP, ICMP, TCP, TLS, traceroute, WHOIS, ASN, health, and time. Minor gaps exist, such as no UDP port check or broader HTTP request methods, but agents can work around them for diagnostics.
Maintenance
Related MCP Connectors
Public DNS, mail, TLS, and web diagnostics plus Looking Glass probes via remote MCP.
Network, domain and website diagnostics for AI clients via MCP.
Remote MCP server: 19 domain-hygiene and email-auth tools (DNS, SPF, DMARC, DKIM, TLS).
IP lookup, DNS, DNSSEC, WHOIS, TLS, email and blocklist checks, and a domain report card.
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server for DNS lookups, reverse DNS, WHOIS, and domain checks. Zero auth, zero config.572 npm3MIT
- AlicenseAqualityCmaintenanceNetwork diagnostics — ping, traceroute, DNS lookup, port scanning, and connectivity testing via MCP.14MIT
- AlicenseAqualityDmaintenanceMCP server providing DNS resolution, reverse DNS, RDAP-based WHOIS, and IP geolocation lookups. No API keys required , and all upstreams are public.4MIT
- AlicenseBqualityDmaintenanceMCP server for network diagnostics providing tools like ping, DNS lookup, port check, traceroute, speed test, Wake-on-LAN, SSL certificate check, and MAC address lookup.8MIT