/ ディレクトリ / プレイグラウンド / unity-mcp
● コミュニティ CoplayDev ⚡ 即起動

unity-mcp

作者 CoplayDev · CoplayDev/unity-mcp

Drive the Unity Editor from Claude — build scenes, write C# scripts, run tests, inspect the console, all from chat.

MCP for Unity (by CoplayDev) exposes 40+ tools covering scene hierarchy, prefabs, materials, packages, scripts, tests, and profiler. Installed as a Unity package plus a Python bridge; the Unity side runs a local HTTP server the AI connects to. Works with Claude Desktop, Cursor, VS Code and any MCP client.

なぜ使うのか

主な機能

ライブデモ

実際の動作

unity.replay ▶ 準備完了
0/0

インストール

クライアントを選択

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "unity": {
      "command": "TODO",
      "args": [
        "See README: https://github.com/CoplayDev/unity-mcp"
      ],
      "_inferred": true
    }
  }
}

Claude Desktop → Settings → Developer → Edit Config を開く。保存後、アプリを再起動。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "unity": {
      "command": "TODO",
      "args": [
        "See README: https://github.com/CoplayDev/unity-mcp"
      ],
      "_inferred": true
    }
  }
}

Cursor は Claude Desktop と同じ mcpServers スキーマを使用。プロジェクト設定はグローバルより優先。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "unity": {
      "command": "TODO",
      "args": [
        "See README: https://github.com/CoplayDev/unity-mcp"
      ],
      "_inferred": true
    }
  }
}

Cline サイドバーの MCP Servers アイコンをクリックし、"Edit Configuration" を選択。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "unity": {
      "command": "TODO",
      "args": [
        "See README: https://github.com/CoplayDev/unity-mcp"
      ],
      "_inferred": true
    }
  }
}

Claude Desktop と同じ形式。Windsurf を再起動して反映。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "unity",
      "command": "TODO",
      "args": [
        "See README: https://github.com/CoplayDev/unity-mcp"
      ]
    }
  ]
}

Continue はマップではなくサーバーオブジェクトの配列を使用。

~/.config/zed/settings.json
{
  "context_servers": {
    "unity": {
      "command": {
        "path": "TODO",
        "args": [
          "See README: https://github.com/CoplayDev/unity-mcp"
        ]
      }
    }
  }
}

context_servers に追加。保存時に Zed がホットリロード。

claude mcp add unity -- TODO 'See README: https://github.com/CoplayDev/unity-mcp'

ワンライナー。claude mcp list で確認、claude mcp remove で削除。

ユースケース

実用的な使い方: unity-mcp

How to prototype a Unity scene from a text description

👤 Game designers, solo devs, hackathon teams ⏱ ~20 min intermediate

使うタイミング: You want to go from 'low-poly forest with a player and 5 patrolling enemies' to a runnable scene without wiring every GameObject by hand.

前提条件
  • Unity 2021.3 LTS or newer, Python 3.10+, uv — Install uv via brew install uv; Unity from unity.com/download
  • Install the Unity package — Window > Package Manager > + > Add from git URL: https://github.com/CoplayDev/unity-mcp.git?path=/MCPForUnity#main
フロー
  1. Describe the scene you want
    Create a new scene called 'ForestDemo'. Add a low-poly terrain 200x200, a player capsule at origin with a rigidbody, and 5 cube enemies placed randomly between (-50,-50) and (50,50).✓ コピーしました
    → Scene created, GameObjects appear in Hierarchy, Unity reflects changes live
  2. Ask for behavior scripts
    Create a C# script EnemyPatrol.cs that moves between two random waypoints, and attach it to every Enemy* GameObject.✓ コピーしました
    → New script compiles cleanly, attached to enemies
  3. Enter Play mode and iterate
    Enter Play mode for 5 seconds, then read the console and tell me if anything threw.✓ コピーしました
    → Runtime log returned, Claude proposes concrete fixes for any NullReferenceException

結果: A runnable prototype scene with scripted enemies — under 15 minutes of chat.

注意点
  • Script edits reject because of compile errors cascading — Ask Claude to run manage_script validate before apply_text_edits
  • Domain reload wipes runtime state mid-session — Save scene explicitly before script edits; use refresh_unity afterwards
組み合わせ: filesystem · github

How to diagnose and fix Unity compile/runtime errors from chat

👤 Unity developers stuck on a red console ⏱ ~15 min intermediate

使うタイミング: The console is full of errors from a big refactor or a package update and you want a second pair of eyes.

フロー
  1. Pull the console
    Read the Unity console. Group errors by root cause.✓ コピーしました
    → Grouped error categories with likely files identified
  2. Read the offending script
    Open the top script mentioned, find the line, and explain why it breaks.✓ コピーしました
    → Specific fix proposal referencing line numbers
  3. Apply a minimal patch
    Apply the smallest change to make it compile, then refresh Unity and re-read the console.✓ コピーしました
    → Error count drops, no new errors introduced

