How to Handle Dependencies with Unity MCP: Complete Setup and Detection Guide
Unity MCP handles external dependencies through a centralized DependencyManager that automatically detects your platform, validates Python 3.10+ and uv installations, and surfaces installation instructions in the Editor UI.
The Unity MCP (Model Context Protocol) package requires specific external tooling to bridge AI assistants with the Unity Editor. According to the CoplayDev/unity-mcp source code, the dependency handling logic lives in the MCPForUnity/Editor/Dependencies subsystem, which provides platform-aware detection and user-friendly setup workflows without requiring manual configuration files.
How the Dependency Manager Orchestrates Checks
The dependency resolution process follows a six-step pipeline orchestrated by [DependencyManager.cs](https://github.com/CoplayDev/unity-mcp/blob/beta/MCPForUnity/Editor/Dependencies/DependencyManager.cs):
-
Platform Detection –
GetCurrentPlatformDetector()selects the firstIPlatformDetectorthat returnstrueforCanDetect, choosing from Windows, macOS, or Linux implementations inMCPForUnity/Editor/Dependencies/PlatformDetectors/. -
Tool Validation – The selected detector executes
DetectPython()andDetectUv()to locate Python 3.10+ and the uv package manager, returning aDependencyStatusobject for each tool containing version, path, and availability data. -
Result Aggregation – All
DependencyStatusobjects are compiled into aDependencyCheckResult(defined in [DependencyCheckResult.cs](https://github.com/CoplayDev/unity-mcp/blob/beta/MCPForUnity/Editor/Dependencies/Models/DependencyCheckResult.cs)), which generates a human-readableSummaryand a list ofRecommendedActions. -
UI Presentation – The
MCPSetupWindowreads the result and renders a checklist interface (defined inMCPSetupWindow.uxml) that displays missing dependencies with direct installation links. -
Auto-Installation – For the MCP Server component itself, the manager reports that it "will be installed automatically when needed," eliminating manual server setup.
-
Re-Validation – After installing missing tools, calling
CheckAllDependencies()again updates theIsSystemReadyflag to verify the system state.
Platform-Specific Detection Logic
Each platform detector implements IPlatformDetector with OS-specific heuristics to locate binaries without requiring external dependencies:
Windows Detection
The [WindowsPlatformDetector.cs](https://github.com/CoplayDev/unity-mcp/blob/beta/MCPForUnity/Editor/Dependencies/PlatformDetectors/WindowsPlatformDetector.cs) searches for python.exe on the system PATH and validates the existence of uv.exe in standard installation directories.
macOS and Linux Detection
macOS and Linux detectors use which python3 and which uv shell commands to locate binaries, with Linux specifically checking /usr/bin and /usr/local/bin for package manager installations.
All detectors rely solely on standard .NET APIs and System.Runtime.InteropServices.RuntimeInformation, ensuring they function without additional NuGet packages or native plugins.
Checking Dependencies Programmatically
You can interact with the dependency system from custom Editor scripts to validate the environment before running MCP workflows.
Running a Full Dependency Check
Use DependencyManager.CheckAllDependencies() to validate the entire toolchain and log specific missing components:
using MCPForUnity.Editor.Dependencies;
var result = DependencyManager.CheckAllDependencies();
Debug.Log(result.Summary);
if (!result.IsSystemReady)
{
foreach (var action in result.RecommendedActions)
{
Debug.LogWarning($"Required action: {action}");
}
}
This method returns a DependencyCheckResult containing the IsSystemReady boolean and aggregated status for all required tools.
Launching the Setup Window
To present the graphical dependency checklist to users, invoke the MCPSetupWindow class:
using MCPForUnity.Editor.Windows;
// Opens the Local Setup Window with current check results
MCPSetupWindow.ShowWindow();
This window calls DependencyManager.CheckAllDependencies() internally and renders the results using the dependency-list UI component defined in the UXML template.
Retrieving Installation URLs
For custom UI elements or automated documentation, fetch the official download URLs:
var (pythonUrl, uvUrl) = DependencyManager.GetInstallationUrls();
Debug.Log($"Download Python from: {pythonUrl}");
Debug.Log($"Download uv from: {uvUrl}");
The GetInstallationUrls() method (lines 95-104 in [DependencyManager.cs](https://github.com/CoplayDev/unity-mcp/blob/beta/MCPForUnity/Editor/Dependencies/DependencyManager.cs)) returns platform-appropriate download links for the missing dependencies.
Validating Dependencies in CI/CD
For automated build pipelines, programmatically fail the build if required dependencies are missing:
var result = DependencyManager.CheckAllDependencies();
var missing = result.GetMissingRequired();
if (missing.Count > 0)
{
throw new BuildFailedException(
$"Missing MCP dependencies: {string.Join(", ", missing.Select(m => m.Name))}\n" +
$"Actions required: {string.Join("\n", result.RecommendedActions)}"
);
}
The GetMissingRequired() method filters the dependency list to return only items marked as required but not available on the system.
Understanding the Data Models
The dependency system uses two primary data structures defined in MCPForUnity/Editor/Dependencies/Models/:
DependencyStatus – Represents a single external tool with properties for Name, IsAvailable, Version, InstallPath, and ErrorMessage.
DependencyCheckResult – Aggregates multiple DependencyStatus objects and provides helper methods like GetMissingRequired() and GetMissingOptional() to filter results by severity.
Summary
- Unity MCP requires Python 3.10+ and the uv package manager to function as an AI bridge.
- The
DependencyManagerclass inMCPForUnity/Editor/Dependencies/DependencyManager.csorchestrates platform detection and validation. - Platform detectors in
MCPForUnity/Editor/Dependencies/PlatformDetectors/implement OS-specific logic for locating binaries without external dependencies. - Use
CheckAllDependencies()to programmatically validate the environment and retrieve actionable recommendations. - The
MCPSetupWindowprovides a built-in UI for visualizing missing dependencies and accessing installation URLs. - The
DependencyCheckResultmodel offersIsSystemReadyandGetMissingRequired()for automated validation in CI/CD pipelines.
Frequently Asked Questions
What dependencies are required for Unity MCP to function?
Unity MCP requires Python 3.10 or higher and the uv package manager (a fast Python package installer). The DependencyManager validates these through DetectPython() and DetectUv() methods. The MCP Server itself is installed automatically when needed, so you only need to ensure Python and uv are present on your system.
How can I check if my system is ready without opening the Unity Editor?
You can run dependency checks from any Editor script using DependencyManager.CheckAllDependencies(). This method returns a DependencyCheckResult with an IsSystemReady property that returns true only when all required dependencies (Python and uv) are detected and meet version requirements.
Can I automate dependency validation in my build pipeline?
Yes. Use the GetMissingRequired() method on the DependencyCheckResult object to identify critical missing tools. If the returned list contains any items, you can fail the build before attempting to initialize MCP connections. This is useful for CI/CD environments where you want to validate the environment before running automated tests.
What happens if I install Python but the setup window still shows it as missing?
The platform detectors cache results during the current editor session. After installing Python or uv, click the refresh button in the MCPSetupWindow or manually call DependencyManager.CheckAllDependencies() again to re-run the detection logic. The WindowsPlatformDetector (and other platform implementations) will then scan the updated PATH and registry to locate the newly installed binaries.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →