| name | cocos-creator-mcp-server |
| description | MCP server plugin for Cocos Creator 3.8+ that enables AI assistants to control the editor through 50 powerful tools for scenes, nodes, components, prefabs, and assets. |
| triggers | ["how do I control Cocos Creator with AI","integrate AI with Cocos Creator editor","automate Cocos Creator scene creation","manipulate Cocos Creator nodes programmatically","create prefabs in Cocos Creator with MCP","use AI to build Cocos Creator games","connect Claude to Cocos Creator","automate Cocos Creator workflows"] |
Cocos Creator MCP Server Skill
Skill by ara.so — MCP Skills collection.
A comprehensive MCP (Model Context Protocol) server plugin for Cocos Creator 3.8+ that enables AI assistants to interact with the Cocos Creator editor through a standardized protocol. Provides 50 powerful tools covering 99% of editor operations including scenes, nodes, components, prefabs, assets, project management, debugging, and preferences.
Installation
Prerequisites
- Cocos Creator 3.8.6 or higher
- MCP-compatible client (Claude Desktop, Claude CLI, Cursor, etc.)
Plugin Installation
-
From Cocos Store (Recommended):
-
Manual Installation:
git clone https://github.com/DaxianLee/cocos-mcp-server.git
-
Enable in Cocos Creator:
- Open Cocos Creator
- Go to Extensions → Extension Manager
- Find "Cocos Creator MCP Server" and enable it
- Configure server port (default: 3000) in the MCP panel
Client Configuration
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"cocos-creator": {
"type": "http",
"url": "http://127.0.0.1:3000/mcp"
}
}
}
Claude CLI:
claude mcp add --transport http cocos-creator http://127.0.0.1:3000/mcp
Cursor (.cursor/mcp.json or settings):
{
"mcpServers": {
"cocos-creator": {
"url": "http://localhost:3000/mcp"
}
}
}
Core Concepts
Action-Based Tool System
All 50 tools follow a unified "action + parameters" pattern:
{
"tool": "category_operation",
"arguments": {
"action": "specific_action",
}
}
This design reduces token consumption by ~50% and increases AI call success rates.
Tool Categories
- scene_* - Scene management and hierarchy
- node_* - Node lifecycle, transforms, and hierarchy
- component_* - Component management and scripting
- prefab_* - Prefab browsing, creation, and instantiation
- asset_* - Asset management and analysis
- project_* - Project control and build system
- debug_* - Console, logs, and system debugging
- preferences_* - Editor preferences
- server_* - Server information
- broadcast_* - Message broadcasting
Key Tools & Usage
Scene Management
Get Current Scene
{
"action": "get_current_scene"
}
Open Scene
{
"action": "open_scene",
"sceneUuid": "scene-uuid-here"
}
Create New Scene
{
"action": "create_scene",
"name": "MyNewScene",
"savePath": "db://assets/scenes/"
}
Save Current Scene
{
"action": "save_scene"
}
Node Operations
Create Node
{
"action": "create",
"name": "PlayerNode",
"parentUuid": "parent-node-uuid",
"nodeType": "2DNode",
"components": [
{
"type": "cc.Sprite",
"properties": {
"spriteFrame": "texture-uuid"
}
}
]
}
Query Nodes
{
"action": "find_by_name",
"name": "Player",
"exactMatch": false
}
{
"action": "find_all",
"includeComponents": true
}
Delete Node
{
"action": "delete",
"uuid": "node-uuid-to-delete"
}
Transform Node
{
"action": "set_property",
"uuid": "node-uuid",
"property": "position",
"value": { "x": 100, "y": 200, "z": 0 }
}
{
"action": "set_property",
"uuid": "node-uuid",
"property": "rotation",
"value": { "x": 0, "y": 0, "z": 45 }
}
{
"action": "set_property",
"uuid": "node-uuid",
"property": "scale",
"value": { "x": 2, "y": 2, "z": 1 }
}
Move Node in Hierarchy
{
"action": "move",
"uuid": "node-uuid",
"newParentUuid": "new-parent-uuid",
"siblingIndex": 0
}
Component Management
Add Engine Component
{
"action": "add",
"nodeUuid": "node-uuid",
"componentType": "cc.Sprite",
"properties": {
"spriteFrame": "texture-uuid",
"sizeMode": 0
}
}
Attach Custom Script
{
"action": "add_script",
"nodeUuid": "node-uuid",
"scriptName": "PlayerController",
"properties": {
"speed": 100,
"jumpForce": 500
}
}
Get Component Information
{
"action": "get_components",
"nodeUuid": "node-uuid"
}
Remove Component (IMPORTANT)
{
"action": "get_components",
"nodeUuid": "node-uuid"
}
{
"action": "remove",
"nodeUuid": "node-uuid",
"componentType": "comp.PlayerController!1234abcd"
}
Set Component Properties
{
"nodeUuid": "node-uuid",
"componentType": "cc.Sprite",
"properties": {
"color": { "r": 255, "g": 0, "b": 0, "a": 255 }
}
}
{
"nodeUuid": "node-uuid",
"componentType": "comp.PlayerController!1234abcd",
"properties": {
"health": 100,
"maxSpeed": 200
}
}
Prefab Operations
List Prefabs
{
"action": "list",
"folderPath": "db://assets/prefabs/"
}
Create Prefab from Node
{
"action": "create",
"nodeUuid": "source-node-uuid",
"savePath": "db://assets/prefabs/MyPrefab.prefab"
}
Instantiate Prefab
{
"action": "instantiate",
"prefabUuid": "prefab-uuid",
"parentUuid": "parent-node-uuid",
"position": { "x": 0, "y": 0, "z": 0 }
}
Apply Instance Changes to Prefab
{
"action": "apply",
"nodeUuid": "prefab-instance-uuid"
}
Revert Instance to Original
{
"action": "revert",
"nodeUuid": "prefab-instance-uuid"
}
Asset Management
Import Assets
{
"action": "import",
"paths": [
"/path/to/texture.png",
"/path/to/audio.mp3"
]
}
Query Assets by Type
{
"action": "query_by_type",
"type": "cc.Texture2D",
"folder": "db://assets/textures/"
}
Get Asset Dependencies
{
"action": "get_dependencies",
"uuid": "asset-uuid"
}
Delete Asset
{
"action": "delete",
"uuid": "asset-uuid"
}
Project Control
Run Project
{
"action": "run",
"preview": true
}
Build Project
{
"action": "build",
"platform": "web-mobile",
"buildPath": "/path/to/build/output"
}
Get Project Info
{
"action": "get_info"
}
Debugging
Get Console Logs
{
"action": "get_logs",
"filter": "error",
"limit": 50
}
Clear Console
{
"action": "clear"
}
Search Log Files
{
"action": "search",
"pattern": "Error:",
"maxLines": 100
}
Common Patterns
Creating a Complete Game Object
const createNode = {
tool: "node_lifecycle",
arguments: {
action: "create",
name: "Player",
nodeType: "2DNode"
}
};
const addSprite = {
tool: "component_manage",
arguments: {
action: "add",
nodeUuid: "player-node-uuid",
componentType: "cc.Sprite",
properties: {
spriteFrame: "player-texture-uuid"
}
}
};
const addScript = {
tool: "component_script",
arguments: {
action: "add_script",
nodeUuid: "player-node-uuid",
scriptName: "PlayerController",
properties: {
speed: 300,
health: 100
}
}
};
const setPosition = {
tool: "node_transform",
arguments: {
action: "set_property",
uuid: "player-node-uuid",
: ,
: { : , : , : }
}
};
Working with Prefabs
const findNode = {
tool: "node_query",
arguments: {
action: "find_by_name",
name: "Enemy"
}
};
const createPrefab = {
tool: "prefab_lifecycle",
arguments: {
action: "create",
nodeUuid: "enemy-node-uuid",
savePath: "db://assets/prefabs/Enemy.prefab"
}
};
const spawn1 = {
tool: "prefab_instance",
arguments: {
action: "instantiate",
prefabUuid: "enemy-prefab-uuid",
position: { x: 100, y: 0, z: 0 }
}
};
const spawn2 = {
tool: "prefab_instance",
arguments: {
action: "instantiate",
prefabUuid: "enemy-prefab-uuid",
position: { x: -100, y: 0, z: 0 }
}
};
Batch Node Operations
const findEnemies = {
tool: "node_query",
arguments: {
action: "find_by_name",
name: "Enemy",
exactMatch: false
}
};
const deleteEnemy = {
tool: "node_lifecycle",
arguments: {
action: "delete",
uuid: "enemy-uuid"
}
};
Scene Setup Workflow
const newScene = {
tool: "scene_management",
arguments: {
action: "create_scene",
name: "Level1",
savePath: "db://assets/scenes/"
}
};
const background = {
tool: "node_lifecycle",
arguments: {
action: "create",
name: "Background",
nodeType: "2DNode",
components: [{
type: "cc.Sprite",
properties: {
spriteFrame: "bg-texture-uuid"
}
}]
}
};
const canvas = {
tool: "node_lifecycle",
arguments: {
action: "create",
name: "Canvas",
nodeType: "2DNode",
components: [{
type: "cc.Canvas"
}]
}
};
const saveScene = {
tool: "scene_management",
arguments: {
action: "save_scene"
}
};
Configuration
Server Settings
Access via MCP panel in Cocos Creator:
- Port: Default 3000, customizable
- Auto-start: Enable to launch server with editor
- Tool Management: Selectively enable/disable specific tools
Tool Configuration
The plugin saves tool configurations in editor preferences. Enable/disable tools through the MCP panel's tool management tab.
Environment Variables
For external integrations, you can configure:
COCOS_MCP_URL=http://127.0.0.1:3000/mcp
COCOS_PROJECT_PATH=/path/to/project
Troubleshooting
Server Won't Start
Issue: MCP server fails to start in Cocos Creator
Solutions:
- Check port is not in use:
netstat -an | grep 3000
- Try different port in MCP panel settings
- Restart Cocos Creator
- Check extension is enabled in Extension Manager
Tool Calls Failing
Issue: AI can't execute tools or gets errors
Solutions:
- Verify server is running (check MCP panel status)
- Ensure scene is open (many tools require active scene)
- Check UUIDs are valid (use query tools first)
- Enable debug logging in console to see detailed errors
Component Removal Fails
Issue: Cannot remove component or script
Solution:
Always use the exact cid (type field) from component_query:
{ action: "get_components", nodeUuid: "node-uuid" }
{
action: "remove",
nodeUuid: "node-uuid",
componentType: "comp.MyScript!abc123"
}
{
action: "remove",
nodeUuid: "node-uuid",
componentType: "MyScript"
}
Prefab References Lost
Issue: Prefab loses component or asset references
Solutions:
- This was fixed in v1.4.0+
- Ensure using latest plugin version
- Internal references use
{"__id__": x} format
- External references set to
null (as expected)
- Asset references preserve UUID format
Connection Issues
Issue: MCP client can't connect to server
Solutions:
- Verify URL in client config matches server port
- Check firewall isn't blocking localhost connections
- Restart both Cocos Creator and MCP client
- Test with:
curl http://127.0.0.1:3000/mcp
Performance Degradation
Issue: Editor becomes slow with MCP server
Solutions:
- Disable unused tools in tool management
- Reduce log levels in debug tools
- Limit query result counts
- Close unnecessary editor panels
Cross-Platform Path Issues
Issue: Asset paths don't work on different OS
Solution:
Always use Cocos db:// protocol for asset paths:
"savePath": "db://assets/prefabs/MyPrefab.prefab"
"savePath": "/Users/me/project/assets/prefabs/MyPrefab.prefab"
Advanced Usage
Custom Message Broadcasting
const listen = {
tool: "broadcast_message",
arguments: {
action: "listen",
channel: "game-events"
}
};
const broadcast = {
tool: "broadcast_message",
arguments: {
action: "broadcast",
channel: "game-events",
message: { event: "player_died", score: 100 }
}
};
Preferences Management
const getPrefs = {
tool: "preferences_manage",
arguments: {
action: "get",
key: "editor.grid.snap"
}
};
const setPrefs = {
tool: "preferences_manage",
arguments: {
action: "set",
key: "editor.grid.snap",
value: true
}
};
System Information
const systemInfo = {
tool: "debug_system",
arguments: {
action: "get_info"
}
};
Best Practices
- Always Query Before Modify: Use query tools to get UUIDs before operations
- Use Exact CIDs for Components: Never use script names for removal
- Save After Major Changes: Call
save_scene after structural changes
- Validate UUIDs: Check UUIDs exist before referencing
- Use db:// Paths: Always use Cocos protocol for cross-platform compatibility
- Enable Only Needed Tools: Disable unused tools for better performance
- Test Prefabs After Creation: Instantiate and verify before distributing
- Handle Errors Gracefully: Check tool responses for success/failure
Resources
Version Compatibility
- Plugin Version: 1.5.0+ recommended (1.4.0+ on GitHub)
- Cocos Creator: 3.8.6 or higher
- MCP Clients: Claude Desktop, Claude CLI, Cursor, VS Code (with MCP extensions)
- Node.js: Not required (plugin runs in editor runtime)