GitHub Stars
90
User Rating
Not Rated
Favorites
0
Views
81
Forks
19
Issues
4
Installation
Difficulty
IntermediateEstimated Time
10-20 minutes
Requirements
Unity 2021.3 or laterNode.js 18+Installation
Installation
Prerequisites
Unity: 2021.3 or later
Node.js: 18 or higher
Installation Steps
1. Install Unity Package
Option A: Package Manager (Git URL)1Open the Unity Package Manager (
Window > Package Manager)2Click the
+ button and select Add package from git URL...3Enter the repository URL:
https://github.com/quazaai/UnityMCPIntegration.git4Click
Option B: Import Custom Package
Add1Clone this repository or [download it as a unityPackage](https://github.com/quazaai/UnityMCPIntegration/releases)
2In Unity, go to
Assets > Import Package > Custom Package3Select the
UnityMCPIntegration.unitypackage file2. Set up the MCP Server
Option A: Run the server directly1Navigate to
mcpServerbash
cd /Library/PackageCache/com.quaza.unitymcp@
Configuration
Configuration
Basic Configuration
MCP Server Setup
Configure the MCP server as follows:json
{
"mcpServers": {
"unity-mcp": {
"command": "node",
"args": ["path/to/server.js"]
}
}
}
Environment Variables
Set the following environment variables as needed:bash
export API_KEY="your-api-key"
export DEBUG="true"
Security Settings
Store API keys in secure configuration files
Set appropriate file access permissions
Examples
Examples
Basic Usage
Programmatic Usage
javascript
// JavaScript example (Node.js)
const { MCPClient } = require('@modelcontextprotocol/client');
const client = new MCPClient();
await client.connect();
// Execute tool
const result = await client.callTool('toolName', {
parameter1: 'value1',
parameter2: 'value2'
});
console.log(result);
Advanced Examples
Automation Script
bash
#!/bin/bash
Batch processing example
for file in *.txt; do
mcp-tool process "$file"
done
Use Cases
A scenario where AI agents manipulate objects in the scene in real-time.
Executing automated test scripts within the Unity Editor.
Use case where AI suggests and executes changes to project settings.
A system where AI monitors errors and logs, notifying developers.
Additional Resources
Author Information
Related MCPs
unity-mcp-template
10
This is a simple example project demonstrating the interaction between a TypeScript-based MCP server and Unity. By using this template, you can build and expand your own tools. To ensure compatibility with legacy versions, it avoids using specific packages and implements the EditorWindow using IMGUI.