This release is a pre-release and may not be stable for production use.
mcbe-ws-sdk
Bring your Python ideas into Minecraft Bedrock Edition.
mcbe-ws-sdk is a general-purpose WebSocket gateway SDK for Minecraft Bedrock.
Use familiar async Python to respond to chat commands, inspect player inventories,
connect addon capabilities to your services or consume data as a stream.
The project includes a Python SDK and a companion TypeScript addon. Together they manage connections, protocol negotiation, request correlation, fragmentation and cleanup when a connection ends. Build a chat bot, a game utility or your own interactive experience, and connect it to the model services, message systems and application state you already use. Your host controls authentication and authorization.
The SDK and the addon talk over V2 (MCBEWS/2), which supports capability calls in both directions, notifications, metadata and request streams. The SDK, the addon and the protocol are versioned independently; migration lists the current values.
Read the docs · Get started · Explore the example
Minecraft world (companion addon) ←── /wsserver ──→ Python app (McbeServer)
├── ConnectionHook: input
├── ResponseSink: replies
└── server.v2: capabilities and streams
What you can build
- Respond to game actions with async Python. Handle player messages in a
ConnectionHook, run native commands and await addon results. While your handler waits, the SDK keeps reading and matches each reply to its request. - Call both ways between Python and the addon. Either side can register capabilities, send requests and notifications, and attach call context as metadata. New game-side features reuse the same request mechanism.
- Receive data as it is produced. A request stream can finish normally or be cancelled. Large items are fragmented for transport and reassembled, so your code always receives complete items.
- Keep each player's interactions separate. Every message carries its sender. Work from one player runs in order, while different players can progress independently, so you can store application context by connection and sender.
- Shape the in-game experience. Render results with a
ResponseSinkandMcbeOutboundDelivery, or use native event subscriptions and interceptors to change how your host receives input. - Start from a working example. The default addon already provides player and inventory snapshots, echo, streams and world commands. Run the demo first, then swap in your own handlers.
Run your first example
You need Python 3.11+, Node.js 22 and a Bedrock world with /wsserver available.
Both examples need the companion addon for protocol negotiation.
From the repository root, install the SDK and build the addon:
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e ".[dev,docs]"
npm ci --prefix addon
npm --prefix addon run mcaddon:production
Import addon/dist/packages/mc-ws-sdk.mcaddon into Minecraft. Enable
Experiments → Beta APIs in the target world and activate the behavior pack.
Without Beta APIs the scripts never load, and protocol negotiation times out.
The addon targets Minecraft engine 1.26.30; the full requirements are in the
addon README.
Start the server:
python examples/addon-server/server.py --host 0.0.0.0 --port 8080
Connect from Minecraft and query your inventory:
/wsserver <python-host-ip>:8080
!inv
Use 127.0.0.1 when Python and the game run on the same machine, and the
LAN IP of the Python machine when connecting from another device. Then try:
!helpto list the commands.!echo helloto get an echo back.!stream 5to receive five items followed by completion.
The example reacts only to messages that start with ASCII !, so ordinary chat
stays silent. Press Ctrl+C to stop the server.
Integrate with your application
To use the SDK in your own application, start with a hook. The host below
listens for !inv, asks the addon for the sender's inventory and prints the
result. The SDK takes care of request IDs, sending, timeouts and matching the
reply to its request:
import asyncio
from mcbe_ws_sdk import McbeServer, NoOpHook
class InventoryHook(NoOpHook):
async def on_player_message(self, state, event, parsed=None):
if event.message.strip() != "!inv":
return
response = await server.v2.request(
state.id, "get_inventory_snapshot", {"target": event.sender}
)
print(response["result"])
server = McbeServer(hook=InventoryHook())
asyncio.run(server.run_lifetime())
To show results in the game, add a ResponseSink backed by
McbeOutboundDelivery; the runnable example
has the complete setup. In a multiplayer world, key your per-player state by
(connection_id, event.sender) so each player keeps a separate context.
Find what you need
| Goal | Guide |
|---|---|
| Install, connect, run commands and troubleshoot | Getting started |
| Add capabilities, notifications, metadata and streams | Extension authors |
| Understand queues, lifetimes and ownership | Architecture |
| Subscribe to or intercept game events | Native events |
| Trace requests and diagnose errors | Diagnostics |
| Inspect message fields and transport limits | V2 protocol |
| Upgrade from 0.2.x or roll back a deployment | Migration |
| Look up classes, methods and parameters | API reference |
Good to know
- Choosing an addon pack. The default addon includes snapshots, echo,
streams and world commands. If you only need snapshots, build the lean pack
with
npm --prefix addon run mcaddon:base. - World commands. They pass through a command denylist, but deciding who may call them is still up to your host.
- Long text. Native commands are never split and fail if they exceed the byte budget. tellraw and script events can be split to stay within the default 461-byte budget.
Development and checks
To work on the SDK itself, run these checks from the repository root:
ruff check --no-cache src tests examples tools
mypy --no-incremental src
MCBE_REQUIRE_CROSS_LANGUAGE=1 pytest -p no:cacheprovider -q
mkdocs build --strict
python tools/format.py --check
Cross-language tests need Node.js 22 and the addon's TypeScript dependencies, so
run npm ci --prefix addon first. When those tools are missing, plain pytest
skips the tests that depend on them; with MCBE_REQUIRE_CROSS_LANGUAGE=1 a
missing tool fails the run instead.
Metadata
Release files for mcbe-ws-sdk 0.3.0rc1
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 |
|---|---|---|---|---|
| mcbe_ws_sdk-0.3.0rc1.tar.gz | 3.9 MB | With provenance | Details for mcbe_ws_sdk-0.3.0rc1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcbe_ws_sdk-0.3.0rc1-py3-none-any.whl | Python 3 | none | any | Details for mcbe_ws_sdk-0.3.0rc1-py3-none-any.whl |
Total release size: 4.0 MB
Release files / mcbe_ws_sdk-0.3.0rc1.tar.gz
| Download URL | mcbe_ws_sdk-0.3.0rc1.tar.gz |
|---|---|
| Size | 3.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5e5e183db63f9d7c41f826bd114bbc8d64e17c1811b0d7fd72b3a544d65806e4
|
|
BLAKE2b-256 checksum How to use checksums |
525af3d308fb49817081cdcac137cc38b068ff1cc0785087037a92de8f741ea4
|
| 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 1, 2026.
Transparency logRelease files / mcbe_ws_sdk-0.3.0rc1-py3-none-any.whl
| Download URL | mcbe_ws_sdk-0.3.0rc1-py3-none-any.whl |
|---|---|
| Size | 93.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
67e3f91b81d95a56b166a1b83b7bf964ec5bd5065f678598d558556eea996e7e
|
|
BLAKE2b-256 checksum How to use checksums |
0dafcc706903b18b5c7d48ed8c98edf5c1f0e70ba077ea4a40fca1241a901426
|
| 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 1, 2026.
Transparency logSecurity for mcbe-ws-sdk 0.3.0rc1
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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for mcbe_ws_sdk-0.3.0rc1.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 1, 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.