Cocos MCP Server
C

Cocos MCP Server

The Cocos Creator MCP Server Plugin is a comprehensive MCP server plugin designed for Cocos Creator 3.8+. It enables interaction between the AI assistant and the editor through a standardized protocol, offering one-click installation and support for 151 tools, covering 98% of the editor's control functions.
2.5 points
10.7K

Installation

Copy the following command to your Client for configuration
Note: Your key is sensitive information, do not share it with anyone.

๐Ÿš€ Cocos Creator MCP Server Plugin

This is a comprehensive MCP (Model Context Protocol) server plugin for Cocos Creator 3.8+. It enables AI assistants to interact with the Cocos Creator editor through standardized protocols. With one - click installation and use, it eliminates all cumbersome environments and configurations. The Claude clients Claude CLI and Cursor have been tested, and other editors are also perfectly supported in theory.

๐Ÿš€ Quick Start

Configuration for Different Clients

  • Claude cli configuration:
claude mcp add --transport http cocos-creator http://127.0.0.1:3000/mcp (use the port number you configured yourself)
  • Claude client configuration:
{
    "mcpServers": {
        "cocos-creator": {
            "type": "http",
            "url": "http://127.0.0.1:3000/mcp"
        }
    }
}
  • Cursor or VS class MCP configuration:
{
    "mcpServers": {
        "cocos-creator": {
            "url": "http://localhost:3000/mcp"
        }
    }
}

โœจ Features

๐ŸŽฏ Scene Operations

  • Retrieve current scene information and the complete scene list.
  • Open scenes by path and save the current scene.
  • Create new scenes with custom names.
  • Obtain the complete scene hierarchy with component information.

๐ŸŽฎ Node Operations

  • Create nodes of different types (Node, 2DNode, 3DNode).
  • Get node information by UUID and find nodes by name pattern.
  • Set node properties (position, rotation, scale, active).
  • Delete, move, and duplicate nodes with full hierarchy support.

๐Ÿ”ง Component Operations

  • Add/remove components from nodes.
  • Get all components of a node with properties.
  • Set component properties dynamically.
  • Attach script components from asset paths.
  • List available component types by category.

๐Ÿ“ฆ Prefab Operations

  • List all prefabs in the project with folder organization.
  • Load, instantiate, and create prefabs.
  • Update existing prefabs and revert prefab instances.
  • Get detailed prefab information including dependencies.

โš ๏ธ Important Note

Prefab instantiation may not properly restore child nodes due to Cocos Creator API limitations.

๐Ÿš€ Project Control

  • Run the project in preview mode (browser/simulator).
  • Build the project for different platforms (web, mobile, desktop).
  • Get project information and settings.
  • Refresh the asset database and import new assets.
  • Get detailed asset information.

๐Ÿ” Debug Tools

  • Get editor console logs with filtering.
  • Clear the console and execute JavaScript in the scene context.
  • Get the detailed node tree for debugging.
  • Obtain performance statistics and perform scene validation.
  • Get editor and environment information.

โš™๏ธ Additional Features

  • Preferences Management: Get/set editor preferences and global settings.
  • Server Control: Retrieve server information, project details, and control the editor.
  • Message Broadcasting: Listen to and broadcast custom messages.
  • Asset Management: Create, copy, move, delete, and query assets.
  • Build System: Control project building and the preview server.
  • Reference Image Management: Add, remove, and manage reference images in the scene view.
  • Scene View Controls: Control gizmo tools, coordinate systems, and view modes.
  • Advanced Scene Operations: Undo/redo, take snapshots, and perform advanced node manipulation.

๐Ÿ“ฆ Installation

1. Copy Plugin Files

Copy the entire cocos-mcp-server folder to your Cocos Creator project's extensions directory:

YourProject/
โ”œโ”€โ”€ assets/
โ”œโ”€โ”€ extensions/
โ”‚   โ””โ”€โ”€ cocos-mcp-server/          <- Place plugin here
โ”‚       โ”œโ”€โ”€ source/
โ”‚       โ”œโ”€โ”€ dist/
โ”‚       โ”œโ”€โ”€ package.json
โ”‚       โ””โ”€โ”€ ...
โ”œโ”€โ”€ settings/
โ””โ”€โ”€ ...

2. Install Dependencies

cd extensions/cocos-mcp-server
npm install

3. Build the Plugin

npm run build

4. Enable Plugin

  1. Restart Cocos Creator or refresh extensions.
  2. The plugin will appear in the Extension menu.
  3. Click Extension > Cocos MCP Server to open the control panel.

๐Ÿ’ป Usage Examples

Basic Usage

Create a new sprite node

{
    "tool": "node_create_node",
    "arguments": {
        "name": "MySprite",
        "nodeType": "2DNode",
        "parentUuid": "parent-node-uuid"
    }
}

Add a Sprite component

{
    "tool": "component_add_component", 
    "arguments": {
        "nodeUuid": "node-uuid",
        "componentType": "cc.Sprite"
    }
}

Instantiate a prefab

