Repository navigation
Add MCP server for scripted in-game testing - #764
nicholasgower wants to merge 4 commits into
Conversation
|
I'm also working on a save file editor for this project, and I've decided I will not continue work on this until after the MCP server is merged. Easily automating user input is impossible without a functional MCP server, and I'd rather not combine PRs prematurely. #784 |
|
Nice work on this; the game-side seams in particular (script-only input, I've been running something similar locally for a while, but as a few small command-line tools instead of an MCP server, so I wanted to share how that's turned out. I think the core of this would be more useful as a CLI, with MCP (if wanted) as a thin layer on top. What I use, roughly:
Why a CLI rather than only MCP:
What I'd suggest: keep the seams as they are, and make
Happy to compare notes or help with any of it. |
Add scripts/hookshot_mcp.py, a stdio MCP server using the official Python SDK. It launches Hookshot, drives HOS_INPUT_LIVE, requests on-demand screenshots and returns them inline. Game-side seams: HOS_INPUT_SCRIPT_ONLY, analog stick tokens (LX/LY/RX/RY), !quit, HOOKSHOT_NO_ENV_FILE, RX_VK_SHOT_FILE and RX_SCREENSHOT_FILE. Tests: tests/test_mcp_server.py plus script-only and analog cases in the input fixture. Docs include MCP host configuration and the new switches. Assisted-by: DeepSeek V4.1 Flash Co-Authored-By: DeepSeek V4.1 Flash <noreply@deepseek.com>
scripts/pr_check.py audits the branch before a pull request: game-derived paths, LF endings, Conventional Commit subjects and trailers, then the full game-free suite. It never stages, commits, pushes or calls GitHub. tests/test_pr_check.py builds throwaway repositories with a bad and a clean commit, and the docs tables and contributor checklist now mention the command. Assisted-by: DeepSeek V4.1 Flash Co-Authored-By: DeepSeek V4.1 Flash <noreply@deepseek.com>
tests/test_shot_request.py extracts read_shot_request() from vk_replay.cpp and compiles a fixture for the missing, empty, trimmed, one-shot and buffer-edge cases behind RX_VK_SHOT_FILE. Assisted-by: DeepSeek V4.1 Flash Co-Authored-By: DeepSeek V4.1 Flash <noreply@deepseek.com>
tests/test_docs.py resolves relative Markdown links, verifies documented python and powershell commands name tracked files, and compares docs/mcp.md's tool/resource tables with the live MCP server. Vendored third_party docs are skipped. Assisted-by: DeepSeek V4.1 Flash Co-Authored-By: DeepSeek V4.1 Flash <noreply@deepseek.com>
93f6215 to
7841496
Compare
|
Closing to keep the queue clear — please rebase on current main and reopen; thanks! |
|
Rebased onto current |
What this adds
scripts/hookshot_mcp.py: a stdio MCP server built on the official Python SDK (mcp==2.3.0).launch,stop,status,press,stick,sequence,screenshot,wait,logs.hookshot://log,hookshot://last-screenshot,hookshot://status.HOS_INPUT_SCRIPT_ONLY=1ignores physical pads, keyboard and mouse.LX=,LY=,RX=,RY=.!quitlive command for a clean stop.HOOKSHOT_NO_ENV_FILE=1lets the MCP server own the environment.RX_VK_SHOT_FILEandRX_SCREENSHOT_FILErequest one PNG of the next present from the Vulkan and WebGPU renderers.tests/test_mcp_server.py(protocol over stdio, input encoding, env handling, native seams, fake-game end to end), plus analog and script-only cases intests/test_input_background.py.docs/mcp.mdwith host configuration and tool usage; updated development, design, contributing and Vulkan notes.mcp==2.3.0for the new test.Follow-up checks
scripts/pr_check.py: a read-only pre-PR gate. It rejects game-derived paths, CRLF endings, non-Conventional commit subjects and missing commit trailers, then runs the game-free suite unless--no-testsis given. It never stages, commits, pushes or calls GitHub.tests/test_pr_check.py: throwaway-repository coverage for clean and bad PRs, including a.nup, CRLF content, missing trailers and an untracked game file.tests/test_shot_request.py: extracts the productionread_shot_request()fromvk_replay.cppand compiles a fixture for the missing, empty, trimmed, one-shot and buffer-edge cases behindRX_VK_SHOT_FILE.tests/test_docs.py: resolves relative Markdown links, verifies documentedpython/powershellcommands name tracked files, and compares this page's MCP tool/resource tables with the live server.CONTRIBUTING.mdanddocs/development.mdnow point atscripts/pr_check.py;gpu/vk/VULKAN.mdanddocs/mcp.mdpoint at the new fixtures.Verification
python -I -B tests/test_mcp_server.pypython -I -B tests/run_all.py mcp --strictpython -I -B tests/test_input_background.py --cc gcc(all cases, includinganalogandscript-only)python -I scripts/hookshot_mcp.py --check --game-dir <fake-folder>python -I -B tests/test_pr_check.pypython -I -B tests/test_shot_request.py --cxx g++python -I -B tests/test_docs.pypython -I -B tests/run_all.py pr_check shot_request docs --strictThe Vulkan/WebGPU C++ changes could not be compiled in this environment because there is no game build, Vulkan headers or dump here. The input-parser changes were compiled and exercised through the existing fixture; the extracted shot-request parser was compiled and tested separately.
The full local
tests/run_all.py --strictrun gave 71 passed, 11 failed, 9 skipped; the failures are environment/tool gaps here (missing SPIR-V/Vulkan headers,clang/clang++, and Windows symlink privileges innx2/test_nup_paths.py), not the new tests. All three new checks passed.Known issue in the first commit
The first commit
e9c2b0dpredates the newpr_checkgate. It is not a Conventional Commit and lacks theCo-Authored-Bytrailer, sopython -I -B scripts/pr_check.py --base main --no-testsreports it. The three follow-up commits pass. I did not rewrite the published branch; if a rebase/amend is acceptable, the subject should becomefeat: add the Hookshot MCP server for scripted in-game testingand the body should end with both trailers fromdocs/design.mdsection 8.No game files, builds, saves or generated screenshots are included.