{"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.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install mcstatus"],"cli":{"name":"mcstatus","version":"usage: mcstatus [-h] [--bedrock | --legacy]"}},"imports":["from mcstatus import JavaServer","from mcstatus import BedrockServer","from mcstatus import JavaServer"],"auth":{"required":false,"env_vars":[]},"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}