mcbe-ws-sdk
Generic WebSocket gateway SDK for Minecraft Bedrock Edition.
It owns the WS transport, packet protocol, and byte-safe command chunking
(461-byte empirically measured default ceiling; deployments may lower it).
Your host injects behaviour through typed ConnectionHook and ResponseSink
interfaces, with optional typed session/approval control callbacks, and drives
the stack with McbeServerFacade.
There is no message broker and no LLM worker inside the SDK — those stay in the host application.
Minecraft client ←── /wsserver IP:port ──→ Your Python host (this SDK)
In-game addon capability bridge
Use the companion TypeScript addon when your host needs structured information or Script API actions from inside the world—not just player chat. A capability call follows one correlated, chunk-safe round trip:
Python host
→ AddonBridgeService request(capability, payload)
→ scriptevent mcbews:bridge_req
→ addon capability handler in the Bedrock world
→ MCBEWS_BRIDGE simulated-player chat chunks
→ WebSocket PlayerMessage stream
→ AddonBridgeSession reassembles by request_id and resolves the request
→ your host renders the result (tellraw or mcbews:text_resp)
- Bidirectional by design. Python calls addon capabilities; the addon can
also send UI-originated player messages back through the same bridge. Python
can send framed text responses to the addon UI with
mcbews:text_resp. - Safe on the actual transport. Requests and responses carry a
request_id; large payloads are chunked and reassembled rather than relying on a direct addon-to-WebSocket connection. - Clear ownership. The addon owns its capability registry; the Python host owns authentication and authorization. The bridge itself is not a security boundary.
Start with the runnable addon-server example and
the bridge protocol. To load the companion
addon, the target world must enable Experiments → Beta APIs; otherwise its
scripts do not load and capability calls time out.
Install
pip install mcbe-ws-sdk
Editable install for development:
pip install -e ".[dev,docs]"
Requires Python 3.11+.
30-second taste
import asyncio
from mcbe_ws_sdk import McbeServerFacade, NoOpHook
class MyHook(NoOpHook):
async def on_connected(self, state):
print("connected:", state.id)
async def on_player_message(self, state, event, parsed=None):
print(f"{event.sender}: {event.message}")
async def main() -> None:
facade = McbeServerFacade(hook=MyHook())
print(f"ws://{facade.settings.websocket.host}:{facade.settings.websocket.port}")
await facade.run_lifetime()
if __name__ == "__main__":
asyncio.run(main())
Then in Minecraft: /wsserver <this-machine-ip>:8080
For a reply-with-tellraw host, run the ready-made example:
python examples/basic-server/server.py
Documentation
Full beginner tutorial, architecture, protocol, and API reference live on the docs site (English + 中文):
| Online | https://rice-awa.github.io/mcbe-ws-sdk/ |
| Local | pip install -e ".[docs]" && mkdocs serve → http://127.0.0.1:8000 |
| Page | Content |
|---|---|
| Getting Started | Install, 5-minute walkthrough, minimal echo bot, FAQ |
| Architecture | Layer stack and dependency inversion |
| Protocol | mcbews v1 bridge wire format |
| API Reference | Generated from source |
Examples
| Path | What it shows |
|---|---|
examples/basic-server/ |
Echo chat with tellraw (start here) |
examples/addon-server/ |
Capability calls via the companion addon |
examples/addon-capability-call/ |
In-memory bridge round-trip (no game) |
Companion TypeScript addon: addon/. Worlds that load it must enable
Experiments → Beta APIs (see addon README).
Development
pip install -e ".[dev,docs]"
ruff check --no-cache src tests examples
mypy --no-incremental src
pytest -p no:cacheprovider -q
python tools/format.py # ruff format+fix (Python); prettier (Addon if Node)
python tools/format.py --check # CI-style check
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcbe_ws_sdk-0.2.0.tar.gz.
File metadata
- Download URL: mcbe_ws_sdk-0.2.0.tar.gz
- Upload date:
- Size: 3.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
368eea0dc4e63f45f180ea856c9e856469fd009e022dbbb13dc5938b3d1c1ac9
|
|
| MD5 |
f82cd0c5f91522e527c5a66935d1a4e9
|
|
| BLAKE2b-256 |
487540fe1988ae4f62416bbb786c22ca4b67109ca38d86920f518ec8bec68bf5
|
Provenance
The following attestation bundles were made for mcbe_ws_sdk-0.2.0.tar.gz:
Publisher:
release.yml on rice-awa/mcbe-ws-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcbe_ws_sdk-0.2.0.tar.gz -
Subject digest:
368eea0dc4e63f45f180ea856c9e856469fd009e022dbbb13dc5938b3d1c1ac9 - Sigstore transparency entry: 2393594168
- Sigstore integration time:
-
Permalink:
rice-awa/mcbe-ws-sdk@8bdb754417410ac12e0f0dce37e41cdd2555fb1a -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/rice-awa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8bdb754417410ac12e0f0dce37e41cdd2555fb1a -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcbe_ws_sdk-0.2.0-py3-none-any.whl.
File metadata
- Download URL: mcbe_ws_sdk-0.2.0-py3-none-any.whl
- Upload date:
- Size: 61.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb008345999545e08b624d5223ec32b5d58bdcfbc7edbfc149e6f2bd0f8fdb02
|
|
| MD5 |
ed29fc91ae1453e64faaea7af9d588d2
|
|
| BLAKE2b-256 |
54667476523dccaa18395ab325d22a5fd955da9a37f17134097d82715d5e132c
|
Provenance
The following attestation bundles were made for mcbe_ws_sdk-0.2.0-py3-none-any.whl:
Publisher:
release.yml on rice-awa/mcbe-ws-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcbe_ws_sdk-0.2.0-py3-none-any.whl -
Subject digest:
fb008345999545e08b624d5223ec32b5d58bdcfbc7edbfc149e6f2bd0f8fdb02 - Sigstore transparency entry: 2393594734
- Sigstore integration time:
-
Permalink:
rice-awa/mcbe-ws-sdk@8bdb754417410ac12e0f0dce37e41cdd2555fb1a -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/rice-awa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8bdb754417410ac12e0f0dce37e41cdd2555fb1a -
Trigger Event:
push
-
Statement type: