FunplayAI/funplay-cocos-mcp

The Most Advanced MCP Server for Cocos Creator Editor with `execute_javascript`, prompts/resources, screenshots, asset dependency validation, tool profiles, one-click client configuration, and editor automation.

Funplay MCP for Cocos – AI‑enabled Cocos Creator Extension

What it is – An MIT‑licensed Cocos Creator editor extension that runs an embedded HTTP MCP (Machine‑Code‑Protocol) server inside the editor. The server lets AI coding assistants (Claude Code, Cursor, VS Code Copilot, etc.) call tools such as execute_javascript to inspect or modify a Cocos project in real time.


Core idea

  • The extension starts a local HTTP JSON‑RPC endpoint (default port 8765, or a project‑derived port in 20000‑29999).
  • AI clients connect to that endpoint and invoke MCP tools – pre‑defined actions that can run JavaScript in the scene or editor, read assets, capture screenshots, list scenes, etc.
  • The primary tool is execute_javascript, which can run arbitrary JavaScript in either the scene runtime or the editor UI context.
  • All other tools are built on top of that, providing a compact but powerful surface for AI agents to automate UI creation, asset inspection, debugging, and more.

Key features

Feature What it gives you
Embedded server No external daemon; the MCP server lives inside the Cocos Creator extension and starts/stops from the editor menu (Funplay > MCP Server).
One‑click client config The panel writes ready‑to‑use JSON‑RPC config snippets for popular AI assistants (Claude Code, Cursor, VS Code, Trae, Kiro, Qoder, Kimi Code, Codex, OpenCode).
Two execution contexts context: "scene" runs JavaScript in the active game scene; context: "editor" runs it in the editor/browser UI.
Tool profiles core (39 high‑signal tools), full (106 tools), or a custom profile where you enable/disable categories.
Safety checks By default blocks dangerous filesystem or shell calls; can be disabled per call if you accept the risk.
Screenshot & input simulation Capture editor, scene, or preview screenshots and send mouse/keyboard events back to the AI client.
Global install option Install once for all Cocos Creator projects; the extension auto‑updates from GitHub releases and verifies SHA‑256 checksums.
Debug helpers Simple GET /health and GET /tools endpoints for quick curl checks; recent‑activity log view inside the panel.
npm stdio wrapper Optional funplay-cocos-mcp command that bridges stdio‑based MCP clients to the embedded HTTP server.

Typical workflow

  1. Install – via the Cocos Store or by cloning the repo into your project's extensions/ folder (or use the Install for All Projects button).
  2. Start the server – Funplay > MCP Server → enable. The panel shows the exact URL and port.
  3. Configure an AI client – click One‑Click Configure for Claude Code, Cursor, etc.; the extension writes the correct JSON‑RPC entry to the client’s config file.
  4. Send a request – from the AI assistant, ask it to run execute_javascript (e.g., create a login UI, list assets, capture a screenshot). The assistant receives the JSON‑RPC response, can inspect the result, and iterate.
  5. Iterate – use the Recent Activity view to see each call, its console output, and any returned data.

Who should use it

  • Game developers who already work in Cocos Creator and want AI‑driven code generation, UI prototyping, or automated debugging.
  • AI‑assistant developers looking for a ready‑made MCP endpoint to test their tools against a real editor environment.
  • Tool‑builders who need a stable JSON‑RPC surface to script Cocos scenes without writing a custom plugin.

Maturity & status

  • Versioning – Follows GitHub releases; the extension can check for updates automatically.
  • Stability – Core functionality (execute_javascript, project info, asset inspection, screenshots) is marked stable. Advanced tool sets (full profile) are available but may evolve.
  • Platform – Editor‑only; does not add runtime code to the final game build.
  • Supported Cocos Creator – 3.8 + (tested on macOS, Linux, Windows).

License

MIT – free for commercial and non‑commercial use, with attribution.


Bottom line – Funplay MCP for Cocos gives you a plug‑and‑play bridge between modern AI coding assistants and the Cocos Creator editor, letting the AI manipulate scenes, assets, and editor state through a single, well‑documented HTTP JSON‑RPC server.

Related

  • Project
  • Project
  • Project
  • Project
  • Project