Funplay Cocos MCP — Claude Code MCP server for Cocos Creator
Embeds an MCP server inside the Cocos Creator editor so an AI assistant can inspect and drive the running project.
claude mcp add --env FUNPLAY_COCOS_MCP_URL=<FUNPLAY_COCOS_MCP_URL> --env FUNPLAY_COCOS_MCP_TIMEOUT_SECONDS=<FUNPLAY_COCOS_MCP_TIMEOUT_SECONDS> --transport stdio funplay-cocos-mcp -- npx -y funplay-cocos-mcpWhat Funplay Cocos MCP does
The extension installs into a Cocos Creator project and starts an HTTP MCP server inside the editor. From there the assistant calls execute_javascript: with context: "scene" the code runs in the active scene and runtime, with context: "editor" it runs in the editor context. That covers building a UI hierarchy under the active Canvas, attaching components, checking the result and capturing a screenshot.
Clients connect either by hand or through the built-in configuration window. The stdio bridge needs the server address: FUNPLAY_COCOS_MCP_URL holds the URL and FUNPLAY_COCOS_MCP_TIMEOUT_SECONDS the timeout. With no editor open and no project loaded there is nothing to bridge to, because the server lives inside Cocos Creator rather than in its own process.
New projects get a port in the 20000–29999 range, while saved configurations keep their fixed one. If another listener already holds the port, the extension falls back to the next free one, so pin the port with **Pin Current Port** before wiring up a client. You can also install the extension globally for every project on one Creator version; in that case remove the copy under extensions/, otherwise MCP Settings flags a duplicate install.
What it helps with
- build a UI hierarchy under the active Canvas from a prompt
- attach Cocos components to scene objects
- run JavaScript in the editor or runtime context
- capture a screenshot to validate the result
- connect an AI client to the editor with one command
Example prompts for the agent
- Create a login screen with account and password fields plus a submit button, then check the hierarchy under Canvas
- Run this script in the scene context and show me the screenshot
- Inspect the current scene and tell me which components sit on the root nodes
How to install Funplay Cocos MCP
Platform CLI
claude mcp add --env FUNPLAY_COCOS_MCP_URL=<FUNPLAY_COCOS_MCP_URL> --env FUNPLAY_COCOS_MCP_TIMEOUT_SECONDS=<FUNPLAY_COCOS_MCP_TIMEOUT_SECONDS> --transport stdio funplay-cocos-mcp -- npx -y funplay-cocos-mcpReplace <…> with your own values
Platform CLI
codex mcp add funplay-cocos-mcp --env FUNPLAY_COCOS_MCP_URL=<FUNPLAY_COCOS_MCP_URL> --env FUNPLAY_COCOS_MCP_TIMEOUT_SECONDS=<FUNPLAY_COCOS_MCP_TIMEOUT_SECONDS> -- npx -y funplay-cocos-mcpReplace <…> with your own values
Config file
{
"mcpServers": {
"funplay-cocos-mcp": {
"command": "npx",
"args": [
"-y",
"funplay-cocos-mcp"
],
"env": {
"FUNPLAY_COCOS_MCP_URL": "<FUNPLAY_COCOS_MCP_URL>",
"FUNPLAY_COCOS_MCP_TIMEOUT_SECONDS": "<FUNPLAY_COCOS_MCP_TIMEOUT_SECONDS>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"funplay-cocos-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"funplay-cocos-mcp"
],
"env": {
"FUNPLAY_COCOS_MCP_URL": "<FUNPLAY_COCOS_MCP_URL>",
"FUNPLAY_COCOS_MCP_TIMEOUT_SECONDS": "<FUNPLAY_COCOS_MCP_TIMEOUT_SECONDS>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e FUNPLAY_COCOS_MCP_URL=<FUNPLAY_COCOS_MCP_URL> -e FUNPLAY_COCOS_MCP_TIMEOUT_SECONDS=<FUNPLAY_COCOS_MCP_TIMEOUT_SECONDS> funplay-cocos-mcp npx -y funplay-cocos-mcpReplace <…> with your own values
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Funplay Cocos MCP
How do I install Funplay Cocos MCP in Claude?
Install the extension into your Cocos Creator project and start the server from Funplay > MCP Server first. Then run claude mcp add funplay-cocos-mcp -- npx -y funplay-cocos-mcp. To pass the URL and timeout, use `claude mcp add --env FUNPLAY_COCOS_MCP_URL=<FUNPLAY_COCOS_MCP_URL> --env FUNPLAY_COCOS_MCP_TIMEOUT_SECONDS=<FUNPLAY_COCOS_MCP_TIMEOUT_SECONDS> --transport stdio funplay-cocos-mcp -- npx -y funplay-cocos-mcp`.
What does Funplay Cocos MCP do?
It runs an MCP server inside the Cocos Creator editor and gives the assistant access to the live project. The main tool is execute_javascript, with scene and editor contexts.
Do I need Cocos Creator running?
Yes. The server is embedded in the editor instead of running as a separate process, so the client connects to the URL shown in Funplay > MCP Server.