- Unity MCP Server
Unity MCP Server
Content
Unity MCP Server
Unity ゲームエンジン統合のための Model Context Protocol (MCP) サーバーです。このサーバーにより、AI アシスタントが Unity プロジェクトと対話し、ビルド、テスト、プロファイリング、Unity アプリケーションの管理のためのツールを提供します。
機能
コア機能
- Unity コマンド実行 - Unity コマンドライン操作の実行
- プロジェクトビルド - 複数プラットフォーム向けの Unity プロジェクトビルド
- テスト実行 - Unity テストの実行(EditMode/PlayMode)
- プロジェクト情報取得 - Unity バージョンとプロジェクトの詳細情報取得
開発ツール
- スクリプトコンパイル - プラットフォーム固有の設定での Unity スクリプトコンパイル
- C# プロジェクト生成 - IDE 統合用の .csproj ファイル生成(Visual Studio、VSCode、Rider)
- アセット管理 - Unity アセットの更新と再インポート
- スクリプティング定義 - 条件付きコンパイルシンボルの設定
パフォーマンス分析
- Unity Profiler - 設定可能な期間とディーププロファイリングでパフォーマンスデータをキャプチャ
- Frame Debugger - フレームレンダリング統計のキャプチャ(ドローコール、バッチ、トライアングル)
- メモリスナップショット - Unity Memory Profiler での分析用メモリ使用量キャプチャ
- ログ分析 - Unity Editor とビルドログの読み取りと分析
インストール
# リポジトリのクローン
git clone https://github.com/yourusername/unity-mcp-server.git
cd unity-mcp-server
# 依存関係のインストール
npm install
# プロジェクトのビルド
npm run build
設定
環境変数
UNITY_EXECUTABLE- Unity 実行ファイルへのパス(オプション、設定されていない場合は自動検出)
自動検出
サーバーは Unity インストールを自動的に検出します:
- Windows: 一般的な Unity Hub とスタンドアロンインストールパスをチェック
- macOS: Applications フォルダ内の Unity.app を検索
- Linux/WSL: 実行中の Unity プロセスを検出し、パスを適切に変換
使用方法
サーバーの起動
# プロダクションモード
npm start
# 開発モード
npm run dev
利用可能なツール
unity_execute
Unity コマンドライン操作を実行します。
{
"command": "-batchmode -quit -logFile output.log",
"projectPath": "/path/to/project"
}
unity_build
指定されたプラットフォーム向けに Unity プロジェクトをビルドします。
{
"projectPath": "/path/to/project",
"buildTarget": "StandaloneWindows64",
"outputPath": "/path/to/output"
}
unity_compile
Unity スクリプトをコンパイルし、アセットを更新します。
{
"projectPath": "/path/to/project",
"platform": "StandaloneWindows64"
}
unity_generate_csproj
IDE 統合用の C# プロジェクトファイルを生成します。
{
"projectPath": "/path/to/project",
"ide": "VSCode"
}
unity_run_tests
オプションのフィルタリングで Unity テストを実行します。
{
"projectPath": "/path/to/project",
"testPlatform": "EditMode",
"testFilter": "MyNamespace.MyTestClass"
}
unity_profile
パフォーマンスプロファイリングデータをキャプチャします。
{
"projectPath": "/path/to/project",
"duration": 30,
"deepProfile": true,
"scenePath": "Assets/Scenes/MainScene.unity"
}
unity_frame_debugger
フレームレンダリング統計をキャプチャします。
{
"projectPath": "/path/to/project",
"frameCount": 10,
"scenePath": "Assets/Scenes/MainScene.unity"
}
unity_memory_snapshot
分析用のメモリスナップショットをキャプチャします。
{
"projectPath": "/path/to/project",
"outputPath": "/path/to/snapshot.snap"
}
unity_refresh_assets
Unity にアセットの再インポートを強制します。
{
"projectPath": "/path/to/project",
"assetPath": "Assets/Textures"
}
unity_set_defines
スクリプティング定義シンボルを設定します。
{
"projectPath": "/path/to/project",
"defines": ["DEBUG_MODE", "ENABLE_LOGS"],
"platform": "Android"
}
WSL サポート
サーバーは WSL(Windows Subsystem for Linux)環境を完全にサポートしています:
- WSL 環境を自動的に検出
- Windows と WSL パス間の変換
- WSL から Windows Unity を実行するために
cmd.exeを使用 - Windows 側で実行中の Unity プロセスを検出
ビルドターゲット
サポートされているプラットフォーム:
StandaloneWindows64StandaloneOSXStandaloneLinux64AndroidiOSWebGL
パフォーマンス分析
プロファイラーデータ
Unity Profiler は以下をキャプチャします:
- CPU 使用率とフレームタイム
- GPU パフォーマンスメトリクス
- メモリアロケーション
- スクリプトパフォーマンス(ディーププロファイリング使用時)
Frame Debugger 出力
フレーム統計には以下が含まれます:
- ドローコール
- バッチ
- トライアングル数
- 頂点数
- レンダリング時間
- SetPass コール
メモリスナップショット
Unity Memory Profiler パッケージと互換性があり、以下の分析が可能:
- マネージドオブジェクト分析
- ネイティブアロケーション追跡
- メモリリーク検出
エラーハンドリング
サーバーは以下を含む詳細なエラーメッセージを提供します:
- コマンド実行ステータス
- Unity の stdout/stderr 出力
- ファイル操作結果
- 長時間操作のタイムアウト処理
開発
プロジェクト構造
unity-mcp-server/
├── src/
│ └── index.ts # メインサーバー実装
├── dist/ # コンパイル済み JavaScript 出力
├── package.json # Node.js 依存関係
├── tsconfig.json # TypeScript 設定
└── README.md # このファイル
ソースからのビルド
# 依存関係のインストール
npm install
# TypeScript コンパイラの実行
npm run build
# ホットリロード付き開発モードで実行
npm run dev
要件
- Node.js 18 以上
- Unity 2019.4 以上
- TypeScript 5.0 以上
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
WindsurfThe new purpose-built IDE to harness magic
Serper MCP ServerA Serper MCP Server
Tavily Mcp
Playwright McpPlaywright MCP server
Amap Maps高德地图官方 MCP Server
ChatWiseThe second fastest AI chatbot™
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题;
Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
DeepChatYour AI Partner on Desktop
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
CursorThe AI Code Editor