This release is a pre-release and may not be stable for production use.
calagoapi-minecraft
Minecraft servers for CalagoAPI, the Calagopus
panel SDK. MinecraftServer is a calagoapi.Server with Minecraft features:
- commands with output and live console streaming through HungerBridge, the plugin/mod inside the game, using HungerBridgePy;
- players, TPS/MSPT, world data and JVM information;
- the Calagopus Minecraft Version Changer (
server.versions); server.properties, EULA, chat and moderation helpers;- installing HungerBridge and creating its tokens through the panel.
pip install calagoapi calagoapi-minecraft # also installs hungerbridge (HungerBridgePy)
from calagoapi import Panel
from calagoapi.extensions import enable
enable('minecraft', config={'bridge_token': 'calagoapi:9f2c...'})
with Panel(url='https://panel.example.com', api_key='c7sp_...') as panel:
server = panel.minecraft.getServer('abc123', bridge_url='http://10.0.0.5:1913')
print(server.sendCommand('list')) # the command's output
for line in server.streamConsole(history=10, timeout=30):
print(line)
print(f'{server.getPlayerCount()} online, TPS {server.getTPS("1m")}')
print(f'container {server.getRAM()} MiB, heap {server.getMemoryInfo()["used"]:.0f} MiB')
Learn it step by step in the Minecraft tutorials; runnable code is in examples/minecraft/.
Two channels
| Channel | Used by |
|---|---|
| Panel / daemon (CalagoAPI) | everything inherited from Server: start(), stop(), restart(), getRAM(), getCPU(), getStatus(), files, backups, ...; plus server.properties, EULA, server.versions, sendPanelCommand(), installBridge(), createBridgeToken(), server.console |
HungerBridge (HungerBridgePy, server.bridge) |
sendCommand(), streamConsole(), onConsoleLine(), chat helpers, players, TPS/MSPT, world, JVM info, writeLog() |
Nothing falls back silently. Bridge methods without a token raise
BridgeNotConfiguredError; HungerBridge errors are raised as HungerBridgePy's
hungerbridge.HungerBridgeError subclasses (HungerBridgeAuthError with .reason,
HungerBridgeForbidden, HungerBridgeNotFound, HungerBridgeRateLimit,
HungerBridgeConnectionError).
Getting a server
server = panel.minecraft.getServer('abc123') # after enable('minecraft')
server = panel.minecraft.getServer('abc123', address='play.example.com', bridge_url=..., bridge_token=...)
server = panel.minecraft.fromServer(panel.servers.getServerByName('Survival'))
servers = panel.minecraft.getServers() # every visible server, as MinecraftServer
from calagoapi_minecraft import MinecraftServer # works without enable() too
server = MinecraftServer(panel, 'abc123', bridge_token='calagoapi:9f2c...')
Connecting HungerBridge
| Method | Description |
|---|---|
installBridge(minecraft_version=None, loader=None, release=None, replace=True) |
download the right jar into /plugins or /mods (detects loader and version); returns a hungerbridge.ReleaseAsset |
findBridgeRelease(minecraft_version, loader, release=None) |
the jar without installing it |
createBridgeToken(token_id='calagoapi', policy='admin', expiry=None, timeout=30, url=None) |
run hb token create on the console, redeem the pickup, connect; returns 'id:secret' |
redeemBridgePickup(pickup_url) |
redeem a pickup URL (or its /pickup/... part) and connect |
connectBridge(url=None, token=None, **options) |
set URL/token (and BridgeClient options such as timeout) for this server |
setBridge(client), closeBridge() |
use your own BridgeClient; close connections |
bridge |
the hungerbridge.BridgeClient (the full HungerBridgePy API) |
getBridgeUrl(), hasBridge(), isBridgeReachable(), waitForBridge(timeout=120) |
|
getBridgeInfo(), getBridgeTokenInfo(), getPlatform(), getMinecraftVersion() |
/server/meta, /auth/check |
The bridge URL is bridge_url, else the bridge_url config, else the server's address
with bridge_port (1913). HungerBridge binds 127.0.0.1 by default. Set its
bind-address and security.yaml ips so your code can reach it.
Commands and console
| Method | Description |
|---|---|
sendCommand(command, *, silent=False, showConsole=False) |
HungerBridgePy runCommand(): returns the output text, None when silent |
sendCommands(commands, *, silent=False, showConsole=False) |
list of outputs |
sendPanelCommand(command) |
through the panel (Server.sendCommand), no output |
streamConsole(history=0, timeout=None, *, reconnect=None, sanitize=True) |
HungerBridgePy streamLogs(): yields [HH:mm:ss LEVEL]: message lines; history ≤ 200 (True = 200) |
onConsoleLine(callback, history=0, *, reconnect=None, sanitize=True) |
background callbacks; returns the hungerbridge.Stream (.disconnect()) |
writeLog(message, level='info', thread=None) |
write a line to the server log |
say, broadcast(message, prefix=None), tellraw, kick, ban, pardon, op, deop, whitelistAdd, whitelistRemove, saveAll |
chat and moderation (return the command output) |
Game and JVM information
These are additional to the panel's getRAM(), getCPU(), getUptime(), which stay
unchanged (the container as the panel sees it).
| Method | Returns |
|---|---|
getPlayers(), getPlayerCount(), getMaxPlayers() |
names, online count, slots |
getTPS(mode='current') |
'current', '1m', '5m', '15m'; -1 if unavailable |
getMSPT() |
milliseconds per tick |
getPerformance() |
{'tps': {...}, 'mspt', 'players', 'max_players'} |
getWorldTime(), getWorldTimeInfo(), getWeather() |
tick of day, time info, clear/rain/thunder |
getLoadedChunks(), getLoadedEntities() |
per dimension and total |
getMemoryInfo(unit='mib') |
heap, non-heap, JVM, process + used, total, free, max |
getProcessInfo(unit='mib') |
process_used, process_virtual, uptime_ms |
getProcessorInfo() |
load (JVM process, 0–1), processors |
getThreadInfo() |
current, peak, daemon |
getGarbageCollectorInfo() |
gc_type, gc_count, gc_time_ms, last_gc_pause_ms, avg_gc_pause_ms |
getNetworkInfo() |
bytes_in_per_sec, bytes_out_per_sec, total_bytes_in, total_bytes_out |
getJVMUptime(formatted=False) |
ms, or '3h 12m' |
Version Changer
Needs the Calagopus Minecraft Version Changer panel extension.
server.versions. |
|
|---|---|
isAvailable() |
is the panel extension installed? |
getInstalled(), getInstalledBuild(), isUpToDate() |
the installed build and the newest build of its version |
getTypes(), getVersions(type, ...), getBuilds(type, version, ...), getLatestBuild(type, version) |
|
install(build, truncate_directory=False, accept_eula=True, backup=None) |
backup=None uses auto_backup; a failed backup installs nothing |
update(truncate_directory=False, backup=None) |
newest build of the installed version; False if up to date |
Admin (panel.minecraft.versionChanger.): getSettings(), updateSettings(**values),
getStatistics(), getDefaultOrder().
server.properties and EULA
getProperties(), getProperty(key, default=None), setProperty(key, value),
setProperties(values) (comments and order are kept; booleans become true/false),
getMOTD(), setMOTD(motd), acceptEula(), isEulaAccepted().
Configuration
enable('minecraft', config={...}), all optional:
| Key | Default | Meaning |
|---|---|---|
bridge_url |
None |
HungerBridge URL for every server; None uses the server's address + bridge_port |
bridge_port |
1913 |
|
bridge_token |
None |
'tokenId:secret' (secret: masked in diagnostics) |
bridge_timeout |
None |
seconds or (connect, read); None = HungerBridgePy's (5, 30) |
bridge_max_retries |
2 |
retries after HTTP 429 |
stream_reconnect |
True |
default reconnect of streamConsole() / onConsoleLine() |
auto_backup |
False |
back up before server.versions.install() |
backup_name, backup_timeout |
'Before version change', 3600 |
|
release |
'latest' |
HungerBridge release for installBridge() |
repository, github_api |
'HungerNet/HungerBridge', 'https://api.github.com' |
where releases are published |
Without enable(), MinecraftServer uses these defaults (calagoapi_minecraft.settings()).
Async
async with AsyncPanel(url=..., api_key=...) as panel:
server = await panel.minecraft.getServer('abc123')
print(await server.sendCommand('list'))
async for line in server.streamConsole(history=10):
print(line)
AsyncMinecraftServer runs HungerBridgePy in worker threads (one per open stream);
onConsoleLine() accepts coroutine callbacks.
Package layout
| Module | Responsibility |
|---|---|
server.py |
MinecraftServer |
bridge.py |
client creation, pickup parsing, loader/version detection |
versions.py |
VersionManager, VersionChangerAdmin, VersionChangerAPI |
properties.py |
server.properties text handling |
manager.py |
MinecraftManager (panel.minecraft) |
extension.py, config.py |
MinecraftExtension, defaults, validation, settings() |
aio.py |
AsyncMinecraftServer, async type registrations |
exceptions.py |
MinecraftError, BridgeNotConfiguredError |
Replaces the CalagoAPI 1.x packages calagoapi-hungerbridge and calagoapi-version-changer;
see Migrating to 2.0.
Metadata
Release files for calagoapi-minecraft 1.0.dev2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| calagoapi_minecraft-1.0.dev2.tar.gz | 30.9 kB | With provenance | Details for calagoapi_minecraft-1.0.dev2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| calagoapi_minecraft-1.0.dev2-py3-none-any.whl | Python 3 | none | any | Details for calagoapi_minecraft-1.0.dev2-py3-none-any.whl |
Total release size: 55.3 kB
Release files / calagoapi_minecraft-1.0.dev2.tar.gz
| Download URL | calagoapi_minecraft-1.0.dev2.tar.gz |
|---|---|
| Size | 30.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
081274b17b259c06197b0ac5f4412d286d46ca46711d1c17238f751a4cf18a89
|
|
BLAKE2b-256 checksum How to use checksums |
27309b0645323f23c6cbfaecad1917c39c5d9dbeb595984dfd0a8a1ada31518f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / calagoapi_minecraft-1.0.dev2-py3-none-any.whl
| Download URL | calagoapi_minecraft-1.0.dev2-py3-none-any.whl |
|---|---|
| Size | 24.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
378c55f23881857743c9e1d6a62e2cb444c0cc0a864bef5ac960607674e6324c
|
|
BLAKE2b-256 checksum How to use checksums |
39c287aa5901f74bec71ffefbb821b14f85fc1a69e350e66a452d201ef255271
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logSecurity for calagoapi-minecraft 1.0.dev2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for calagoapi_minecraft-1.0.dev2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.