DISCOVER THE FUTURE OF AI AGENTSarrow_forward

Unity MCP

calendar_todayAdded Feb 26, 2026
categoryAgent & Tooling
codeOpen Source
PythonWorkflow AutomationModel Context ProtocolAI AgentsAgent FrameworkC#Agent & ToolingDeveloper Tools & CodingAutomation, Workflow & RPAProtocol, API & Integration

A bidirectional bridge connecting MCP clients (e.g., Claude, Cursor) to the Unity Editor, enabling AI-driven control over scenes, objects, and scripts.

Unity MCP is a dual-end architecture tool built with C# and Python, enabling direct interaction between AI coding assistants and the Unity Editor through the Model Context Protocol (MCP).

Core Architecture#

Dual-layer architecture design:

  • Unity Editor Side: TCP server implemented in C#, listening on port 6400, auto-starts bridge service using [InitializeOnLoad]
  • Python Side: MCP server based on FastMCP framework, communicates with AI clients via stdio and connects to Unity via TCP

Key Features#

Editor Control#

  • Execute editor actions: PLAY, PAUSE, STOP, BUILD, SAVE
  • Read and filter Unity Console logs

Scene Management#

  • Get scene list and current scene info
  • Open/save/create/switch scenes

Object Management#

  • Create/delete objects (Cube, Sphere, Camera, Empty, etc.)
  • Set Transform position/rotation/scale
  • Add/remove components
  • Find objects by name, get hierarchy structure

Script Management#

  • Create/view/update script files
  • Attach scripts to game objects
  • Support custom namespaces and templates

Assets & Materials#

  • Import assets, instantiate/create/apply Prefabs
  • Set object materials with RGB color parameters
  • Get project asset list

Requirements#

  • Unity 2022.3+
  • Python >=3.12
  • Dependencies: httpx>=0.28.1, mcp[cli]>=1.4.1

Installation#

  1. Import package com.justinpbarnett.unity-mcp via Unity Package Manager
  2. Install Python dependencies: pip install httpx mcp[cli] or uv sync
  3. Start Python server: python Python/server.py
  4. Configure MCP client connection

Extension Development#

Supports custom tool addition: Register command handlers in C#, define tool functions in Python using @mcp.tool() decorator.

Related Projects

View All arrow_forward

STAY UPDATED

Get the latest AI tools and trends delivered straight to your inbox. No spam, just intelligence.

rocket_launch