Skip to main content

A library to query Minecraft Servers for their status and capabilities.

Project description

MCStatus

discord chat supported python versions current PyPI version Docs CI status

Mcstatus provides an API and command line script to fetch publicly available data from Minecraft servers. Specifically, mcstatus retrieves data by using these protocols: Server List Ping and Query. Because of mcstatus, you do not need to fully understand those protocols and can instead skip straight to retrieving minecraft server data quickly in your own programs.

Installation

Mcstatus is available on PyPI, and can be installed trivially with:

python3 -m pip install mcstatus

Usage

Python API

Java Edition (1.7+)

from mcstatus import JavaServer

# You can pass the same address you'd enter into the address field in minecraft into the 'lookup' function
# If you know the host and port, you may skip this and use JavaServer("example.org", 1234)
server = JavaServer.lookup("example.org:1234")

# 'status' is supported by all Minecraft servers that are version 1.7 or higher.
# Don't expect the player list to always be complete, because many servers run
# plugins that hide this information or limit the number of players returned or even
# alter this list to contain fake players for purposes of having a custom message here.
status = server.status()
print(f"The server has {status.players.online} player(s) online and replied in {status.latency} ms")

# 'ping' is supported by all Minecraft servers that are version 1.7 or higher.
# It is included in a 'status' call, but is also exposed separate if you do not require the additional info.
latency = server.ping()
print(f"The server replied in {latency} ms")

# 'query' has to be enabled in a server's server.properties file!
# It may give more information than a ping, such as a full player list or mod information.
query = server.query()
print(f"The server has the following players online: {', '.join(query.players.names)}")

Java Edition (Beta 1.8-1.6)

from mcstatus import LegacyServer

# You can pass the same address you'd enter into the address field in minecraft into the 'lookup' function
# If you know the host and port, you may skip this and use LegacyServer("example.org", 1234)
server = LegacyServer.lookup("example.org:1234")

# 'status' is supported by all Minecraft servers.
status = server.status()
print(f"The server has {status.players.online} player(s) online and replied in {status.latency} ms")

Bedrock Edition

from mcstatus import BedrockServer

# You can pass the same address you'd enter into the address field in minecraft into the 'lookup' function
# If you know the host and port, you may skip this and use BedrockServer("example.org", 19132)
server = BedrockServer.lookup("example.org:19132")

# 'status' is the only feature that is supported by Bedrock at this time.
# In this case status includes players.online, latency, motd, map, gamemode, and players.max. (ex: status.gamemode)
status = server.status()
print(f"The server has {status.players.online} players online and replied in {status.latency} ms")

See the documentation to find what you can do with our library!

Command Line Interface

The mcstatus library includes a simple CLI. Once installed, it can be used through:

python3 -m mcstatus --help

License

Mcstatus is licensed under the Apache 2.0 license. See LICENSE for full text.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcstatus-13.1.0.tar.gz (162.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcstatus-13.1.0-py3-none-any.whl (61.1 kB view details)

Uploaded Python 3

File details

Details for the file mcstatus-13.1.0.tar.gz.

File metadata

  • Download URL: mcstatus-13.1.0.tar.gz
  • Upload date:
  • Size: 162.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcstatus-13.1.0.tar.gz
Algorithm Hash digest
SHA256 491f27afd384c8b3dee21fe88d6c0119d2f12f7c8c6b58f44e41afb65b0a8369
MD5 99e527f4aefec9bba24e10f34a44ea9a
BLAKE2b-256 3b1175ade1d6e86e45b8233ef17fc09188dbf29a427856664c33c9097958166e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcstatus-13.1.0.tar.gz:

Publisher: publish.yml on py-mine/mcstatus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcstatus-13.1.0-py3-none-any.whl.

File metadata

  • Download URL: mcstatus-13.1.0-py3-none-any.whl
  • Upload date:
  • Size: 61.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcstatus-13.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76dfaedcdfbadb105c2483a6bba1dd7e5fa9ea3dee8698fe89e4a7651b6d9a21
MD5 7580ff98409b547e729d50466c13de1a
BLAKE2b-256 1590285ae8ab8e4deed57e4c81e021d8d6a9d76fd9cbc8bff04803e77e06a28b

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcstatus-13.1.0-py3-none-any.whl:

Publisher: publish.yml on py-mine/mcstatus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page