cocos-mcp-server
v0.1.0MCP server for Cocos Creator 3.8 LTS (requires the cocos-mcp editor extension)
MCP server (stdio) for Cocos Creator 3.8 LTS. It lets MCP clients such as VS Code + GitHub Copilot (Agent mode) inspect and control a running Cocos Creator editor: scenes, nodes, components, assets, scripts, prefabs, animation, builds, preview and screenshots — 80 tools in total. 1. Download the cocos-mcp package (Cocos Store) or unzip artifacts/cocos-mcp-.zip into /extensions. 2. Open the project in Cocos Creator 3.8. 3. If the editor was already running: Extensions → Extension Manager → Reload on cocos-mcp. 4.
Summary extracted from the README.
@atomicmicrotech/cocos-mcp-server
MCP server (stdio) for Cocos Creator 3.8 LTS. It lets MCP clients such as VS Code + GitHub Copilot (Agent mode) inspect and control a running Cocos Creator editor: scenes, nodes, components, assets, scripts, prefabs, animation, builds, preview and screenshots — 80 tools in total.
The server is only half of the bridge. It talks over a local WebSocket to the
cocos-mcpeditor extension, which must be installed in your Cocos Creator project. Without the extension the server starts but every call fails withEDITOR_NOT_RUNNING/NO_RUNTIME_FILE.Get the extension from the Cocos Store, or build it from the repository: https://github.com/Atomicmicrotech/Cocos2d-MCP
Install the editor extension
- Download the
cocos-mcppackage (Cocos Store) or unzipartifacts/cocos-mcp-<version>.zipinto<COCOS_PROJECT>/extensions. - Open the project in Cocos Creator 3.8.
- If the editor was already running: Extensions → Extension Manager →
Reload on
cocos-mcp. - Healthy sign:
[cocos-mcp] bridge listening on ws://127.0.0.1:<port>in Developer → Console, and~/.cocos-mcp/runtime.jsonexists.
Reloading the extension (or restarting the editor) reloads the scene from disk — save your scene first (Ctrl/Cmd+S).
Register the server in VS Code
<COCOS_PROJECT>/.vscode/mcp.json:
{
"servers": {
"cocos": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@atomicmicrotech/cocos-mcp-server"]
}
}
}
Or globally: Command Palette → MCP: Open User Configuration and paste the same block. Then MCP: List Servers → cocos → Start.
The server finds the editor through ~/.cocos-mcp/runtime.json (port + token),
so VS Code does not need to have the Cocos project open.
Try it
In Copilot Chat (Agent mode):
Use the cocos editor_status tool, then summarize the current scene.
# from any terminal, with the editor running
npx -y @atomicmicrotech/cocos-mcp-server # starts on stdio
For debugging with the MCP Inspector:
npx @modelcontextprotocol/inspector npx -y @atomicmicrotech/cocos-mcp-server
Requirements
- Node.js >= 20
- Cocos Creator 3.8.x (verified on 3.8.8) with the
cocos-mcpextension installed and loaded
Security model
- The bridge binds to
127.0.0.1and authenticates the first frame with a token generated by the extension (runtime.json, mode0600). - Access modes:
read-onlyandsafe-write(default). Destructive operations inread-onlyare denied; insafe-writethey require a single-use confirmation token (TTL 2 min, bound to the exact payload). - File access is sandboxed to the Cocos project (
db://assets/only for writes, symlink-safe reads). - Every call is written to
~/.cocos-mcp/audit.log(JSONL).
Details: https://github.com/Atomicmicrotech/Cocos2d-MCP/blob/main/docs/security.md
Environment variables
| Variable | Default | Purpose |
|---|---|---|
COCOS_MCP_RUNTIME_FILE |
~/.cocos-mcp/runtime.json |
Override bridge discovery |
COCOS_MCP_RATE_LIMIT |
50 |
Max requests per second |
COCOS_MCP_NOTIFY_EVENTS |
enabled | Set 0 to disable editor event forwarding |
Troubleshooting
| Symptom | Cause |
|---|---|
NO_RUNTIME_FILE |
Extension not installed, not loaded, or editor not running |
EDITOR_NOT_RUNNING |
Editor closed after the server started — restart the server |
PERMISSION_DENIED |
Access mode is read-only |
CONFIRMATION_REQUIRED |
Destructive call needs confirmationToken (safe-write) |
License
MIT