Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

mcping

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.

Overview

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.

Usage

python3 mcping.py <host> [port]
python3 mcping.py <host> [port] --json

Port defaults to 25565.

Example

$ 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)

Notes

  • MOTD can be a plain string or a chat-component object with nested extra parts (colors, formatting); this flattens it to plain text for the human-readable view. --json gives 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.

License

MIT, see LICENSE.

About

Minecraft Java Server List Ping over a raw socket, pure Python stdlib

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages