Skip to main content
Glama

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/ から 2 つの DLL をゲームの BepInEx/plugins/ フォルダーにコピーします:

<game directory>/BepInEx/plugins/CU-MCP-Mod.dll
<game directory>/BepInEx/plugins/Newtonsoft.Json.dll

2. Python の依存関係のインストール

pip install -r requirements.txt

3. 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. プレイ

  1. ゲームを起動してレベルに入る

  2. Python サーバーを起動する: python src/bridge_server/server.py

  3. 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 -> Game: 注文は名前付きパイプを介して送信され、Unity のメインスレッドで実行されます。

  • Game -> 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 dependencies

MCP ツール

ツール

説明

get_game_state

プレイヤーの状態(位置、体力、インベントリ)+ 環境スナップショット

get_map_info

プレイヤー周辺の地形とエンティティ情報

get_nearby_items

プレイヤー近くのドロップアイテムの一覧

query_position

特定のワールド座標にあるエンティティ/地形を照会

search_blocks

マテリアル名で地形を検索(例: "sand", "rock")

move_to

アクティブなプレイヤーをワールド座標へ移動

move_to_player

AI コンパニオンを人間のプレイヤーの場所へ移動

follow

AI コンパニオンに人間を追従させる

jump

ジャンプ(水平方向に対応)

use_item

インベントリのアイテムを使用

pick_up_item

近くのアイテムを拾う(名前指定または最寄り)

drop_item

インベントリのアイテムを落とす

sleep

休息してエネルギーを回復

heal_ai

AI コンパニオンの特定の部位を治療

create_ai_player

人間の隣に AI コンパニオンを複製

destroy_ai_player

AI コンパニオンを削除

set_contingency

条件アクションルールを設定(例: "heal if HP < 30%")

update_contingency

実行時にコンティンジェンシールールを更新

user_interact

最優先の人間による介入

既知の問題

  • スキンモッドの互換性: サードパーティ製のスキンモッド(例: "Skin Sync")をインストールすると、AI コンパニオンに人間のプレイヤーの尻尾を映した重複した尻尾が表示される場合があります。これはスキンモッドの互換性の問題であり、バニラゲームでは発生しません。

ライセンス

MIT

Maintenance

ActivityMaintained
ResponsivenessSyncing

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

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