cocos-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| COCOS_CREATOR_PATH | No | Specify the Cocos Creator installation directory (highest priority, useful for CI/Docker). | |
| COCOS_MCP_SCENE_COMPACT | No | Set to '1' to write scene files as compact JSON (reduces file size by ~41% for 500 objects). | 0 |
| COCOS_CREATOR_EXTRA_ROOTS | No | Additional paths to scan for Cocos Creator installations, separated by ':' on POSIX or ';' on Windows. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| cocos_new_uuidA | Generate a fresh standard UUID4 (36-char dashed lowercase hex). Used as the main UUID for new scripts, scenes, prefabs, and images. |
| cocos_compress_uuidA | Compress a 36-char UUID to Cocos Creator's 23-char short form. Required when referencing a custom TS script class as a component
|
| cocos_decompress_uuidA | Reverse cocos_compress_uuid: 23-char short -> 36-char dashed. |
| cocos_list_creator_installsA | List every locally installed Cocos Creator version. Returns a list of {version, exe, template_dir} dicts. Looks under /Applications/Cocos/Creator on macOS, C:/CocosDashboard/Creator on Windows, /opt/Cocos/Creator on Linux. |
| cocos_init_projectA | Initialize a new Cocos Creator project from a template. Copies a built-in template (default empty-2d) into Use |
| cocos_get_project_infoC | Read package.json + list assets / scenes / scripts in the project. |
| cocos_list_assetsA | List all assets in the project grouped by type, with their UUIDs. Returns {scripts: [...], scenes: [...], images: [...], prefabs: [...]}.
Each entry has at minimum {rel, uuid}; images additionally include
|
| cocos_add_scriptA | Write a TypeScript script + its meta into the project.
Returns {path, rel_path, uuid}. The uuid is the standard 36-char form; use cocos_compress_uuid to get the 23-char form needed in scene files. |
| cocos_add_imageA | Copy a PNG into the project and write a complete sprite-frame meta. Default: assets/textures/. Set as_resource=True to put it under assets/resources/ (needed for runtime loading via resources.load()). Returns {path, rel_path, main_uuid, sprite_frame_uuid, texture_uuid}. |
| cocos_upgrade_image_metaA | Upgrade a texture-only PNG meta to include a sprite-frame sub. Cocos Creator's CLI Returns the updated meta dict. |
| cocos_get_sprite_frame_uuidC | Return the |
| cocos_set_sprite_frame_borderA | Set 9-slice border on an existing sprite-frame meta in pixels. Required before using a PNG with cc.Sprite type=SLICED (rounded buttons, UI panels, dialog backgrounds — anything that should keep crisp corners while stretching the middle). Idempotent. The meta must already be sprite-frame type
(run |
| cocos_list_toolsA | List the tools actually registered on this MCP server. Addresses stale-catalog scenarios where a subagent's MCP
session can't reliably see tools registered after the session
started — asking the server directly is the ground truth.
Returns Filters (all optional):
Empty filters return every tool. Use this whenever you need to double-check whether a capability is already baked in before implementing it manually. |
| cocos_constantsA | Return commonly used Cocos Creator constants. Saves you from looking up layer bitmasks, blend factors, alignment enum values, etc. |
| cocos_set_ui_themeA | Pin a UI theme so every subsequent Built-in theme names: Preset vocabulary every theme MUST provide: color: primary / secondary / bg / surface / text / text_dim / success / warn / danger / border (10) font_size: title / heading / body / caption (4) spacing: xs / sm / md / lg / xl (5) radius: sm / md / lg / pill (4) Calling with no args pins |
| cocos_get_ui_tokensA | Return the project's active UI theme (fully resolved). Always returns a complete theme — un-themed projects get the
|
| cocos_list_builtin_themesA | Return all five bundled UI themes verbatim. Useful for previewing the palette before pinning one, or as a
starting point for a |
| cocos_derive_theme_from_seedA | Generate a coherent UI palette from one brand color. Given
Returns a Typical use:: |
| cocos_hex_to_rgbaA | Convert Returns |
| cocos_create_sceneA | Create a minimal empty 2D scene + meta in assets/scenes/. Includes Canvas + UICamera (cc.Camera) + cc.Canvas + Widget +
SceneGlobals (Ambient/Skybox/Shadows) + PrefabInfo. The Camera's
Returns canonical IDs: {scene_path, scene_uuid, scene_node_id, canvas_node_id, ui_camera_node_id, camera_component_id, canvas_component_id} These IDs are array-index references into the scene's JSON;
use them as |
| cocos_create_nodeA | Append a new cc.Node under
|
| cocos_add_uitransformC | Attach a cc.UITransform to a node. Required for any UI rendering. |
| cocos_add_spriteB | Attach a cc.Sprite to a node.
|
| cocos_add_labelA | Attach cc.Label. overflow: 0=NONE 1=CLAMP 2=SHRINK 3=RESIZE_HEIGHT. cache_mode: 0=NONE 1=BITMAP 2=CHAR. CLAMP truncates, SHRINK auto-shrinks font. Design-token presets (override the equivalent explicit arg):
|
| cocos_add_graphicsC | Attach a cc.Graphics to a node (for runtime vector drawing). |
| cocos_add_widgetC | Attach a cc.Widget for screen-anchor layout. align_flags is a bitmask. |
| cocos_add_componentB | Attach any cc component by its full type name (e.g. 'cc.RigidBody2D').
|
| cocos_attach_scriptA | Attach a custom TypeScript script component to a node.
|
| cocos_link_propertyB | Set a @property on a component to reference another node/component. Pass |
| cocos_set_propertyA | Set a literal (non-reference) property on any scene object. Use this for things like |
| cocos_set_uuid_propertyC | Set a property to a uuid resource ref (SpriteFrame, AudioClip, etc.). |
| cocos_set_node_positionB | Set a node's local position (x, y, z). z defaults to 0 for 2D scenes. |
| cocos_set_node_activeC | Toggle a node's _active flag (True = visible/ticking, False = disabled). |
| cocos_set_node_scaleC | Set a node's local scale. |
| cocos_set_node_rotationB | Set 2D rotation (euler Z) in degrees. |
| cocos_set_node_layerA | Set a node's layer bitmask. Common: UI_2D=33554432, DEFAULT=1073741824. |
| cocos_move_nodeC | Re-parent a node. sibling_index=-1 appends as last child. |
| cocos_delete_nodeA | Soft-delete a node (disconnect from parent, deactivate). Indices stay stable. |
| cocos_duplicate_nodeB | Shallow-copy a node (no children/components). Returns new node index. |
| cocos_find_node_by_nameA | Find the first node with the given name. Returns its array index, or None. |
| cocos_list_scene_nodesB | List every cc.Node in the scene with its id, name, parent, components, children. |
| cocos_validate_sceneA | Sanity-check a scene file: ref ranges, type tags, parent linkage. Returns {valid: bool, object_count: int, issues: [...]}. Run this
after building a scene to catch dangling id references before
invoking NOTE: structural-only. To check whether the scene's components
match the project's enabled engine modules (the "build succeeds
but RigidBody2D doesn't work" class of bugs), also call
|
| cocos_assert_scene_stateA | Declarative expectations against a scene/prefab — regression- test style. Each entry in {"path": "", "op": "", "value": } with optional root-finder shortcuts: {"find_node_by_name": "Player", # find first cc.Node _name "path": "_lpos.x", "op": "gt", "value": 0} {"find_component": {"type": "cc.Sprite", "on_node_named": "Enemy"}, "path": "_color.r", "op": "eq", "value": 255} Ops: eq / ne / gt / ge / lt / le / in / not_in / contains / match / is_null / not_null / type_is / exists / not_exists Path syntax: Runs EVERY assertion even if earlier ones fail — regression checks want a full report, not a first-failure bail. Returns {ok, scene_path, total, passed_count, failed_count, passed: [...], failed: [...]}. |
| cocos_lint_uiA | Non-structural UI quality check (complement to cocos_validate_scene). Flags issues that build + load cleanly but produce bad UX:
Returns {ok, scene_path, warnings:[{rule, node_id, node_name, message}]}. All warnings are non-fatal; the caller decides what to fix. |
| cocos_audit_scene_modulesA | Cross-check scene components against the project's engine.json. Catches the single highest-frequency "build succeeded, game broken at runtime" failure: using a component (RigidBody2D, Spine, VideoPlayer, ...) whose engine module is currently disabled. Build produces artifacts, the scene loads, but the components silently do nothing.
Returns {ok, project_path, required, enabled, disabled, actions}. When ok=False, actions lists copy-pasteable next steps (cocos_set_engine_module calls + the library clean that module changes need). |
| cocos_get_object_countB | Return the total number of objects in the scene/prefab JSON array. |
| cocos_get_objectB | Return the raw JSON dict of a scene object (for debugging/inspection). |
| cocos_create_prefabC | Create an empty .prefab in assets/prefabs/ with a single root node. |
| cocos_instantiate_prefabA | Drop a .prefab file into the scene as a child node — returns root id. Reads the .prefab JSON, deep-copies its node tree (root + children +
components), shifts every internal id reference, gives every cloned
object a fresh _id, refreshes each cc.PrefabInfo.fileId so multiple
instances of the same prefab don't alias, and parents the new root
under Treats the prefab as unlinked (a one-shot copy). If you later edit the .prefab, instances already dropped into the scene will NOT update — re-instantiate to pick up the changes. Pass any of name / pos_x / pos_y / pos_z / scale to override the root's defaults (otherwise the prefab's own values stay). |
| cocos_save_subtree_as_prefabA | Extract a fully-configured scene subtree into a reusable .prefab. The usual case: build your "Enemy" in a scratch scene with
Sprite + RigidBody2D + Collider + Animation + script all wired,
then save-as-prefab to spawn dozens. Without this, every copy
requires re-running the same Self-contained rule: every cc.Node referenced from inside the
subtree (script field pointing at another Node, Button target,
etc.) must already BE inside the subtree. External cc.Node
refs raise with a message naming the offender — Cocos's prefab
format has no way to express late-bound cross-scene refs, so
silent clipping would produce a broken prefab. Asset UUID refs
( Effects on Returns {prefab_path, prefab_uuid, root_node_id (=1), object_count, source_root_name}. |
| cocos_set_ambientA | Configure ambient lighting on the scene's cc.AmbientInfo. Colors are floats 0..1 (NOT 0..255 — sky/ground colors in Cocos are normalized like material PBR inputs). Pass None to leave unchanged. sky_illum is in lux, default ~20000. The scene must have been created via cocos_create_scene (which auto-attaches AmbientInfo). |
| cocos_set_skyboxB | Configure the scene's cc.SkyboxInfo. env_lighting_type: 0=HEMISPHERE_DIFFUSE (cheap default), 1=AUTOGEN_HEMISPHERE_DIFFUSE, 2=DIFFUSEMAP_WITH_REFLECTION (PBR, needs envmap). envmap_uuid points at a cc.TextureCube asset. Pass empty string "" to clear. Pass None to leave fields unchanged. |
| cocos_set_shadowsA | Configure planar shadows on the scene's cc.ShadowsInfo. normal: ground plane normal, defaults to (0, 1, 0) for flat ground. distance: signed offset along normal from world origin. color: shadow color, ints 0..255. Pass None on any axis/channel to leave it unchanged. Enabling planar shadows also typically requires at least one DirectionalLight in the scene. |
| cocos_set_fogA | Configure volumetric fog on the scene's cc.FogInfo. Fourth scene-global alongside ambient/skybox/shadows. Lazy-creates a cc.FogInfo + links it from cc.SceneGlobals if the scene doesn't have one yet (scenes built before this tool existed won't). fog_type: 0=LINEAR (use start+end), 1=EXP (density), 2=EXP_SQUARED, 3=LAYERED (top+range). Atmospheric settings are inter-dependent — LINEAR ignores density, EXP/EXP_SQUARED ignore start/end. |
| cocos_batch_scene_opsA | PREFERRED for ≥3 sequential mutations on the same scene. Execute multiple scene operations in a single file read/write cycle.
~80× faster than calling individual Rule of thumb: if you would otherwise call Each operation is a dict with an
Supported ops:
Structural:
- {"op": "add_node", "parent_id": N, "name": "...",
"lpos": [x, y, z]?, "lscale": [sx, sy, sz]?,
"pos_x": ..., "pos_y": ..., "pos_z": ...,
"sx": ..., "sy": ..., "sz": ...,
"layer": L?, "active": true/false?, "sibling_index": -1?}
( Components: - {"op": "add_uitransform", "node_id": N, "width": W, "height": H, "anchor_x": ..., "anchor_y": ...} - {"op": "add_widget", "node_id": N, "align_flags": 45, "target_id": M?} - {"op": "add_sprite", "node_id": N, "sprite_frame_uuid": "...", "size_mode": 0} - {"op": "add_label", "node_id": N, "text": "...", "font_size": 40, "color_r"...} - {"op": "add_graphics", "node_id": N} - {"op": "add_camera", "node_id": N, "ortho_height": ..., "clear_color_r"...} - {"op": "add_mask", "node_id": N, "mask_type": 0, "inverted": false, "segments": 64} - {"op": "add_richtext", "node_id": N, "text": "Hi", "font_size": 40, ...} - {"op": "add_button", "node_id": N, "transition": 2, "zoom_scale": 1.1} - {"op": "add_layout", "node_id": N, "layout_type": 1, "spacing_x": ..., ...} - {"op": "add_progress_bar", "node_id": N, "mode": 0, "total_length": 100, "progress": 1.0, "bar_sprite_id": M?} - {"op": "add_audio_source", "node_id": N, "clip_uuid": "...", "volume": 1.0, "loop": false, "play_on_awake": false} - {"op": "add_animation", "node_id": N, "default_clip_uuid": "...", "clip_uuids": [...], "play_on_load": true} - {"op": "add_rigidbody2d", "node_id": N, "body_type": 2, ...} - {"op": "add_box_collider2d", "node_id": N, "width": W, ...} - {"op": "add_circle_collider2d", "node_id": N, "radius": R, ...} - {"op": "add_polygon_collider2d", "node_id": N, "points": [[x,y], ...], ...} - {"op": "add_component", "node_id": N, "type_name": "cc.X", "props": {...}} Physics 2D joints (Cocos 3.8 has eight — all present): - {"op": "add_distance_joint2d", "node_id": N, "connected_body_id": M?, "distance": 100, ...} - {"op": "add_hinge_joint2d", "node_id": N, "enable_motor": true, "motor_speed": 50, ...} - {"op": "add_spring_joint2d", "node_id": N, "frequency": 5, "damping_ratio": 0.7, ...} - {"op": "add_mouse_joint2d", "node_id": N, "max_force": 1000, "target_x": ..., "target_y": ...} - {"op": "add_slider_joint2d", "node_id": N, "angle": 0, "enable_motor": true, ...} - {"op": "add_wheel_joint2d", "node_id": N, "angle": 90, ...} - {"op": "add_fixed_joint_2d", "node_id": N, "angle": 0, ...} (cc.FixedJoint2D — previously mis-named "weld"; 3.8 renames it.) - {"op": "add_relative_joint2d", "node_id": N, "linear_offset_x": 10, ...} Back-reference forms inside any op value:
Example mixing both forms:: [{"op": "add_node", "parent_id": 2, "name": "bird"}, # $0 or $bird {"op": "add_uitransform", "node_id": "$bird", "width": 50, "height": 50}, {"op": "add_rigidbody2d", "node_id": "$bird", "body_type": 2}, {"op": "add_circle_collider2d", "node_id": "$bird", "radius": 25}] |
| cocos_add_rigidbody2dC | Attach cc.RigidBody2D. body_type: 0=Static, 1=Kinematic, 2=Dynamic. |
| cocos_add_box_collider2dC | Attach cc.BoxCollider2D with given size, offset, and physics material. |
| cocos_add_circle_collider2dC | Attach cc.CircleCollider2D with given radius and physics material. |
| cocos_add_polygon_collider2dC | Attach cc.PolygonCollider2D. |
| cocos_add_distance_joint2dC | Attach cc.DistanceJoint2D — keeps two bodies a fixed distance apart. |
| cocos_add_hinge_joint2dC | Attach cc.HingeJoint2D — pivots around a shared anchor (door, wheel, pendulum). |
| cocos_add_spring_joint2dC | Attach cc.SpringJoint2D — soft springy distance (suspensions, ropes). |
| cocos_add_mouse_joint2dC | Attach cc.MouseJoint2D — drag-to-target constraint, used to pick up bodies with the mouse. |
| cocos_add_slider_joint2dC | Attach cc.SliderJoint2D — translates along an axis (elevators, pistons). |
| cocos_add_wheel_joint2dC | Attach cc.WheelJoint2D — wheel + axle (slide along axis + spring + motor combined; vehicles). |
| cocos_add_fixed_joint_2dC | Attach cc.FixedJoint2D — rigidly fuses two bodies (breakable structures). Named "weld" in Box2D; replaces the prior |
| cocos_add_relative_joint2dC | Attach cc.RelativeJoint2D — keeps relative position+angle ('attach to' effect). Also covers the follow-target use case that the old |
| cocos_add_buttonA | Attach cc.Button. transition: 0=NONE, 1=COLOR, 2=SCALE, 3=SPRITE.
click_events: list of dicts from cocos_make_click_event(). Each binds a button press to a script method. Example: evt = cocos_make_click_event(scene, gm_node, 'GameManager', 'onRestart') cocos_add_button(scene, btn_node, click_events=[evt]) |
| cocos_add_layoutC | Attach cc.Layout. layout_type: 0=NONE, 1=HORIZONTAL, 2=VERTICAL, 3=GRID. |
| cocos_add_progress_barB | Attach cc.ProgressBar. mode: 0=HORIZONTAL, 1=VERTICAL, 2=FILLED. |
| cocos_add_scroll_viewC | Attach cc.ScrollView. content_id points to the scrollable content node. |
| cocos_add_toggleD | Attach cc.Toggle. check_events: list from cocos_make_event_handler(). |
| cocos_add_editboxC | Attach cc.EditBox. input_mode: 0=ANY, 6=SINGLE_LINE. -1=unlimited length. |
| cocos_add_sliderC | Attach cc.Slider. slide_events: list from cocos_make_event_handler(). |
| cocos_add_page_viewC | Attach cc.PageView (swipeable pages). direction: 0=H, 1=V. |
| cocos_add_toggle_containerC | Attach cc.ToggleContainer (radio group). Children are mutually exclusive. |
| cocos_add_scroll_barB | Attach cc.ScrollBar — companion scroll indicator for a ScrollView. direction: 0=HORIZONTAL (default), 1=VERTICAL.
Pass |
| cocos_add_page_view_indicatorA | Attach cc.PageViewIndicator — dots row that tracks PageView position. Attach to a child of the PageView node. Engine auto-spawns one
indicator sprite per page using |
| cocos_add_webviewC | Attach cc.WebView — embedded browser pane for ToS / activity pages. |
| cocos_make_event_handlerB | Build a cc.EventHandler dict for component event bindings. Use with: cocos_add_scroll_view(scroll_events=[...]), cocos_add_toggle(check_events=[...]), cocos_add_slider(slide_events=[...]), cocos_add_editbox(editing_return=[...]). Same pattern as cocos_make_click_event but for non-Button components. |
| cocos_make_click_eventA | Build a cc.ClickEvent dict for use with cocos_add_button's click_events. Args: target_node_id: Node that holds the script (array index) component_name: @ccclass name (e.g. 'GameManager') handler: Method name to call (e.g. 'onStartClick') Returns a dict to pass in click_events list of cocos_add_button. Example workflow: evt = cocos_make_click_event(scene, gm_node, 'GameManager', 'onStart') cocos_add_button(scene, btn_node, click_events=[evt]) |
| cocos_add_rigidbody_3dB | Attach cc.RigidBody (3D). body_type: 1=DYNAMIC (default), 2=STATIC, 4=KINEMATIC. Values are engine's ERigidBodyType bitmask, NOT contiguous 0/1/2 like the 2D API. linear_factor / angular_factor lock motion on a per-axis basis (set component to 0 to freeze that axis, 1 for free movement). |
| cocos_add_box_collider_3dC | Attach cc.BoxCollider (3D AABB shape). |
| cocos_add_sphere_collider_3dC | Attach cc.SphereCollider (3D sphere shape). |
| cocos_add_capsule_collider_3dC | Attach cc.CapsuleCollider. direction: 0=X, 1=Y (default), 2=Z. |
| cocos_add_cylinder_collider_3dD | Attach cc.CylinderCollider. |
| cocos_add_cone_collider_3dD | Attach cc.ConeCollider. |
| cocos_add_plane_collider_3dC | Attach cc.PlaneCollider — infinite plane, typically used for the ground. Default normal (0, 1, 0) + constant 0 means the XZ plane at y=0. |
| cocos_add_mesh_collider_3dA | Attach cc.MeshCollider. IMPORTANT: |
| cocos_add_terrain_collider_3dC | Attach cc.TerrainCollider (pass a cc.Terrain asset UUID). |
| cocos_add_box_character_controllerA | Attach cc.BoxCharacterController — AABB-shaped kinematic character. Use this INSTEAD of RigidBody + Collider for player movement. It handles ground snapping, slope limits, step-up automatically. |
| cocos_add_capsule_character_controllerA | Attach cc.CapsuleCharacterController — capsule-shaped kinematic character. More common than box for humanoid characters; smoother wall sliding.
|
| cocos_create_physics_materialA | Create a cc.PhysicsMaterial (.pmat) asset. Returns {path, rel_path, uuid}. Bind to a collider via
Defaults match engine: friction=0.6, restitution=0 (no bounce). For bouncy materials set restitution 0.3-0.9; for ice set friction 0.02. |
| cocos_add_directional_lightA | Attach cc.DirectionalLight — sun/moon parallel light.
|
| cocos_add_sphere_lightB | Attach cc.SphereLight — point-light with physical size (bulb, lantern).
|
| cocos_add_spot_lightC | Attach cc.SpotLight — cone-shaped light (torch, stage spot). |
| cocos_add_mesh_rendererB | Attach cc.MeshRenderer — renders a 3D mesh.
|
| cocos_add_skinned_mesh_rendererB | Attach cc.SkinnedMeshRenderer — MeshRenderer driven by a skeleton. Use this for humanoid/animal characters imported from GLTF/FBX.
|
| cocos_add_audio_sourceC | Attach cc.AudioSource. clip_uuid references an audio-clip asset. |
| cocos_add_animationC | Attach cc.Animation. clip_uuids is a list of AnimationClip asset UUIDs. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/chenShengBiao/cocos-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server