BlenderLens
io.github.pzalutski-pixelv0.2.0更新于 Oct 10, 2026
MCP server that lets AI agents build, check, preview and export game assets in Blender
概览
让助手在 Blender 中构建、检查、预览并导出 3D 游戏资产,并核验导出的文件。
- 功能
- BlenderLens 直接驱动 Blender:创建和编辑网格、材质、修改器、UV、动画与碰撞代理,渲染预览 PNG,测量并按三角形预算和项目规则检查资产,导出 glTF、FBX、OBJ、STL、PLY 或 USD 文件并从磁盘读回,按 Godot 或 three.js 的目标给出警告。它还提供在 Blender 内执行 Python 的能力,每次改动场景的调用对应一个撤销步骤。命令行检查模式可在 CI 中不借助助手运行同样的检查。
- 适用场景
- 当助手需要真正产出或校验 3D 游戏资产,而不是只盲写 Blender 脚本时使用,例如制作道具、检查三角形预算与原点位置,或确认导出的 .glb 是否符合目标引擎的预期。
- 运行要求
- 本地进程,通过 npx 或 uvx 运行,需要 Python 3.10+ 或 Node.js 18+,以及 Blender 4.2 LTS 或更高版本,可通过 BLENDER_BIN、PATH 或常见安装目录找到。可选插件仅在需要在 Blender 窗口中观看工作时安装。无需 GPU,预览和烘焙使用 Cycles 在 CPU 上渲染。配置使用 BLENDERLENS_MODE、BLENDERLENS_HOST、BLENDERLENS_PORT、BLENDERLENS_ALLOWED_DIRS、BLENDERLENS_ALLOW_PYTHON 等变量。
安装
在 SourceWeft 中
- 打开 控制台中的 BlenderLens,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
BlenderLens: game assets built, checked and exported by Blender itself
[GitHub Release] [npm] [PyPI] [License: Apache 2.0]
An MCP server that lets an AI agent work in Blender itself: build and shape objects with Blender's own
operations, look at a rendered preview, check the asset against a triangle budget and your project's rules, and
export a .glb that is read back from disk and judged for Godot or three.js.
A short animated scene that an AI agent made in Blender through BlenderLens, shown at double speed.
Why
An agent that models through Blender Python is working blind. It cannot see what it built, cannot tell whether the exported file holds what it meant, and learns about a part that did not export, or an import hint it never intended, only when the game shows it.
BlenderLens never judges an asset from what the agent intended. It asks Blender, and the written file. Measured on
Blender 5.0.1, on a scene with a 0.5 m crate, a lid named Lid_col parented to it, and a metaball:
That principle, ask Blender and the file, never assume, runs through every tool. The building tools return what
Blender now holds. render_preview renders the scene with Blender. check_asset reads the mesh as the exporter
will write it. export_glb reads back the file it wrote.
Requirements
Blender 4.2 is the floor because it is the oldest LTS release with the extension system the add-on installs through. An older Blender is refused with a clear message. No GPU is needed: previews and bakes render with Cycles on the CPU.
Install
npx (recommended). The package bundles the server, and needs Python 3.10 or later on PATH.
pip
In Claude Code this goes in a project's .mcp.json. That is all a headless pipeline needs: the first call that
needs Blender starts blender --background, and the server keeps it until the server exits.
Watching it work in Blender
To have the agent work in a Blender window you watch, and can undo, install the add-on:
Then, in the 3D viewport, press N, open the BlenderLens tab and press Start. The add-on listens on this machine only, and serves only a server that holds its token, which it writes to a file the server reads.
The loop
The tools are designed around one cycle. Read it once and the rest of this document is a reference.
- Build.
create_objectmakes a part with its size built into the mesh,edit_meshshapes it,set_materialcolours it, andjoin_objectsandset_parentassemble parts. An existing build script runs as it is withrun_script. - Look.
render_previewrenders the part, or a sheet of several angles, as a PNG to look at.get_objectgives exact sizes and counts. - Check.
check_assetfinds broken geometry, unapplied scale, a misplaced origin, UV and texture problems, parts passing through each other, and anything over budget or against your rules, each with the faces concerned.measure_objectssays what touches what. - Deliver.
export_glbwrites the file for your target engine, reads it back and warns.save_filekeeps the.blend.
Three conventions apply throughout:
- Units are metres, rotations degrees, and Z is up. A model's front faces -Y;
export_glbconverts to glTF's Y-up, where the front faces +Z. - Face indices are what
get_meshlists, and change after any edit that adds or removes faces.edit_meshreturns the faces it made. - A refusal changes nothing. It is a structured error with
error,exit,kindandhint. The kinds, with their exit codes:blender_error1,not_found2,bad_argument3,python_error4,unsaved_changes5,blender_missing6,not_connected7,connection_lost8,start_failed9,version_mismatch10,token_mismatch11,busy12,not_allowed13,internal_error70,deadline124.
Tools
Session
Inspecting
Building
Arranging
Checking
Seeing
Files
Python and undo
Checking in CI
blenderlens-mcp check runs the same checks from the command line, with no agent. It exits 0 when the asset
passes, 1 when it fails, and 2 when it could not be checked; --json prints the full result. A .glb is read on
its own, with no Blender; a .blend is opened in a background Blender.
A project's rules are a JSON object. Each key is optional:
A name may also be a pattern, "re:<regular expression>". examples/rules.json
is a complete rule set, and examples/build_lantern.py
builds, checks and exports a prop through the server from start to finish.
What Blender cannot tell you
Worth knowing before you trust a result:
- Python is unrestricted.
run_pythonandrun_scriptcan do anything Python can inside Blender, including quitting it. SetBLENDERLENS_ALLOW_PYTHON=0, or turn off Allow Python from the agent in the add-on, where that matters. - Blender's glTF exporter writes a metaball as an empty node.
check_assetreports metaballs as errors, andexport_glbwarns about them. dropfinds supports at vertices. When the only contact would be edge against edge, such as one bar lying across another, that support is missed and the object drops past it.- A Principled BSDF inside a node group is invisible to BlenderLens, so it will not change that material's values.
- In a Blender window, a preview marks the file as changed, because Blender does so whenever the render engine is set, even back to the same one.
- Godot 4.7.0 to 4.7.2 ignore vertex colours on a mesh's first primitive.
export_glbwarns about affected meshes when the target isgodot.
Architecture
Two ways to reach Blender, one set of commands.
BLENDERLENS_MODE chooses: auto uses the window when its add-on is started, and a background Blender otherwise.
Both run the same command code, on Blender's main thread, where bpy may be used; mesh work goes through bmesh,
so it behaves the same with or without a window. Each call that changes the scene is one undo step.
The MCP protocol and the link to Blender are implemented on the standard library, so the package has no runtime dependencies. docs/architecture.md maps the modules, and docs/decisions/ records why each part is built as it is.
Configuration
License
Apache License 2.0 — see LICENSE and NOTICE. BlenderLens is not affiliated with or endorsed by the Blender Foundation.
来源:README.md,提交 e0558f0
工具
0版本历史
1- v0.2.0最新Oct 10, 2026


