MCP ExplorerExplorer

Mcp Server Unity

@zabaglioneon 5 months ago
5 MIT
FreeCommunity
AI Systems
Model Context Protocol (MCP) server for Unity - enables Claude to interact with Unity projects

Overview

What is Mcp Server Unity

mcp-server-unity is a Model Context Protocol (MCP) server designed for Unity, allowing Claude to directly interact with Unity projects. It provides tools for script creation, asset management, and project building.

Use cases

Use cases include automating the build process for multi-platform games, managing large asset libraries, creating custom shaders and editor tools, and dynamically generating 3D models during runtime.

How to use

To use mcp-server-unity, install Node.js 18.x or higher and Unity 2021.3 LTS or newer. Set up the server, configure your Unity project paths, and utilize the provided functionalities for managing scripts and assets.

Key features

Key features include project management, script operations, asset creation and management, shader support, editor extensions, runtime mesh generation, automation for build processes, and a service-oriented architecture for easy maintenance.

Where to use

mcp-server-unity can be used in game development, interactive simulations, and any projects utilizing the Unity engine that require efficient asset and script management.

Content

Unity 6 MCP Bridge v3.0.0

Direct Unity API integration for AI-powered game development

Unity 6
MCP
License

Unity 6 MCP Bridge provides seamless integration between AI assistants (like Claude) and Unity Editor through direct Unity API calls. This is a complete rewrite of the previous MCP server, designed specifically for Unity 6000+ with breaking changes from v1.x/v2.x.

Features

Unity 6 Integration

  • Direct Unity API calls via Named Pipes/Domain Sockets
  • Real-time synchronization with Unity Editor
  • Native AssetDatabase operations (no more meta file issues!)
  • Roslyn-powered code analysis and IntelliSense
  • Unity 6 template system for code generation

Script Operations

  • script_create - Generate scripts from Unity 6 templates
  • script_read - Read script content from Unity project
  • script_delete - Safe deletion with reference checking
  • script_rename - Rename with class name updates

Folder Management

  • folder_create - Create with automatic parent directories
  • folder_delete - Safe deletion with asset cleanup
  • folder_rename - Rename with reference updates
  • folder_list - List with Unity metadata

Installation

Prerequisites

  • Unity 6000.0 or later (Required)
  • Node.js 18+
  • Claude Desktop or compatible MCP client

1. Install MCP Bridge

npm install -g unity-mcp-bridge

2. Install Unity Package

  1. Download MCPBridge.cs from this repository
  2. Place it in Assets/Editor/MCP/MCPBridge.cs in your Unity project
  3. Unity will automatically compile and start the bridge

3. Configure Claude Desktop

Add to your Claude Desktop configuration:

{
  "mcpServers": {
    "unity-bridge": {
      "command": "unity-mcp-bridge",
      "args": []
    }
  }
}

Quick Start

1. Start Unity 6

Open your Unity 6 project. The MCP Bridge will automatically start and listen for connections.

2. Connect with Claude

Open Claude Desktop and start using Unity commands:

Create a new PlayerController script using the MonoBehaviour template

3. Verify Connection

Check Unity project status

API Reference

Project Management

  • project_set_path - Set Unity project path
  • project_get_info - Get project info and connection status

Script Operations

Create Script

script_create({
  fileName: "PlayerController",
  template: "MonoBehaviour",
  folder: "Assets/Scripts/Player",
  namespace: "Game.Player"
})

Read Script

script_read({
  path: "Assets/Scripts/PlayerController.cs"
})

Folder Operations

Create Folder

folder_create({
  path: "Assets/Scripts/Player/Components",
  recursive: true
})

List Folder

folder_list({
  path: "Assets/Scripts"
})

Advanced Features

Real-time Code Analysis

The bridge provides real-time Roslyn-powered analysis:

  • Syntax error detection
  • Reference finding
  • Usage analysis
  • IntelliSense data

Template System

Supports Unity 6’s built-in templates:

  • MonoBehaviour - Standard Unity component
  • ScriptableObject - Data container
  • Editor - Editor extension
  • Custom - Basic C# class

Template System

Supports Unity 6’s built-in templates:

  • MonoBehaviour - Standard Unity component
  • ScriptableObject - Data container
  • Editor - Editor extension
  • Custom - Basic C# class

Configuration

Environment Variables

  • UNITY_MCP_LOG_LEVEL - Set logging level (debug, info, warn, error)
  • UNITY_MCP_TIMEOUT - Request timeout in milliseconds (default: 30000)

Unity Settings

The bridge automatically detects Unity installation and project settings. No manual configuration required.

Troubleshooting

Common Issues

“Unity Bridge disconnected”

  • Ensure Unity 6000+ is running
  • Verify MCPBridge.cs is in Assets/Editor/MCP/
  • Check Unity Console for errors

“Method not implemented”

  • Verify Unity version (6000.0+ required)
  • Check if Newtonsoft.Json package is installed
  • Update Unity to latest 6.x version

Permission Errors

  • On macOS/Linux, ensure socket file permissions
  • Run Unity with appropriate permissions
  • Check firewall settings

Debug Mode

UNITY_MCP_LOG_LEVEL=debug unity-mcp-bridge

Breaking Changes from v2.x

API Changes

  • asset_create_scriptscript_create
  • asset_update_script → Removed (update functionality removed)
  • script_patch → Removed (patch functionality removed)
  • script_move → Removed (move functionality removed)
  • folder_move → Removed (move functionality removed)
  • script_analyze → Removed (analysis functionality removed)
  • folder_info → Removed (detailed info functionality removed)
  • All APIs now use Unity’s AssetDatabase directly

Requirements

  • Unity 6000+ required (was 2019+)
  • Node.js 18+ required (was 16+)
  • MCP Bridge package required

Removed Features

  • File system-based operations
  • Manual meta file handling
  • Legacy Unity version support
  • Script update/patch functionality
  • File/folder move functionality
  • Script analysis functionality
  • Detailed folder information

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Development Setup

git clone https://github.com/yourusername/unity-mcp-bridge.git
cd unity-mcp-bridge
npm install
npm run dev

License

MIT License - see LICENSE file for details.

Acknowledgments

  • Unity Technologies for Unity 6 API improvements
  • Anthropic for the Model Context Protocol
  • The Unity developer community

Unity 6 MCP Bridge v3.0.0 - Bringing AI and Unity closer together

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers