CU-MCP-Bridge
CU-MCP-Bridge
BepInEx mod + Python MCP server that lets AI assistants control Casualties Unknown gameplay in real time over a local HTTP link.
Requirements
Windows, Linux, or macOS — the game may run natively or under Proton/Wine; a
127.0.0.1HTTP socket bridges the two either wayCasualties Unknown (Steam)
Python 3.10+ (standard library only — no
pywin32).NET SDK (for building the mod)
BepInEx installed in the game
Related MCP server: Unity-MCP
Quick start
1. Install the mod
Copy the two DLLs from mod/ into your game's BepInEx/plugins/ folder:
<game directory>/BepInEx/plugins/CU-MCP-Mod.dll
<game directory>/BepInEx/plugins/Newtonsoft.Json.dll2. Install Python dependencies
With uv (recommended — pyproject.toml + uv.lock
are checked in):
uv syncor with pip:
pip install -r requirements.txtStandard library only otherwise — no pywin32, no native transport dependency.
3. Configure your AI client
Add to your MCP configuration (e.g. opencode.json):
{
"mcp": {
"servers": {
"cu-mcp-bridge": {
"type": "stdio",
"command": "python",
"args": ["src/bridge_server/server.py"],
"cwd": "/path/to/CU-MCP-Bridge"
}
}
}
}4. Play
Start the game, enter a level
Start the Python server:
python src/bridge_server/server.py(usually launched for you by the MCP client via the config above)Ask your AI assistant to control the player
Start order no longer matters: the mod keeps polling until the server is up, and the server queues anything it wants to send until the mod connects.
Configuration
The mod and server rendezvous on http://127.0.0.1:8765 by default.
Server: set
CU_MCP_HTTP_HOST/CU_MCP_HTTP_PORTbefore launchingserver.py.Mod: set
"http_url"incu_mcp_config.json(next to the game executable), e.g.{ "http_url": "http://127.0.0.1:8765" }.
Both must point at the same host/port.
Building from source
# Build the C# mod
dotnet build BepInEx/CU-MCP-Mod.csproj -c Release
# Deploy to game (kills the game process, rebuilds, copies DLL)
.\deploy.ps1 -Action deployOutput: BepInEx/bin/Release/net472/CU-MCP-Mod.dll
Architecture
AI Client (opencode)
|
stdio (JSON-RPC)
|
Python FastMCP Server (src/bridge_server/) <-- HTTP server on 127.0.0.1:8765
|
Local HTTP (newline-delimited JSON Message bodies)
|
C# BepInEx Mod (BepInEx/, inside Unity game) <-- HTTP client (poll + post)
|
Unity Game (Casualties Unknown)Communication
The mod drives both directions against the server:
GET /poll?timeout=<sec>— long-poll for the next AI -> Game message (order / query / contingency);204means "nothing yet, poll again".POST /message— Game -> AI player state, query/search results, order results, acks, interrupts (newline-delimited JSON; batches allowed).GET /health— liveness /connectedflag.
Message payloads are byte-for-byte the same newline-delimited JSON Message
objects the previous named-pipe transport used. Each order still blocks on the
MCP side until the mod reports completion (success/failure/timeout).
Project structure
CU-MCP-Bridge/
├── BepInEx/ # C# mod source (BepInEx plugin)
│ ├── Executor/ # Order execution, pathfinding, movement
│ ├── Collector/ # Game state collection (player, environment)
│ ├── Contingency/ # Local condition-action rules
│ ├── Transport/ # HTTP bridge client + wire protocol
│ ├── AIPlayerManager.cs # AI companion creation/destruction
│ ├── BridgePlugin.cs # Entry point, tick loop
│ └── DebugGUI.cs # F6 debug panel
├── src/bridge_server/ # Python MCP server
│ ├── server.py # MCP tool definitions
│ ├── state_manager.py # inbound reader, state cache
│ ├── order_manager.py # Order queue
│ ├── transport.py # HTTP bridge server (stdlib http.server)
│ ├── pipe_server.py # back-compat shim -> transport.py
│ └── contingency.py # Contingency rule manager
├── tests/ # Unit & integration tests
├── deploy.ps1 # Build + deploy script
└── requirements.txt # Python dependenciesMCP Tools
Tool | Description |
| Player state (position, health, inventory) + environment snapshot |
| Terrain and entity info around the player |
| List dropped items near the player |
| Query entities/terrain at a specific world coordinate |
| Search terrain by material name (e.g. "sand", "rock") |
| Move the active player to a world position |
| Move the AI companion to the human player |
| Make the AI companion follow the human |
| Jump (supports horizontal direction) |
| Use an inventory item |
| Pick up a nearby item (by name or nearest) |
| Drop an inventory item |
| Rest to recover energy |
| Heal a specific limb on the AI companion |
| Clone an AI companion next to the human |
| Remove the AI companion |
| Set condition-action rules (e.g. "heal if HP < 30%") |
| Update contingency rules at runtime |
| Highest-priority human intervention |
Known issues
Skin mod compatibility: Installing third-party skin mods (e.g. "Skin Sync") may cause the AI companion to display a duplicate tail that mirrors the human player's tail. This is a skin mod compatibility issue and does not occur in the vanilla game.
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to control Unreal E…
MCP server for AI dialogue using various LLM models via AceDataCloud
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
MCP server for Hailuo (MiniMax) AI video generation
Related MCP Servers
- AlicenseBqualityAmaintenanceMCP Unity Server to integrate Unity Editor game engine with different AI Model clients (e.g. Claude Desktop, Windsurf, Cursor)57 npm1,899MIT
- AlicenseNot gradedqualityAmaintenanceSeamless automation and intelligent control over your Unity projects. By integrating with the MCP server and client, it allows AI agents or external tools to interact with your Unity environment—creating, modifying, and managing GameObjects, Components, Assets, Scenes, and more.4,280Apache 2.0
- AlicenseAqualityBmaintenanceMCP server to dynamically load Claude Code skills into AI agents523 npm15MIT
- AlicenseNot gradedqualityDmaintenanceMCP server that bridges Unity with AI agents, enabling scene inspection, C# code execution, and screenshot capture via WebSocket communication.MIT