A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
feat(editor): MCP grows the doors live game-building demanded
yhh75d7f64bb8c1
diff --git a/desktop/scripts/editor-mcp-tools.mjs b/desktop/scripts/editor-mcp-tools.mjsindex 2b5aa71cb..f0e6571bd 100644--- a/desktop/scripts/editor-mcp-tools.mjs+++ b/desktop/scripts/editor-mcp-tools.mjs@@ -88,6 +88,14 @@ export const TOOLS = [type: { type: 'string' }, value: {},}, ['entity', 'component', 'key', 'type', 'value']),method: 'setField', args: (i) => [i.entity, i.component, i.key, i.type, i.value] },+ { name: 'add_component', write: true,+ description: 'Add a component to an entity by schema name (what the Details "Add Component" button does; see get_inspector for current components). Undoable.',+ schema: obj({ entity: { type: 'number' }, component: { type: 'string' } }, ['entity', 'component']),+ method: 'addComponent', args: (i) => [i.entity, i.component] },+ { name: 'remove_component', write: true,+ description: 'Remove a component from an entity by schema name. Undoable.',+ schema: obj({ entity: { type: 'number' }, component: { type: 'string' } }, ['entity', 'component']),+ method: 'removeComponent', args: (i) => [i.entity, i.component] },{ name: 'set_entity_xy', write: true,description: 'Move an entity to a world position (x, y) — converts to parent-local under the hood (undoable).',schema: obj({ id: { type: 'number' }, x: { type: 'number' }, y: { type: 'number' } }, ['id', 'x', 'y']),@@ -169,6 +177,10 @@ export const TOOLS = [schema: obj({ destDir: { type: 'string' }, sources: { type: 'object', description: 'array of absolute file paths' } },['destDir', 'sources']),js: (i) => `window.estella.project.importFiles(${JSON.stringify(i.destDir)}, ${JSON.stringify(i.sources)})` },+ { name: 'set_project_physics', write: true,+ description: 'Patch the project physics feature (Project Settings → Physics), e.g. { "enabled": true }. Persists to the manifest; Play and exports boot it.',+ schema: obj({ patch: { type: 'object' } }, ['patch']),+ method: 'setPhysics', args: (i) => [i.patch], root: 'editor' },{ name: 'list_entity_templates',description: "The Create-popover catalog: every ready-made entity the editor can spawn (id, label, category). Use an id with create_entity.",schema: obj({}), method: 'listEntityTemplates', args: () => [], root: 'editor' },@@ -193,6 +205,14 @@ export const TOOLS = [description: "A LIVE World component's data for a source entity, resolved by component name — verifies an edit actually reached the engine.",schema: obj({ id: { type: 'number' }, component: { type: 'string' } }, ['id', 'component']),method: 'worldComp', args: (i) => [i.id, i.component], root: 'editor' },+ { name: 'get_logs',+ description: "The editor Output Log's newest entries (editor + SDK + engine + play realm console) — check here when play looks wrong or a build fails.",+ schema: obj({ tail: { type: 'number' } }),+ method: 'logs', args: (i) => [i.tail], root: 'editor' },+ { name: 'reveal_panel',+ description: "Reveal a dock panel by id (viewport, log, sequencer, profiler, audiomixer...) — useful before a screenshot.",+ schema: obj({ id: { type: 'string' } }, ['id']),+ method: 'reveal', args: (i) => [i.id], root: 'editor' },{ name: 'run_editor_command', write: true,description: 'Dispatch any registered editor command by id (the UI\'s own channel) — the escape hatch for operations without a dedicated tool.',schema: obj({ id: { type: 'string' } }, ['id']),diff --git a/desktop/src/engine/EditorControlSurface.ts b/desktop/src/engine/EditorControlSurface.tsindex 9dbc4353f..f5a646601 100644--- a/desktop/src/engine/EditorControlSurface.ts+++ b/desktop/src/engine/EditorControlSurface.ts@@ -148,6 +148,14 @@ export class EditorControlSurfaceImpl {): void {this.s.commands.setField(entity, component, key, type, value);}+ /** Add a component (by schema name) to an entity — the Details "Add Component" door. */+ addComponent(entity: EntityId, component: string): void {+ this.s.commands.addComponent(entity, component);+ }+ /** Remove a component from an entity. */+ removeComponent(entity: EntityId, component: string): void {+ this.s.commands.removeComponent(entity, component);+ }setEntityXY(id: EntityId, x: number, y: number): void {this.s.commands.setEntityXY(id, x, y);}diff --git a/desktop/src/main.tsx b/desktop/src/main.tsxindex 8bd0cfd0e..7310f03b5 100644--- a/desktop/src/main.tsx+++ b/desktop/src/main.tsx@@ -122,6 +122,8 @@ if (new URLSearchParams(location.search).has('automation')) {runCommand: (id: string) => commands.run(id),/** Save the open scene to disk (the toolbar Save, awaitable). */save: () => ProjectStore.save(),+ /** Patch the project's physics feature (Project Settings → Physics). */+ setPhysics: (patch: Record<string, unknown>) => ProjectStore.setPhysics(patch),/** Create a blank scene FILE under `destDir` (Content Browser "New Scene"). */createSceneFile: (destDir: string) => ProjectStore.createSceneFile(destDir),/** The Create-popover catalog: every ready-made entity the editor can spawn. */@@ -141,6 +143,9 @@ if (new URLSearchParams(location.search).has('automation')) {ASSET_OPEN[assetTypeOf(name)]?.(path, name);},reveal: (id: string) => dockApi.revealAndExpand(id),+ /** The Output Log's captured entries (editor + SDK + wasm + play realm),+ * newest last — an agent's only eyes on runtime errors. */+ logs: (tail = 50) => LogStore.getSnapshot().slice(-tail),togglePerfOverlay: () => PerfMonitor.toggleOverlay(),captureThumbnail: () => ProjectStore.captureThumbnail(),surface: EditorControlSurface,