cocos_mcp
Enables AI assistants to control Cocos Creator game development directly within the engine, providing tools for node manipulation, asset management, scene operations, and AI-powered image generation.
README
This repository will no longer supported due to movement to Code Mode approach. Please try it instead!
Cocos Creator MCP Server
A Cocos Creator extension that implements a Model Context Protocol (MCP) server with Streamable HTTP transport. This extension runs directly within Cocos Creator - no external tools, bridges, or setup required. Simply install the extension and start connecting AI assistants to your game development workflow.
Example of the game created fully with AI agent prompts only with this extension
Key Advantages
🚀 Zero-Setup Integration
- Runs In-Engine: MCP server operates directly within Cocos Creator extension
- Streamable HTTP Transport: Direct connection via
http://localhost:3000/mcp - No External Dependencies: No need for additional tools, bridges, or complicated setup
- Instant Access: One-click server start from the built-in control panel
🎯 Compact Yet Comprehensive Toolset
A carefully curated collection of 16 powerful tools designed for maximum AI efficiency:
🔍 Discovery & Inspection (5 tools)
query_nodes- Inspect scene hierarchy with granular detail controlquery_components- Discover component properties with types and tooltipsget_available_asset_types- Enumerate all available asset typesget_available_component_types- Enumerate all available component typesget_assets_by_type- Query assets by specific type
🏗️ Creation & Modification (4 tools)
create_nodes- Bulk node creation with components and transformsmodify_nodes- Batch property updates, hierarchy changes, component managementmodify_components- Precise component configuration with UUID targetinggenerate_image_asset- ⚡ Advanced AI-powered asset creation
📦 Asset & Project Management (5 tools)
operate_assets- Comprehensive asset operations (create, copy, move, delete, inspect)operate_current_scene- Scene lifecycle management (open, save, configure)operate_prefab_assets- Full prefab workflow (create, edit, close)node_linked_prefabs_operations- Prefab instance management (edit, unwrap, reset)operate_project_settings- Project configuration (layers, collisions, design resolution)
🔧 Advanced Operations (2 tools)
execute_scene_code- Direct TypeScript/JavaScript execution in scene contextoperate_scripts_and_text- Comprehensive file operations (read, write, search, replace)
🎨 Experimental AI Image Generation
Transform your asset creation workflow with advanced AI capabilities:
Multi-Modal Generation Modes:
- SVG/Emoji → Image: Convert vector graphics or emoji to game assets
- Text → Image: Generate assets from descriptive prompts
- SVG + Text → Image: Use SVG as template/init image for AI enhancement
Provider Ecosystem:
- AUTOMATIC1111: WebUI integration (tested)
- Stable Diffusion: Local or remote installations (untested)
- OpenAI DALL-E: Cloud-based generation (untested)
- Custom Providers: Extensible architecture for new services
Advanced Features:
- Dynamic Model Selection: Auto-populated from configured providers
- Background Removal: Automatic transparency for sprites/icons
- Asset Type Control: Generate as texture, sprite-frame, normal-map, etc.
- Reproducible Results: Seed-based generation for consistency
- Batch Operations: Efficient bulk asset creation
AI-Optimized Workflow:
- Template Enhancement: Use existing assets as generation templates
- Prompt Engineering: Negative prompts and guidance scale control
- Asset Integration: Generated content automatically imported with proper metadata
Quick Start
- Install & Enable: Install the extension in Cocos Creator and enable it in Extension Manager
- Start Server: Open
Panel -> cocos-mcp -> MCP Server Control Paneland click Start - Connect AI: Point your AI assistant to
http://localhost:3000/mcp - Start Creating: Use natural language to build games, generate assets, and iterate rapidly
AI Image Generation Setup
- Configure Providers: Use the extension's AI Image Generation config panel
- Add Models: Configure available models for each provider through the UI
- Test Connectivity: Verify provider setup with the built-in test function
- Generate Assets: Use the
generate_image_assetMCP tool
Quick Start with Local Stable Diffusion
- Open the AI Image Generation config panel in Cocos Creator
- Add a new Stable Diffusion provider pointing to
http://localhost:7860 - Configure your models through the UI
- Test the connection
Technical Implementation
- Transport: Streamable HTTP transport with Express.js server
- Protocol: JSON-RPC 2.0 compliance with proper error handling
- Session Management: Stateful connections with CORS support
- Type Safety: Full TypeScript implementation with Zod schemas for input validation
- Modular Architecture: Each resource, tool, and completion implemented in separate files
Architecture
The extension consists of several key components:
- Extension Panel (
source/panels/default/): Vue3-based UI for controlling the MCP server - MCP Server Manager (
source/mcp/server-manager.ts): Manages the HTTP server and MCP transport - Tools (
source/mcp/tools/): Provide actions for modifying the project
Development Environment
- Node.js
- TypeScript
- Vue 3.x
- Express.js for HTTP server
- MCP TypeScript SDK
Installation
# Install dependencies
npm install
# Build the extension
npm run build
Development
Adding New Tools
- Create new file in
source/mcp/tools/ - Implement using
server.registerTool()with Zod schema - Export registration function
- Add import and call in
server-manager.ts
Dependencies
@modelcontextprotocol/sdk- MCP TypeScript SDKexpress- HTTP server frameworkzod- Schema validationvue- UI framework for the panel
License
This project is licensed under the MIT License.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.