[PR #1344] [MERGED] Launcher MCP: every CLI command is a tool of the same name, plus settings and agent-config #3492

Closed
opened 2026-11-03 04:09:55 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1344
Author: @ludovic111
Created: 10/23/2026
Status: ✅ Merged
Merged: 10/23/2026
Merged by: @ludovic111

Base: main ← Head: feat/agent-control-launcher


📝 Commits (2)

  • b117930 No AI: one switch that turns off agent control (socket, horizon-ctl, both MCP servers)
  • ef792ec Launcher MCP: every CLI command is a tool of the same name, plus settings and agent-config

📊 Changes

17 files changed (+1031 additions, -271 deletions)

View changed files

📝 crates/horizon-client/src/bin/horizon-ctl/commands.rs (+3 -2)
📝 crates/horizon-client/src/bin/horizon-ctl/main.rs (+43 -1)
📝 crates/horizon-client/src/extras.rs (+7 -1)
📝 crates/horizon-client/src/game.rs (+7 -1)
📝 crates/horizon-core/src/lib.rs (+1 -0)
➕ crates/horizon-core/src/no_ai.rs (+97 -0)
📝 launcher/README.md (+27 -19)
➕ launcher/src/agents.rs (+147 -0)
📝 launcher/src/backend.rs (+11 -0)
📝 launcher/src/cli.rs (+172 -3)
➕ launcher/src/cli_tools.rs (+339 -0)
📝 launcher/src/game_tools.rs (+6 -6)
📝 launcher/src/lib.rs (+1 -0)
📝 launcher/src/main.rs (+1 -0)
📝 launcher/src/mcp.rs (+44 -226)
📝 tools/agent_control_e2e.py (+67 -5)
📝 tools/launcher_mcp_e2e.py (+58 -7)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Stacked on #1342 (the No AI switch): merge that first.

What

The launcher's MCP offers every CLI command as a tool of the same name and arguments, generated from the CLI's clap definition (launcher/src/cli_tools.rs), so the two can't drift:

  • mods_search is horizon-launcher mods search; its arguments are the command's (snake_case), positional ones and flags alike; a call runs that command with --json as a child process and returns its output (JSON where the command has some).
  • So the mod browser (mods_*, including #1269's mods_check), modpacks (modpack_*), hosted servers (servers_*), settings, game_args, desktop_entry, data collection (data_*), update, notes, benchmark are all tools now; a new CLI command becomes a tool by itself.
  • Destructive ones (remove, mods_remove, modpack_remove, servers_forget, account_sign_out, data_delete) need confirm: true and carry destructiveHint; the ones that send data carry openWorldHint.
  • The session keeps a few in-process, renamed after the CLI: play (was launch_client; now also takes join for an invite code), server with server_command, server_log, server_stop (were start_server, stop_server), account_list (shows a running sign-in) and account_sign_in. The old names are gone: MCP clients list tools each session.
  • The launcher's own tools win over the game_ prefix (game_args is the launcher's).

New CLI commands:

  • settings [KEY VALUE]: the Settings page's selected version, Minecraft folder, server folder, install-new-versions, opening animation (and shows the rest).
  • agent-config [--client ID]: the ready-made MCP config for Claude Code, Codex, Cursor and any client, and the command that adds it (launcher/src/agents.rs, shared with the Settings page in the next PR).
  • play --world NAME --creative, as the MCP tool has.

Under No AI, mcp and agent-config are hidden from --help and refused; every other command stays (see the report for why).

One MCP server for the whole thing (brief 2.): the launcher forwards the game's tools as game_* to the selected version's horizon-ctl mcp, which talks to the game play started (this existed since #342; kept). Why: an agent configures one server and gets both, the game's tools stay defined once (horizon-ctl's table), and the launcher already owns the game process it would hand over.

Tests

  • Unit (cli_tools): every CLI leaf is a tool named after its words, argument conversion (lists, enums, ---separated rest arguments, required ones), confirm on destructive tools; agents: configs, shell quoting of a path with spaces, TOML escaping.
  • tools/launcher_mcp_e2e.py: the generated tools are listed beside game_*; versions, settings, game_args run and return JSON; remove without confirm is refused; play starts the game and the game_* tools play it; agent-config --json lists 4 clients; under No AI, mcp and agent-config refuse and are gone from --help.

Self-check

Run once on an integration commit of the agent-control PRs (No AI switch, horizon-ctl table, launcher MCP), on the Mac mini:

cargo fmt --all --check                                              ok
cargo clippy --workspace --all-targets -- -D warnings                ok
launcher: cargo clippy --features gpui/runtime_shaders --all-targets -- -D warnings   ok
cargo test -p horizon-core -p horizon-client                         ok (1013 + 101 + 18 horizon-ctl + ...)
launcher: cargo test --features gpui/runtime_shaders                 ok (97 lib + 23 bin + 1)
tools/agent_control_e2e.py (fast build, offscreen)                   18/18: survival ui options events consume pick suggestions manage no-ai, cli and mcp
tools/launcher_mcp_e2e.py                                            PASS: 134 tools (46 launcher + 88 game), No AI refused
tools/parity.py --changed origin/main                                selects all 327 (game.rs is an input of every harness); ran the 10 that cover
                                                                     the touched areas: options world_options world_reopen world menu_click
                                                                     screen_layout chat_screen container_screen pack_screen pack_selection: 10 passed

Needs Ludovic

  • The MCP tool names change (launch_client is play, list_versions is versions, ...). Clients re-list tools each session, so agents adapt; scripts written against the old names would not. No alias kept, to keep one name per command.
  • The CLI's remove, mods remove... still run without a confirmation: a person typing them meant it, and scripts and packagers use them. Only the MCP tools require confirm. Say if the CLI should ask too.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/1344 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/23/2026 **Status:** ✅ Merged **Merged:** 10/23/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/agent-control-launcher` --- ### 📝 Commits (2) - [`b117930`](https://github.com/horizon-rust/horizon/commit/b117930ae493b00e4d1a8ef44555b449bddfa967) No AI: one switch that turns off agent control (socket, horizon-ctl, both MCP servers) - [`ef792ec`](https://github.com/horizon-rust/horizon/commit/ef792ec3b9c28bdc416d463b49fe8e751f3ebf59) Launcher MCP: every CLI command is a tool of the same name, plus settings and agent-config ### 📊 Changes **17 files changed** (+1031 additions, -271 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/bin/horizon-ctl/commands.rs` (+3 -2) 📝 `crates/horizon-client/src/bin/horizon-ctl/main.rs` (+43 -1) 📝 `crates/horizon-client/src/extras.rs` (+7 -1) 📝 `crates/horizon-client/src/game.rs` (+7 -1) 📝 `crates/horizon-core/src/lib.rs` (+1 -0) ➕ `crates/horizon-core/src/no_ai.rs` (+97 -0) 📝 `launcher/README.md` (+27 -19) ➕ `launcher/src/agents.rs` (+147 -0) 📝 `launcher/src/backend.rs` (+11 -0) 📝 `launcher/src/cli.rs` (+172 -3) ➕ `launcher/src/cli_tools.rs` (+339 -0) 📝 `launcher/src/game_tools.rs` (+6 -6) 📝 `launcher/src/lib.rs` (+1 -0) 📝 `launcher/src/main.rs` (+1 -0) 📝 `launcher/src/mcp.rs` (+44 -226) 📝 `tools/agent_control_e2e.py` (+67 -5) 📝 `tools/launcher_mcp_e2e.py` (+58 -7) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Stacked on #1342 (the No AI switch): merge that first. ## What The launcher's MCP offers **every CLI command as a tool of the same name and arguments**, generated from the CLI's clap definition (`launcher/src/cli_tools.rs`), so the two can't drift: - `mods_search` is `horizon-launcher mods search`; its arguments are the command's (snake_case), positional ones and flags alike; a call runs that command with `--json` as a child process and returns its output (JSON where the command has some). - So the mod browser (`mods_*`, including #1269's `mods_check`), modpacks (`modpack_*`), hosted servers (`servers_*`), `settings`, `game_args`, `desktop_entry`, data collection (`data_*`), `update`, `notes`, `benchmark` are all tools now; a new CLI command becomes a tool by itself. - Destructive ones (`remove`, `mods_remove`, `modpack_remove`, `servers_forget`, `account_sign_out`, `data_delete`) need `confirm: true` and carry `destructiveHint`; the ones that send data carry `openWorldHint`. - The session keeps a few in-process, renamed after the CLI: **`play`** (was `launch_client`; now also takes `join` for an invite code), **`server`** with `server_command`, `server_log`, `server_stop` (were `start_server`, `stop_server`), `account_list` (shows a running sign-in) and `account_sign_in`. The old names are gone: MCP clients list tools each session. - The launcher's own tools win over the `game_` prefix (`game_args` is the launcher's). New CLI commands: - `settings [KEY VALUE]`: the Settings page's selected version, Minecraft folder, server folder, install-new-versions, opening animation (and shows the rest). - `agent-config [--client ID]`: the ready-made MCP config for Claude Code, Codex, Cursor and any client, and the command that adds it (`launcher/src/agents.rs`, shared with the Settings page in the next PR). - `play --world NAME --creative`, as the MCP tool has. Under No AI, `mcp` and `agent-config` are hidden from `--help` and refused; every other command stays (see the report for why). **One MCP server for the whole thing** (brief 2.): the launcher forwards the game's tools as `game_*` to the selected version's `horizon-ctl mcp`, which talks to the game `play` started (this existed since #342; kept). Why: an agent configures one server and gets both, the game's tools stay defined once (horizon-ctl's table), and the launcher already owns the game process it would hand over. ## Tests - Unit (`cli_tools`): every CLI leaf is a tool named after its words, argument conversion (lists, enums, `--`-separated rest arguments, required ones), `confirm` on destructive tools; `agents`: configs, shell quoting of a path with spaces, TOML escaping. - `tools/launcher_mcp_e2e.py`: the generated tools are listed beside `game_*`; `versions`, `settings`, `game_args` run and return JSON; `remove` without `confirm` is refused; `play` starts the game and the `game_*` tools play it; `agent-config --json` lists 4 clients; under No AI, `mcp` and `agent-config` refuse and are gone from `--help`. ## Self-check Run once on an integration commit of the agent-control PRs (No AI switch, horizon-ctl table, launcher MCP), on the Mac mini: ``` cargo fmt --all --check ok cargo clippy --workspace --all-targets -- -D warnings ok launcher: cargo clippy --features gpui/runtime_shaders --all-targets -- -D warnings ok cargo test -p horizon-core -p horizon-client ok (1013 + 101 + 18 horizon-ctl + ...) launcher: cargo test --features gpui/runtime_shaders ok (97 lib + 23 bin + 1) tools/agent_control_e2e.py (fast build, offscreen) 18/18: survival ui options events consume pick suggestions manage no-ai, cli and mcp tools/launcher_mcp_e2e.py PASS: 134 tools (46 launcher + 88 game), No AI refused tools/parity.py --changed origin/main selects all 327 (game.rs is an input of every harness); ran the 10 that cover the touched areas: options world_options world_reopen world menu_click screen_layout chat_screen container_screen pack_screen pack_selection: 10 passed ``` ## Needs Ludovic - The MCP tool names change (`launch_client` is `play`, `list_versions` is `versions`, ...). Clients re-list tools each session, so agents adapt; scripts written against the old names would not. No alias kept, to keep one name per command. - The CLI's `remove`, `mods remove`... still run without a confirmation: a person typing them meant it, and scripts and packagers use them. Only the MCP tools require `confirm`. Say if the CLI should ask too. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:09:55 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#3492
No description provided.