mc_wait_for_bridge
Wait for a newly launched Minecraft client to start its DebugBridge, then connect. Verifies the correct instance by game directory or version to avoid conflicts with other running clients.
Instructions
Block until a freshly (re)launched Minecraft client's DebugBridge answers, then connect to it. Sweeps ports 9876-9886 once per second, verifying the answering instance is the expected one — by game directory when known from the previous connection, else by Minecraft version — so a second running instance (e.g. a 1.19 client next to the 1.21 one) is never mistaken for it. Read-only; doesn't require session control.
Use this instead of polling mc_connect yourself after launching the client (typically right after mc_quit_client + a detached launch command — see the mcdev://guides/dev-loop resource). On timeout, the likely causes are a launcher login prompt or a crash during startup.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| timeoutSeconds | No | Give up after this many seconds. Default 120. | |
| expectedVersion | No | Only accept an instance reporting this Minecraft version (e.g. "1.21.11"). Overrides the identity remembered from the previous connection — use when deliberately switching instances. |