Skip to content

Test control: an MCP server for testing a build with an agent, off unless asked for - #548

Merged
elripalda merged 1 commit into
mainfrom
claude/project-thread-d49tbl
Nov 25, 2026
Merged

elripalda merged 1 commit into
mainfrom
claude/project-thread-d49tbl

Conversation

@elripalda

Copy link
Copy Markdown
Owner

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_CONTROL set 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:

  • it answers on 127.0.0.1 only (port 47811, or RECOMPLAUNCHER_TEST_CONTROL_PORT);
  • every request needs Authorization: Bearer <token>; requests from web pages are refused even with the token (Origin header, wrong Host, non-JSON bodies);
  • the window shows a small yellow "Test control on" mark, and the trail says it started (or why it didn't).

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 in tv.js that 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-Mode on 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 in docs/BUILDING.md.

How you tested it

  • npm test passes (1137 passed, 30 of them new)
  • node --test tests/*.test.cjs passes (923)
  • Tried it in the launcher: a debug build on Linux (Xvfb), driven over MCP with a small script and with the official MCP TypeScript SDK client. Went through first-run setup by clicking, opened pages and Settings tabs, typed in Catalog search, started Big Picture and moved around it with controller_press (highlight and page change confirmed), left it again, added a local test game with launcher_command, pressed Play with ui_click, saw it in launcher_status and recent_events, and read its output with read_logs.
  • Off: started without the variable, and with a too-short token. Nothing listened on the port, and the trail said why for the short token.
  • Refused: wrong token (401), an Origin header (403).
  • Windows: cargo check --target x86_64-pc-windows-gnu is 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

  • One change per pull request
  • Not a fix for one recomp's own quirks
  • No version bump or patch notes
  • Doesn't change what developers can write in recomplauncher.json

Generated by Claude Code

…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]>
@orca-bots

orca-bots Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Issue Triage

Lost track of this on Xarishark’s computer. It may still finish. Check Orca.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants