Unity MCP

Unity MCP

Enables real-time control of Unity Editor through natural language commands, allowing AI to manipulate game objects, run automated tests, manage scenes, and perform batch operations with undo support.

Category
访问服务器

README

Unity MCP

<div align="center">

🎮 Control Unity Editor • ⚡ Real-time automation • 🚀 AI-powered workflows

npm MCP Server MIT GitHub Sponsors Discord GitHub Stars

<img src="res/MCP.png" alt="Unity MCP">

</div>

✨ What It Does

Unity MCP provides real-time control of Unity Editor via the Model Context Protocol allowing you to:

<div align="left">Feature</div> <div align="left">Description</div>
Editor Control Select, move, rotate, and scale objects with natural language
Batch Operations Align, distribute, duplicate objects with undo support
Automated Testing Enter play mode and run test scenarios programmatically
Scene Management Load, save, inspect scene hierarchy in real-time

🚀 Quick Setup

📋 Prerequisites

<details> <summary><strong>🔑 Requirements</strong></summary>

</details>


📥 Installation

⚠️ REQUIRED: You must install Unity MCP before using any of its tools.

<details> <summary><strong>📦 Choose your setup method</strong></summary>

Method 1: Automatic Setup (Recommended) ⚡

One command does everything:

claude mcp add @spark-apps/unity-mcp

✅ Installs the package ✅ Configures your MCP client automatically ✅ Ready to use immediately after restart


Method 2: Manual Setup 🛠️

If you prefer to configure manually or use a different MCP client:

Step 1: Install the package globally

npm i -g @spark-apps/unity-mcp

Step 2: Add to your MCP client configuration

Edit your MCP client config file:

  • <span style="background: #1e90ff; color: white; padding: 2px 6px; border-radius: 3px; font-size: 11px; font-weight: bold;">Windows</span> %APPDATA%\\Claude\\claude_desktop_config.json
  • <span style="background: #c0c0c0; color: black; padding: 2px 6px; border-radius: 3px; font-size: 11px; font-weight: bold;">macOS</span> ~/Library/Application Support/Claude/claude_desktop_config.json
  • <span style="background: #ffd700; color: black; padding: 2px 6px; border-radius: 3px; font-size: 11px; font-weight: bold;">Linux</span> ~/.config/Claude/claude_desktop_config.json

Add this configuration:

{
  "mcpServers": {
    "unity-mcp": {"command": "npx", "args": ["-y", "@spark-apps/unity-mcp"]}
  }
}

Step 3: Restart your MCP client

</details>


🎮 Unity Editor Integration

<details> <summary><strong>⚡ One-time setup per Unity project</strong></summary>

Tell Claude to set up the integration:

Setup Unity MCP in my project at /path/to/unity/project

This installs 8 editor scripts to Assets/Editor/UnityMCP/ including:

  • HTTP server with auto-start (port 8080)
  • Control Panel UI with 🟢🟠🔴⚪ status monitoring
  • ScriptableObject configuration for persistent settings
  • Handlers for all 30 tools

After installation:

  1. Restart Unity Editor
  2. Open Tools → Unity MCP → Control Panel
  3. Verify 🟢 Connected status

Done! Use the Control Panel to manage settings and monitor your connection.

</details>


🛠️ Available Tools

<details> <summary><strong>🔧 View All 30 Available Tools</strong></summary>

🎯 Editor Control (7 tools)

<div align="left">Tool</div> <div align="left">Description</div>
Setup Unity MCP Install editor integration into Unity project
Select Objects Select by name, tag, or pattern with framing
Transform Objects Move, rotate, scale objects
Align Objects Align left/right/top/bottom/center
Distribute Objects Distribute evenly along axis
Duplicate Objects Clone objects with undo support
Find Objects Find by component type or pattern

🗺️ Scene Management (6 tools)

<div align="left">Tool</div> <div align="left">Description</div>
List Scenes List all scenes in build settings
Load Scene Load scene by name or index
Save Scene Save current or all scenes
Get Hierarchy Get complete scene hierarchy
Find In Scene Find objects in current scene
Cleanup Scene Remove missing scripts and empty objects

🧪 Testing & Play Mode (5 tools)

<div align="left">Tool</div> <div align="left">Description</div>
Enter Play Mode Start play mode programmatically
Exit Play Mode Exit play mode programmatically
Run Test Execute automated test scenarios
Play Mode Status Get play mode status and logs
Set Time Scale Slow motion or fast forward

📦 Assets & Console (5 tools)

