{"id":9928,"library":"mcstatus","title":"mcstatus - Minecraft Server Status","description":"mcstatus is a Python library designed to query Minecraft servers (Java Edition and Bedrock Edition) for their status and capabilities, including player counts, server version, MOTD, and latency. It supports both synchronous and asynchronous operations. The current version is 13.0.1 and it's actively maintained with regular updates.","status":"active","version":"13.0.1","language":"en","source_language":"en","source_url":"https://github.com/py-mcstatus/mcstatus","tags":["minecraft","server","status","query","gaming","api"],"install":[{"cmd":"pip install mcstatus","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"JavaServer","correct":"from mcstatus import JavaServer"},{"symbol":"BedrockServer","correct":"from mcstatus import BedrockServer"},{"note":"The 'MinecraftServer' class was renamed to 'JavaServer' in version 10.0.0. For Bedrock Edition servers, use 'BedrockServer'.","wrong":"from mcstatus import MinecraftServer","symbol":"MinecraftServer","correct":"from mcstatus import JavaServer"}],"quickstart":{"code":"from mcstatus import JavaServer\nimport asyncio\n\nasync def get_server_status(host, port):\n    try:\n        # 'lookup' can infer the port if not provided for default Minecraft Java port\n        server = await JavaServer.async_lookup(f\"{host}:{port}\")\n        status = await server.async_status() # Use async_status for async context\n        print(f\"Minecraft Java Server at {host}:{port}\")\n        print(f\"  Version: {status.version.name}\")\n        print(f\"  Players: {status.players.online}/{status.players.max}\")\n        print(f\"  Latency: {status.latency:.2f}ms\")\n        print(f\"  MOTD: {status.description}\")\n\n    except Exception as e:\n        print(f\"Could not get status for {host}:{port}: {e}\")\n\nif __name__ == '__main__':\n    # Replace with your server details\n    target_host = \"play.hypixel.net\" # Example public server\n    target_port = 25565\n    asyncio.run(get_server_status(target_host, target_port))","lang":"python","description":"This example demonstrates how to asynchronously connect to a Minecraft Java Edition server, retrieve its status, and print key information like version, player count, and latency. It uses `asyncio.run` for a runnable async entry point."},"warnings":[{"fix":"Update your imports from `from mcstatus import MinecraftServer` to `from mcstatus import JavaServer` for Java Edition servers, or `from mcstatus import BedrockServer` for Bedrock Edition.","message":"The primary class for Java Edition servers was renamed from `MinecraftServer` to `JavaServer` in version 10.0.0. A new `BedrockServer` class was introduced for Bedrock Edition.","severity":"breaking","affected_versions":">=10.0.0"},{"fix":"Ensure your environment uses Python 3.10 or newer. Consider using a virtual environment and updating your Python interpreter if needed.","message":"The Python version requirement has been updated multiple times. As of version 13.0.1, it requires Python >=3.10. Older versions of Python are no longer supported.","severity":"breaking","affected_versions":">=13.0.0"},{"fix":"Remove the `async_` prefix when calling asynchronous methods (e.g., `await server.status()` instead of `await server.async_status()`).","message":"Asynchronous methods (e.g., `async_status`, `async_query`, `async_handshake`) were changed in v10.0.0. They are now named `status`, `query`, `handshake` (without the `async_` prefix) and are directly awaitable. The old `async_` prefixed methods were removed.","severity":"breaking","affected_versions":">=10.0.0"},{"fix":"Instead of `server.ping()`, use `server.status().latency` to retrieve the ping value.","message":"The `MinecraftServer.ping()` method was removed in version 10.0.0. Its functionality is now integrated into the `status()` method.","severity":"deprecated","affected_versions":">=10.0.0"},{"fix":"Adjust any code expecting `timedelta` operations on the `latency` value. It is now a simple numeric value in milliseconds.","message":"The `status().latency` attribute, which provides the server ping, changed its return type in version 10.0.0. It now returns a `float` representing milliseconds, instead of a `datetime.timedelta` object.","severity":"gotcha","affected_versions":">=10.0.0"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Update your import and class usage to `JavaServer` for Java Edition servers, or `BedrockServer` for Bedrock Edition servers (e.g., `from mcstatus import JavaServer` and `server = JavaServer.lookup(...)`).","cause":"Attempting to use the old `MinecraftServer` class name, which was renamed in mcstatus v10.0.0.","error":"NameError: name 'MinecraftServer' is not defined"},{"fix":"Double-check the server IP address and port. Verify the Minecraft server is running and accessible from your network. Check local firewall settings on both the client and server machines.","cause":"The server address or port is incorrect, the server is offline, or a firewall is blocking the connection. This often indicates the server is not reachable.","error":"mcstatus.exceptions.MinecraftServerTimeoutError: Could not connect to the server"},{"fix":"Ensure you `await` asynchronous calls, e.g., `status = await server.status()` instead of `status = server.status()`.","cause":"This error occurs when an asynchronous method (like `status()`) is called in an `async` function without the `await` keyword, making Python try to treat the coroutine object itself as a function.","error":"TypeError: 'coroutine' object is not callable"}]}