Skip to main content

MCStatusio

Tests Lint PyPI - Version PyPI - Python Version PyPI - Downloads

A Python wrapper for the mcstatus.io API that provides an easy way to query Minecraft server status for both Java Edition and Bedrock Edition servers.

Features

  • 🎮 Support for both Java Edition and Bedrock Edition servers
  • 🔄 Synchronous and asynchronous API support
  • 📊 Comprehensive server information (players, version, MOTD, etc.)
  • 🚀 Simple and intuitive interface
  • 🔧 Type hints for better IDE support
  • ⚡ Lightweight with minimal dependencies

Installation

Requirements: Python 3.11 or higher

You can install the package via pip:

pip install mcstatusio

Quick Start

Java Edition Server

from mcstatusio import JavaServer

# Create a server instance (default port is 25565)
server = JavaServer("mc.hypixel.net")
status = server.status()

if status.online:
    print(f"Server is online!")
    print(f"Players: {status.players.online}/{status.players.max}")
    print(f"Version: {status.version.name.clean}")
    print(f"MOTD: {status.motd.clean}")
else:
    print("Server is offline")

Bedrock Edition Server

from mcstatusio import BedrockServer

# Create a server instance (default port is 19132)
server = BedrockServer("play.cubecraft.net")
status = server.status()

if status.online:
    print(f"Server is online!")
    print(f"Players: {status.players.online}/{status.players.max}")
    print(f"Version: {status.version.name}")
    print(f"Edition: {status.edition}")
else:
    print("Server is offline")

Usage Examples

Custom Port

You can specify a custom port either in the hostname or as a parameter:

from mcstatusio import JavaServer

# Method 1: Include port in hostname
server = JavaServer("play.example.com:25566")

# Method 2: Pass port as parameter
server = JavaServer("play.example.com", port=25566)

status = server.status()

Accessing Server Information

from mcstatusio import JavaServer

server = JavaServer("mc.hypixel.net")
status = server.status()

if status.online:
    # Player information
    print(f"Players online: {status.players.online}")
    print(f"Max players: {status.players.max}")
    
    # Version information
    print(f"Version: {status.version.name.clean}")
    print(f"Protocol: {status.version.protocol}")
    
    # Message of the Day
    print(f"MOTD (clean): {status.motd.clean}")
    print(f"MOTD (raw): {status.motd.raw}")
    print(f"MOTD (HTML): {status.motd.html}")
    
    # Server details
    print(f"Hostname: {status.hostname}")
    print(f"IP Address: {status.ip_address}")
    print(f"Port: {status.port}")
    
    # Optional fields (may be None)
    if status.software:
        print(f"Software: {status.software}")
    if status.plugins:
        print(f"Plugins: {len(status.plugins)}")

Error Handling

from mcstatusio import JavaServer
from mcstatusio.exceptions import McstatusioTimeoutError, McstatusioConnectionError

server = JavaServer("invalid.server.address")

try:
    status = server.status()
    if status.online:
        print("Server is online")
    else:
        print("Server is offline")
except McstatusioTimeoutError:
    print("Request timed out")
except requests.exceptions.RequestException as e:
    print(f"Error querying server: {e}")

Async Usage

For asynchronous applications, use the async_status() method:

import asyncio
from mcstatusio import JavaServer

async def check_server():
    server = JavaServer("mc.hypixel.net")
    status = await server.async_status()
    
    if status.online:
        print(f"Players online: {status.players.online}")
    return status

# Run the async function
status = asyncio.run(check_server())

Query Multiple Servers

import asyncio
from mcstatusio import JavaServer

async def check_multiple_servers():
    servers = [
        JavaServer("mc.hypixel.net"),
        JavaServer("play.cubecraft.net"),
        JavaServer("mineplex.com"),
    ]
    
    # Query all servers concurrently
    statuses = await asyncio.gather(*[s.async_status() for s in servers])
    
    for server, status in zip(servers, statuses):
        if status.online:
            print(f"{server.hostname}: {status.players.online} players online")
        else:
            print(f"{server.hostname}: Offline")

asyncio.run(check_multiple_servers())

Custom Timeout

from mcstatusio import JavaServer

# Set a custom timeout (default is 5 seconds)
server = JavaServer("mc.hypixel.net", timeout=10)
status = server.status()

API Reference

JavaServer

Constructor:

  • JavaServer(hostname: str, port: int = 25565, timeout: int = 5)

Methods:

  • status(): Returns server status synchronously
  • async_status(): Returns server status asynchronously

Response Attributes (when online):

  • online: bool - Whether the server is online
  • players.online: int - Number of players currently online
  • players.max: int - Maximum number of players
  • players.sample: list | None - Sample of online players (if available)
  • version.name.clean: str - Clean version string
  • version.protocol: int - Protocol version number
  • motd.clean: str - Message of the Day (plain text)
  • motd.raw: str - MOTD with formatting codes
  • motd.html: str - MOTD in HTML format
  • hostname: str - Server hostname
  • ip_address: str - Server IP address
  • port: int - Server port
  • icon: str | None - Base64-encoded server icon
  • software: str | None - Server software (e.g., "Paper", "Spigot")
  • plugins: list | None - List of plugins (if available)
  • mods: list | None - List of mods (if available)

BedrockServer

Constructor:

  • BedrockServer(hostname: str, port: int = 19132, timeout: int = 5)

Methods:

  • status(): Returns server status synchronously
  • async_status(): Returns server status asynchronously

Response Attributes (when online):

  • online: bool - Whether the server is online
  • players.online: int - Number of players currently online
  • players.max: int - Maximum number of players
  • version.name: str - Version string
  • version.protocol: int - Protocol version number
  • motd.clean: str - Message of the Day (plain text)
  • gamemode: str | None - Server gamemode (e.g., "Survival", "Creative")
  • server_id: str | None - Unique server identifier
  • edition: str | None - Server edition ("MCPE" or "MCEE")
  • ip_address: str - Server IP address
  • port: int - Server port

Documentation

Full documentation is available at Read the Docs.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

Support

Metadata

Release files for mcstatusio 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcstatusio 1.1.1
File Size Uploaded
mcstatusio-1.1.1.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcstatusio 1.1.1
File Interpreter ABI Platform
mcstatusio-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 23.1 kB

Release files / mcstatusio-1.1.1.tar.gz

Download URL mcstatusio-1.1.1.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3de8ff09b9eb1775026055bfdfd0efefa5d2c347c3c71853fef6e4d46754b866
BLAKE2b-256 checksum
How to use checksums
ab79c96ffc1d6137b077b32be853a094cad7414a0b0bd7c9cddfff7dea58736b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / mcstatusio-1.1.1-py3-none-any.whl

Download URL mcstatusio-1.1.1-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f563e3489022f3c23f467d80e8303184a7d91f5c50835c3ff1a90bca1ba64ba
BLAKE2b-256 checksum
How to use checksums
87059eaae69b0025de23c1cc9fe6b8e380bfd4aa1f6135b5ca2090661a37d59d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page