HOI4 Background Co-op
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
HOI4 Background Co-op
Experimental Windows adapter for an AI agent to play its own HOI4 client alongside a human.
中文说明 · Validation · Architecture
The human uses a foreground client. The agent uses a separate game copy on a private Windows desktop, exposed through MCP. Inputs are posted to that bound window; the adapter does not move the real cursor or activate the foreground.
This is an input/isolation and local-multiplayer integration project. It is not a complete HOI4 strategy bot, a new game engine, or a replacement for HOI4-Live-Tools.
Status: v0.1.0, LAN prototype
Capability | Evidence |
Same-machine human and agent clients | Verified in HOI4 1.19.5, vanilla, checksum |
Agent runs on a private desktop | Verified in the original adapter |
Private-room entry with distinct player seats | Verified: human Brazil, agent Germany |
Advancing synchronized game dates | Verified from Jan 1 to Jan 2, 1936 |
Game-reported peer latency | Two observed samples: 59 and 127 ms; not model decision latency |
Complete autonomous campaign / defeating the USSR | Not demonstrated |
Joining normal Steam public/friend rooms without another account | Not supported by the local compatibility setup |
Other game versions, platforms, overhaul mods | Not qualified |
The original integrated prototype was tested with DSH. This extracted package has offline packaging/protocol checks; a clean-machine end-to-end game run remains to be done. See the distinction in VALIDATION.md.
Related MCP server: Computer-Controller-Bridg
What is included
A small GUI-only MCP server: status, launch, close, OCR/image view, click, drag, scroll, text input, named menu keys, and short action batches.
Exact executable-path binding and private-desktop window selection.
Preparation scripts for separate agent/host userdata and game copies.
Source-only steamemu compatibility patches used for the local LAN experiment: a valid lobby instance flag and the legacy game-server initialization export.
Generic agent instructions for observed actions and compact session handoffs.
No game files, Steamworks SDK, compatibility DLLs, model credentials, account configuration, chat history, saves, or private memory are included.
Requirements
Windows x64, an unlocked interactive user session, Python 3.11+.
Your own working HOI4 installation; both clients must have matching versions, mods and checksum. This release was qualified only on 1.19.5 (
c184).Enough RAM/commit capacity to run two game instances.
An MCP host (DSH was used in the original experiment) and your chosen model.
For the tested no-second-account local setup: a separately obtained/built steamemu library. Read patches/README.md and upstream terms. This project does not bundle or install that dependency automatically.
Install
In PowerShell, from the cloned repository:
git clone https://github.com/F15EXII/hoi4-background-coop.git
cd hoi4-background-coop
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install ".[ocr]"For image-only operation, install . without the OCR extra. OCR uses the optional
rapidocr-onnxruntime dependency. The MCP transport uses the official Python SDK.
Prepare clients
After building the external compatibility DLL, prepare a new runtime directory:
.\scripts\prepare-clients.ps1 `
-GameDirectory 'C:\path\to\Hearts of Iron IV' `
-OutputDirectory 'C:\hoi4-coop' `
-CompatibilityDll 'C:\path\to\built\steam_api64.dll'The script copies root game files, links asset directories with junctions, writes separate userdata paths, and generates two distinct local test identities. It refuses an existing output directory and does not launch either game. Linked assets depend on the original install; recreate the copies after game updates. Do not edit game assets through those junctions.
Omitting -CompatibilityDll prepares isolated copies only; it does not make
ordinary Steam clients acquire independent multiplayer identities.
Configure the agent process and inspect status:
$env:HOI4_COOP_CONFIG = 'C:\hoi4-coop\agent-config.json'
.\.venv\Scripts\python.exe -m hoi4_background_coop status
.\.venv\Scripts\python.exe -m hoi4_background_coop launchOpen C:\hoi4-coop\host\game\hoi4.exe yourself. For this setup, do not substitute
a normally launched Steam client for one of the matching prepared clients.
Connect an MCP host
Adapt examples/mcp.config.json to your Python and configuration paths. The stdio command is:
python -m hoi4_background_coop serveThe human creates a room and supplies the game's room ID. The agent joins using its own UI, selects its country, and readies up. Confirm two players, countries, then advancing synchronized dates. A nonzero ID alone is not an acceptance test.
The default OCR view returns text and coordinates in the same scaled image space
used by click/drag/scroll (at most 1100 x 680). view(format="image") is available
when OCR is insufficient. Stable observed paths can use sequence to reduce
model round trips. A tool's submitted receipt never proves game acceptance.
Use the example agent instructions. Strategic planning, cost limits, memory, session rotation and continuation belong to your agent host. The original DSH-specific QQ supervisor is not bundled: it depended on private application APIs and personal configuration.
Limitations and next steps
Private desktops separate input surfaces; they are not a security sandbox. The agent process runs as your Windows user. Only connect a trusted agent host.
The game still consumes CPU/GPU resources. The input technique depends on HOI4's window behavior and may break with DPI, layout or version changes. Posted menu keys may have no effect; observe and use the visible UI button when needed. Multiplayer pause/speed permissions remain the game's own rules.
The main unsolved performance problem is agent perception and decision latency. Low network latency does not make repeated OCR/model/click cycles fast enough for an active front. The next useful work is broader live qualification and integration with existing semantic game-action tools, not a larger untested catalog.
Development
.\.venv\Scripts\python.exe -m unittest discover -s tests -vTests do not launch HOI4, send live input, or prove campaign ability. Contributions should state what was tested offline versus in the actual game. See NOTICE.md for third-party scope and LICENSE for original code.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Remote desktop MCP: let AI see, click, type and run terminal commands on your own Windows or Mac.
Let AI see and use your own Windows PC with your permission: screen, apps, mouse and keyboard.
Remote MCP access to user-authorized Linux, Windows and Intel Mac devices for AI assistants.
Hosted Screenshots MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Related MCP Servers
- AlicenseAqualityCmaintenanceAllows AI clients to see and control Windows 10/11 desktops via MCP, with screenshots, UI Automation, Chrome CDP, keyboard/mouse, and terminal using semantic element targeting.30MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI clients on Windows to control the local mouse, keyboard, and screen understanding via MCP stdio, allowing automated workflows like viewing the screen, locating elements, clicking, typing, and verifying results.1Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to control a Windows PC via MCP, including launching apps, managing windows, driving keyboard and mouse, reading the screen with OCR, and monitoring system state, with multi-agent locking and a local dashboard for confirmation.MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients such as ChatGPT and Claude chats to control a Windows desktop by taking screenshots, moving the mouse, typing text and key chords, focusing windows, reading or writing the clipboard, and launching applications. Access is gated by local approval modes, input kill switches, and an optional authenticated relay for remote clients.MIT