# ivanmurzak/unity-mcp architecture

> Architecture diagram of the GitHub repository ivanmurzak/unity-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ivanmurzak/unity-mcp
- Repository: https://github.com/ivanmurzak/unity-mcp

## Overview

Unity-MCP connects AI agents to the Unity Editor and, optionally, a running game through MCP; its CLI offers terminal workflows alongside the plugin. The primary flow is an agent or CLI sending tool calls through a chosen MCP server to plugin-registered tools, which operate on Editor state and return results. RQL is a major query-and-mutate capability; other documented branches include code execution, tests, screenshots, generated Skills, runtime tools, extensions, and dependency resolution. Relationships beyond the README-described integration are limited because most implementation files were not sampled.

Main entry points: [`Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/Startup.cs`](https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/Startup.cs) (Unity Editor plugin), [`Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/Tool/Rql.cs`](https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/Tool/Rql.cs) (RQL tool), [`cli/src/lib.ts`](https://github.com/ivanmurzak/unity-mcp/blob/main/cli/src/lib.ts) (CLI operations), [`cli/src/index.ts`](https://github.com/ivanmurzak/unity-mcp/blob/main/cli/src/index.ts) (Unity MCP CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_connection["Agent connectivity"]
  node_cli["Unity MCP CLI<br/>[index.ts]"]
  node_cli_library["CLI operations<br/>[lib.ts]"]
  node_tool_transport["Tool transport<br/>[run-tool.ts]"]
  node_mcp_server["MCP server"]
end

subgraph group_editor["Editor workflows"]
  node_editor_plugin["Unity Editor plugin<br/>[Startup.cs]"]
  node_tool_api["Editor tools<br/>[Script.Execute.cs]"]
  node_scene_prompts["Scene workflows<br/>[SceneManagement.cs]"]
  node_code_execution["C&#35; execution<br/>[CodeRunner.cs]"]
  node_tests["Test runs<br/>[Tests.Run.cs]"]
  node_screenshots["Screenshots<br/>[Screenshot.cs]"]
  node_skills["Generated Skills<br/>[Skills.Generate.cs]"]
end

subgraph group_rql["RQL and Unity data"]
  node_rql_tool["RQL tool<br/>[Rql.cs]"]
  node_rql_editor["RQL Editor API<br/>[RqlEditorApi.cs]"]
  node_rql_unity["RQL Unity engine<br/>[RqlUnity.cs]"]
end

subgraph group_runtime["Runtime and extensions"]
  node_runtime_tools["Game runtime tools<br/>[ObjectRef.cs]"]
  node_extensions["Optional extensions"]
end

subgraph group_support["Plugin support"]
  node_nuget_config["Dependency pins<br/>[NuGetConfig.cs]"]
  node_nuget_package["Dependency model<br/>[NuGetPackage.cs]"]
  node_log_level["Runtime log levels<br/>[LogLevel.cs]"]
  node_log_storage[("File log storage<br/>[FileLogStorage.cs]")]
end

node_agent(("AI agent"))

node_agent -->|"calls tools"| node_mcp_server
node_mcp_server -->|"routes tool calls"| node_editor_plugin
node_editor_plugin -->|"registers tools"| node_mcp_server
node_cli -.->|"invokes operations"| node_cli_library
node_cli_library -->|"runs tools"| node_tool_transport
node_editor_plugin -->|"exposes tools"| node_tool_api
node_mcp_server -->|"dispatches RQL calls"| node_rql_tool
node_mcp_server -->|"dispatches code calls"| node_code_execution
node_mcp_server -->|"dispatches test calls"| node_tests
node_mcp_server -->|"dispatches screenshot calls"| node_screenshots
node_mcp_server -->|"offers Skills"| node_skills
node_mcp_server -->|"calls game tools"| node_runtime_tools
node_rql_tool -.->|"uses Editor operations"| node_rql_editor
node_rql_tool -.->|"queries Unity state"| node_rql_unity
node_mcp_server -->|"loads optional tools"| node_extensions

click node_cli "https://github.com/ivanmurzak/unity-mcp/blob/main/cli/src/index.ts"
click node_cli_library "https://github.com/ivanmurzak/unity-mcp/blob/main/cli/src/lib.ts"
click node_tool_transport "https://github.com/ivanmurzak/unity-mcp/blob/main/cli/src/lib/run-tool.ts"
click node_editor_plugin "https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/Startup.cs"
click node_tool_api "https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/Tool/Script.Execute.cs"
click node_scene_prompts "https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/Prompt/SceneManagement.cs"
click node_code_execution "https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/CodeExec/Core/CodeRunner.cs"
click node_tests "https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/Tool/Tests.Run.cs"
click node_screenshots "https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/Tool/Screenshot.cs"
click node_rql_tool "https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/Tool/Rql.cs"
click node_rql_editor "https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/Rql/RqlEditorApi.cs"
click node_rql_unity "https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/Rql/RqlUnity.cs"
click node_skills "https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/SystemTool/Skills.Generate.cs"
click node_runtime_tools "https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Runtime/Data/ObjectRef.cs"
click node_extensions "https://github.com/ivanmurzak/unity-mcp/blob/main/extensions/Animation/Packages/com.ivanmurzak.unity.mcp.animation/Editor/Scripts/Rql/UnityEngine_AnimationClip_Adapter.cs"
click node_nuget_config "https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/DependencyResolver/NuGetConfig.cs"
click node_nuget_package "https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/DependencyResolver/NuGetPackage.cs"
click node_log_level "https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Runtime/Utils/LogLevel.cs"
click node_log_storage "https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Runtime/Unity/Logs/FileLogStorage.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_cli_library,node_tool_transport,node_mcp_server toneBlue
class node_editor_plugin,node_tool_api,node_scene_prompts,node_code_execution,node_tests,node_screenshots,node_skills toneAmber
class node_rql_tool,node_rql_editor,node_rql_unity toneMint
class node_runtime_tools,node_extensions toneRose
class node_nuget_config,node_nuget_package,node_log_level,node_log_storage,node_agent toneIndigo
```

## Components

### Agent connectivity

- [Unity MCP CLI](https://github.com/ivanmurzak/unity-mcp/blob/main/cli/src/index.ts): `cli/src/index.ts`
- [CLI operations](https://github.com/ivanmurzak/unity-mcp/blob/main/cli/src/lib.ts): `cli/src/lib.ts`
- [Tool transport](https://github.com/ivanmurzak/unity-mcp/blob/main/cli/src/lib/run-tool.ts): `cli/src/lib/run-tool.ts`
- **MCP server**

### Editor workflows

- [Unity Editor plugin](https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/Startup.cs): `Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/Startup.cs`
- [Editor tools](https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/Tool/Script.Execute.cs): `Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/Tool/Script.Execute.cs`
- [Scene workflows](https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/Prompt/SceneManagement.cs): `Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/Prompt/SceneManagement.cs`
- [C# execution](https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/CodeExec/Core/CodeRunner.cs): `Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/CodeExec/Core/CodeRunner.cs`
- [Test runs](https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/Tool/Tests.Run.cs): `Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/Tool/Tests.Run.cs`
- [Screenshots](https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/Tool/Screenshot.cs): `Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/Tool/Screenshot.cs`
- [Generated Skills](https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/SystemTool/Skills.Generate.cs): `Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/SystemTool/Skills.Generate.cs`

### RQL and Unity data

- [RQL tool](https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/Tool/Rql.cs): `Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/API/Tool/Rql.cs`
- [RQL Editor API](https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/Rql/RqlEditorApi.cs): `Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/Rql/RqlEditorApi.cs`
- [RQL Unity engine](https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/Rql/RqlUnity.cs): `Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/Rql/RqlUnity.cs`

### Runtime and extensions

- [Game runtime tools](https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Runtime/Data/ObjectRef.cs): `Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Runtime/Data/ObjectRef.cs`
- [Optional extensions](https://github.com/ivanmurzak/unity-mcp/blob/main/extensions/Animation/Packages/com.ivanmurzak.unity.mcp.animation/Editor/Scripts/Rql/UnityEngine_AnimationClip_Adapter.cs): `extensions/Animation/Packages/com.ivanmurzak.unity.mcp.animation/Editor/Scripts/Rql/UnityEngine_AnimationClip_Adapter.cs`

### Plugin support

- [Dependency pins](https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/DependencyResolver/NuGetConfig.cs): `Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/DependencyResolver/NuGetConfig.cs`
- [Dependency model](https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/DependencyResolver/NuGetPackage.cs): `Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/DependencyResolver/NuGetPackage.cs`
- [Runtime log levels](https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Runtime/Utils/LogLevel.cs): `Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Runtime/Utils/LogLevel.cs`
- [File log storage](https://github.com/ivanmurzak/unity-mcp/blob/main/Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Runtime/Unity/Logs/FileLogStorage.cs): `Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Runtime/Unity/Logs/FileLogStorage.cs`

### Other components

- **AI agent**

## Connections

- AI agent → MCP server: calls tools (evidence: `README.md`)
- MCP server → Unity Editor plugin: routes tool calls (evidence: `README.md`)
- Unity Editor plugin → MCP server: registers tools (evidence: `README.md`)
- Unity MCP CLI → CLI operations: invokes operations
- CLI operations → Tool transport: runs tools (evidence: `cli/src/lib.ts`)
- Unity Editor plugin → Editor tools: exposes tools (evidence: `README.md`)
- MCP server → RQL tool: dispatches RQL calls (evidence: `README.md`)
- MCP server → C# execution: dispatches code calls (evidence: `README.md`)
- MCP server → Test runs: dispatches test calls (evidence: `README.md`)
- MCP server → Screenshots: dispatches screenshot calls (evidence: `README.md`)
- MCP server → Generated Skills: offers Skills (evidence: `README.md`)
- MCP server → Game runtime tools: calls game tools (evidence: `README.md`)
- RQL tool → RQL Editor API: uses Editor operations (evidence: `Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/Rql/RqlEditorApi.cs`)
- RQL tool → RQL Unity engine: queries Unity state (evidence: `Unity-MCP-Plugin/Packages/com.ivanmurzak.unity.mcp/Editor/Scripts/Rql/RqlUnity.cs`)
- MCP server → Optional extensions: loads optional tools (evidence: `README.md`)
