SL

shiliyu1991-lang/cocos-mcp-2x

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

27 stars 10 forks Качество 70 Тренд 15MIT

MCP-мост для Cocos Creator 2.4.x — подключение MCP-клиента (Claude/Cursor) к редактору через пакетный сервер Python FastMCP. Порт Кокос-Mcp-3x.

Обзор

Расширение редактора, которое соединяет LLM (Claude Desktop / Cursor или любой MCP-клиент) с редактором, позволяя модели проверять и управлять вашим игровым проектом: читать / писать узлы, работать с активами и сценами, читать консоль и выполнять сценарии. Это 2.4.x порт cocos-mcp-3x (версия Creator 3.8.x): , отличающийся только 2.4 редактором API-интерфейсов. Плагин — сервер Python MCP в комплекте с ./server — и расширение имеет. Разработано и проверено против Cocos Creator 2.4.15; нацелено на всю линию 2.4.x (в том числе 2.4.9). Сторона Python - это WebSocket; расширение Cocos - это и набирает через кнопку Connect на панели. Каждый вызов инструмента отправляет конверт JSON в расширение (main.js), которое отправляет по имени команды: операции с активами используют Editor.assetdb; операции с узлом/сценографом пересылаются в сцена сцена.

Обзор (машинный перевод)

** Английский ** * 中

Расширение редактора, которое соединяет LLM (Claude Desktop / Cursor или любой MCP-клиент) Редактор Cocos Creator 2.4.x, позволяющий модели проверять и управлять вашим игровым проектом Узлы, работайте с активами и сценами, читайте консоль и выполняйте сценарии.

Это порт 2.4.x cocos-mcp-3x (версия Creator 3.8.x): Python MCP-сервер и WebSocket-протокол**, отличающиеся только 2,4 редактором API Звонки. Плагин self-contained — сервер Python MCP в комплекте с ./server — и Расширение не имеет зависимостей npm и не имеет шага сборки.

Разработано и проверено против Cocos Creator 2.4.15; нацелено на всю линию 2.4.x (включая 2.4.9).

Как это работает

Стороной Python является WebSocketserver; расширение Cocos - client и набирает С помощью кнопки Connect на панели. Каждый вызов инструмента отправляет конверт JSON в расширение ([T2]), которое отправляется по команде. имя: использование операций с активами Editor.assetdb; операции с узлом/сценографом пересылаются на Сценарий scene.js (который мутирует живой график через cc движок в сцене)

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

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 use Editor.assetdb; node/scene-graph operations are forwarded to the scene script scene.js (which mutates the live graph through the cc engine 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)
Открыть полный README на GitHub

Установка

This server does not publish a one-line install command.

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →