CU-MCP-Bridge
CU-MCP-Bridge
BepInEx 模组 + Python MCP 服务器,让 AI 助手通过命名管道实时控制 Casualties Unknown 的游戏玩法。
环境要求
Windows 10/11
Casualties Unknown(Steam)
Python 3.10+
.NET SDK(用于构建模组)
BepInEx 已安装到游戏中
Related MCP server: Unity-MCP
快速开始
1. 安装模组
将 mod/ 中的两个 DLL 复制到游戏的 BepInEx/plugins/ 文件夹:
<game directory>/BepInEx/plugins/CU-MCP-Mod.dll
<game directory>/BepInEx/plugins/Newtonsoft.Json.dll2. 安装 Python 依赖
pip install -r requirements.txt3. 配置你的 AI 客户端
添加到你的 MCP 配置中(例如 opencode.json):
{
"mcp": {
"servers": {
"cu-mcp-bridge": {
"type": "stdio",
"command": "python",
"args": ["src/bridge_server/server.py"],
"cwd": "/path/to/CU-MCP-Bridge"
}
}
}
}4. 开始游戏
启动游戏,进入一个关卡
启动 Python 服务器:
python src/bridge_server/server.py让 AI 助手控制玩家
顺序很重要:服务器必须在游戏运行之后启动。
从源码构建
# 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 deploy输出:BepInEx/bin/Release/net472/CU-MCP-Mod.dll
架构
AI Client (opencode)
|
stdio (JSON-RPC)
|
Python FastMCP Server (src/bridge_server/)
|
Named Pipe (win32pipe, newline-delimited JSON)
|
C# BepInEx Mod (BepInEx/, inside Unity game)
|
Unity Game (Casualties Unknown)通信
AI -> 游戏:命令通过命名管道发送,并在 Unity 的主线程上执行
游戏 -> AI:玩家状态和查询结果通过同一管道返回
阻塞:每个命令都会阻塞,直到模组报告完成(成功/失败/超时)
项目结构
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
│ ├── Pipe/ # Named pipe client + 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 # Pipe reader, state cache
│ ├── order_manager.py # Order queue
│ ├── pipe_server.py # Named pipe server (win32pipe)
│ └── contingency.py # Contingency rule manager
├── tests/ # Unit & integration tests
├── deploy.ps1 # Build + deploy script
└── requirements.txt # Python dependenciesMCP 工具
工具 | 描述 |
| 玩家状态(位置、生命值、物品栏)+ 环境快照 |
| 玩家周围的地形和实体信息 |
| 列出玩家附近掉落物品 |
| 查询特定世界坐标处的实体/地形 |
| 按材质名称搜索地形(例如 "sand"、"rock") |
| 将当前活跃玩家移动到世界坐标 |
| 将 AI 同伴移动到人类玩家身边 |
| 让 AI 同伴跟随人类玩家 |
| 跳跃(支持水平方向) |
| 使用物品栏中的物品 |
| 拾取附近物品(按名称或最近物品) |
| 丢弃物品栏中的物品 |
| 休息以恢复体力 |
| 治疗 AI 同伴的特定肢体 |
| 在人类玩家旁边克隆一个 AI 同伴 |
| 移除 AI 同伴 |
| 设置条件-动作规则(例如 "HP < 30% 时治疗") |
| 在运行时更新应变规则 |
| 最高优先级的人类干预 |
已知问题
皮肤模组兼容性:安装第三方皮肤模组(例如 "Skin Sync")可能会导致 AI 同伴显示一条与人类玩家尾巴镜像的重复尾巴。这是皮肤模组兼容性问题,在原版游戏中不会出现。
许可证
MIT
This server cannot be installed
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)5101,880MIT
- 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,016Apache 2.0
- AlicenseAqualityBmaintenanceMCP server to dynamically load Claude Code skills into AI agents56215MIT
- AlicenseNot gradedqualityDmaintenanceMCP server that bridges Unity with AI agents, enabling scene inspection, C# code execution, and screenshot capture via WebSocket communication.MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mouse114514/CU-MCP-Bridge'
If you have feedback or need assistance with the MCP directory API, please join our Discord server