Minecraft Java server status pinger. Speaks the actual Server List Ping protocol over a raw TCP socket -- the same handshake, status request, and ping/pong exchange the vanilla client uses -- with no Minecraft client and no third-party library involved.
Standard library only: socket, struct, json. Implements the VarInt
encoding the protocol uses for lengths and packet IDs, sends a handshake
requesting the status state, reads back the JSON status payload, then does
a ping/pong round trip for a real latency number rather than measuring
socket-connect time.
python3 mcping.py <host> [port]
python3 mcping.py <host> [port] --json
Port defaults to 25565.
$ python3 mcping.py mc.hypixel.net
version: Requires MC 1.8 / 1.21 (protocol 765)
motd: Hypixel Network [1.8/26.2]
players: 44508/200000
latency: 129ms
favicon: present (base64 PNG, use --json to extract)
- MOTD can be a plain string or a chat-component object with nested
extraparts (colors, formatting); this flattens it to plain text for the human-readable view.--jsongives you the raw structure if you need the formatting codes. - Only speaks the modern (1.7+) protocol. Servers on 1.6 and earlier used a different, legacy ping format and are not supported.
- No support for Bedrock servers -- that's a different protocol (RakNet) entirely, not just a different port.
MIT, see LICENSE.