Skip to main content

Generic WebSocket gateway SDK for Minecraft Bedrock Edition

Project description

mcbe-ws-sdk

Languages Python License

Generic WebSocket gateway SDK for Minecraft Bedrock Edition.

It owns the WS transport, packet protocol, and byte-safe command chunking (461-byte hard limit). Your host injects behaviour through ConnectionHook and ResponseSink, 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)

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 servehttp://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

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcbe_ws_sdk-0.1.0.tar.gz (3.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcbe_ws_sdk-0.1.0-py3-none-any.whl (46.8 kB view details)

Uploaded Python 3

File details

Details for the file mcbe_ws_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: mcbe_ws_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for mcbe_ws_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f871691ab9445721186fa2004c2ef6cb8e82294720bd32e3f37398465b2bf36c
MD5 6e0bc6bb68602e2f01e2a1dc8c3fd698
BLAKE2b-256 89cf897786a102fd056163006a9c109270420e327b924f9887cc4a12d57714b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcbe_ws_sdk-0.1.0.tar.gz:

Publisher: release.yml on rice-awa/mcbe-ws-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcbe_ws_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mcbe_ws_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 46.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for mcbe_ws_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bbe1e0ba24197b76d8a6b5fa402bdeacc73d21ff157732086c1388c6fd47e398
MD5 15f766a11a77bf49751f8b491a7a2631
BLAKE2b-256 2bf4acfc582eaf1a917505976b14311ec300b584c192ef71d3489c06651ce619

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcbe_ws_sdk-0.1.0-py3-none-any.whl:

Publisher: release.yml on rice-awa/mcbe-ws-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page