Back to MCP Catalog

Unity Integration MCP Server

GamingC#
Enable AI agents to control and interact with Unity projects
Available Tools

browseProject

Browse and navigate through Unity project files and directories

path

getSceneHierarchy

Retrieve the current scene's hierarchy of game objects

executeCode

Execute C# code directly in the Unity Editor context

code

getLogs

Retrieve console logs and errors from the Unity Editor

count

setPlayMode

Control the Editor's play mode (start/stop game execution)

enabled

waitForExecution

Wait for code execution to complete before continuing

Unity Integration provides a seamless connection between AI assistants and the Unity game engine through the Model Context Protocol (MCP). This integration allows AI agents to understand and manipulate Unity projects in real-time, accessing scene hierarchies, project settings, and executing code directly within the Unity Editor. With this powerful integration, AI assistants can browse project files, monitor logs, control play mode, and execute C# code - all while maintaining context of your Unity project structure. This creates a collaborative environment where AI can provide meaningful assistance for game development tasks, debugging, and project management.

Overview

Unity Integration enables AI assistants to interact with your Unity projects through the Model Context Protocol (MCP). This integration creates a bridge between AI systems and the Unity Editor, allowing for real-time collaboration and assistance with game development tasks.

Installation

Step 1: Add the Unity Package

There are two ways to add the Unity MCP Integration to your project:

Option A: Using the Unity Package Manager

  1. Open your Unity project
  2. Go to Window > Package Manager
  3. Click the "+" button in the top-left corner
  4. Select "Add package from git URL..."
  5. Enter: https://github.com/quazaai/UnityMCPIntegration.git
  6. Click "Add"

Option B: Manual Installation

  1. Clone the repository: git clone https://github.com/quazaai/UnityMCPIntegration.git
  2. Copy the contents into your Unity project's Assets folder

Step 2: Configure the MCP Server

The package includes a Node.js-based MCP server that needs to be configured:

  1. Make sure you have Node.js 18+ installed on your system
  2. Open a terminal in the mcpServer directory within the package
  3. Run npm install to install dependencies
  4. Configure your MCP client to connect to the server (see MCP Client Configuration below)

MCP Client Configuration

Add the following configuration to your MCP client (Claude, Cursor, etc.):

"mcpServers": {
  "unity-integration": {
    "command": "node",
    "args": [
      "PATH_TO_YOUR_UNITY_PROJECT/Assets/mcpServer/server.js"
    ]
  }
}

Replace PATH_TO_YOUR_UNITY_PROJECT with the actual path to your Unity project.

Using the Integration

Once installed and configured, you can access the MCP Debug Window in Unity:

  1. Go to Window > MCP Debug Window
  2. The window displays connection status and provides controls for the MCP server
  3. You can start/stop the server, view logs, and configure server settings

Features and Capabilities

Project Navigation

AI assistants can browse and understand your project structure, including:

  • Scene hierarchies
  • Asset organization
  • Project settings
  • Scripts and components

Code Execution

Execute C# code directly in the Unity Editor context:

  • Modify game objects and components
  • Create or update scripts
  • Test functionality
  • Debug issues

Editor Control

Control various aspects of the Unity Editor:

  • Enter/exit Play mode
  • Compile scripts
  • Save scenes and assets
  • Monitor console logs and errors

Real-time Feedback

The integration provides real-time feedback to the AI assistant:

  • Console output
  • Execution results
  • Error messages
  • Scene changes

Troubleshooting

Connection Issues

  • Ensure the MCP server is running (check the MCP Debug Window)
  • Verify your firewall isn't blocking the WebSocket connection
  • Check that the port specified in the configuration is available

Performance Concerns

  • For large projects, consider limiting the scope of scene hierarchy information sent to the MCP server
  • Use the debug settings to adjust verbosity levels

Compatibility

  • This integration requires Unity 2021.3 or later
  • If using older Unity versions, you may encounter compatibility issues

Security Considerations

The MCP server provides significant access to your Unity project. Consider these security practices:

  • Run the server only when actively collaborating with an AI assistant
  • Be cautious about executing unknown code
  • Review code suggestions before execution
  • Use the integration in development environments, not production builds

Related MCPs

VRChat API
GamingTypeScript

Access and interact with the VRChat API

Godot
GamingTypeScript

Interface with the Godot game engine to launch, run, and debug projects

Unity Editor Integration
GamingC#

Connect Unity Editor with AI models for game development assistance

About Model Context Protocol

Model Context Protocol (MCP) allows AI models to access external tools and services, extending their capabilities beyond their training data.

Generate Cursor Documentation

Save time on coding by generating custom documentation and prompts for Cursor IDE.