Unity MCP Server

Unity MCP Server

Enables AI assistants to interact with Unity Editor projects through 68+ tools for manipulating scenes, GameObjects, components, and assets, plus live access to console logs, hierarchies, and test results.

Category
访问服务器

README

Unity MCP Server

Unity 6+ License: MIT

A Model Context Protocol (MCP) server for Unity Editor, enabling AI assistants like Claude to interact with Unity projects.

Features

  • 72 Tools for manipulating scenes, GameObjects, components, prefabs, transforms, and more
  • MCP Resources for live access to console logs, scene hierarchy, test results, and project files
  • Auto-start Node.js server - no manual setup required
  • Editor Window for monitoring and configuration
  • Full test coverage with unit and integration tests

Requirements

  • Unity 6 or later
  • Node.js 18 or later

Installation

Via Git URL (Package Manager)

  1. Open Window > Package Manager
  2. Click the + button > Add package from git URL
  3. Enter: https://github.com/Singtaa/UnityMCP.git

Via git submodule

git submodule add https://github.com/Singtaa/UnityMCP.git Packages/com.singtaa.unity-mcp

Quick Start

  1. Install the package
  2. Open Window > Unity MCP Server
  3. The server starts automatically when Unity opens
  4. Configure your AI assistant to connect to http://127.0.0.1:5173/mcp

Configuration

Settings are stored in ProjectSettings/McpSettings.json:

Setting Default Description
HTTP Port 5173 Port for MCP HTTP server
IPC Port 52100 Port for Unity-Node TCP bridge
Auto Start true Start server on Unity launch
Auth Enabled true Require bearer token authentication

Available Tools

Scene Management

  • unity_scene_list - List all loaded scenes
  • unity_scene_load - Load a scene
  • unity_scene_save - Save scene(s)
  • unity_scene_new - Create a new scene
  • unity_scene_close - Close a scene

GameObject Operations

  • unity_gameobject_create - Create GameObjects (with optional primitives)
  • unity_gameobject_find - Find GameObjects by name, tag, or path
  • unity_gameobject_delete - Delete GameObjects
  • unity_gameobject_set_active - Enable/disable GameObjects
  • unity_gameobject_set_parent - Reparent GameObjects
  • unity_gameobject_rename - Rename GameObjects
  • unity_gameobject_duplicate - Duplicate GameObjects

Component Management

  • unity_component_list - List components on a GameObject
  • unity_component_add - Add components
  • unity_component_remove - Remove components
  • unity_component_set_enabled - Enable/disable components
  • unity_component_get_properties - Get component properties
  • unity_component_set_property - Set component properties

Transform Operations

  • unity_transform_get - Get position/rotation/scale
  • unity_transform_set - Set position/rotation/scale
  • unity_transform_translate - Move by delta
  • unity_transform_rotate - Rotate by euler angles
  • unity_transform_look_at - Orient toward target
  • unity_transform_reset - Reset to identity

Editor Operations

  • unity_selection_get/set/focus - Editor selection
  • unity_editor_execute_menu_item - Execute menu commands
  • unity_editor_notification - Show notifications
  • unity_editor_log - Log to console
  • unity_editor_get_state - Get editor state
  • unity_editor_pause/step - Playmode control
  • unity_undo_* - Undo/redo operations

Prefab Operations

  • unity_prefab_load - Load a prefab asset for inspection/editing
  • unity_prefab_save - Save changes to a prefab
  • unity_prefab_get_hierarchy - Get full prefab hierarchy
  • unity_prefab_find_component - Find component within prefab by path

Testing

  • unity_test_list - List available tests
  • unity_test_run - Run tests asynchronously
  • unity_test_run_sync - Run tests synchronously
  • unity_test_get_results - Get test results

Project & Assets

  • unity_project_list_files - List project files
  • unity_project_read_text - Read text files
  • unity_project_write_text - Write text files
  • unity_assets_refresh - Refresh AssetDatabase
  • unity_assets_import - Import specific assets

MCP Resources

Resource URI Description
unity://console/logs Live console output
unity://hierarchy Scene hierarchy
unity://hierarchy/{scene} Specific scene hierarchy
unity://tests/results Latest test results
unity://project/files Project file tree

Architecture

┌─────────────────────────────────────────────────────────────┐
│                      AI Assistant                            │
├─────────────────────────────────────────────────────────────┤
│                 HTTP JSON-RPC (Port 5173)                   │
├─────────────────────────────────────────────────────────────┤
│              Node.js MCP Server (Server~/)                  │
├─────────────────────────────────────────────────────────────┤
│                TCP NDJSON (Port 52100)                      │
├─────────────────────────────────────────────────────────────┤
│                Unity Editor C# Bridge                        │
│  (McpBridge → ToolRegistry → MainThreadDispatcher)          │
├─────────────────────────────────────────────────────────────┤
│                     Unity APIs                               │
└─────────────────────────────────────────────────────────────┘

Development

Running Tests

Open Window > General > Test Runner and run:

  • EditMode tests for unit and integration tests
  • PlayMode tests for runtime behavior

Building the Node Server

The Node.js server is in Server~/. Dependencies are installed automatically on first run.

License

MIT License - see LICENSE for details.

Contributing

Contributions are welcome! Please read our contributing guidelines and submit PRs to the main branch.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选