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:
-
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):
Claude CLI:
Cursor (.cursor/mcp.json or settings):
Core Concepts
All 50 tools follow a unified "action + parameters" pattern:
This design reduces token consumption by ~50% and increases AI call success rates.
- 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
Scene Management
Get Current Scene
Open Scene
Create New Scene
Save Current Scene
Node Operations
Create Node
Query Nodes
Delete Node
Move Node in Hierarchy
Component Management
Add Engine Component
Attach Custom Script
Remove Component (IMPORTANT)
Set Component Properties
Prefab Operations
List Prefabs
Create Prefab from Node
Instantiate Prefab
Apply Instance Changes to Prefab
Revert Instance to Original
Asset Management
Import Assets
Query Assets by Type
Get Asset Dependencies
Delete Asset
Project Control
Run Project
Build Project
Get Project Info
Debugging
Get Console Logs
Clear Console
Search Log Files
Common Patterns
Creating a Complete Game Object
Working with Prefabs
Batch Node Operations
Scene Setup Workflow
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
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:
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
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:
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
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
Issue: Asset paths don't work on different OS
Solution:
Always use Cocos db:// protocol for asset paths:
Advanced Usage
Custom Message Broadcasting
Preferences Management
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)