Skip to main content
Glama
Singtaa

Unity MCP Server

by Singtaa

Unity MCP Server

Unity 2022.3+ License: MIT

MCP server for the Unity Editor. Lets AI agents like Claude Code inspect, manipulate, test, and screenshot your project.

ハイライト

  • 73 のツール: シーン、GameObject、コンポーネント、プレハブ、トランスフォーム、テスト、リフレクション + 逆コンパイル、C# 評価、UI キャプチャ

  • ゼロコンフィグのクライアント: マシンごとに 1 回のクリック(または 1 つのコマンド)で、以降はすべてのプロジェクトとエディターが自動的に接続されます。ポートもトークンもプロジェクトごとの設定も不要です。

  • 複数エディター対応: 開いている各プロジェクトが独自のサーバーを実行し、セッションは自動的に正しいサーバーへルーティングされます。

  • MCP リソース: コンソールログ、シーンヒエラルキー、テスト結果、プロジェクトファイル

  • Unity 2022.3+(Unity 6 推奨)、Node.js 18+

Related MCP server: Unity MCP Server

インストール

Package Manager > + > Add package from git URL:

https://github.com/Singtaa/UnityMCP.git

または Packages/com.singtaa.unity-mcp にクローン / サブモジュールします。

セットアップ(マシンごとに 1 回)

  1. Unity でプロジェクトを開きます。サーバーが自動起動し、ランチャーが ~/.unity-mcp/stdio.js にデプロイされます。

  2. Window > Unity MCP Server > Set up Claude Code

完了。ターミナルでの同等の操作:

# macOS / Linux
claude mcp add --scope user --transport stdio unity -- node ~/.unity-mcp/stdio.js

# Windows
claude mcp add --scope user --transport stdio unity -- node "%USERPROFILE%\.unity-mcp\stdio.js"

すべての Claude Code セッションは、どの Unity プロジェクト内であっても、そのプロジェクト自身のエディターに到達します。複数のエディターを並べて使用しても、各セッションは自分のエディターを見つけます。エディターが閉じている場合やリロード中の場合、ツールは明確なエラーを返し、自動的に回復します。セッション中にエディターを開くこともできます: エディターが閉じた状態で開始されたセッションはツールリストを即座に登録し(プロジェクトごとのキャッシュから提供)、エディターが起動した瞬間にライブで再同期します。クライアントの再起動は不要です。

内部の仕組み: エディターはセッションごとのビーコン(Temp/UnityMcp_Endpoint.json、終了時に削除され、古くなることはありません)を書き込みます。ランチャーはセッションのプロジェクト(CLAUDE_PROJECT_DIR、それ以外の場合はカレントディレクトリを遡って検出、UNITY_MCP_PROJECT が両方を上書き)を解決し、そのプロジェクトのライブエンドポイントに MCP をプロキシします。リクエストのたびにビーコンを再読み込みします。tools.listChanged を宣言し、ビーコンを監視します: エディターが現れたとき(または別のエディターがプロジェクトを引き継いだとき)、list_changed 通知を発行して、クライアントがセッション中にツールとリソースのリストを再取得できるようにします。~/.unity-mcp/stdio.js へのランチャーのデプロイは LAUNCHER_VERSION によるアップグレード時のみ行われるため、異なるパッケージバージョンのエディターがファイルをめぐって競合することはありません。

他の MCP クライアント: 同じランチャーを使用するか、プレーンな HTTP(エンドポイントとトークンがウィンドウに表示されます)を使用します。

ツール

グループ

ツール(unity_ プレフィックス)

シーン

scene_list, scene_load, scene_save, scene_new, scene_close

GameObject

gameobject_create, gameobject_find, gameobject_delete, gameobject_set_active, gameobject_set_parent, gameobject_rename, gameobject_duplicate

コンポーネント

component_list, component_add, component_remove, component_set_enabled, component_get_properties, component_set_property

トランスフォーム

transform_get, transform_set, transform_translate, transform_rotate, transform_look_at, transform_reset

エディター

selection_get/set/focus, editor_execute_menu_item, editor_notification, editor_log, editor_get_state, editor_pause/step, undo_*, playmode_enter/exit

プレハブ

prefab_load, prefab_save, prefab_get_hierarchy, prefab_find_component

テスト

test_list, test_run, test_run_sync, test_get_results

キャプチャ

capture_panel, capture_game_view

プロジェクトとアセット

project_list_files, project_read_text, project_write_text, assets_refresh, assets_import, assets_find

リフレクション

reflection_search_types, reflection_get_type_info, reflection_get_method_info, reflection_get_public_api, reflection_get_assemblies, reflection_decompile, reflection_invoke_static

評価

eval

