01-introduction.md•3.75 kB
# Introduction to Unity-MCP
## Overview
Unity-MCP is a bridge between Unity and AI assistants using the Model Context Protocol (MCP). It enables AI assistants like Claude to interact with Unity game environments through a standardized interface, allowing for AI-assisted game development, automated testing, scene analysis, and runtime debugging.
## Purpose
The primary purpose of Unity-MCP is to provide a standardized way for AI assistants to:
1. **Execute code** in the Unity runtime environment
2. **Inspect game objects** and their components
3. **Analyze scene hierarchies** and structures
4. **Run tests** and receive results
5. **Invoke methods** on game objects and components
6. **Modify game state** during runtime
## Key Benefits
- **AI-Assisted Development**: Enable AI assistants to understand and modify Unity projects
- **Automated Testing**: Run tests from AI assistants and analyze results
- **Runtime Inspection**: Examine the state of a running Unity game
- **Code Execution**: Execute arbitrary C# code in the Unity environment
- **Standardized Interface**: Use the MCP standard for compatibility with various AI assistants
- **Bidirectional Communication**: Allow both AI-to-Unity and Unity-to-AI communication
## Four-Component Architecture
Unity-MCP implements a four-component architecture:
1. **MCP STDIO Client**: A command-line tool that implements the MCP protocol using the official TypeScript SDK
2. **Web Server with Persistence**: A long-running service that maintains state across sessions
3. **Unity Integration**: A plugin for Unity that executes code and communicates with the Web Server
4. **Unity SDK**: A C# library that Unity developers can use to interact with the system
Each component has a specific role in the architecture, and they work together to provide a complete solution for AI-Unity interaction.
## Communication Flow
The communication flow between Claude and Unity is as follows:
```
Claude <-- stdio --> MCP STDIO Client <-- HTTP --> Web Server <-- HTTP/WebSockets --> Unity Integration
^
|
v
Unity SDK (used by Unity developers)
```
This architecture provides several benefits:
- Claude interacts with the MCP STDIO client using the standard MCP protocol
- The web server maintains state between interactions
- Unity only needs to communicate with the web server, not directly with Claude
- Unity developers can use a simple SDK to interact with the system
## Documentation Structure
This documentation is organized into the following sections:
1. **Introduction**: Overview of Unity-MCP (this document)
2. **Model Context Protocol**: Explanation of the MCP protocol and how it's used in Unity-MCP
3. **Architecture**: Detailed description of the four-component architecture
4. **MCP STDIO Client**: Documentation for the command-line tool that implements MCP
5. **Web Server**: Documentation for the persistent web server
6. **Unity Integration**: Documentation for the Unity plugin
7. **Unity SDK**: Documentation for the C# library used by Unity developers
8. **Tools and Capabilities**: Description of the tools and capabilities provided by Unity-MCP
9. **Installation and Setup**: Instructions for installing and setting up Unity-MCP
10. **Usage Examples**: Examples of using Unity-MCP in various scenarios
11. **Security Considerations**: Security implications and best practices
12. **Troubleshooting**: Common issues and their solutions
## Getting Started
To get started with Unity-MCP, see the [Installation and Setup](09-installation-setup.md) guide.