<div align="left">Tool</div> <div align="left">Description</div>
Get Console Logs Retrieve Unity console logs for debugging
Clear Console Clear all console logs
Create Prefab Create prefab from selected GameObject
Get Assets List project assets with filtering
Refresh Assets Refresh Unity asset database

⚡ Advanced Tools (7 tools)

<div align="left">Tool</div> <div align="left">Description</div>
Execute Menu Item Execute any Unity Editor menu command
Add Package Install Unity packages via Package Manager
Run Unity Tests Execute Test Runner tests (EditMode/PlayMode)
Add Asset to Scene Add prefab or asset to current scene
Script Operations Create, read, update, delete C# scripts
Validate Script Validate C# script syntax
Delete Objects Delete objects with undo support

</details>


💬 Example Commands

<details> <summary><strong>🎯 Object Manipulation</strong></summary>

  • "Select all objects with tag 'Enemy' and align them horizontally"
  • "Move the Player object to position (0, 5, 10)"
  • "Distribute selected objects evenly along the x axis"
  • "Find all objects with Camera component"
  • "Duplicate selected object 5 times"

</details>

<details> <summary><strong>🧪 Automated Testing</strong></summary>

  • "Enter play mode and move Player to (10, 0, 0) for 5 seconds"
  • "Set time scale to 0.5 for slow motion"
  • "Run a test that destroys the Boss after 2 seconds"
  • "Check play mode status and show test logs"

</details>

<details> <summary><strong>🗺️ Scene Operations</strong></summary>

  • "List all scenes in the project"
  • "Load the MainMenu scene"
  • "Show me the complete hierarchy of the current scene"
  • "Find all objects with Rigidbody component"
  • "Clean up scene by removing missing scripts"

</details>


🎛️ Unity Control Panel

<details> <summary><strong>⚙️ Manage settings and monitor status</strong></summary>

Once installed, access the Control Panel via Tools → Unity MCP → Control Panel.

Features:

  • 🟢 Real-time Status Monitoring

    • 🟢 Connected - Server running normally
    • 🟠 Starting - Server is initializing
    • 🔴 Error - Connection failed
    • Disconnected - Server stopped
  • ⚙️ Server Settings (Collapsable)

    • Port configuration (default: 8080)
    • Auto-start on Unity load
    • Request timeout settings
    • Remote connections (⚠️ use with caution)
  • ✨ Features (Collapsable)

    • Console monitoring (max logs configurable)
    • Auto-refresh assets on changes
    • Verbose logging for debugging
  • ⚡ Quick Actions (Collapsable)

    • 📋 View Console Logs
    • 🔄 Refresh Assets
    • 💾 Save Scene
    • 🧹 Clear Console
    • 📁 Open Config
    • 📖 Documentation
  • 🔧 Tools Overview (Collapsable)

    • View all 30 available tools categorized by type
    • Quick reference without leaving Unity
  • ⚡ Advanced Settings (Collapsable)

    • Undo/Redo support
    • Auto-backup scenes
    • Reset to defaults

Configuration is stored as a ScriptableObject: Assets/Editor/UnityMCP/Resources/MCPConfig.asset

All settings persist across Unity sessions!

</details>


🐛 Troubleshooting

<details> <summary><strong>🐞 Common Issues</strong></summary>

MCP Server Not Showing:

  1. Verify Node.js is installed: node --version
  2. Check config file path is correct
  3. Ensure JSON syntax is valid
  4. Restart MCP client completely

Unity Editor Not Responding:

  1. Ensure Unity Editor is open
  2. Check Assets/Editor/UnityMCP/ scripts are installed
  3. Verify Console for [Unity MCP] Server started on port 8080
  4. Check no errors in Unity Console

Port Already in Use:

  1. Default port is 8080
  2. Check what's using it: lsof -i :8080 (Mac/Linux) or netstat -ano | findstr :8080 (Windows)
  3. Stop conflicting process or change port in Unity scripts

</details>


🌱 Support & Contributions

Star the repo & I power up like Mario 🍄
Devs run on coffee - Buy me one?
💰 Crypto tips welcome - Tip in crypto
🤝 Contributions are welcome - 🍴 Fork, improve, PR!
🎥 Need help? <img src="https://img.icons8.com/color/20/youtube-play.png" alt="YouTube" width="20" height="20" style="vertical-align: middle;"> Setup Tutorial • <img src="https://img.icons8.com/color/20/discord--v2.png" alt="Discord" width="20" height="20" style="vertical-align: middle;"> Join Discord

💖 Sponsor

Your support helps maintain and improve the tool. please consider sponsoring the project.


<div align="center">

Made with ❤️ for Game DevsPrivacy PolicyTerms of Service

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选