結果: A green console and a diff you can review before committing.

注意点
  • Claude proposes fixes that break API contracts for other scripts — Ask it to find references (find_in_file) before editing
組み合わせ: github

How to run Unity EditMode/PlayMode tests and read failures

👤 Unity devs with a real test suite ⏱ ~15 min intermediate

使うタイミング: Before opening a PR or when CI is down and you want a quick local pass.

フロー
  1. Kick off a test run
    Run all EditMode tests in the Tests.EditMode assembly.✓ コピーしました
    → Test job id returned, status streamed
  2. Summarize failures
    For each failing test, show the assertion message and the line it fired on.✓ コピーしました
    → Per-test diagnosis
  3. Fix the smallest failure first
    Pick the failure most likely caused by my last change and propose a patch.✓ コピーしました
    → Concrete edit suggestion

結果: A green test run with traceable edits.

注意点
  • PlayMode tests need a different assembly — Specify EditMode vs PlayMode explicitly
組み合わせ: github

組み合わせ

他のMCPと組み合わせて10倍の力を

unity + github

Scaffold a scene + scripts, commit the changes, open a PR for review

Build the EnemyPatrol feature in Unity, commit the new script and scene changes to a branch 'feature/enemy-patrol', and open a PR with a summary of what changed.✓ コピーしました
unity + filesystem

Import a batch of 3D assets from a local folder and wire them into prefabs

Read /Downloads/kenney-nature-pack, import every .fbx into Assets/Models/, then create a prefab for each tree with a collider.✓ コピーしました
unity + unity-2 + unity-3

Pick the Unity MCP that best matches your workflow — run only one at a time

Compare MCP for Unity vs CoderGamester mcp-unity for my 2D tilemap project, then keep the better one enabled.✓ コピーしました

ツール

このMCPが提供する機能

ツール入力呼び出すタイミングコスト
manage_scene action: 'create'|'open'|'save'|'load', name?: str, path?: str Any scene lifecycle change free
find_gameobjects query: str, scene?: str Locate objects by name, tag, or component free
manage_components target: str, action: 'add'|'remove'|'modify', component: str, values?: obj Attach or tweak components free
manage_script action: 'create'|'read'|'delete', path: str, body?: str Full-file script writes — use apply_text_edits for partial free
apply_text_edits path: str, edits: Edit[] Surgical patches; safer than full rewrites free
read_console since_ms?: int Inspect errors/warnings after any change free
run_tests mode: 'EditMode'|'PlayMode', filter?: str Start a test run; poll with get_test_job free
refresh_unity After creating/modifying scripts or assets free
manage_asset action, path, ... Import/move/delete assets free
unity_docs query: str Look up Unity API docs inline free

コストと制限

運用コスト

APIクォータ
No remote API — runs entirely on your machine
呼び出しあたりのトークン
Reading the scene hierarchy: 500–3000 tokens. Script reads: depends on file size
金額
Free (open source, MIT)
ヒント
Disable tools you won't use (e.g. manage_vfx, manage_probuilder) via the tool allowlist to shrink the prompt footprint.

セキュリティ

権限、シークレット、影響範囲

最小スコープ: local filesystem write to your Unity project
認証情報の保管: None required — localhost HTTP only
データ送信先: Localhost only (http://localhost:8080/mcp). No telemetry by default.
絶対に付与しない: access to Unity projects outside the active one

トラブルシューティング

よくあるエラーと対処法

Claude can't connect: ECONNREFUSED localhost:8080

Unity Editor must be open with the MCP package loaded. Check Window > MCP for Unity > Status.

確認: curl http://localhost:8080/mcp/ping
apply_text_edits reports 'file changed on disk'

Another tool modified the file. Re-read with manage_script before editing again.

refresh_unity hangs forever

Usually a compile error locking the domain reload. Open Unity, fix the red script, then retry.

確認: Check Unity console manually
Package Manager 'Could not resolve git URL'

Behind a proxy or no git on PATH. Install git and retry, or use OpenUPM install instead.

確認: git --version

代替案

unity-mcp 他との比較

代替案代わりに使う場面トレードオフ
Unity-MCP (IvanMurzak)You want CLI-driven setup and Roslyn-based C# executionSmaller community than Coplay's, different tool surface
mcp-unity (CoderGamester)You want a simpler tool set focused on scene manipulation and testsFewer tools, less coverage of materials/VFX

その他

リソース

📖 GitHub の公式 README を読む

🐙 オープンな issue を見る

🔍 400以上のMCPサーバーとSkillsを見る