Get the FREE Ultimate OpenClaw Setup Guide →

unity -template

Simple template project for controlling Unity via MCP

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio dunward-unity-mcp-template node F:/unity-mcp-template/unity-mcp-server/dist/index.js

How to use

This MCP server template demonstrates how Unity can communicate with a TypeScript-based MCP server. The Unity side acts as a client that sends input data and receives results via the MCP framework, while the TypeScript server processes those inputs and returns structured results. The included example uses a simple object-oriented approach to create tools that operate on shared input data, enabling you to build custom Unity tools that can send commands, process responses, and visualize outcomes inside Unity or Claude Desktop.

To use it, configure the MCP server in your environment (e.g., Claude Desktop) to point to the Node.js server entry file. The server exposes a small API through the MCP protocol, allowing Unity to send object data and receive tool results. You can create additional tools by following the patterns described in the template: implement a CreateObjectTools-like interface in TypeScript and a corresponding Unity tool that emits the same input data shape. Ensure both sides keep the same input data structure for compatibility.

How to install

Prerequisites:

  • Node.js and npm installed on your machine
  • Basic familiarity with npm scripts
  1. Clone the repository or obtain the template package.
  2. Install dependencies for the Unity MCP server package:
    • Open a terminal and navigate to the unity-mcp-server directory.
    • Run: npm install
  3. Build the MCP server:
    • In the same directory: npm run build
  4. Run or integrate the server:
    • After building, you can start the server (the exact command may depend on your setup). A typical approach is to run the built entry file via Node: node dist/index.js
  5. Configure your MCP client (e.g., Claude Desktop) to connect to the server. Example configuration (as shown in the README): { "mcpServers": { "unity-mcp": { "command": "node", "args": ["F:/unity-mcp-template/unity-mcp-server/dist/index.js"] } } }

Additional notes

Tips:

  • Ensure the Unity tooling and the MCP server share the same object data structure for input and output to avoid serialization issues.
  • The template emphasizes IMGUI-based Editor UI for Unity and a straightforward Node.js-based MCP server; this makes it easy to extend with additional tools.
  • If you modify the TCP/communication structure, update both Unity and TypeScript sides to keep compatibility.
  • Keep your build paths consistent; when moving between environments (Windows paths shown in the example vs. Unix-like paths), adjust the command args accordingly.
  • The repository does not rely on Newtonsoft.Json for compatibility; if you plan to replace serialization, ensure both sides handle the new format.

Related MCP Servers

Sponsor this space

Reach thousands of developers