特筆すべき点:

  • unity_eval: エディター内で C# スニペットをコンパイル + 実行します。ドメインリロードは不要です。式形式は値を返し、ステートメント形式は return を使用します。一般的な using がインポートされ、先頭の using 行はホイストされます。同梱の Roslyn(C# 9 が上限)。最初の呼び出しは数秒間ウォームアップし、その後は 1 回のコンパイルに数十ミリ秒かかります。

  • unity_capture_panel: UI Toolkit の PanelSettings をオフスクリーンで PNG にレンダリングします。シーンの UI は含まず、編集モードとプレイモードの両方で動作します。アクティブな UIDocument を自動検出します。

  • unity_assets_find: プロジェクトウィンドウのクエリ構文(t:Materialt:Prefab uil:MyLabel)、オプションのフォルダースコープ、結果は上限付きで総数も表示されます。

  • unity_reflection_decompile: 読み込まれている任意の型またはメソッドの完全な C# ソース。

  • 既知の注意点: ドメインリロード後、テストツールを使用する前に約 1 秒待ってください。unity_capture_game_view は Unity 6.3+ ではプレイモードのみで使用できます。

リソース

unity://console/logs · unity://hierarchy · unity://hierarchy/{scene} · unity://tests/results · unity://project/files

設定

ProjectSettings/McpSettings.json(コミットすることを想定): HTTP ポート 5173、IPC ポート 52100、自動起動、認証トークン。

ポートが別のプロジェクトのサーバーに使用されていますか? 空いているポートのペアが自動的に割り当てられ、マシンごとに UserSettings/McpPortOverride.json(gitignore 対象)に保存されるため、ポートの変更がチームに影響することはありません。プロジェクト ID はブリッジ接続のたびに検証されるため、エディターが別のプロジェクトのサーバーを引き継ぐことは、ポートが誤って設定されていても発生しません。

手動でのサーバー起動: MCP_PROJECT_ROOT をプロジェクトのパスに設定して node src/server.js を実行します。

Unity CLI との連携

補完的であり、競合しません。

  • Unity CLI はエディターのライフサイクルを担当します: インストール、unity open、ビルド、CI

  • UnityMCP はライブのエディターセッションを担当します: UI キャプチャ、逆コンパイル、eval、テストループ、ゼロコンフィグのルーティング

  • 典型的なエージェントループ: CLI 経由で unity open <project> を実行し、エディターが起動して、サーバー + ビーコンが立ち上がり、ランチャーが接続します。どちら側にも設定は不要です。

  • CLI から起動されたエディターはフォーカスなし / バックグラウンドで実行されます。UnityMCP はまさにそのために構築・テストされています(バックグラウンドで安全な起動、ドメインリロード中の再試行)。

  • ポートやツール名の競合はありません。両方を登録してください。

アーキテクチャ

┌─────────────────────────────────────────────────────────────┐
│                      AI Assistant                           │
├──────────────────────────────┬──────────────────────────────┤
│  stdio launcher              │  (or direct HTTP clients)    │
│  ~/.unity-mcp/stdio.js       │                              │
│  resolves the session's      │                              │
│  project, reads its beacon   │                              │
│  Temp/UnityMcp_Endpoint.json │                              │
├──────────────────────────────┴──────────────────────────────┤
│           HTTP JSON-RPC (Port 5173, per project)            │
├─────────────────────────────────────────────────────────────┤
│              Node.js MCP Server (Server~/)                  │
├─────────────────────────────────────────────────────────────┤
│                TCP NDJSON (Port 52100)                      │
├─────────────────────────────────────────────────────────────┤
│                Unity Editor C# Bridge                       │
│  (McpBridge → ToolRegistry → MainThreadDispatcher)          │
├─────────────────────────────────────────────────────────────┤
│                     Unity APIs                              │
└─────────────────────────────────────────────────────────────┘

開いている各プロジェクトは独自の Node サーバーを実行します。ランチャーは共有の入り口として、すべてのセッションを正しいサーバーにルーティングします。

開発

  • Unity テスト: Window > General > Test Runner(EditMode + PlayMode)

  • ランチャーのテスト: Server~/ 内で npm test

  • 変更履歴: CHANGELOG.md

ライセンス

MIT。 LICENSE を参照してください。

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
<1hResponse time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    Not graded
    maintenance
    Enables AI assistants to interact with Unity Editor through the Model Context Protocol, allowing natural language control of Unity projects including scene manipulation, GameObject creation, component updates, package management, and test execution.
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to interact with Unity Editor, managing scenes, game objects, animations, materials, scripts, and more via natural language commands.
    1
    MIT

View all related MCP servers

Related MCP Connectors

  • Build, validate, and deploy multi-agent AI solutions from any AI environment.

  • SaaS intelligence for AI agents. 5 unified tools cover 1,000+ services with 91-96% token savings.

  • Build and run visual creative-production workflows from your AI agent.

View all MCP Connectors

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/Singtaa/UnityMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server