AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
MCP verified MIT Self-run

Unity Cli Loop

mcp-hatayama-unity-cli-loop · by hatayama

Let AI Drive Unity, from Editor to Play Mode.

No reviews yet
0 installs
30 views
0.0% view→install

Install

$ agentstack add mcp-hatayama-unity-cli-loop

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access Used
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/mcp-hatayama-unity-cli-loop)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude DesktopCursorWindsurf

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Unity Cli Loop? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Unity CLI Loop

[日本語](README_ja.md)

[](https://unity3d.com/) [](LICENSE.md)

(Logo inspired by Daft Punk's Discovery album art)

Let an AI agent compile, test, and operate your Unity project from popular LLM tools via CLI.

Designed to keep AI-driven development loops running autonomously inside your existing Unity projects.

> Note: This project was formerly known as uLoopMCP.

Concept

Unity CLI Loop is a Unity integration tool designed so that AI can drive your Unity project forward with minimal human intervention. Tasks that humans typically handle manually—compiling, running the Test Runner, checking logs, editing scenes, and capturing windows to verify UI layouts—are exposed as tools that LLMs can orchestrate.

Unity CLI Loop is built around four core ideas:

  1. A self-hosted development loop where AI autonomously compiles, tests, inspects logs, and fixes issues. Uses compile, run-tests, get-logs, clear-console.
  2. AI-driven Unity Editor operation—scene building, object manipulation, menu execution, and UI refinement from screenshots. Uses execute-dynamic-code, screenshot.
  3. PlayMode automated testing—AI clicks buttons, drags elements, presses keys, records and replays input, and verifies game behavior. Uses simulate-mouse-ui, simulate-mouse-input, simulate-keyboard, record-input, replay-input, execute-dynamic-code, screenshot.
  4. Achieving the above with a minimal set of tools. See [Design Philosophy](#design-philosophy).

https://github.com/user-attachments/assets/569a2110-7351-4cf3-8281-3a83fe181817

Installation

> [!WARNING] > The following software is required > > - Unity 2022.3 or later > - Node.js 22.0 or later - Required for CLI execution > - Install via the official site or your preferred version manager

Via Unity Package Manager

  1. Open Unity Editor
  2. Open Window > Package Manager
  3. Click the "+" button
  4. Select "Add package from git URL"
  5. Enter the following URL:
https://github.com/hatayama/unity-cli-loop.git?path=/Packages/src

> If you installed via git URL before v1.0.0: The repository was renamed from uLoopMCP to unity-cli-loop in v1.0.0. Please update your manifest.json: > ``text > Old: https://github.com/hatayama/uLoopMCP.git?path=/Packages/src > New: https://github.com/hatayama/unity-cli-loop.git?path=/Packages/src > `` > The old URL still works via GitHub redirect, but updating is recommended. OpenUPM users are not affected.

Via OpenUPM (Recommended)

Using Scoped registry in Unity Package Manager

  1. Open Project Settings window and go to Package Manager page
  2. Add the following entry to the Scoped Registries list:
Name: OpenUPM
URL: https://package.openupm.com
Scope(s): io.github.hatayama.uloopmcp
  1. Open Package Manager window and select OpenUPM in the My Registries section. Unity CLI Loop will be displayed.

> [!NOTE] > com.unity.inputsystem is now an optional dependency. Install it only if you want Input System features such as simulate-keyboard, simulate-mouse-input, record-input, replay-input, and the Recordings window. > com.unity.test-framework is also optional. Install it only if you want the run-tests tool to execute Unity Test Runner.

Quickstart

Step 1: Install the CLI

Select Window > Unity CLI Loop > Settings. A dedicated window will open — confirm that the CLI button is highlighted in blue.

Press the Install CLI button.

If you see the following display, the installation was successful.

To install from terminal

npm install -g uloop-cli

See uloop-cli on npm for details.

Step 2: Install Skills

Select your target (Claude Code, Codex, etc.) and press the Install Skills button.

To install from terminal

# Install for Claude Code project
uloop skills install --claude

# Install for OpenAI Codex project
uloop skills install --codex

# Or install globally
uloop skills install --claude --global

That's it! After installing Skills, LLM tools can automatically handle instructions like these:

| Your Instruction | Skill Used by LLM Tools | |---|---| | "Launch Unity for this project" | /uloop-launch | | "Fix the compile errors" | /uloop-compile | | "Run the tests and tell me why they failed" | /uloop-run-tests + /uloop-get-logs | | "Check the scene hierarchy" | /uloop-get-hierarchy | | "Play the game and bring Unity to the front" | /uloop-control-play-mode + /uloop-focus-window | | "Bulk-update prefab parameters" | /uloop-execute-dynamic-code | | "Take a screenshot of Game View and adjust the UI layout" | /uloop-screenshot + /uloop-execute-dynamic-code | | "Record my gameplay input" | /uloop-record-input | | "Replay the recorded input" | /uloop-replay-input |

All 16 Bundled Skills

  • /uloop-launch - Launch Unity with correct version
  • /uloop-compile - Execute compilation
  • /uloop-get-logs - Get console logs
  • /uloop-run-tests - Run tests
  • /uloop-clear-console - Clear console
  • /uloop-focus-window - Bring Unity Editor to front
  • /uloop-get-hierarchy - Get scene hierarchy
  • /uloop-find-game-objects - Find GameObjects
  • /uloop-screenshot - Capture EditorWindow
  • /uloop-simulate-mouse-ui - Simulate mouse click, long-press, and drag on PlayMode UI elements
  • /uloop-simulate-mouse-input - Simulate mouse input in PlayMode via Input System
  • /uloop-simulate-keyboard - Simulate keyboard input in PlayMode via Input System
  • /uloop-record-input - Record keyboard and mouse input during PlayMode
  • /uloop-replay-input - Replay recorded input during PlayMode
  • /uloop-control-play-mode - Control Play Mode
  • /uloop-execute-dynamic-code - Execute dynamic C# code

Direct CLI Usage (Advanced)

You can also call the CLI directly without using Skills:

# List available tools
uloop list

# Launch Unity project with correct version
uloop launch

# Launch with build target (Android, iOS, StandaloneOSX, etc.)
uloop launch -p Android

# Kill running Unity and restart
uloop launch -r

# Execute compilation
uloop compile

# Compile and wait for Domain Reload to complete
uloop compile --wait-for-domain-reload true

# Get logs
uloop get-logs --max-count 10

# Run tests
uloop run-tests --filter-type all

# Execute dynamic code
uloop execute-dynamic-code --code 'using UnityEngine; Debug.Log("Hello from CLI!");'

Shell Completion (Optional)

You can install Bash/Zsh/PowerShell completion:

# Add completion script to shell config (auto-detects shell)
uloop completion --install

# Explicitly specify shell (when auto-detection fails on Windows)
uloop completion --shell bash --install        # Git Bash / MINGW64
uloop completion --shell powershell --install  # PowerShell

# Check completion script
uloop completion

Project Path Specification

If --project-path is omitted, the port is automatically selected from the Unity project detected in the current directory.

To operate multiple Unity instances from a single LLM tool, explicitly specify a project path:

# Specify by project path (absolute or relative)
uloop compile --project-path /Users/foo/my-unity-project
uloop compile --project-path ../other-project

Using MCP instead of CLI

> [!WARNING] > MCP connection may be deprecated or removed in a future release. We recommend using the CLI instead.

You can also connect via MCP (Model Context Protocol). CLI and Skills installation is not required for MCP.

MCP Connection Steps

  1. Select Window > Unity CLI Loop > Settings. A dedicated window will open — press the MCP button.
  1. Next, select the target IDE in the LLM Tool Settings section. Press the yellow "Configure {LLM Tool Name}" button to automatically connect to the IDE.
  1. IDE Connection Verification
  • For example, with Cursor, check the Tools & MCP in the settings page and find uLoopMCP. Click the toggle to enable MCP.

> [!WARNING] > About Windsurf > Project-level configuration is not supported; only a global configuration is available.

Manual Setup (Usually Unnecessary)

> [!NOTE] > Usually automatic setup is sufficient, but if needed, you can manually edit the configuration file (e.g., mcp.json):

{
  "mcpServers": {
    "uLoopMCP": {
      "command": "node",
      "args": [
        "[Unity Package Path]/TypeScriptServer~/dist/server.bundle.js"
      ],
      "env": {
        "UNITY_TCP_PORT": "{port}"
      }
    }
  }
}

Path Examples:

  • Via Package Manager: "/Users/username/UnityProject/Library/PackageCache/io.github.hatayama.uloopmcp@[hash]/TypeScriptServer~/dist/server.bundle.js"

> [!NOTE] > When installed via Package Manager, the package is placed in Library/PackageCache with a hashed directory name. Using the "Auto Configure Cursor" button will automatically set the correct path.

Multiple Unity Instance Support

> [!NOTE] > Multiple Unity instances can be supported by changing port numbers. Unity CLI Loop automatically assigns unused ports when starting up.

Design Philosophy

Unity CLI Loop does not chase tool count. With dynamic C# code execution (execute-dynamic-code), almost any Unity Editor operation can be accomplished through a single tool.

Too many tools make it harder for AI to choose the right one. And even when tools are packaged as Skills, each tool's description still consumes the context window. We believe keeping tools to the essential minimum is good design.

Dedicated tools exist only for operations that dynamic code execution cannot handle by nature — such as frame-spanning input simulation and screenshot capture — and for operations called so frequently in the development loop, like compile and get-logs, that generating C# code each time would waste tokens.

Key Features

Development Loop Tools

1. compile - Execute Compilation

Performs AssetDatabase.Refresh() and then compiles, returning the results. Can detect errors and warnings that built-in linters cannot find. You can choose between incremental compilation and forced full compilation. With WaitForDomainReload=true, results are returned after Domain Reload completes, regardless of the ForceRecompile value.

→ Execute compile, analyze error and warning content
→ Automatically fix relevant files
→ Verify with compile again

2. get-logs - Retrieve Logs Same as Unity Console

Filter by LogType or search target string with advanced search capabilities. You can also choose whether to include stacktrace. This allows you to retrieve logs while keeping the context small. MaxCount behavior: Returns the latest logs (tail-like behavior). When MaxCount=10, returns the most recent 10 logs. Advanced Search Features:

  • Regular Expression Support: Use UseRegex: true for powerful pattern matching
  • Stack Trace Search: Use SearchInStackTrace: true to search within stack traces
→ get-logs (LogType: Error, SearchText: "NullReference", MaxCount: 10)
→ get-logs (LogType: All, SearchText: "(?i).*error.*", UseRegex: true, MaxCount: 20)
→ get-logs (LogType: All, SearchText: "MyClass", SearchInStackTrace: true, MaxCount: 50)
→ Identify cause from stacktrace, fix relevant code

3. run-tests - Execute TestRunner (PlayMode, EditMode supported)

Executes Unity Test Runner and retrieves test results. This tool requires the Unity Test Framework package. If the package is not installed, run-tests returns an unsupported message while the rest of Unity CLI Loop keeps working. You can set conditions with FilterType and FilterValue.

  • FilterType: all (all tests), exact (individual test method name), regex (class name or namespace), assembly (assembly name)
  • FilterValue: Value according to filter type (class name, namespace, etc.)
  • SaveBeforeRun: Saves unsaved loaded Scene changes and current Prefab Stage changes before running tests when explicitly enabled

Test results can be output as xml. The output path is returned so AI can read it. This is also a strategy to avoid consuming context.

→ run-tests (FilterType: exact, FilterValue: "PlayerControllerTests.TestJump")
→ run-tests (SaveBeforeRun: true)
→ Check failed tests, fix implementation to pass tests

> [!WARNING] > During PlayMode test execution, Domain Reload is forcibly turned OFF. (Settings are restored after test completion) > Note that static variables will not be reset during this period.

Unity Editor Automation & Discovery Tools

4. clear-console - Log Cleanup

Clear logs that become noise during log searches.

→ clear-console
→ Start new debug session

5. find-game-objects - Search Scene Objects

Retrieve objects and examine component parameters. Also retrieve information about currently selected GameObjects (multiple selection supported) in Unity Editor.

→ find-game-objects (RequiredComponents: ["Camera"])
→ Investigate Camera component parameters

→ find-game-objects (SearchMode: "Selected")
→ Get detailed information about currently selected GameObjects in Unity Editor (supports multiple selection)

6. get-hierarchy - Analyze Scene Structure

Retrieve information about the currently active Hierarchy in nested JSON format. Works at runtime as well. Automatic File Export: Retrieved hierarchy data is always saved as JSON in {project_root}/.uloop/outputs/HierarchyResults/ directory. The response only returns the file path, minimizing token consumption even for large datasets. Selection Mode: Use UseSelection: true to get hierarchy starting from currently selected GameObject(s) in Unity Editor. Supports multiple selection - when parent and child are both selected, only the parent is used as root to avoid duplicate traversal.

→ Understand parent-child relationships between GameObjects, discover and fix structural issues
→ Regardless of scene size, hierarchy data is saved to a file and the path is returned instead of raw JSON
→ get-hierarchy (UseSelection: true)
→ Get hierarchy of currently selected GameObjects without specifying paths manually

7. focus-window - Bring Unity Editor Window to Front (macOS & Windows)

Ensures the Unity Editor window becomes the foreground application on macOS and Windows Editor builds. Great for keeping visual feedback in sync after other apps steal focus. (Linux is currently unsupported.)

8. screenshot - Take a Screenshot of EditorWindow

Take a screenshot of any EditorWindow as a PNG. Specify the window name (the text displayed in the title bar/tab) to capture. When multiple windows of the same type are open (e.g., 3 Inspector windows), all windows are saved with numbered filenames. Supports three matching modes: exact (default), prefix, and contains - all case-insensitive.

→ screenshot (WindowName: "Console")
→ Save Console window state as PNG
→ Provide visual feedback to AI

9. control-play-mode - Control Play Mode

Control Unity Editor's Play Mode. Supports three actions: Play (start/resume), Stop, and Pause.

→ control-play-mode (Action: Play)
→ Start Play Mode to verify game behavior
→ control-play-mode (Action: Pause)
→ Pause to inspect state

10. execute-dynamic-code - Dynamic C# Code Execution

Execute C# code dynamically within Unity Editor.

Async support:

  • You can write await in your snippet (Task/ValueTask/UniTask and any awaitable type)
  • Cancellation is propagated when you pass a CancellationToken to the tool

Security Level Support: Implements 2-tier security control to restrict executable code. To disable this tool entirely, use the tool on/off toggle in the MCP tool settings UI.

  • Level 1 - Restricted 【Recommended Setting】
  • All Unity APIs and .NET standard libraries are generally available
  • User-defined assemblies (Assembly-CSharp, etc.) are also accessible
  • Only pinpoint blocking of security-critical operations:
  • File deletion: File.Delete, `Directory.D

Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.