Skip to main content
Glama

netdiag-mcp

English | 日本語

オンデマンドのネットワーク診断のためのMCPサーバー — DNSルックアップ(DNSSEC ADビットチェック付き)、ping、mtrベースの経路レポート、TCPポートチェック、HTTPステータス/リダイレクトチェック、TLS証明書検査、WHOISを、すべて1つのサーバーから提供します。

「Xに到達できない」「DNSはまだ伝播しているか」といった報告をトリアージするために、ジャンプホストにシェルインしてその都度dig/ping/curlを実行することなく対応できるように作られています。

Tools

Tool

Purpose

dns_lookup

digを使用してDNSレコードを解決します(A/AAAA/MX/TXT/NS/CNAME/SOA/PTR/CAA)。必要に応じて特定のリゾルバーを指定し、プレーンDNS/DoT/DoHで実行できます。

dnssec_check

既知の検証リゾルバーに問い合わせ、ADビットが設定されているかどうかを報告します(プレーン/DoT/DoH)。プレーンなdig応答にRRSIGが存在しても、それ自体が検証されたことを証明するわけではないため、DNSSEC検証を確認する唯一の信頼できる方法です。

ping_host

ICMP ping(回数は1〜10に制限)

traceroute_path

mtr --reportによるホップごとの経路/損失レポート(固定サイクル、ライブ/連続実行ではない)

tcp_port_check

TCPポートが開いているかどうか — 単純なソケット接続であり、ポートスキャンではない

http_check

URLに対してHEAD/GETを実行し、ステータス、リダイレクトチェーン、レイテンシを報告します

tls_cert_check

ホストが提示する証明書を取得し、サブジェクト/発行者/有効期間/SANを報告します

whois_lookup

ドメインのWHOISルックアップ

asn_lookup

IPのASN + 国コード、またはAS番号の組織情報を、Team Cymruのwhoisサービス経由で検索します — APIキーやGeoIPデータベースは不要

health_check

バージョンと、PATH上に存在するラップされたバイナリ(dig/ping/mtr/whois)を報告します

すべてのツールは読み取り専用で単一ターゲットです(バッチ/スイープモードなし)— これはオペレーターが手動で実行するチェックの便利なラッパーであり、スキャンツールではありません。nmapスタイルのマルチホスト/マルチポートスキャンは意図的に範囲外です。多数のホストやポートを意図的にプローブすることは、別の、より影響範囲の大きいアクションであり、専用のツールと承認フローが必要です。

tcp_port_check、http_check、tls_cert_checkは、nc/curl/opensslにシェルアウトするのではなく、Python自身のsocket/ssl/httpxスタックを使用します。そのため、これらの3つのツールは、dig/ping/mtr/whoisバイナリだけがインストールされているホスト(またはそれらがまったくないホスト)でも動作します。health_checkは、サーバー全体を失敗させることなく、欠落しているものを報告します。

dns_lookup/dnssec_checkは、transport="dot"/"doh"(digの+tls/+https)を介してDNS-over-TLSおよびDNS-over-HTTPSをサポートします。これにはBIND 9.18以降のdigが必要です。古いdigは、暗黙的にプレーンDNSにフォールバックするのではなく、フラグを完全に拒否するため、古いバイナリは、暗号化されたトランスポートでチェックしたという誤った感覚を与える代わりに、大きな音を立てて失敗します。

tls_cert_check/http_checkをベアIPアドレスに対して実行すると、SNIホスト型/CDNフロント型のオリジン(例:Cloudflareの背後)でTLSハンドシェイクが「handshake failure」などのエラーで失敗する可能性があります。TLSのSNI拡張はホスト名のみを運ぶため、IPリテラルは共有エッジ上の正しい証明書にルーティングできません。これは正常なTLS動作であり、ツールのバグではありません。ターゲットがCDNフロント型の場合は、ホスト名でチェックしてください。

Related MCP server: Keel

Setup

1. System dependencies

dns_lookup、dnssec_check、ping_host、traceroute_path、whois_lookupは、それぞれdig、ping、mtr、whoisにシェルアウトします。利用可能にしたいものをインストールしてください:

# Debian/Ubuntu
sudo apt install dnsutils iputils-ping mtr-tiny whois

mtrはrawソケットアクセスを必要とします。Debian/Ubuntuのmtr-tinyパッケージは、インストール時にmtr-packetヘルパーにcap_net_rawを付与するため、通常は追加設定なしで非特権サービスユーザーでも動作します。traceroute_pathがソケット権限エラーを報告する場合は、getcap "$(command -v mtr-packet)"で確認してください。その機能がない場合、traceroute_pathはサーバーをクラッシュさせる代わりに、ToolErrorでクリーンに失敗します。

2. Install

pip install netdiag-mcp
# or
uv tool install netdiag-mcp

3. Claude Code (manual)

claude mcp add netdiag -- netdiag-mcp

環境変数は必要ありません。

CLI

netdiag-mcp --version   # print version
netdiag-mcp --check     # report which wrapped binaries are present (exit 0 when all are)

Security notes

  • すべての外部バイナリ呼び出しはargvリストを渡します(シェル文字列は決して使用しません)。そのため、ツールの引数がシェル構文に抜け出すことはありません。

  • ホスト名/IPおよびポート引数は、使用前に検証され、サイズ/範囲がクランプされます。ツール入力はモデル駆動であり、他のツール呼び出しサーフェスと同様に信頼できないものとして扱われます。

  • tcp_port_checkは、呼び出しごとに正確に1つのホスト:ポートに接続します。設計上、ループや範囲引数はありません。

Development

Live smoke test

単体テストはフィクスチャに対してロジックをチェックしますが、ツールが実際のデータを返さなくなったこと(死んだdig/ping/mtr/whoisバイナリ、壊れたTLSトラストストア、アウトバウンドICMPをブロックするネットワーク)を検出することはできません。scripts/smoke_test.pyは、登録されているすべてのツールを実際の公開エンドポイントに対して実行し、空、不正、またはエラー応答で失敗します:

uv run python scripts/smoke_test.py
uv run python scripts/smoke_test.py --only ping --traceback
  • インベントリがないため、すべてのターゲットは固定の公開エンドポイントです — Cloudflareの1.1.1.1とIANAのexample.com(ドキュメント/テスト用に予約済み、RFC 2606)。このサーバーは設定を受け取らず、このファミリーのデバイスフリートMCPサーバーとは異なり、ターゲットを発見するための情報がありません。

  • tests/test_smoke_probes.pyはオフライン側です。登録されているすべてのツールにプローブ仕様があるか(およびその逆)をチェックするだけで、CIは、誰がそれが動作するかを知る方法を決定せずに追加されたツールを、ネットワークアクセスなしで検出します。

License

MIT

Available Tools

12 tools
asn_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

    A3.7/5.0

    Scored across 12 tools

    Disambiguation5/5

    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.

    Naming Consistency3/5

    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.

    Tool Count5/5

    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.

    Completeness4/5

    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

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      MCP server for DNS lookups, reverse DNS, WHOIS, and domain checks. Zero auth, zero config.
      5
      72 npm
      3
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Network diagnostics — ping, traceroute, DNS lookup, port scanning, and connectivity testing via MCP.
      14
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      MCP 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.
      8
      MIT

    Appeared in Searches