Skip to content

Scripting on BDS ​

BDS runs JavaScript from behavior packs and offers APIs the normal game does not.

ModuleUseBDS only?
@minecraft/serverWorld, players, eventsNo
@minecraft/server-uiFormsNo
@minecraft/server-adminAdministration, secrets, join controlMostly or entirely
@minecraft/server-netHTTP, WebSocket, packet eventsYes
@minecraft/diagnosticsSentry error reportingYes

The admin, net, and diagnostics modules are beta. Enable Beta APIs on the world and expect breaking changes. BDS has no setting for this: turn it on when creating the world in the game, then copy the world to the server.

Checklist ​

  1. Add a script module and dependencies to the behavior pack's manifest.json.
  2. Allow the modules.
  3. Enable Beta APIs if needed.
  4. Activate the pack.
  5. Enable content-log console output and start.

Example manifest ​

json
{
  "format_version": 2,
  "header": {
    "name": "My server tools",
    "description": "Server-only script",
    "uuid": "REPLACE-WITH-UUID-1",
    "version": [1, 0, 0],
    "min_engine_version": [1, 26, 60]
  },
  "modules": [{
    "type": "script",
    "language": "javascript",
    "uuid": "REPLACE-WITH-UUID-2",
    "version": [1, 0, 0],
    "entry": "scripts/main.js"
  }],
  "dependencies": [
    { "module_name": "@minecraft/server", "version": "beta" },
    { "module_name": "@minecraft/server-admin", "version": "beta" },
    { "module_name": "@minecraft/server-net", "version": "beta" }
  ]
}

Generate two new UUIDs. If your build rejects the beta version alias, use the exact version in its API documentation.

The beta alias works on 1.26.66.1. Permissions, variables, secrets, HTTP, allowlist, and snapshot samples ran on a live server. Samples needing a player (join gate, kick, transfer), packet contents, a working WebSocket, or Sentry delivery were not exercised end to end.

Common errors ​

Console saysFix
the Beta APIs experiment is not enabledTurn on Beta APIs for the world. Without it, even @minecraft/server at beta fails
requesting dependency on module [...] but it is not configured to use itAllow the module
Import [...] not foundFix the file name in your import

Unofficial community wiki. Not approved by or associated with Mojang or Microsoft.