
shiliyu1991-lang/cocos-mcp-2x
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
Cocos Creator 2.4.x 用の MCP ブリッジ — MCP クライアント (Claude/Cursor) をバンドルされた Python FastMCP サーバー経由でエディタに接続します。 cocos-mcp-3xの港.
概要
LLM (Claude Desktop / Cursor または MCP クライアント) をエディタに接続し、モデルを検査し、ゲームプロジェクトをドライブできるようにします。ノードを読み込み/書き込み、アセットやシーンで操作し、コンソールを読み込み、スクリプトを実行します。 これは、cocos-mcp-3x の 2.4.x ポート (クリエイター 3.8.x バージョン): です。2.4 エディタ API では、エクステンションのサイドコールのみが異なります。 プラグインは、Python MCP サーバーが ./server でバンドルされ、拡張子は . Cocos Creator 2.4.15 から開発・検証、2.4.x ライン全体をターゲットに(2.4.9 を含む)。 - Python 側は WebSocket です。Cocos の拡張子は、パネルの [接続] ボタンを介してダイヤルします。 - 各ツールコールは、コマンド名でディスパッチする拡張子(main.js)にJSONエンベロープを送信します。アセット・オペレーションは、Editor.assetdbを使用します。node/scene-graph操作は、シーン・スクリプト・シーンに転送されます.
概要(AI 翻訳)
English** 日本語
LLM(Claude Desktop / CursorまたはMCPクライアント)を接続するエディタ拡張 Cocos Creator 2.4.xエディタで、モデルを検査してゲームプロジェクトを駆動させます。 ノードは、アセットやシーンで操作し、コンソールを読み込み、スクリプトを実行します。
これは [cocos-mcp-3xの2.4.xポートです(クリエイター3.8.xバージョン):同じです
Python MCP サーバーと WebSocket プロトコル は、2.4 エディタ API の拡張側のみで異なる
コール。 プラグインは自己完結 — Python MCP サーバは [./server] でバンドルされ、
拡張子にnpmの依存関係がなく、ビルドステップなしはありません。
Cocos Creator 2.4.15 から開発、検証、2.4.x ライン全体(2.2.4 を含む)をターゲットにします。
使い方
- Python 側は WebSocket server です。Cocos の拡張子は、client でダイヤルされ、 パネルのConnectボタンを使って。
- 各ツールコールはJSONエンベロープを拡張([
main.js])に送る。 名前: アセット操作は[Editor.assetdb]を使用します。 ノード/シーングラフ操作は、 シーンスクリプトscene.js([cc]])のシーンでライブグラフをミュートする
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
cocos-mcp-2x
English · 中文
An editor extension that connects an LLM (Claude Desktop / Cursor or any MCP client) to the Cocos Creator 2.4.x editor, letting the model inspect and drive your game project: read/write nodes, operate on assets and scenes, read the console, and execute scripts.
This is the 2.4.x port of cocos-mcp-3x (the Creator 3.8.x version): the same
Python MCP server and WebSocket protocol, differing only in the 2.4 editor APIs the extension side
calls. The plugin is self-contained — the Python MCP server is bundled at ./server — and the
extension has no npm dependencies and no build step.
Developed and verified against Cocos Creator 2.4.15; targets the whole 2.4.x line (incl. 2.4.9).
How it works
MCP client (Claude / Cursor)
│ stdio / http
▼
Python FastMCP server ── server/src/main.py
│ WebSocket bridge 127.0.0.1:6020/cocosmcp
▼
Cocos Creator extension ── main.js (connects in as the WS client)
│
├─ Editor.assetdb / Editor.Ipc assets, scene open/save
└─ Editor.Scene.callSceneScript ──► scene.js (scene process, holds the cc engine runtime)
- The Python side is the WebSocket server; the Cocos extension is the client and dials in via the Connect button on the panel.
- Each tool call sends a JSON envelope to the extension (
main.js), which dispatches by command name: asset operations useEditor.assetdb; node/scene-graph operations are forwarded to the scene scriptscene.js(which mutates the live graph through theccengine in the scene process), then replies{id, success, data|error}.
Differences from the 3.x version
| Concern | cocos-mcp-3x (3.8.x) | cocos-mcp-2x (2.4.x) |
|---|---|---|
| Asset API | Editor.Message.request('asset-db', …) (Promise) |
Editor.assetdb.* (callbacks) |
| Scene-graph ops | Editor.Message.request('scene', …) |
Editor.Scene.callSceneScript() → scene.js |
| Console capture | hook console.* |
hook the Editor.log/warn/error family |
| Extension entry | exports.methods (3.x) |
module.exports = { load, unload, messages } (2.4) |
| Scene files | .scene |
.fire |
Tools provided
| Tool | Purpose |
|---|---|
get_project_info |
Project path, assets root, editor version, scene list, available bridge commands |
manage_scene |
List / open / save / current scene (Cocos 2.x .fire) |
manage_node |
Inspect or modify nodes in the current scene (mostly by uuid) |
manage_asset |
Inspect and manipulate assets under assets/ via the asset-db |
read_console |
Read / clear the log buffer (500-entry ring) — includes both editor logs and the running game’s own logs from the browser preview |
execute_script |
Execute arbitrary JS in the editor main context (Editor.*) or scene context (cc) |
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →