Skip to content

Cocos Creator CLI examples

The terminal replay uses the installed cbiome launcher. Captured transcripts retain the original cocos-mcp spelling. Both names invoke the same CLI.

Follow the README setup, open assets/Main.scene from the disposable fixture, and export COCOS_MCP_PROJECT_PATH. The output below came from Cocos Creator 3.8.8. The UUIDs are for this fixture. Use the UUIDs returned by your own project when running an instance-specific command.

Claude Code via Bash

Claude Code-style workflow replay

Illustrated from an actual Claude Code session. The prompts are verbatim and the replies summarize verified CLI results.

Claude Desktop-style replay

Illustrative Claude Desktop-style replay

Illustrated Claude Desktop-style conversation showing the same CLI-verified workflow. This is not a recording of an MCP session.

System-shell walkthrough

Verified system-shell walkthrough

A system-shell walkthrough. The installed CLI has no built-in interactive prompt.

Recorded workflow

The five requests below were sent in English to one Claude Code 2.1.337 print-mode session per project. The display is illustrated, not a screen recording. Each collapsed turn includes the actual Bash calls and their tool results, with trailing whitespace trimmed. No MCP servers were loaded for this capture.

Prepare this workflow fixture Follow the [Cocos setup](getting-started.md#quickstart), select a disposable copy of the bundled fixture, and open `Main.scene`. Run from the isolated workspace described below. The created node ID is generated at runtime. Substitute the ID from your own create result when repeating the workflow. Close the scene without saving to discard the changes.
1. Add a checkpoint under FixtureParent.
./cocos-mcp call create_node '{"name":"Checkpoint","parent_uuid":"5db177e5-2cb1-5690-8010-fd1f6cfc962d"}' --json --fields uuid,name,parent_uuid
The first attempt returned an error.
Exit code 1
Result fields and conditional reads apply to read tools only
./cocos-mcp call create_node '{"name":"Checkpoint","parent_uuid":"5db177e5-2cb1-5690-8010-fd1f6cfc962d"}' --json
{"uuid":"d6ar7efbNCwK6qpXw24k3l","name":"Checkpoint"}
./cocos-mcp call describe_node '{"node_uuid":"d6ar7efbNCwK6qpXw24k3l"}' --json
{"uuid":"d6ar7efbNCwK6qpXw24k3l","name":"Checkpoint","active":true,"path":"/FixtureParent/Checkpoint","parent_uuid":"5db177e5-2cb1-5690-8010-fd1f6cfc962d","child_count":0,"active_in_hierarchy":true,"layer":1073741824,"local_transform":{"position":{"x":0,"y":0,"z":0},"rotation_euler":{"x":0,"y":0,"z":0},"scale":{"x":1,"y":1,"z":1}},"world_transform":{"position":{"x":2,"y":3,"z":4},"rotation":{"x":0,"y":0,"z":0,"w":1},"scale":{"x":1,"y":1,"z":1}},"components":[]}
2. Move it to (120, 40, 0).
./cocos-mcp call set_transform '{"node_uuid":"d6ar7efbNCwK6qpXw24k3l","transform":{"position":[120,40,0]}}' --json
{"uuid":"d6ar7efbNCwK6qpXw24k3l","properties":{"position":{"x":120,"y":40,"z":0}}}
./cocos-mcp call describe_node '{"node_uuid":"d6ar7efbNCwK6qpXw24k3l"}' --json
{"uuid":"d6ar7efbNCwK6qpXw24k3l","name":"Checkpoint","active":true,"path":"/FixtureParent/Checkpoint","parent_uuid":"5db177e5-2cb1-5690-8010-fd1f6cfc962d","child_count":0,"active_in_hierarchy":true,"layer":1073741824,"local_transform":{"position":{"x":120,"y":40,"z":0},"rotation_euler":{"x":0,"y":0,"z":0},"scale":{"x":1,"y":1,"z":1}},"world_transform":{"position":{"x":122,"y":43,"z":4},"rotation":{"x":0,"y":0,"z":0,"w":1},"scale":{"x":1,"y":1,"z":1}},"components":[]}
3. Rotate it 30 degrees around Z.
./cocos-mcp call set_transform '{"node_uuid":"d6ar7efbNCwK6qpXw24k3l","transform":{"rotation":[0,0,30]}}' --json
{"uuid":"d6ar7efbNCwK6qpXw24k3l","properties":{"rotation":{"x":0,"y":0,"z":30}}}
./cocos-mcp call describe_node '{"node_uuid":"d6ar7efbNCwK6qpXw24k3l"}' --json
{"uuid":"d6ar7efbNCwK6qpXw24k3l","name":"Checkpoint","active":true,"path":"/FixtureParent/Checkpoint","parent_uuid":"5db177e5-2cb1-5690-8010-fd1f6cfc962d","child_count":0,"active_in_hierarchy":true,"layer":1073741824,"local_transform":{"position":{"x":120,"y":40,"z":0},"rotation_euler":{"x":0,"y":0,"z":30},"scale":{"x":1,"y":1,"z":1}},"world_transform":{"position":{"x":122,"y":43,"z":4},"rotation":{"x":0,"y":0,"z":0.2588190451025207,"w":0.9659258262890683},"scale":{"x":1,"y":1,"z":1}},"components":[]}
4. Disable it until the level is ready.
./cocos-mcp call set_node_property '{"node_uuid":"d6ar7efbNCwK6qpXw24k3l","property":"active","value":false}' --json
{"uuid":"d6ar7efbNCwK6qpXw24k3l","properties":{"active":false}}
./cocos-mcp call describe_node '{"node_uuid":"d6ar7efbNCwK6qpXw24k3l"}' --json
{"uuid":"d6ar7efbNCwK6qpXw24k3l","name":"Checkpoint","active":false,"path":"/FixtureParent/Checkpoint","parent_uuid":"5db177e5-2cb1-5690-8010-fd1f6cfc962d","child_count":0,"active_in_hierarchy":false,"layer":1073741824,"local_transform":{"position":{"x":120,"y":40,"z":0},"rotation_euler":{"x":0,"y":0,"z":30},"scale":{"x":1,"y":1,"z":1}},"world_transform":{"position":{"x":122,"y":43,"z":4},"rotation":{"x":0,"y":0,"z":0.2588190451025207,"w":0.9659258262890683},"scale":{"x":1,"y":1,"z":1}},"components":[]}
5. Verify the checkpoint’s path, layout, and active state.
./cocos-mcp call describe_node '{"node_uuid":"d6ar7efbNCwK6qpXw24k3l"}' --json
{"uuid":"d6ar7efbNCwK6qpXw24k3l","name":"Checkpoint","active":false,"path":"/FixtureParent/Checkpoint","parent_uuid":"5db177e5-2cb1-5690-8010-fd1f6cfc962d","child_count":0,"active_in_hierarchy":false,"layer":1073741824,"local_transform":{"position":{"x":120,"y":40,"z":0},"rotation_euler":{"x":0,"y":0,"z":30},"scale":{"x":1,"y":1,"z":1}},"world_transform":{"position":{"x":122,"y":43,"z":4},"rotation":{"x":0,"y":0,"z":0.2588190451025207,"w":0.9659258262890683},"scale":{"x":1,"y":1,"z":1}},"components":[]}

Captured Claude Code Bash calls

These five calls came from one Claude Code 2.1.337 print-mode session with Bash enabled and no MCP servers. The transcript shows the actual commands and tool results, not a simulated assistant response.

Prepare a disposable capture workspace Follow the quickstart and open only the disposable fixture described above. For these captures the installed CLI was linked into an otherwise empty directory. From the repository root:
DEMO_DIR="$(mktemp -d)"
ln -s "$PWD/server/.venv/bin/cocos-mcp" "$DEMO_DIR/cocos-mcp"
cd "$DEMO_DIR"
Keep `COCOS_MCP_PROJECT_PATH` set to the disposable copy of the bundled project with `Main.scene` open. The rename is not saved. Close the scene without saving after the demo. Fixture UUIDs are not portable to other projects.
1. Read the native scene hierarchy
./cocos-mcp tree --depth 2 --limit 20 --no-ids
Main
  FixtureParent
    Twin
  Twin
2. Find both nodes with the same Twin name
./cocos-mcp call find_nodes '{"pattern":"Twin"}'
nodes: uuid name    path
b26e2535-56bb-536e-bc7c-7030c368f404    Twin    FixtureParent/Twin
5d5c6e5f-b41e-50bd-b66b-b4d6db51918e    Twin    Twin
truncated: false
3. Rename the fixture parent in the disposable scene
./cocos-mcp call rename_node '{"node_uuid":"5db177e5-2cb1-5690-8010-fd1f6cfc962d","name":"DemoAnchor"}'
uuid: 5db177e5-2cb1-5690-8010-fd1f6cfc962d
name: DemoAnchor
4. Verify the new DemoAnchor path
./cocos-mcp call find_nodes '{"pattern":"DemoAnchor"}'
nodes: uuid name    path
5db177e5-2cb1-5690-8010-fd1f6cfc962d    DemoAnchor  DemoAnchor
truncated: false
5. Verify the asset type for Main.scene
./cocos-mcp call get_asset_info '{"asset_url":"db://assets/Main.scene"}' --fields name,type,url
name: Main.scene
type: cc.SceneAsset
url: db://assets/Main.scene
1. Read the scene hierarchy
server/.venv/bin/cocos-mcp tree --depth 2 --limit 20 --no-ids
Main
  FixtureParent
    Twin
  Twin
2. Distinguish two nodes named Twin
server/.venv/bin/cocos-mcp call find_nodes '{"pattern":"Twin"}'
nodes: uuid name    path
b26e2535-56bb-536e-bc7c-7030c368f404    Twin    FixtureParent/Twin
5d5c6e5f-b41e-50bd-b66b-b4d6db51918e    Twin    Twin
truncated: false
3. Read the parent node position
server/.venv/bin/cocos-mcp call get_node_properties   '{"node_uuid":"5db177e5-2cb1-5690-8010-fd1f6cfc962d"}' --fields name,position
name: FixtureParent
position: x: 2
y: 3
z: 4
4. List the scene assets
server/.venv/bin/cocos-mcp call list_assets '{"pattern":"*.scene"}'
assets: uuid    url type    name
9c52a956-a3ee-5c66-9219-550e95968a22    db://assets/Main.scene  cc.SceneAsset   Main.scene
4fa0c820-429c-5f5a-b680-4466e1d93c7f    db://assets/Other.scene cc.SceneAsset   Other.scene
truncated: false
5. Check the asset type before using a scene URL
server/.venv/bin/cocos-mcp call get_asset_info   '{"asset_url":"db://assets/Main.scene"}' --fields name,type,url
name: Main.scene
type: cc.SceneAsset
url: db://assets/Main.scene

Captured MCP responses

The CLI can add presentation labels or format a result differently. These are the actual text responses behind the illustrative chat replay.

Read the scene hierarchy
Main
  FixtureParent
    Twin
  Twin
Distinguish two nodes named Twin
nodes: uuid name    path
b26e2535-56bb-536e-bc7c-7030c368f404    Twin    FixtureParent/Twin
5d5c6e5f-b41e-50bd-b66b-b4d6db51918e    Twin    Twin
truncated: false
Read the parent node position
name: FixtureParent
position: x: 2
y: 3
z: 4
List the scene assets
assets: uuid    url type    name
9c52a956-a3ee-5c66-9219-550e95968a22    db://assets/Main.scene  cc.SceneAsset   Main.scene
4fa0c820-429c-5f5a-b680-4466e1d93c7f    db://assets/Other.scene cc.SceneAsset   Other.scene
truncated: false
Check the asset type before using a scene URL
name: Main.scene
type: cc.SceneAsset
url: db://assets/Main.scene