<strong>An Embedded MCP Server for Cocos Creator Editor</strong>
<a href="#"><img src="https://img.shields.io/badge/Cocos%20Creator-3.8%2B-blue" alt="Cocos Creator 3.8+"></a>
<a href="#"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"></a>
<a href="#"><img src="https://img.shields.io/badge/MCP-Compatible-green" alt="MCP Compatible"></a>
<a href="#"><img src="https://img.shields.io/badge/Platform-Editor%20Only-orange" alt="Editor Only"></a>
<a href="https://store.cocos.com/app/detail/8913"><img src="https://img.shields.io/badge/Cocos%20Store-Install-brightgreen" alt="Install from Cocos Store"></a>
<a href="https://github.com/FunplayAI/funplay-cocos-mcp/raw/v0.4.1/README_CN.md">中文</a> | English
If this project helps your Cocos workflow, please consider giving it a Star. It helps more developers discover the project and supports ongoing development.
Funplay MCP for Cocos is an MIT-licensed Cocos Creator extension that embeds an HTTP MCP server directly inside the editor. It lets AI assistants such as Claude Code, Cursor, Codex, VS Code Copilot, Trae, and Kiro inspect and operate your running Cocos project.
The package follows the same product direction as Funplay MCP for Unity: keep the default tool surface focused, provide a one-click client configuration window, and make one high-flexibility execution tool the primary workflow.
For Cocos, the primary tool is execute_javascript:
context: "scene" runs JavaScript in the active Cocos scene/runtime contextcontext: "editor" runs JavaScript in the Cocos editor/browser context"Create a login page UI with account/password fields and a main login button."
Your AI assistant can call
execute_javascript, build the UI hierarchy under the active Canvas, attach Cocos components, inspect the result, and capture a screenshot for validation.
If you just want to connect quickly, do these three things:
Funplay > MCP ServerRecommended install: use the official Cocos Store page and install the extension into your target Cocos Creator project.
For local development or unreleased builds, clone or copy this repository into your Cocos project extension directory:
cd /path/to/your-cocos-project
mkdir -p extensions
git clone https://github.com/FunplayAI/funplay-cocos-mcp.git extensions/funplay-cocos-mcp
Then restart Cocos Creator or reload extensions from the editor.
For a non-git install, download Funplay.CocosMcp.v<version>.zip from the GitHub Releases page, unzip it, and move the extracted funplay-cocos-mcp folder into your project extensions/ directory.
You can also install it globally by copying the folder into your Cocos Creator user extensions directory.
Open the editor menu:
Funplay > MCP Server
The server runs on http://127.0.0.1:8765/ by default.
If the configured port is already occupied, the extension first checks whether the existing listener belongs to the same Cocos project. Same-project listeners are reused safely; unrelated listeners trigger automatic fallback to the next available local port.
The panel is intentionally small:
The separate Tool Exposure window uses grouped tool lists with per-tool toggles and category select/clear actions. The Activity window uses a single recent-call stream with OK / ERR / INT badges, matching the simpler Funplay Unity MCP information architecture instead of putting every maintenance workflow into the main server panel.
Use the built-in MCP Client Config section in the Funplay > MCP Server panel first.
Select your target client, click One-Click Configure, and the extension writes the recommended MCP config entry for you.
The MCP server name written to clients is:
funplay_cocos
If you prefer to edit config files manually, use the examples below as fallback references.
Claude Code / Claude Desktop
{
"mcpServers": {
"funplay_cocos": {
"type": "http",
"url": "http://127.0.0.1:8765/"
}
}
}
Cursor
{
"mcpServers": {
"funplay_cocos": {
"url": "http://127.0.0.1:8765/"
}
}
}
VS Code
{
"servers": {
"funplay_cocos": {
"type": "http",
"url": "http://127.0.0.1:8765/"
}
}
}
Trae
{
"mcpServers": {
"funplay_cocos": {
"url": "http://127.0.0.1:8765/"
}
}
}
Kiro
{
"mcpServers": {
"funplay_cocos": {
"type": "http",
"url": "http://127.0.0.1:8765/"
}
}
}
Codex
[mcp_servers.funplay_cocos]
url = "http://127.0.0.1:8765/"
If your MCP client prefers a local stdio command, install the npm wrapper after starting the Cocos editor server:
npm install -g funplay-cocos-mcp
Example MCP client entry:
{
"mcpServers": {
"funplay_cocos": {
"command": "funplay-cocos-mcp",
"env": {
"FUNPLAY_COCOS_MCP_URL": "http://127.0.0.1:8765/"
}
}
}
}
The wrapper bridges stdio MCP traffic to the embedded Cocos HTTP endpoint. You can also run it with npx funplay-cocos-mcp --url http://127.0.0.1:8765/.
Open your AI client and try a few safe requests first:
get_project_info and summarize the current Cocos project."cocos://project/context and tell me the editor status."execute_javascript with context: \"scene\" to return the active scene name."execute_javascript with context: \"editor\" to return the project path."If these work, the MCP server, resources, prompts, and primary execution tool are connected correctly.
For local transport debugging, the panel can copy these commands, or you can run them directly:
curl http://127.0.0.1:8765/health
curl http://127.0.0.1:8765/tools
Try a higher-level prompt in your AI client:
Create a login page UI in the current Cocos scene with account/password fields, a login button, and a guest-login button. Use
execute_javascriptfirst, inspect the hierarchy, then capture a screenshot.
http://127.0.0.1:8765/ by default.GET /health and GET /tools are read-only debug endpoints for quick local checks outside an MCP client.core profile exposes 37 high-signal tools. Switch to full for all 102 tools, or use custom to include/exclude tool categories and individual tools.SHA256SUMS.txt, backs up the current extension, replaces the package files, and reloads the extension when the Cocos package API supports it. If reload is unavailable, restart Cocos Creator after installation. Git worktree and symlink installs are intentionally left to manual git pull or package replacement.Accept, MCP-Protocol-Version, JSON-RPC notifications/responses, and optional Mcp-Session-Id sessions.outputSchema and annotations; structured tool results use a standard envelope with ok, tool, callId, summary, data, and follow-up refs.execute_javascript safety checks are enabled by default. They block obvious risky filesystem and shell patterns such as delete/truncate calls, raw writable streams, path traversal, user/system absolute paths, and child_process. This is a guardrail, not a full sandbox; a call can explicitly pass safety_checks: false when you have reviewed the risk.cocos://asset/path/... resources are restricted to the active Cocos project root.execute_javascript first, then focused helper tools for screenshots, diagnostics, assets, and inspection.execute_javascript First — One high-flexibility JavaScript tool can orchestrate scene/runtime work and editor-side automation without flooding AI clients with too many narrow tool callscore reduces tool-list noise; full exposes every available tool; custom plus saved profiles lets you tune and restore tool exposure by category or toolexecute_javascript supports both scene and editor contextsFunplay > MCP Server dashboard plus focused Tool Exposure, MCP Settings, and Activity windows for larger workflowsFunplay MCP for Cocos follows the same design principles as Funplay MCP for Unity, adapted to Cocos Creator's JavaScript/TypeScript editor environment.
| Area | Funplay MCP for Cocos | Funplay MCP for Unity |
|---|---|---|
| Editor integration | Cocos Creator extension | Unity Editor package |
| Embedded server | Built-in HTTP MCP server | Built-in HTTP MCP server |
| Primary execution tool | execute_javascript |
execute_code |
| Primary language | JavaScript in scene/editor contexts | C# in Unity editor/runtime contexts |
| Default profile | core with 37 tools |
core focused tool profile |
| Full profile | 102 tools plus custom exposure |
79 tools |
| Client setup | One-click config panel | One-click config window |
The current package exposes four capability layers:
core, 102 tools in full, plus custom include/exclude rules and saved tool profilesexecute_javascript for scene/runtime and editor/browser automationfix_script_errors, create_playable_prototype, scene_validation, and auto_wire_sceneFor the generated tool reference, including categories, profiles, and read/mutation hints, see docs/TOOLS.md.
The default core set is intentionally small: execute_javascript, execute_scene_script, execute_editor_script, get_editor_state, get_tool_catalog, check_for_updates, get_selection, list_project_instructions, read_project_instruction, set_selection, get_project_info, get_build_status, get_scene_info, get_hierarchy, list_scenes, open_scene, inspect_prefab, validate_prefab_references, inspect_prefab_instance, list_assets, inspect_asset, inspect_asset_dependencies, validate_asset_dependencies, open_asset, select_asset, run_script_diagnostics, get_recent_logs, search_project_logs, clear_logs, validate_scene, get_performance_snapshot, get_script_diagnostic_context, get_runtime_state, capture_editor_screenshot, capture_scene_screenshot, capture_preview_screenshot, and list_editor_windows.
| Resource | Description |
|---|---|
cocos://project/context |
Full project and editor context |
cocos://project/summary |
Short project summary |
cocos://scene/active |
Active scene snapshot |
cocos://scene/current |
Alias for t |
$ claude mcp add funplay-cocos-mcp \
-- python -m otcore.mcp_server <graph>