{
    "tool": "prefab_instantiate_prefab",
    "arguments": {
        "prefabPath": "db://assets/prefabs/Enemy.prefab",
        "position": { "x": 100, "y": 200, "z": 0 }
    }
}

โš ๏ธ Important Note

Complex prefabs with child nodes may not instantiate correctly due to Cocos Creator API limitations. Child nodes may be missing in the instantiated prefab.

Run project in browser

{
    "tool": "project_run_project",
    "arguments": {
        "platform": "browser"
    }
}

Tool Categories

Tools are organized by category with the naming convention: category_toolname

  • scene_*: Scene-related operations (8 tools)
  • node_*: Node manipulation (9 tools)
  • component_*: Component management (7 tools)
  • prefab_*: Prefab operations (11 tools)
  • project_*: Project control (22 tools)
  • debug_*: Debugging utilities (10 tools)
  • preferences_*: Editor preferences (7 tools)
  • server_*: Server information (6 tools)
  • broadcast_*: Message broadcasting (5 tools)
  • assetAdvanced_*: Advanced asset operations (10 tools)
  • referenceImage_*: Reference image management (12 tools)
  • sceneAdvanced_*: Advanced scene operations (23 tools)
  • sceneView_*: Scene view controls (14 tools)

๐Ÿ“– View Complete Tool Documentation for detailed usage examples and parameters.

๐Ÿ“š Documentation

Configuration

Settings are stored in YourProject/settings/mcp-server.json:

{
    "port": 3000,
    "autoStart": false,
    "enableDebugLog": true,
    "allowedOrigins": ["*"],
    "maxConnections": 10
}

Icon Setup

To add an icon for the plugin panel:

  1. Create a PNG icon file (recommended size: 32x32 or 64x64).
  2. Place it in the static/ directory: static/icon.png.
  3. The icon path is already configured in package.json.

Development

Project Structure

cocos-mcp-server/
โ”œโ”€โ”€ source/                    # TypeScript source files
โ”‚   โ”œโ”€โ”€ main.ts               # Plugin entry point
โ”‚   โ”œโ”€โ”€ mcp-server.ts         # MCP server implementation
โ”‚   โ”œโ”€โ”€ settings.ts           # Settings management
โ”‚   โ”œโ”€โ”€ types/                # TypeScript type definitions
โ”‚   โ”œโ”€โ”€ tools/                # Tool implementations
โ”‚   โ”‚   โ”œโ”€โ”€ scene-tools.ts
โ”‚   โ”‚   โ”œโ”€โ”€ node-tools.ts
โ”‚   โ”‚   โ”œโ”€โ”€ component-tools.ts
โ”‚   โ”‚   โ”œโ”€โ”€ prefab-tools.ts
โ”‚   โ”‚   โ”œโ”€โ”€ project-tools.ts
โ”‚   โ”‚   โ”œโ”€โ”€ debug-tools.ts
โ”‚   โ”‚   โ”œโ”€โ”€ preferences-tools.ts
โ”‚   โ”‚   โ”œโ”€โ”€ server-tools.ts
โ”‚   โ”‚   โ”œโ”€โ”€ broadcast-tools.ts
โ”‚   โ”‚   โ”œโ”€โ”€ scene-advanced-tools.ts
โ”‚   โ”‚   โ”œโ”€โ”€ scene-view-tools.ts
โ”‚   โ”‚   โ”œโ”€โ”€ reference-image-tools.ts
โ”‚   โ”‚   โ””โ”€โ”€ asset-advanced-tools.ts
โ”‚   โ”œโ”€โ”€ panels/               # UI panel implementation
โ”‚   โ””โ”€โ”€ test/                 # Test files
โ”œโ”€โ”€ dist/                     # Compiled JavaScript output
โ”œโ”€โ”€ static/                   # Static assets (icons, etc.)
โ”œโ”€โ”€ i18n/                     # Internationalization files
โ”œโ”€โ”€ package.json              # Plugin configuration
โ””โ”€โ”€ tsconfig.json             # TypeScript configuration

Building from Source

# Install dependencies
npm install

# Build for development with watch mode
npm run watch

# Build for production
npm run build

Adding New Tools

  1. Create a new tool class in source/tools/.
  2. Implement the ToolExecutor interface.
  3. Add the tool to mcp-server.ts initialization.
  4. Tools are automatically exposed via the MCP protocol.

TypeScript Support

The plugin is fully written in TypeScript with:

  • Strict type checking enabled.
  • Comprehensive type definitions for all APIs.
  • IntelliSense support for development.
  • Automatic compilation to JavaScript.

Running Tests

# Run comprehensive test suite
node comprehensive-test.js

# Run feature-specific tests
./test-all-features.sh

# Run Node.js test script
node test-mcp-server.js

Troubleshooting

Common Issues

  • Server won't start: Check port availability and firewall settings.
  • Tools not working: Ensure the scene is loaded and UUIDs are valid.
  • Build errors: Run npm run build to check for TypeScript errors.
  • Connection issues: Verify the HTTP URL and server status.

Debug Mode

Enable debug logging in the plugin panel for detailed operation logs.

Using Debug Tools

{
    "tool": "debug_get_console_logs",
    "arguments": {"limit": 50, "filter": "error"}
}
{
    "tool": "debug_validate_scene",
    "arguments": {"checkMissingAssets": true}
}

๐Ÿ”ง Technical Details

Requirements

  • Cocos Creator 3.8.6 or later.
  • Node.js (bundled with Cocos Creator).
  • TypeScript (installed as a dev dependency).

Architecture Notes

This plugin uses a simplified MCP protocol implementation that is compatible with Cocos Creator's CommonJS environment. The HTTP server provides a JSON - RPC interface for AI assistants to interact with the editor.

Protocol Support

  • HTTP Connection: http://localhost:3000/mcp (configurable port).
  • JSON-RPC 2.0: Standard request/response format.
  • Tool Discovery: The tools/list method returns available tools.
  • Tool Execution: The tools/call method executes specific tools.

๐Ÿ“„ License

This plug - in is for the Cocos Creator project, and the source code is packaged together, which can be used for learning and communication. It is not encrypted. It can support your own secondary development and optimization. Any code of this project or its derivative code cannot be used for any commercial purpose or resale. If you need commercial use, please contact me.

Alternatives

R
Rsdoctor
Rsdoctor is a build analysis tool specifically designed for the Rspack ecosystem, fully compatible with webpack. It provides visual build analysis, multi - dimensional performance diagnosis, and intelligent optimization suggestions to help developers improve build efficiency and engineering quality.
TypeScript
8.7K
5 points
N
Next Devtools MCP
The Next.js development tools MCP server provides Next.js development tools and utilities for AI programming assistants such as Claude and Cursor, including runtime diagnostics, development automation, and document access functions.
TypeScript
8.2K
5 points
T
Testkube
Testkube is a test orchestration and execution framework for cloud-native applications, providing a unified platform to define, run, and analyze tests. It supports existing testing tools and Kubernetes infrastructure.
Go
5.1K
5 points
M
MCP Windbg
An MCP server that integrates AI models with WinDbg/CDB for analyzing Windows crash dump files and remote debugging, supporting natural language interaction to execute debugging commands.
Python
8.5K
5 points
R
Runno
Runno is a collection of JavaScript toolkits for securely running code in multiple programming languages in environments such as browsers and Node.js. It achieves sandboxed execution through WebAssembly and WASI, supports languages such as Python, Ruby, JavaScript, SQLite, C/C++, and provides integration methods such as web components and MCP servers.
TypeScript
6.4K
5 points
N
Netdata
Netdata is an open-source real-time infrastructure monitoring platform that provides second-level metric collection, visualization, machine learning-driven anomaly detection, and automated alerts. It can achieve full-stack monitoring without complex configuration.
Go
8.6K
5 points
M
MCP Server
The Mapbox MCP Server is a model context protocol server implemented in Node.js, providing AI applications with access to Mapbox geospatial APIs, including functions such as geocoding, point - of - interest search, route planning, isochrone analysis, and static map generation.
TypeScript
6.7K
4 points
U
Uniprof
Uniprof is a tool that simplifies CPU performance analysis. It supports multiple programming languages and runtimes, does not require code modification or additional dependencies, and can perform one-click performance profiling and hotspot analysis through Docker containers or the host mode.
TypeScript
7.2K
4.5 points
N
Notion Api MCP
Certified
A Python-based MCP Server that provides advanced to-do list management and content organization functions through the Notion API, enabling seamless integration between AI models and Notion.
Python
17.8K
4.5 points
M
Markdownify MCP
Markdownify is a multi-functional file conversion service that supports converting multiple formats such as PDFs, images, audio, and web page content into Markdown format.
TypeScript
30.9K
5 points
G
Gitlab MCP Server
Certified
The GitLab MCP server is a project based on the Model Context Protocol that provides a comprehensive toolset for interacting with GitLab accounts, including code review, merge request management, CI/CD configuration, and other functions.
TypeScript
21.6K
4.3 points
D
Duckduckgo MCP Server
Certified
The DuckDuckGo Search MCP Server provides web search and content scraping services for LLMs such as Claude.
Python
61.5K
4.3 points
F
Figma Context MCP
Framelink Figma MCP Server is a server that provides access to Figma design data for AI programming tools (such as Cursor). By simplifying the Figma API response, it helps AI more accurately achieve one - click conversion from design to code.
TypeScript
57.1K
4.5 points
U
Unity
Certified
UnityMCP is a Unity editor plugin that implements the Model Context Protocol (MCP), providing seamless integration between Unity and AI assistants, including real - time state monitoring, remote command execution, and log functions.
C#
27.8K
5 points
G
Gmail MCP Server
A Gmail automatic authentication MCP server designed for Claude Desktop, supporting Gmail management through natural language interaction, including complete functions such as sending emails, label management, and batch operations.
TypeScript
18.8K
4.5 points
M
Minimax MCP Server
The MiniMax Model Context Protocol (MCP) is an official server that supports interaction with powerful text-to-speech, video/image generation APIs, and is suitable for various client tools such as Claude Desktop and Cursor.
Python
42.0K
4.8 points