babylonjs/editor/mcp
Claude Code and agent skill by babylonjs/editor
- community
- ext:[{"type":"plugin","description":"Custom plugin integration"}]
Checking that the SKILL.md file is still in the repository.
Reference for writing Babylon.js Editor automation scripts (agentdata/*.js exporting main(editor)) run via the MCP tools write_agent_script / run_agent_script. Use when a scene-building task is too complex or voluminous for the individual MCP tools (procedural geometry, scattering forests/cities, bulk programmatic edits) and you need to drive the editor's `editor` mediator and live Babylon scene directly.
Install
npx vskill@latest install babylonjs/editor/mcpSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as babylonjs/editor/mcp.
Babylon.js Editor — Automation Scripts API
Automation scripts let you run real code inside the editor to build content that would be tedious with one-tool-at-a-time calls (procedural geometry, scattering, bulk edits). Everything they create becomes real, hand-editable editor content — not runtime game code.
Prefer the dedicated MCP tools (create_primitive_mesh,create_material,create_instance,create_light, …) for ordinary building. Reach for an automation script only for the heavy, algorithmic parts.
How to run one
- (Optional)
list_agent_scriptsto see what already exists. write_agent_script({ name: "forest.js", content: "..." })— writes to the project-rootagentdata/folder.run_agent_script({ name: "forest.js" })— compiles and executes it. (Or passcontentinline to write-and-run in one call.)
The script is compiled with the editor's own pipeline and executed by calling its main(editor) export. It may be async. Return a short string summary — it's sent back to you (objects like meshes are not serialized).
Skeleton
Imports / module resolution
- Babylon:
import { ... } from "babylonjs"(also"babylonjs-gui","babylonjs-loaders","babylonjs-materials","babylonjs-post-process","babylonjs-procedural-textures","babylonjs-addons").@babylonjs/*imports are auto-rewritten. The editor injects its OWN Babylon instance, so your objects share the live scene. - Editor helpers:
import { UniqueNumber } from "babylonjs-editor"(the editor's public API). Resolves to the running editor at runtime.
⚠️ MANDATORY: set id and uniqueId on EVERY created entity
Every entity you create (mesh, instance, light, camera, transform node, material, …) must have both an id and a uniqueId, or the editor's inspector, selection and serialization will break:
This applies to instanced meshes too (mesh.createInstance(...)).
The editor mediator
editor is the editor's central object. Most useful members:
Scene & rendering
editor.layout.preview.scene→ the live Babylon.js `Scene`. Your main entry point: create/find meshes, materials, lights, cameras. Pass it to Babylon constructors /MeshBuilderso objects join the live scene.editor.layout.preview.engine→ the Babylon engine.editor.layout.preview.camera→ the editor camera.editor.layout.preview.clusteredLightContainer→ add non-shadow lights here for performance (.addLight(light)).editor.layout.preview.switchToCamera(camera)→ make a camera active (saves/restores its per-camera post-processes).
Scene graph (left panel) — call after adding/removing nodes so they appear
await editor.layout.graph.refresh()editor.layout.graph.setSelectedNode(node)editor.layout.graph.getSelectedNodes()
Inspector (right panel)
editor.layout.inspector.setEditedObject(object)editor.layout.inspector.forceUpdate()
Assets browser
editor.layout.assets.refresh()
Console (visible to the user in the editor; NOT returned to you)
editor.layout.console.log(msg)/.warn(msg)/.error(msg)
Layout / project
editor.layout.addLayoutTab(...),editor.layout.selectTab(id),editor.layout.removeLayoutTab(id)editor.path→ the editor application path.
For the full surface, the editor source under /editor/src/editor (preview, layout, graph, inspector, assets-browser) is the reference.
Conventions
- Units are centimeters. Imported glTF/glb are auto-scaled ×100.
- Add objects to
editor.layout.preview.scene. - Set
id+uniqueIdon everything you create (see above). - Prefer
sourceMesh.createInstance(name)for many copies (cheap) over cloning; setinstance.parent = sourceMesh.parent. - Non-shadow lights →
editor.layout.preview.clusteredLightContainer.addLight(light). - After building:
await editor.layout.graph.refresh()and select a representative node. - Don't clear the scene or delete the user's existing content unless asked.
Examples
Scatter a forest from an existing "Tree" mesh
A grid of voxel blocks from one source cube
Custom geometry from raw vertex data
Don't
- Don't use automation scripts as a substitute for authoring — they must produce real editor content, not procedural runtime code.
- Don't forget
id/uniqueIdon created entities. - Don't confuse these with behavior scripts (
create_script/attach_script, undersrc/, implementingIScriptonStart/onUpdate/onStop) which run in the FINAL GAME. Automation scripts run NOW, in the editor, to build the scene.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingmcp/editor-api-skill.md
Popularity
- Repository stars
- 1,112
- Repository forks
- 302
- 7-day trend score
- 35
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
pluginCustom plugin integration
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/babylonjs/editor/mcp)