Skip to content

Automate the client

Use this page when you want to drive the native client from a script or write a bot against its Rust API. Choose a display mode first, then use the control socket, the MCP launcher or the client messages for the task.

For a bot that needs no images, pass --headless to the native client and set MCRS_SERVER to the server’s host:port. This mode uses the same ClientCorePlugins as the rendered client, without a renderer or window, so it cannot capture images.

For GUI input or screenshots without an OS window, set MCRS_OFFSCREEN to an image size such as 1280x720. This keeps the renderer and a primary Window entity for GUI size and input.1 The off-screen loop schedules frames at 50 ms, nominally 20 FPS. This is a scheduling interval, not a measured frame rate, and it does not use the window’s frame-limit option.2

Cameras targeting a window draw the GUI. A camera targeting an image also draws it when it has the extracted GuiCamera component. The native off-screen entry point marks the player camera with that component, so captures include both the world and GUI.

On Unix, build the native client with the opt-in control feature and pass --control <socket-path>. Without that feature, the argument makes the client exit with an error. The socket accepts state queries and look, movement, hotbar slot, chat, command and attack requests in headless and rendered modes.

Key chords, pointer movement, clicks, scrolling and typing need the primary Window entity, so they work off screen but not headless. Scripted keys count rendered frames; hold and attack count game ticks. The launcher README lists the requests and replies.

The MCP launcher builds, starts and stops local servers and clients, waits for log output and drives client input. Its build tool enables control. Use client_start to start a client: it defaults to off-screen rendering at 1280x720; offscreen chooses another size, window: true opens an OS window and headless: true omits the renderer. The screenshot tool captures a window or off-screen image. The launcher’s session variable is in the environment reference.

For development scenes, a native singleplayer build with the opt-in dev feature also reads MCRS_MENU to open a sample container after joining. Set MCRS_PLAY=1 to start the world given as the argument when it belongs to the game directory’s saves list. Client variables lists the settings.

A bot can use the same state without a GUI. mcrs_minecraft_client_world keeps Vitals and FoodLevel on the local Player, emits PlayerKilled with the death message and RespawnScreen, and accepts the RequestRespawn message. Each request sends ServerboundClientCommand with ClientCommandAction::PerformRespawn when a connection exists. mcrs_minecraft_client_entity also emits EntityDamaged for damage to the local player or a tracked entity.3

Build and test describes the contributor checks.

  1. Works#1184 Adds off-screen rendering, capture and keyboard and pointer control over MCP. ↩

  2. Works#1193 Sets the off-screen frame interval to 50 ms. ↩

  3. Works#1085 Adds the health HUD, death screen and headless respawn messages, with the remaining display and combat limits. ↩

Sources and verification

Verified: 26.4-snapshot-7, 1cf84286c, 2026-11-30

Related open issues:

  • #302 WIP Walker bot and command-driven test bot
  • #1102 Partial Developer launcher and client control: follow-ups