A lightweight Minecraft client for querying the status data of a Minecraft server.
- Minecraft Java (v1.4.0 and later)
- Minecraft Bedrock
- ServerListPing for Minecraft Java servers
- Legacy ServerListPing for Minecraft Java servers before 1.4
- Query Protocol for Minecraft Java servers (this needs to be enabled on the server)
- Bedrock ServerListPing for Minecraft Bedrock servers
pip3 install mcclient-lib
Alternatively, you can install the package directly from Github.
pip3 install git+https://github.com/Sch8ill/MCClient-lib.git
from mcclient import SLPClient
# for Minecraft Java servers from version 1.7.0 and later
slp_client = SLPClient("mc.example.com")
res = slp_client.get_status()
from mcclient import QueryClient
# for Minecraft Java servers (needs to be enabled on the server)
query_client = QueryClient("mc.example.com")
res = query_client.get_status()
from mcclient import BedrockSLPClient
# for Minecraft Bedrock servers
bedrock_slp_client = BedrockSLPClient("mc.example.com")
res = bedrock_slp_client.get_status()
How to handle the returned response object
# The server address and port
host = res.host
port = host.port
motd = res.motd
online_players = res.players.online
max_players = res.players.max
player_list = res.players.list
version = res.version.name
protocol_version = res.version.protocol
# only for query responses
plugins = res.plugins
# only for basic ServerListPing
has_favicon = res.favicon
# only for query and Bedrock responses
gametype = res.gametype
# only for query and bedrock responses
map = res.map
# only for bedrock responses
server_id = res.server_id
# timestamp of the request
timestamp = res.timestamp
# the reponse as a dictonary with some further infomation
# the keys are named like the values in the response object
res_dictionary = res.res
- MOTD
- Online player count
- Max player count
- Player list
- Server version
- Server protocol version
- Mods and plugins
- Has a favicon
- Name of the map
- Hostport and hostip
- Gametype
- Server ID
Note that not every field is queryable with every protocol.
You can find more documentation here, feel free to look into the source if you can't find enough.