Skip to main content

CLI Reference

The unity-mcp CLI is a developer-facing terminal for the same Unity automations the MCP tools expose. Both invoke the same C# HandleCommand methods on the Unity side — see Three-Layer Python Design for why both layers exist.

Invocation​

# Run via uvx (no install)
uvx --from mcpforunityserver unity-mcp <command> [args]

# Run from a Server checkout
cd Server && uv run unity-mcp <command> [args]

The same package also installs mcp-for-unity, which starts the MCP server, not the CLI.

How it talks to Unity​

The CLI uses HTTP to the Python server (default http://127.0.0.1:8080), regardless of how your MCP clients are configured. The Python server in turn talks to the connected Unity Editor via WebSocket. MCP tools take a similar path via WebSocket directly; CLI commands take HTTP.

Global flags​

Global flags go before the command group: unity-mcp --format json scene active.

FlagEnv variableDefaultMeaning
--host, -hUNITY_MCP_HOST127.0.0.1Python server host to connect to
--port, -pUNITY_MCP_HTTP_PORT8080Python server port
--timeout, -tUNITY_MCP_TIMEOUT30Command timeout in seconds
--format, -fUNITY_MCP_FORMATtextOutput format: text, json or table
--instance, -iUNITY_MCP_INSTANCE(auto)Target Unity instance (hash or Name@hash)
--verbose, -v—offPrint each command sent to Unity and its raw response to stderr
--version——Print CLI version and exit
--help——Show command help (-h is --host, not help)

For multi-instance setups, see Multi-Instance Routing.

Command groups​

The CLI mirrors the MCP tool catalog. Each command sends one or more MCP tool calls to Unity; the last column names them. Commands marked — only talk to the Python server.

CommandWhat it doesMCP tool(s) it calls
unity-mcp statusCheck the server connection and list Unity instances— (server /health, /api/instances)
unity-mcp instancesList connected Unity instances— (server /api/instances)
unity-mcp rawSend any tool by name with JSON paramsThe named tool
unity-mcp instanceList instances, show the one this shell targets (--instance / UNITY_MCP_INSTANCE)— (server /api/instances)
unity-mcp sceneLoad/save/query/edit scenesmanage_scene
unity-mcp gameobjectFind/create/modify/move/duplicate/delete GameObjectsmanage_gameobject, find_gameobjects (find), manage_components (create --components)
unity-mcp componentAdd/remove/configure componentsmanage_components
unity-mcp scriptCreate/read/edit/validate/delete C# scriptsmanage_script
unity-mcp assetAsset import/create/modify/searchmanage_asset
unity-mcp asset-genGenerate images, 3D models and audio; import modelsgenerate_image, generate_model, generate_audio, import_model, import_model_file
unity-mcp blenderTalk to a running Blender through the Blender Bridgeblender_bridge
unity-mcp materialMaterial CRUD + shader propsmanage_material
unity-mcp prefabPrefab create/open/save/close, inspect, headless modifymanage_prefabs
unity-mcp textureProcedural or image textures, sprites, pixel editsmanage_texture
unity-mcp shaderShader CRUDmanage_shader
unity-mcp vfxParticle systems, line and trail renderers; raw for any manage_vfx actionmanage_vfx
unity-mcp cameraCamera + Cinemachine presets, screenshotsmanage_camera
unity-mcp graphicsVolumes, render pipeline, light baking, URP features, skyboxmanage_graphics
unity-mcp lightingCreate a light GameObjectmanage_gameobject + manage_components
unity-mcp physics3D + 2D physics, joints, queriesmanage_physics
unity-mcp audioPlay, stop or set the volume of an AudioSourcemanage_components
unity-mcp animationAnimator, AnimationClip and AnimatorControllermanage_animation
unity-mcp spriteSprite sheet slicing → clips → Animator controllermanage_sprite
unity-mcp uiCreate uGUI Canvas, text, button and image GameObjectsmanage_gameobject + manage_components
unity-mcp buildPlayer builds across platformsmanage_build
unity-mcp editorPlay mode, tags/layers, undo/redo, console, refresh, menu items, tests, custom toolsmanage_editor, read_console (console), refresh_unity (refresh), execute_menu_item (menu), run_tests (tests), get_test_job (poll-test), execute_custom_tool (custom-tool)
unity-mcp packagesUPM install/remove/embedmanage_packages
unity-mcp probuilderProBuilder meshesmanage_probuilder
unity-mcp profilerProfiler session + counters + snapshotsmanage_profiler
unity-mcp codeExecute C# in the Editor; read and search script filesexecute_code, manage_script (read, search)
unity-mcp batchRun many commands in one requestbatch_execute
unity-mcp toolList the custom tools registered for the active Unity project— (server /api/custom-tools)
unity-mcp custom_toolSame as tool— (server /api/custom-tools)
unity-mcp reflectInspect Unity APIs via reflectionunity_reflect
unity-mcp docsFetch a Unity ScriptReference pageunity_docs (runs in the CLI process)

Discovering subcommands and flags​

Every group supports --help:

unity-mcp scene --help
unity-mcp scene load --help

The help text is the authoritative per-command reference — flags, choices, and defaults all live there because the CLI is built on Click and self-describes.

Examples​

See CLI Examples for end-to-end walkthroughs and the CLI Usage Guide for narrative context (when to use the CLI vs an MCP client).

Source​

CLI command definitions: Server/src/cli/commands/. Entry point: Server/src/cli/main.py.