A simple template project for controlling Unity via MCP (Message Control Protocol). This project demonstrates interaction between a TypeScript-based MCP server and Unity, allowing you to build and configure custom tools for further development.
The Unity MCP Server Template provides a foundation for integrating Unity with MCP, enabling seamless communication between Unity and external tools. The project includes a Unity example project (unity-mcp-sample
) and a TypeScript-based MCP server (unity-mcp-server
).
The unity-mcp-sample
is a Unity example project designed to minimize version-related issues. It does not use packages like NewtonsoftJSON and implements the EditorWindow using IMGUI. The MCP can be managed through the UnityMCP-ShowWindow
at the top.
To build the MCP server, navigate to the unity-mcp-server
directory and run the following commands:
npm install
npm run build
Open Claude Desktop Settings, navigate to Developer-Edit Config, and add the following configuration:
{
"mcpServers": {
"unity-mcp": {
"command": "node",
"args":["F:/unity-mcp-template/unity-mcp-server/dist/index.js"]
}
}
}
Both Unity and TypeScript components should follow the same input data structure.
Refer to CreateObjectTools
and create the tool you want.
Refer to createObject
and create the tool you want.
This project is a simple template for controlling Unity via MCP. It provides a starting point for developers to build and expand their own tools.