Unity MCP Server
Unity MCP Server
中文 | English
Unity Editorプラグインであり、MCP (Model Context Protocol) を通じてUnity Editorの機能を外部AIエージェントに公開します。
エージェント(Kiro、Cursor、Claude Codeなど)は、標準のMCPプロトコルを介してUnity Editorに接続し、エディタ機能を呼び出すことができます。
理念
本プラグインは、AIエージェントの Unity認識レイヤー + 診断ツールチェーン として位置付けられています:
認識優先 — 「シーン状態の読み取り、コンテキストの取得、診断支援」などの高頻度なシナリオを優先的にカバーし、エージェントが現在のプロジェクト状態を十分に理解し、開発の意思決定を支援できるようにします。
構造化された書き込み — 安全で監査可能な書き込み操作機能(プロパティの変更、ノードの追加・削除など)を提供しますが、Unity Editor GUIのすべての操作をカバーすることは目指していません。
エディタの代替ではない — エンジニアとエージェントのコラボレーション効率を高めることを目的としており、エディタのすべての操作をダイアログボックスに移すことではありません。
Related MCP server: MCP Unity
特性
Streamable HTTP転送 — MCP 2025-03-26仕様に基づいた単一のHTTPエンドポイント
プロセス内実行 — 外部のNode.js/Pythonプロセスは不要で、エディタ内で直接起動
拡張可能なツールシステム —
IMcpToolインターフェースを実装するだけで新しいツールを登録可能、コアコードの変更は不要Domain Reload自動復旧 — PlayModeへの移行/終了後にサービスが自動的に再起動
内蔵ツール
完全なパラメータ説明と使用例については、ツール詳細ドキュメントを参照してください。
Debugツール
ツール | 機能 |
| Unity Consoleログの取得(フィルタリング対応) |
| ログバッファのクリア |
| 最近のError/Exceptionの完全なスタックトレースを取得 |
| FPS、DrawCall、メモリなどのパフォーマンス指標を取得 |
| Game/Sceneビューのスクリーンショットを撮影 |
Editorツール
Query(クエリ)
ツール | 機能 |
| GameObjectツリー構造の取得 |
| Inspectorのシリアライズされたフィールド値の取得 |
| 現在選択されているオブジェクト情報の取得 |
| 名前/コンポーネントによるGameObjectの検索 |
| プロジェクトルートディレクトリパスの取得 |
| Assetsディレクトリ構造の取得 |
Mutation(変更)
ツール | 機能 |
| GameObjectの追加 |
| GameObjectの削除 |
| シリアライズされたフィールド値の変更 |
| Transformプロパティの変更 |
| アクティブ状態の変更 |
| 親ノードの変更 |
| コンポーネントの追加 |
| コンポーネントの削除 |
| コンポーネントの有効/無効化 |
| 指定したGameObjectの選択 |
Project(プロジェクト)
ツール | 機能 |
| パスによるUnityメニュー項目の実行 |
| PlayMode状態の制御 |
Asset(アセット)
ツール | 機能 |
| Assetsサブディレクトリの削除 |
Buildツール
ツール | 機能 |
| スクリプトコンパイルのトリガー |
| コンパイルエラーリストの取得 |
| Test Runnerテストの実行 |
Codeツール(実験的、Unity 2022 Monoのみ)
ツール | 機能 |
| C#コードの動的コンパイルと実行(メインスレッド/バックグラウンドのデュアルモード対応) |
Window → MCP Serverパネルで手動で有効にする必要があります。詳細はツール詳細ドキュメントを参照してください。
インストール
Git URLインストール(推奨)
Unity Editor → Window → Package Manager →
+→ Add package from git URL以下のURLを入力:
https://github.com/yangfch3/Unity-MCP-Server.gitまたは、ホストプロジェクトの Packages/manifest.json を直接編集:
{
"dependencies": {
"com.yangfch3.unity-mcp": "https://github.com/yangfch3/Unity-MCP-Server.git"
}
}ローカルパスインストール
本リポジトリをクローン
Unity Editor → Window → Package Manager →
+→ Add package from disk本リポジトリルートの
package.jsonを選択
または Packages/manifest.json に以下を追加:
{
"dependencies": {
"com.yangfch3.unity-mcp": "file:../../path/to/unity-mcp"
}
}バージョン更新
UPMでGit URLからインストールすると、ホストプロジェクトの packages-lock.json に現在のコミットハッシュがロックされます。その後、自動的には更新されません。
特定のバージョンをロックしたい場合は、URLの末尾にGit Tagを追加できます:
https://github.com/yangfch3/Unity-MCP-Server.git#v0.3.0対応する Packages/manifest.json の設定:
{
"dependencies": {
"com.yangfch3.unity-mcp": "https://github.com/yangfch3/Unity-MCP-Server.git#v0.3.0"
}
}Tagを指定しない場合は、デフォルトブランチの最新コミットを追跡します:
{
"dependencies": {
"com.yangfch3.unity-mcp": "https://github.com/yangfch3/Unity-MCP-Server.git"
}
}バージョンを更新する際は、manifest.json 内の #tag サフィックスを新しいバージョン番号に変更するか、UPM GUIで再度Add package from git URLを行い、新しいTagのURLを入力してください。
使用方法
サービスの起動
Unity Editor → Window → MCP Server
ポートを設定(デフォルト8090)し、Startをクリック
パネル内の設定JSONをコピー
エージェントの設定
以下の内容をエージェントのMCP設定ファイル(mcp.jsonなど)に追加します:
{
"mcpServers": {
"unity-mcp": {
"url": "http://localhost:8090/"
}
}
}拡張:カスタムツールの追加
IMcpTool インターフェースを実装し、任意のEditorアセンブリに配置すると、サービス起動時に自動的に検出・登録されます:
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityMcp.Editor;
public class MyCustomTool : IMcpTool
{
public string Name => "my_custom_tool";
public string Category => "custom";
public string Description => "我的自定义工具";
public string InputSchema => "{\"type\":\"object\",\"properties\":{}}";
public Task<ToolResult> Execute(Dictionary<string, object> parameters)
{
return Task.FromResult(ToolResult.Success("Hello from custom tool!"));
}
}要件
Unity 2022.3+
Editor環境のみ、ランタイムビルドには影響しません
貢献
本プロジェクトの開発への参加を歓迎します。詳細は CONTRIBUTING.md を参照してください。
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to control Unreal E…
Your org's AI agents, tasks, runs, search, and brain files as MCP tools and resources.
A Model Context Protocol server for Wix AI tools
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceA bridge enabling seamless communication between Unity and Large Language Models via the Model Context Protocol, allowing developers to automate workflows, manipulate assets, and control the Unity Editor programmatically.14,777MIT
- AlicenseNot gradedqualityDmaintenanceImplementation of the Model Context Protocol for Unity Editor, allowing AI assistants to interact with Unity projects through a Node.js server bridge.10 npm2MIT
- AlicenseNot gradedqualityNot gradedmaintenanceEnables 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.-
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that integrates AI assistants like Claude and Cursor directly into the Unity Editor to automate game development workflows. It provides over 40 built-in tools for scene manipulation and project management, while offering a simple C# API for creating custom extensions.9GPL 3.0