Repository navigation
Test control: an MCP server for testing a build with an agent, off unless asked for - #548
Merged
Merged
Conversation
…less asked for Start the launcher with RECOMPLAUNCHER_TEST_CONTROL set to a token of 16+ characters and an MCP client can drive it like a tester: read what's on screen, click, type, press keys and controller buttons, open pages, switch Big Picture mode on and off, call the launcher's own commands, and read the trail, a game's output and the window's console. Screenshots on Windows. Without the variable nothing listens and nothing is added to the window. With it, the server answers on 127.0.0.1 only, every request needs the token, requests from web pages are refused, and the window shows a "Test control on" mark. The HTTP and MCP handling started from the local control API in #10 by Alex Southwell. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 25, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Ruben · project thread
What this changes
An MCP server inside the launcher, so an agent (or a script) in a test PC or VM can use a build the way a tester would before it ships. Asked for by Xarishark.
Off for players. It only starts when the launcher is started with
RECOMPLAUNCHER_TEST_CONTROLset to a token of 16 characters or more. Without it nothing listens, no listener is added, and nothing is put in the window. With it:127.0.0.1only (port 47811, orRECOMPLAUNCHER_TEST_CONTROL_PORT);Authorization: Bearer <token>; requests from web pages are refused even with the token (Origin header, wrong Host, non-JSON bodies);Tools:
launcher_status,ui_snapshot(what's in front, with refs),ui_click,ui_type,ui_key,ui_navigate(pages, plus Big Picture on and off),ui_wait_for,controller_press,launcher_command(the launcher's own commands, called the way the window calls them),ui_eval,read_logs(trail, a game's output, the window's console),recent_events(downloads, setups, games starting),screenshot(Windows),launcher_window.The window side (
bridge.js) is only put in the page when test control is on. The UI tools act through the window itself, so they do exactly what a click or the window's own code would. The one change to the window's code is two lines intv.jsthat let it read Big Picture's current page and leave Big Picture; they do nothing on their own.This builds on #10 (Alex Southwell's local control API): its HTTP reading and MCP message handling are reused with credit. #10 is a player-facing Play/status switch in Settings; this one is a testing tool with a much wider set of actions, so it's a separate module and leaves #10 alone. One change from #10: Node's fetch (which MCP clients use) sends
Sec-Fetch-Modeon every request, so that header can't be used to spot a web page; the Origin check, the JSON content type and the token still keep pages out.Docs:
docs/TEST-CONTROL.md(how to turn it on, connect Claude Code or another client, what each tool does), and a line indocs/BUILDING.md.How you tested it
npm testpasses (1137 passed, 30 of them new)node --test tests/*.test.cjspasses (923)controller_press(highlight and page change confirmed), left it again, added a local test game withlauncher_command, pressed Play withui_click, saw it inlauncher_statusandrecent_events, and read its output withread_logs.Originheader (403).cargo check --target x86_64-pc-windows-gnuis clean, including the screenshot code (it uses xcap the same way the in-game screenshot does). Not run on a real Windows PC yet, so the screenshot tool is the part to try first there.Checklist
recomplauncher.jsonGenerated by Claude Code