Unity MCP Server - A Model Context Protocol server that enables AI assistants to interact with Unity Editor and games through the Unity-MCP Plugin
$ dotnet add package com.IvanMurzak.Unity.MCP.ServerModel Context Protocol implementation for Unity Editor and for games made with Unity.
💬 Join our community: Discord Server - Ask questions, showcase your work, and connect with other developers!
Required to install Unity MCP Plugin into Unity Engine to connect it with MCP Server.
Client <-> Server <-> Plugin (Unity Editor / Game Build)
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) |
Unity-MCP server is developed with idea of flexibility in mind, that is why it has many launch options.
The default the transport method is streamableHttp. The port 8080 should be forwarded. It will be used for http transport and for plugin <-> server communication
docker run -p 8080:8080 ivanmurzakdev/unity-mcp-server
MCP client config:
{
"mcpServers": {
"ai-game-developer": {
"url": "http://localhost:8080"
}
}
}
The 8080 port is not needed for STDIO, because it uses the STDIO to communicate with Client. It is a good setup for using in a client with automatic installation and launching. Because this docker command loads the image from docker hub and launches immediately.
docker run -t -e MCP_PLUGIN_CLIENT_TRANSPORT=stdio -p 8080:8080 ivanmurzakdev/unity-mcp-server
MCP client config:
{
"mcpServers": {
"ai-game-developer": {
"command": "docker",
"args": [
"run",
"-t",
"-e",
"MCP_PLUGIN_CLIENT_TRANSPORT=stdio",
"-p",
"8080:8080",
"ivanmurzakdev/unity-mcp-server"
]
}
}
}
docker run -e MCP_PLUGIN_PORT=123 -p 123:123 ivanmurzakdev/unity-mcp-server
MCP client config:
{
"mcpServers": {
"ai-game-developer": {
"url": "http://localhost:123",
"type": "streamableHttp"
}
}
}
Port forwarding is need for the launch with docker -p 123:123.
Download binary from the GitHub releases page. Unpack the zip archive and use command line to simply launch binary of the server for your target operation system and CPU architecture.
./unity-mcp-server --client-transport stdio
MCP client config:
{
"mcpServers": {
"ai-game-developer": {
"command": "C:/Projects/Unity/Unity-MCP/Unity-MCP-Plugin/Library/mcp-server/win-x64/unity-mcp-server.exe",
"args": [
"--client-transport=stdio"
]
}
}
}
Launch server with STDIO transport type for local usage on the same machine with Unity Editor.
./unity-mcp-server --port 8080 --plugin-timeout 10000 --client-transport stdio
MCP client config:
{
"mcpServers": {
"ai-game-developer": {
"command": "C:/Projects/Unity/Unity-MCP/Unity-MCP-Plugin/Library/mcp-server/win-x64/unity-mcp-server.exe",
"args": [
"--port=8080",
"--plugin-timeout=10000",
"--client-transport=stdio"
]
}
}
}
Launch server with HTTP transport type for local OR remote usage using HTTP(S) url.
./unity-mcp-server --port 8080 --plugin-timeout 10000 --client-transport streamableHttp
MCP client config:
{
"mcpServers": {
"ai-game-developer": {
"command": "C:/Projects/Unity/Unity-MCP/Unity-MCP-Plugin/Library/mcp-server/win-x64/unity-mcp-server.exe",
"args": [
"--port=8080",
"--plugin-timeout=10000",
"--client-transport=streamableHttp"
]
}
}
}