Files
lms db0143be83 Merge remote changes: integrate MCP tools and resource refactor docs into framework
- Resolve directory rename conflict from old 03/06 dirs
- Move remote-added 资源加载重构方案.md into modules/frameworks/资源管理/
- Move remote-added 06_工具脚本/MCP工具 into modules/frameworks/编辑器工具/MCP工具/
- Keep Tools/CodexUnityMcp/ as MCP Server implementation
- Update README.md, modules/模块索引.md, and parent READMEs
- Add 文档关联 sections to new docs and fix old absolute paths

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 19:07:27 +08:00
..

CrystalBattle Unity MCP

This local MCP server exposes selected CrystalBattle Unity Editor commands to Codex.

Architecture

  • Codex connects to this MCP server over stdio.
  • The MCP server calls the Unity Editor bridge at http://127.0.0.1:17777.
  • The Unity Editor bridge executes Unity API work on the editor main thread.

Unity Setup

Open CrystalBattle_Client in Unity. The bridge starts automatically after scripts compile.

Manual controls are available from the bridge panel:

Tools/Codex Unity MCP/Bridge Panel

The panel shows the current connection status, endpoint, listener thread state, pending command count, total request count, recent command, and cached log count. It also includes buttons to start, stop, restart, copy the endpoint, and print status to the Unity Console.

Install Dependencies

From this directory:

pnpm install

If pnpm is not on PATH, use the Codex bundled runtime:

& "C:\Users\admin\.cache\codex-runtimes\codex-primary-runtime\dependencies\bin\pnpm.cmd" install

Tools

  • unity_health
  • unity_refresh_assets
  • unity_execute_menu_item
  • unity_get_console_logs
  • unity_generate_ui_prefab
  • unity_export_prefab_to_json

Environment

Optional:

UNITY_MCP_BRIDGE_URL=http://127.0.0.1:17777

Codex Config

The workspace includes .codex/config.toml with a crystalbattle-unity MCP server entry. Restart Codex after dependency installation so the new MCP server is discovered.


文档关联

当本文档发生变更时,应同步检查以下关联文档,避免信息不一致。

文档 关联原因
MCP 工具 Codex ↔ Unity MCP 工具说明
CrystalBattle Codex ↔ Unity MCP 使用规则 具体使用规则
modules/模块索引.md 模块索引是项目知识总入口