unity-mcp

usmanbutt-dev/unity-mcp

3.2

If you are the rightful owner of unity-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

A Model Context Protocol (MCP) server for Unity that enables AI agents to interact with the Unity Editor.

Tools
5
Resources
0
Prompts
0

Unity MCP Server

Unity 2021.3+ MCP

A Model Context Protocol (MCP) server for Unity that enables AI agents to query and control the Unity Editor.

What is MCP?

MCP is an open standard by Anthropic that allows AI systems to access external tools and data. This package turns Unity into an MCP server, letting AI assistants like Antigravity, Claude, and Cursor query your scenes, assets, and execute editor commands.

Features

  • 🎮 Scene Hierarchy - Query GameObjects, components, and structure
  • ✏️ Write Operations - Create, delete, and modify GameObjects in real-time
  • 🧩 Component Control - Add, remove, and configure components
  • 🎬 Scene Management - Open, save, create, and manage scenes
  • 🏷️ Prefab Tools - Instantiate, create, and inspect prefabs
  • 📦 Asset Browser - List and search project assets
  • 📁 Resource Access - Read scripts, prefabs, and ScriptableObjects
  • 📋 Console Access - Read and clear Unity console logs
  • ⚙️ Editor Control - Execute menu items, select objects
  • 🔧 Compilation Status - Monitor build errors and warnings
  • 📷 Screenshots - Capture Game View or Scene View (v2.1)
  • 🔍 Project Search - Search by name, content, or references (v2.1)
  • ▶️ Play Mode Control - Enter/exit/pause play mode (v2.1)
  • 🎮 Input Simulation - Keyboard, mouse, and UI interactions (v2.1)
  • 📋 Schema Support - Full JSON Schema for all tool parameters (v2.1)
  • 🔒 Secure - Localhost only, no external access

Installation

Via Git URL (Recommended)

  1. Open Window > Package Manager
  2. Click + > Add package from git URL...
  3. Enter:
    https://github.com/usmanbutt-dev/unity-mcp.git
    

Quick Start

  1. The server auto-starts when Unity loads
  2. Open Window > MCP Server to view status
  3. Click "Copy Config to Clipboard"
  4. Paste into your MCP client's configuration file

Available Tools (52 Total)

GameObject Tools

ToolDescription
unity_create_gameobjectCreate new GameObjects (primitives supported)
unity_delete_gameobjectDelete GameObjects from scene
unity_set_transformSet position, rotation, scale
unity_add_componentAdd components to GameObjects
unity_remove_componentRemove components
unity_set_component_propertySet component property values

Hierarchy Tools

ToolDescription
unity_get_hierarchyGet scene GameObject hierarchy
unity_get_gameobjectGet details of a specific GameObject
unity_get_componentsList components on a GameObject

Prefab Tools

ToolDescription
unity_instantiate_prefabInstantiate prefabs in scene
unity_get_prefab_infoGet prefab structure
unity_create_prefabCreate prefab from GameObject
unity_unpack_prefabUnpack prefab instances

Scene Tools

ToolDescription
unity_get_scenesList all scenes in project
unity_open_sceneOpen a scene
unity_save_sceneSave current scene
unity_new_sceneCreate new scene
unity_close_sceneClose a scene
unity_set_active_sceneSet active scene

Asset & Editor Tools

ToolDescription
unity_get_assetsList assets in a folder
unity_get_project_settingsGet project configuration
unity_get_console_logsGet recent console logs
unity_clear_consoleClear the console
unity_execute_menuExecute a menu item
unity_select_objectSelect a GameObject
unity_get_selectionGet current selection
unity_get_editor_stateGet editor play/pause state

Compilation Tools

ToolDescription
unity_get_compilation_statusGet compile errors/warnings
unity_recompile_scriptsForce recompilation
unity_get_assembliesList project assemblies

Screenshot & Search Tools (v2.1)

ToolDescription
unity_take_screenshotCapture Game View or Scene View as base64 PNG
unity_search_projectSearch by name, content, or asset references

Play Mode & Input Tools (v2.1)

ToolDescription
unity_enter_play_modeEnter play mode
unity_exit_play_modeExit play mode
unity_pause_play_modePause/unpause play mode
unity_simulate_keySimulate keyboard input
unity_simulate_mouseSimulate mouse clicks
unity_click_ui_elementClick UI buttons/toggles by name

Animation Tools (v2.2)

ToolDescription
unity_set_animator_parameterSet bool/float/int/trigger parameters
unity_get_animator_infoGet animator state, parameters, layers
unity_play_animationPlay animation state by name

Material & Shader Tools (v2.2)

ToolDescription
unity_get_material_infoGet material properties and shader
unity_set_material_propertySet color/float/int/vector properties
unity_set_materialAssign material to renderer

Physics Tools (v2.2)

ToolDescription
unity_raycastCast ray and get hit info
unity_overlap_sphereFind colliders in radius
unity_add_forceApply force to Rigidbody

Asset Creation Tools (v2.2)

ToolDescription
unity_create_folderCreate project folders
unity_create_materialCreate material assets
unity_create_scriptCreate C# scripts with templates
unity_move_assetMove/rename assets
unity_duplicate_assetDuplicate assets

AI Context Tools (v2.2)

ToolDescription
unity_get_scene_summaryCompact scene overview for AI
unity_get_component_schemaGet component properties schema
unity_get_type_infoDiscover Unity component types

MCP Resources

The server also provides resource access via MCP resources protocol:

  • Scripts - Read C# source files
  • Scenes - Get scene metadata
  • Prefabs - Read prefab structure
  • ScriptableObjects - Read SO data as JSON

MCP Client Configuration

Add to your MCP client config (e.g., mcp_config.json):

{
  "mcpServers": {
    "unity": {
      "command": "node",
      "args": ["path/to/Packages/com.community.unity-mcp/Bridge/mcp-bridge.js"]
    }
  }
}

Note: Use the "Copy Config to Clipboard" button in Window > MCP Server to get the correct path.

Example Queries

Once connected, ask your AI assistant:

  • "Create a red cube at position (0, 2, 0)"
  • "Add a Rigidbody to the Player object"
  • "What GameObjects are in my current scene?"
  • "Show me the components on the Player object"
  • "Open the MainMenu scene"
  • "What compilation errors do I have?"

Requirements

  • Unity 2021.3 or later
  • Node.js (for the MCP bridge)

Related Packages

License

MIT License - see