Make 3D games in Unity Engine with AI. MCP Server + Plugin for Unity Editor and Unity games.
The MCP server for Unity enables Model Context Protocol integration with Unity Engine, providing an MCP server and a plugin for the Unity Editor and Unity games. It supports AI-assisted game development workflows by embedding model contexts into Unity projects.
π οΈ Key Features
MCP server implementation compatible with Unity-based workflows
Plugin support for Unity Editor and Unity runtime
Topics include AI-integration, model-context-protocol, and several AI providers
Lightweight Docker image and OpenUPM package availability
Readme excerpt highlights MCP branding and integration badges
π Use Cases
AI-assisted game development in Unity
Embedding model contexts from MCP into Unity projects
Integrating Claude, OpenAI, Gemini, and other LLMs via MCP
CLI-based setup for MCP-enabled Unity environments
β‘ Developer Benefits
Clear MCP server integration path for Unity projects
Availability via OpenUPM package and Docker image
Community topics covering AI, CLIs, and editor plugins
Quick-start references from readme excerpt and badges
β οΈ Limitations
Specific runtime compatibility details not included in the excerpt
No detailed API surface, configuration options, or plugin installation steps provided in source data
Unity MCP is an AI-powered game development assistant for Editor & Runtime. Connect Claude, Cursor, & Windsurf to Unity via MCP. Automate workflows, generate code, and enable AI within your games.
Unlike other tools, this plugin works inside your compiled game, allowing for real-time AI debugging and player-AI interaction.
# 1. Install unity-mcp-cli
npm install -g unity-mcp-cli
# 2. Install "AI Game Developer" in Unity project
unity-mcp-cli install-plugin ./MyUnityProject
# 3. Sign in to ai-game.dev (opens your browser β OAuth device flow)
unity-mcp-cli login
# 4. Open Unity project (auto-connects and generates skills)
unity-mcp-cli open ./MyUnityProject
AI Game Developer Windows
AI Game Developer β Unity SKILLS and MCP
Quick Start
Get up and running in three steps:
Install plugin β download the .unitypackage installer or run openupm add com.ivanmurzak.unity.mcp
Alternative:npx unity-mcp-cli install-plugin ./MyUnityProject β see CLI documentation
Pick an AI agent β Claude Code, Claude Desktop, GitHub Copilot, Cursor, or any other
Setup AI agent β open Window/AI Game Developer in Unity and click Auto-generate skills (recommended) or Configure MCPSetup AI Skills
Alternative:npx unity-mcp-cli setup-skills claude-code ./MyUnityProject β see CLI documentation
That's it. Ask your AI "Create 3 cubes in a circle with radius 2" and watch it happen. β¨
Skills and Tools Reference
The plugin ships with 70+ built-in tools across four categories. Each tool brings AI skill. All tools are available immediately after installation β no extra configuration required. See docs/default-mcp-tools.md for the full reference with detailed descriptions.
Cloud sign-in & project pinning:unity-mcp-cli login runs the browser OAuth device flow and stores the credential in the shared machine store (~/.ai-game-dev/credentials.json) β there is no personal access token to paste. By default the AI-agent config that setup-mcp writes points at a per-project pinned endpoint (https://ai-game.dev/mcp/p/<pin>); pass --no-pin to use the shared https://ai-game.dev/mcp endpoint instead. Teams can distribute access with an enrollment code: unity-mcp-cli install-plugin --enroll <code>.
Step 2: Install AI agent
Choose a single AI agent you prefer - you don't need to install all of them. This will be your main chat window to communicate with the LLM.
The AI Game Developer is quite universal, which is why you may use any AI agent you prefer - it will work as smoothly as any other. The only important requirement is that the AI agent must support Skills or dynamic MCP Tool updates.
Option 2: Click Configure Model Context Protocol (MCP)
Unity_AI
If your MCP client is not in the list, use the raw JSON shown in the window to inject it into your MCP client. Read the instructions for your specific MCP client on how to do this.
Manual configuration
If automatic configuration doesn't work for you for any reason, use the JSON from the AI Game Developer (Unity-MCP) window to configure any MCP Client manually.
2. Replace <unityProjectPath> with the full path to Unity project
3. Replace <port> with your port from AI Game Developer configuration
4. Add MCP server using command line
Gemini CLI Gemini CLI
bash
gemini mcp add ai-game-developer <command>
Replace <command> from the table above
Claude Code CLI Claude Code CLI
bash
claude mcp add ai-game-developer <command>
Replace <command> from the table above
GitHub Copilot CLI GitHub Copilot CLI
bash
copilot
bash
/mcp add
Server name: ai-game-developer
Server type: local
Command: <command>
Replace <command> from the table above
AI Game Developer β Unity SKILLS and MCP
AI Workflow Examples
Communicate with the AI (LLM) in your AI agent. Ask it to do anything you want. The better you describe your task or idea, the better it will perform the job.
Some AI agents allow you to choose different LLM models. Pay attention to this feature, as some models may work much better than others.
Example prompts:
text
Explain my scene hierarchy
text
Create 3 spheres on top of each other
text
Create metallic golden material and attach it to a new sphere gameObject
Make sure Agent mode is enabled if using VS Code with Copilot
Disabling update notifications for the whole team
The plugin shows an update popup at Editor startup when a newer version is available on OpenUPM. By default, each team member sees this popup until they individually click "Do not show again" (which is a per-user setting stored on their machine).
For multi-person Unity projects where one engineer owns plugin versioning, you can disable the popup for the entire team by opening Edit βΈ Project Settings βΈ AI Game Developer and enabling "Disable update notifications for the entire team". The setting is persisted to ProjectSettings/AI-Game-Developer-UpdateSettings.asset and only needs to be set once per project β commit that file and every team member who pulls the commit will have the popup suppressed.
The same toggle is also reachable via Tools βΈ AI Game Developer βΈ Updates βΈ Disable Update Notifications (Team) in the menu bar.
Advanced Features for LLM
Unity MCP provides advanced tools that enable the LLM to work faster and more effectively, avoiding mistakes and self-correcting when errors occur. Everything is designed to achieve your goals efficiently.
Core Capabilities
βοΈ Agent-ready tools - Find anything you need in 1-2 steps
βοΈ Instant compilation - C# code compilation & execution using Roslyn for faster iteration
βοΈ Full asset access - Read/write access to assets and C# scripts
βοΈ Intelligent feedback - Well-described positive and negative feedback for proper issue understanding
Reflection-Powered Features
βοΈ Object references - Provide references to existing objects for instant C# code
βοΈ Project data access - Get full access to entire project data in a readable format
βοΈ Granular modifications - Populate & modify any piece of data in the project
βοΈ Method discovery - Find any method in the entire codebase, including compiled DLL files
βοΈ Method execution - Call any method in the entire codebase
βοΈ Advanced parameters - Provide any property for method calls, even references to existing objects in memory
βοΈ Live Unity API - Unity API instantly available - even when Unity changes, you get the fresh API
βοΈ Self-documenting - Access human-readable descriptions of any class, method, or property via Description attributes
AI Game Developer β Unity SKILLS and MCP
Customize Tools
Unity MCP supports custom MCP Tool, MCP Resource, and MCP Prompt development by project owners. The MCP server takes data from the Unity MCP Plugin and exposes it to a client. Anyone in the MCP communication chain will receive information about new MCP features, which the LLM may decide to use at some point.
Add custom Tool
To add a custom Tool, you need:
A class with the AiToolType attribute
A method in the class with the AiTool attribute
Optional: Add a Description attribute to each method argument to help the LLM understand it
Optional: Use string? optional = null properties with ? and default values to mark them as optional for the LLM
Note that the line MainThread.Instance.Run(() => allows you to run code on the main thread, which is required for interacting with Unity's API. If you don't need this and running the tool in a background thread is acceptable, avoid using the main thread for efficiency purposes.
csharp
[AiToolType]
publicclassTool_GameObject
{
[AiTool
(
"MyCustomTask",
Title = "Create a new GameObject"
)]
[Description("Explain here to LLM what is this, when it should be called.")]
publicstringCustomTask
(
[Description("Explain to LLM what is this.")]
string inputData
)
{
// do anything in background threadreturn MainThread.Instance.Run(() =>
{
// do something in main thread if neededreturn$"[Success] Operation completed.";
});
}
}
Add custom MCP Prompt
MCP Prompt allows you to inject custom prompts into the conversation with the LLM. It supports two sender roles: User and Assistant. This is a quick way to instruct the LLM to perform specific tasks. You can generate prompts using custom data, providing lists or any other relevant information.
csharp
[AiPromptType]
publicstaticclassPrompt_ScriptingCode
{
[AiPrompt(Name = "add-event-system", Role = Role.User)]
[Description("Implement UnityEvent-based communication system between GameObjects.")]
publicstringAddEventSystem()
{
return"Create event system using UnityEvents, UnityActions, or custom event delegates for decoupled communication between game systems and components.";
}
}
AI Game Developer β Unity SKILLS and MCP
Runtime usage (in-game)
Use Unity MCP in your game/app. Use Tools, Resources or Prompts. By default there are no tools, you would need to implement your custom.
csharp
// Build MCP pluginvar mcpPlugin = UnityMcpPluginRuntime.Initialize(builder =>
{
builder.WithConfig(config =>
{
config.Host = "http://localhost:8080";
config.Token = "your-token";
});
// Automatically register all tools from the current assembly
builder.WithToolsFromAssembly(Assembly.GetExecutingAssembly());
})
.Build();
await mcpPlugin.Connect(); // Start active connection with retry to the MCP serverawait mcpPlugin.Disconnect(); // Stop active connection and close existed connection
Sample: AI powered Chess game bot
There is a classic Chess game. Lets outsource to LLM the bot logic. Bot should do the turn using game rules.
csharp
[AiToolType]
publicstaticclassChessGameAI
{
[AiTool("chess-do-turn", Title = "Do the turn")]
[Description("Do the turn in the chess game. Returns true if the turn was accepted, false otherwise.")]
publicstatic Task<bool> DoTurn(int figureId, Vector2Int position)
{
return MainThread.Instance.RunAsync(() => ChessGameController.Instance.DoTurn(figureId, position));
}
[AiTool("chess-get-board", Title = "Get the board")]
[Description("Get the current state of the chess board.")]
publicstatic Task<BoardData> GetBoard()
{
return MainThread.Instance.RunAsync(() => ChessGameController.Instance.GetBoardData());
}
}
Why runtime usage is needed?
There are many use cases, lets imagine you are working on a Chess game with bot. You may outsource the bot decision making to LLM by writing few lines of code.
AI Game Developer β Unity SKILLS and MCP
Unity MCP Server setup
Unity MCP Server supports many different launch options and Docker deployment. Both transport protocols are supported: streamableHttp and stdio. If you need to customize or deploy Unity MCP Server to a cloud, this section is for you. Read more...
Variables
Doesn't matter what launch option you choose, all of them support custom configuration using both Environment Variables and Command Line Arguments. It would work with default values, if you just need to launch it, don't waste your time for the variables. Just make sure Unity Plugin also has default values, especially the --port, they should be equal.
Environment Variable
Command Line Args
Description
MCP_PLUGIN_PORT
--port
Client -> Server <- Plugin connection port (default: 8080)
MCP_PLUGIN_CLIENT_TIMEOUT
--plugin-timeout
Plugin -> Server connection timeout (ms) (default: 10000)
MCP_PLUGIN_CLIENT_TRANSPORT
--client-transport
Client -> Server transport type: stdio or streamableHttp (default: streamableHttp)
MCP_AUTHORIZATION
--authorization
Authentication mode for incoming Client connections: none, oauth, or token (default: none; the legacy required mode was removed)
MCP_PLUGIN_TOKEN
--token
Bearer token required from the Client when authorization is token (default: unset)
MCP_PLUGIN_IDLE_TIMEOUT_SECONDS
--idle-timeout-seconds
Shut down the server after this many seconds with no connections (default: 600)
Command line args support also the option with a single - prefix (-port) and an option without prefix at all (port).
For analytics and authorization webhook variables (MCP_PLUGIN_WEBHOOK_*), see docs/mcp-server.md.
Choosing a transport: Use stdio when the MCP client launches the server binary directly (local use β this is the most common setup). Use streamableHttp when running the server as a standalone process or in Docker/cloud, and connecting over HTTP.
Plugin Variables
The Unity MCP Plugin reads the following environment variables (and command-line arguments) on startup to override values from the saved config file. Overrides are applied at runtime; on first run or when a new authentication token is generated, the overridden values are written to the config file. On subsequent runs, overrides are applied in memory but are not automatically saved. The exception is UNITY_MCP_TOOLS, which uses [JsonIgnore] and is never persisted β it is runtime-only.
Environment Variable
Command Line Arg
Values
Description
UNITY_MCP_CLOUD_URL
-url
URL string
Override the MCP Server URL (UNITY_MCP_HOST is a legacy alias)
UNITY_MCP_CONNECTION_MODE
-UNITY_MCP_CONNECTION_MODE
Cloud / Custom
Force the connection mode (a loopback URL implies Custom)
UNITY_MCP_KEEP_CONNECTED
-UNITY_MCP_KEEP_CONNECTED
true / false
Force enable or disable the active connection
UNITY_MCP_AUTH_OPTION
-auth
none / oauth / token
Force set the authentication mode (legacy required migrates to token)
UNITY_MCP_TOKEN
-token
string
Force set the authentication token
UNITY_MCP_TRANSPORT
-UNITY_MCP_TRANSPORT
stdio / streamableHttp
Force the client transport the plugin configures
UNITY_MCP_START_SERVER
-UNITY_MCP_START_SERVER
true / false
Force whether the plugin keeps a local server process running
UNITY_MCP_TOOLS
-UNITY_MCP_TOOLS
comma-separated tool IDs
Enable only the listed tools; all others are disabled. Unknown IDs are logged as errors.
Command-line args take precedence over environment variables. Both override the saved config file value. The short flags -url, -token, and -auth are aliases; the full -UNITY_MCP_* arg names are also accepted.
Replace url with your real endpoint if it is hosted in cloud
Binary executable
You may launch Unity MCP Server directly from a binary file. You would need to have a binary compiled specifically for your CPU architecture. Check GitHub Release Page, it contains pre-compiled binaries for all CPU architectures.
Unity MCP serves as a bridge between LLMs and Unity. It exposes and explains Unity's tools to the LLM, which then understands the interface and utilizes the tools according to user requests.
Connect Unity MCP to LLM clients such as Claude or Cursor using the integrated AI Connector window. Custom clients are also supported.
The system is highly extensible - you can define custom MCP Tools, MCP Resource or MCP Prompt directly in your Unity project codebase, exposing new capabilities to AI or automation clients. This makes Unity MCP a flexible foundation for building advanced workflows, rapid prototyping, and integrating AI-driven features into your development process.
What is MCP
MCP - Model Context Protocol. In a few words, that is USB Type-C for AI, specifically for LLM (Large Language Model). It teaches LLM how to use external features. Such as Unity Engine in this case, or even your custom C# method in your code. Official documentation.
What is AI agent
It is an application with a chat window. It may have smart agents to operate better, it may have embedded advanced MCP Tools. In general well done MCP Client is 50% of the AI success of executing a task. That is why it is very important to choose the best one for usage.
What is MCP Server
It is a bridge between MCP Client and "something else", in this particular case it is Unity Engine. This project includes MCP Server.
What is MCP Tool
MCP Tool is a function or method that the LLM can call to interact with Unity. These tools act as the bridge between natural language requests and actual Unity operations. When you ask the AI to "create a cube" or "change material color," it uses MCP Tools to execute these actions.
Key characteristics:
Executable functions that perform specific operations
Typed parameters with descriptions to help the LLM understand what data to provide
Return values that give feedback about the operation's success or failure
Thread-aware - can run on main thread for Unity API calls or background thread for heavy processing
When to use Tool
Automate repetitive tasks - Create tools for common operations you do frequently
Complex operations - Bundle multiple Unity API calls into a single, easy-to-use tool
Project-specific workflows - Build tools that understand your project's specific structure and conventions
Error-prone tasks - Create tools that include validation and error handling
Custom game logic - Expose your game's systems to AI for dynamic content creation
Examples:
Creating and configuring GameObjects with specific components
Generating level geometry or placing objects procedurally
Configuring physics settings or collision layers
What is MCP Resource
MCP Resource provides read-only access to data within your Unity project. Unlike MCP Tools that perform actions, Resources allow the LLM to inspect and understand your project's current state, assets, and configuration. Think of them as "sensors" that give the AI context about your project.
Key characteristics:
Read-only access to project data and Unity objects
Structured information presented in a format the LLM can understand
Real-time data that reflects the current state of your project
Contextual awareness helping the AI make informed decisions
When to use MCP Resource
Project analysis - Let AI understand your project structure, assets, and organization
Debugging assistance - Provide current state information for troubleshooting
Intelligent suggestions - Give AI context to make better recommendations
Documentation generation - Automatically create documentation based on project state
Asset management - Help AI understand what assets are available and their properties
Examples:
Exposing scene hierarchy and GameObject properties
Listing available materials, textures, and their settings
Showing script dependencies and component relationships
Displaying current lighting setup and render pipeline configuration
Providing information about audio sources, animations, and particle systems
What is MCP Prompt
MCP Prompt allows you to inject pre-defined prompts into the conversation with the LLM. These are smart templates that can provide context, instructions, or knowledge to guide the AI's behavior. Prompts can be static text or dynamically generated based on your project's current state.
Key characteristics:
Contextual guidance that influences how the AI responds
Role-based - can simulate different personas (User requests or Assistant knowledge)
Dynamic content - can include real-time project data
Reusable templates for common scenarios and workflows
When to use MCP Prompt
Provide domain knowledge - Share best practices and coding standards specific to your project
Set coding conventions - Establish naming conventions, architecture patterns, and code style
Give context about project structure - Explain how your project is organized and why
Share workflow instructions - Provide step-by-step procedures for common tasks
Inject specialized knowledge - Add information about specific Unity features, third-party assets, or custom systems
Examples:
"Always use PascalCase for public methods and camelCase for private fields"
"This project uses a custom event system located in Scripts/Events/"
"When creating UI elements, always add them to the Canvas in Scene/UI/MainCanvas"
"Performance is critical - prefer object pooling for frequently instantiated objects"
"This project follows SOLID principles - explain any architecture decisions"
AI Game Developer β Unity SKILLS and MCP
Uninstall π§Ή
To completely remove the plugin from your Unity project:
Open Window βΈ Package Manager, select the AI Game Developer β MCP package, and click Remove.
Close Unity, then delete the Assets/Plugins/NuGet folder (along with its Assets/Plugins/NuGet.meta file).
AI Game Developer β Unity SKILLS and MCP
Contribution ππ
Contributions are highly appreciated. Bring your ideas and let's make game development simpler than ever before! Do you have an idea for a new Tool or feature, or did you spot a bug and know how to fix it?
Please give this project a star π if you find it useful!