← 返回
未分类 中文

Blender MCP Skill

Connect to and control Blender via the official Blender MCP Server. Covers 20+ built-in tools plus arbitrary bpy code execution. Compatible with Blender 5.1...
通过官方 Blender MCP Server 连接并控制 Blender,支持 20+ 内置工具以及任意 bpy 代码执行,兼容 Blender 5.1...
taosiuman taosiuman 来源
未分类 clawhub v2.0.0 2 版本 100000 Key: 无需
★ 0
Stars
📥 417
下载
💾 0
安装
2
版本
#latest

概述

Blender MCP Server Connection Skill

Connect to and control a running Blender instance via the official Blender MCP Server.

Version support: Blender 5.1+ and 5.2 LTS Beta (API compatibility notes included below)


Architecture Overview

┌─────────────┐     TCP Socket      ┌──────────────────     MCP Protocol     ┌──────────────
│  LLM Client │ ◄─────────────────► │  MCP Server      │ ◄──────────────────► │   Blender    │
│  (OpenClaw) │    stdio / HTTP     │  (Python process) │    port 9876         │   (Addon)    │
└─────────────┘                     └──────────────────┘                      └──────────────

Two-component architecture:

  1. Blender Addon — runs inside Blender, provides a TCP Socket Server (default localhost:9876)
  2. MCP Server — standalone Python process that bridges the LLM client and the Blender Addon

Installation

1. Install the Blender Addon

Option A: From ZIP

  1. Download addon ZIP: https://projects.blender.org/lab/blender_mcp/releases/download/v1.0.0/mcp-1.0.0.zip
  2. Blender → Edit → Preferences → Add-ons → Install from Disk
  3. Enable the "Blender MCP" addon
  4. Confirm Host/Port in addon settings (default localhost:9876)

Option B: Drag & Drop

  • Drag the ZIP file into the Blender window (twice: first to add the Blender Lab repository, second to install the addon)

Option C: From Source

  • Source code locations: mcp/blmcp/ and addon/blender_mcp_addon/

2. Start the Blender MCP Server

# Install dependencies
cd path/to/blender_mcp
pip install mcp pyyaml starlette

# Start MCP Server (stdio mode)
python -m blmcp --transport stdio

# Or HTTP mode (default 127.0.0.1:8000)
python -m blmcp --transport http --host 127.0.0.1 --port 8000

3. Configure mcporter

# Add Blender MCP Server config
mcporter config add blender-mcp --transport stdio --command "python -m blmcp --transport stdio"

# Or use HTTP mode
mcporter config add blender-mcp --transport http --url "http://127.0.0.1:8000"

# Verify connection
mcporter list blender-mcp --schema

Usage

Method 1: Via mcporter (recommended)

# List all available tools
mcporter list blender-mcp --schema

# Call a specific tool
mcporter call blender-mcp.execute_blender_code code='import bpy; result = {"objects": [o.name for o in bpy.data.objects]}'

mcporter call blender-mcp.get_objects_summary
mcporter call blender-mcp.get_object_detail_summary object_name="Cube"

# Search API docs
mcporter call blender-mcp.search_api_docs query="bpy.ops.object.delete"

# Search user manual
mcporter call blender-mcp.search_manual_docs query="Geometry Nodes"

# Screenshot
mcporter call blender-mcp.get_screenshot_of_window_as_image

# Render viewport
mcporter call blender-mcp.render_viewport_to_path output_path="C:\\render.png"

Method 2: Direct TCP Socket to Blender Addon (lightweight)

⚠️ Warning: This mode sends caller-supplied code directly to Blender with no guardrails. Review code before execution.

import socket
import json

def send_to_blender(code: str, host="localhost", port=9876, timeout=30.0) -> dict:
    """Send Python code directly to Blender Addon for execution."""
    request = json.dumps({
        "type": "execute",
        "code": code,
        "strict_json": False,
    }) + "\0"

    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
        sock.settimeout(timeout)
        sock.connect((host, port))
        sock.sendall(request.encode("utf-8"))

        buf = bytearray()
        while True:
            chunk = sock.recv(65536)
            if not chunk:
                break
            buf.extend(chunk)
            if b"\0" in buf:
                break

    line, _, _ = buf.partition(b"\0")
    return json.loads(line.decode("utf-8"))

# Example: get all object names in the scene
response = send_to_blender(
    'import bpy\nresult = {"objects": [o.name for o in bpy.data.objects]}'
)
print(response)
# {"status": "ok", "result": {"objects": ["Cube", "Camera", "Light"]}}

Method 3: Blender Background Mode (headless rendering / batch)

# Start Blender background MCP Server
blender --background myscene.blend --command blender_mcp --host localhost --port 9876

# Or execute code via CLI
blender --background myscene.blend --python-expr "
import bpy
# your code
result = {'count': len(bpy.data.objects)}
print('__BLMCP_RESULT__' + str(result))
"

Built-in Tools (20 total)

Core

ToolDescriptionParams
---------------------------
execute_blender_codeExecute arbitrary Python code (full bpy access)code: str
execute_blender_code_for_cliExecute code in a background Blender processblend_file: str, code: str

Scene Analysis

ToolDescriptionParams
---------------------------
get_objects_summaryGet scene object hierarchy and basic infonone
get_object_detail_summaryGet detailed info for a specific objectobject_name: str
get_blendfile_summary_datablocksAnalyze .blend file data-blocksblend_file: str
get_blendfile_summary_missing_filesCheck for missing external file referencesblend_file: str
get_blendfile_summary_of_linked_librariesList linked external librariesblend_file: str
get_blendfile_summary_path_infoAnalyze .blend file path informationblend_file: str
get_blendfile_summary_usage_guessGuess the purpose of a .blend fileblend_file: str

Screenshots & Rendering

ToolDescriptionParams
---------------------------
get_screenshot_of_window_as_imageCapture Blender window screenshotnone
get_screenshot_of_area_as_imageCapture specific area screenshotarea_type: str
get_screenshot_of_window_as_jsonGet window layout as JSON descriptionnone
render_viewport_to_pathRender viewport to fileoutput_path: str
render_thumbnail_to_pathRender thumbnail to fileoutput_path: str

Navigation

ToolDescriptionParams
---------------------------
jump_to_tab_by_nameJump to a named editor tabtab_name: str
jump_to_tab_by_space_typeJump to a space typespace_type: str
jump_to_view3d_object_by_nameFocus on an object in 3D Viewobject_name: str
jump_to_view3d_object_data_by_nameFocus on object data in 3D Viewdata_name: str

Documentation Search

ToolDescriptionParams
---------------------------
search_api_docsSearch Blender Python API docsquery: str
search_manual_docsSearch Blender user manualquery: str
get_python_api_docsGet Python API docsquery: str

Communication Protocol

TCP Socket Protocol

Request format (null-byte delimited JSON):

{"type": "execute", "code": "import bpy\nresult = {'key': 'value'}", "strict_json": false}\0

Response format:

// Success
{"status": "ok", "result": {"key": "value"}, "stdout": "", "stderr": ""}\0

// Error
{"status": "error", "message": "Traceback...", "stdout": "", "stderr": ""}\0

Code Execution Conventions

  • Assign return value to the result variable (must be a dict)
  • strict_json=True: strict JSON serialization; non-serializable values will error
  • strict_json=False: uses repr() as fallback for non-JSON values
  • Supports deferred responses: return a check_is_finished callable for long-running tasks

Example: Get Object Info

import bpy
obj = bpy.data.objects.get("Cube")
if obj:
    result = {
        "name": obj.name,
        "type": obj.type,
        "location": list(obj.location),
        "vertices": len(obj.data.vertices) if obj.type == "MESH" else 0,
    }
else:
    result = {"error": "Object not found"}

Example: Create an Object

import bpy
bpy.ops.mesh.primitive_torus_add(
    align='WORLD',
    location=(0, 0, 0),
    major_radius=1.0,
    minor_radius=0.3,
)
result = {"status": "created", "name": bpy.context.active_object.name}

Environment Variables

VariableDefaultDescription
--------------------------------
BLENDER_MCP_HOSTlocalhostBlender Addon host address
BLENDER_MCP_PORT9876Blender Addon port
BLENDER_PATHblenderPath to Blender executable

Security Notes

⚠️ Official security warning: The MCP Server executes LLM-generated code with no sandboxing.

Built-in weak sandbox (WeakSandboxForLLM):

  • Blocks sys.exit() calls
  • Blocks dangerous operators: wm.quit_blender, wm.read_factory_settings, wm.read_factory_userpref, wm.read_userpref

Security Best Practices

  1. Keep server local only — Always use localhost / 127.0.0.1; never bind to 0.0.0.0
  2. Review code before execution — Prefer scoped built-in tools over raw execute_blender_code
  3. Protect your projects — Keep backups of important .blend files
  4. Verify external dependencies — Download addon only from official Blender Lab sources

Troubleshooting

ErrorCauseSolution
------------------------
ConnectionRefusedErrorBlender not running or Addon not startedStart Blender, enable MCP Addon, click "Start Server"
ConnectionError: Empty responseNetwork timeout or Addon crashedCheck Blender console output, verify port
result is not JSON-serializableReturned a Blender objectUse strict_json=False or manually convert to dict
Blender executable not foundBlender command not foundSet BLENDER_PATH environment variable
Deferred responses not supportedBackground mode doesn't support deferred responsesUse synchronous code or switch to GUI mode

Blender 5.1 API Compatibility Notes

Action Layered Structure (Breaking Change)

In Blender 5.1, Action.fcurves was removed. The new layered animation system uses:

# ❌ Old (5.0 and earlier)
fcurves = action.fcurves

# ✅ Blender 5.1+
fcurves = action.layers[0].strips[0].channelbags[0].fcurves

Brush API: use_*stroke_method Enum

# ❌ Old (5.0)
brush.use_airbrush = True

# ✅ 5.1+
brush.stroke_method = 'AIRBRUSH'  # Options: AIRBRUSH, SPACE, ANCHORED, LINE, CURVE, DRAG_DOT

VSE Time Property Renames

Old (5.0)New (5.1)
----------------------
frame_final_durationduration
frame_final_startleft_handle
frame_final_endright_handle
frame_durationcontent_duration

Principled BSDF Input Renames

Old (5.0)New (5.1)
----------------------
inputs['Transmission']inputs['Transmission Weight']
inputs['Emission']inputs['Emission Color'] + inputs['Emission Strength']

Other 5.1 Changes

  • sculpt.sample_colorpaint.sample_color
  • bpy.app.cachedir — new standard cache directory
  • bpy.app.handlers.exit_pre — new exit handler
  • Python 3.13 runtime

Blender 5.2 LTS Compatibility Notes (Beta)

> Blender 5.2 LTS entered Beta on 2026-06-03. API is frozen; RC expected 2026-07-08, release 2026-07-14.

🔴 Breaking Changes (12 total — all Beta confirmed)

1. Geometry Nodes Modifier API Rewrite

# ❌ 5.1 and earlier
modifier["SocketName"] = 5.0
modifier["SocketName_use_attribute"] = True
modifier["SocketName_attribute_name"] = "some_input"

# ✅ 5.2+
modifier.properties.inputs.SocketName.value = 5.0
modifier.properties.inputs.SocketName.type = "ATTRIBUTE"
modifier.properties.inputs.SocketName.attribute_name = "some_input"
modifier.properties.outputs.SocketName.attribute_name = "some_output"

# ✅ Compatible pattern
import bpy
if bpy.app.version >= (5, 2, 0):
    val = modifier.properties.inputs.SocketName.value
else:
    val = modifier["SocketName"]

2. Principled BSDF Node Renamed

  • TransmissionTransmission Weight
  • Already applies from 5.1; ensure plugin references match

3. paint.eraser_brush API Removed

  • No longer needs manual setting; last eraser brush auto-activates

4. Automasking → MeshAutomaskingSettings (17 properties migrated)

# ❌ Old
brush.use_automasking_topology = True
brush.automasking_cavity_factor = 0.5

# ✅ 5.2+
brush.mesh_automasking_settings.use_automasking_topology = True
brush.mesh_automasking_settings.cavity_factor = 0.5

All 17 properties: use_automasking_topology, use_automasking_face_sets, use_automasking_boundary_edges, use_automasking_boundary_face_sets, use_automasking_cavity, use_automasking_cavity_inverted, use_automasking_start_normal, use_automasking_view_normal, automasking_boundary_edges_propagation_steps, automasking_cavity_factor, automasking_cavity_blur_steps, automasking_cavity_curve, automasking_cavity_curve_op, automasking_start_normal_limit, automasking_start_normal_falloff, automasking_view_normal_limit, automasking_view_normal_falloff

5. VSE strip.use_linear_modifiers Removed

6. VSE timecode files Feature Removed

7. UILayout.template_palette color Parameter Removed

8. Compare / Random Value Node Socket Identifiers Changed

9. Asset Library Index Shift — "All Libraries" and "Essentials" now occupy first two indices

10. Evaluated Meshes Naming Change — Geo Nodes created meshes no longer share object's original mesh name

11. Brush use_*stroke_method (see 5.1 section above)

12. VSE Time Property Renames (see 5.1 section above)


🟢 High-Value New APIs (5.2 LTS)

Python API

APIDescription
------------------
bpy.data.all_idsSingle iterator over ALL data-blocks
WindowManager.reportsRead-only reports list with session-wide unique uid
bpy.data.libraries.load() inputNow exposes nested library paths
Window.screenshot()Get window pixel data without saving to file
gpu.init()Initialize GPU backend in --background mode
mathutils slice stepvector[begin:end:step] for Vector/Matrix/Color/Euler
Blender Arrays slice stepimage.pixels[begin:end:step] — e.g., pixels[3::4] for alpha channel
path_foreach optionsEXPAND_TOKENS, EXPAND_SEQUENCES, EXPAND_CACHES
Annotations APIframe.strokes.new(), stroke.points.add(count, pressure, strength), stroke.points.remove(index), frame.strokes.remove(stroke)
UILayout.link / textboxStyled link buttons and multi-line text buttons
imbuf extendedPixel-level image access, format conversion, buffer protocol
Node panel collapseProgrammatically open/close node panels from Python
Node Tool input valuesSet Node Tool parameters programmatically in 5.2

Geometry Nodes

Node / FeatureDescription
-----------------------------
Physics (experimental)XPBD Solver, Cloth Dynamics modifier, Hair Dynamics, Effector system
Mesh BevelLong-awaited procedural bevel node
Geometry BundlesSet/Get Geometry Bundle — attach arbitrary data (fields, closures) to geometry
Lists data typeNew core type alongside single/field/grid — Length, Get, Filter, Sort
Sample Sound FrequenciesAudio-driven animation without keyframe baking
PCAPrincipal Component Analysis for auto-alignment
Transfer AttributesTransfer attributes between two geometries
3D ↔ Screen SpaceBundled transform nodes (3D to Screen, Screen to 3D, Project with Depth)
Collection ChildrenRecursive access to collection children as lists
Empty ObjectsGeo Nodes modifiers on Empty objects
Capture Attribute SelectionSelection input for efficiency
NURBS Order/WeightSet NURBS Order and Weight nodes
Scene Frame default inputFloat/int sockets default to current frame
Self-object defaultObject sockets can default to self-object
Merge by Distance splitNow: Merge Points + Cluster by Distance + Cluster by Connected

Cycles

FeatureDescription
----------------------
Texture Cache.tx files reduce memory 34-77% in texture-heavy scenes. Enable: Performance > Texture Cache + Auto Generate. CLI: blender scene.blend --command maketx
Raycast AttributesAccess attributes at intersection point (Cycles only)
SSS Negative AnisotropyPrincipled/Subsurface BSDF: -1 to 1 range
World Cast ShadowsWorld can now cast shadows
OSL GPUTexture cache improves OSL performance + adds GPU support
Simplify Texture ResolutionPercentage-based texture scaling (50%, 25%)

EEVEE

FeatureDescription
----------------------
Shader RaycastScreen-space raytracing node
Light Path IntensityGlobal indirect light intensity control
Texture pool -40%Vulkan: 406MB → 245MB

Grease Pencil

FeatureDescription
----------------------
Fill Tool DelaunayNew Delaunay solver: precise geometry, auto gap detection, scale-independent, faster
Draw Tool curvesBézier / Catmull-Rom / NURBS curve types
Line Materials placementCount / Density / Radius modes with randomization
layer.layer_masks APIAdd/remove layer masks via Python

Video Sequencer

FeatureDescription
----------------------
Compositor Effect StripUse compositor node trees for VSE transitions/effects (0/1/2 inputs + fader)
Compositor GPU accelerationIn VSE modifiers
strip.connectionsAPI to find connected strips

Sculpt

FeatureDescription
----------------------
Scene Project brushDisplace vertices toward other objects (like Shrinkwrap)
Add Primitive in Sculpt ModeCube/Cone/Cylinder directly in sculpt
Color Filter unified colorUses scene unified colors; Ctrl-X quick fill
Dyntopo confirmation removedNo more confirmation dialog when switching back to Sculpt
Voxel Remesher attribute interpolationSmooth vertex/corner attribute interpolation

Assets

FeatureDescription
----------------------
Online Asset LibraryBrowse and download from remote hosted libraries
Asset Library index shift"All Libraries" and "Essentials" now at indices 0 and 1

Other

FeatureDescription
----------------------
LoopTools built-inCircle/Space/Flatten now native — no addon needed
Hydra 2.0 APIOpenUSD provides abstraction layer
Animation +125%Action evaluation 32.8→74.1 fps (4 threads)
Gaussian Smooth F-CurveNon-destructive curve smoothing modifier

OpenClaw Integration

Configure openclaw.json

{
  "plugins": {
    "entries": {
      "mcp": {
        "servers": {
          "blender-mcp": {
            "command": "python",
            "args": ["-m", "blmcp", "--transport", "stdio"],
            "cwd": "path/to/blender_mcp",
            "env": {
              "BLENDER_MCP_HOST": "localhost",
              "BLENDER_MCP_PORT": "9876"
            }
          }
        }
      }
    }
  }
}

Via mcporter CLI

# List tools
mcporter call blender-mcp.get_objects_summary

# Execute code
mcporter call blender-mcp.execute_blender_code code='import bpy; result = {"count": len(bpy.data.objects)}'

Quick Start Checklist

  • [ ] Blender 5.1+ installed
  • [ ] MCP Addon installed and enabled
  • [ ] MCP Server started (python -m blmcp --transport stdio)
  • [ ] mcporter installed (npm install -g mcporter)
  • [ ] Port 9876 available (default)
  • [ ] BLENDER_PATH environment variable set (if needed)

版本历史

共 2 个版本

  • v2.0.0 当前
    2026-06-09 18:05
  • v1.0.2
    2026-05-07 23:00 安全 安全

安全检测

腾讯云安全 (Keen)

队列中

腾讯云安全 (Sanbu)

队列中

🔗 相关推荐

Kiri Engine

taosiuman
调用 KIRI Engine API,通过视频或图片集生成照片级、无特征或高斯泼溅3D模型,支持多种输出格式与参数配置。
★ 0 📥 83

Libtv Cli

taosiuman
LibTV 官方 CLI(libtv):在命令行完整操作 LibTV 画布、项目、节点、模型和素材。所有相关操作必须通过 libtv CLI完成,禁止自行构造 HTTP 请求或绕过网页端。本 skill 提供完整的 CLI 命令手册,涵盖常
★ 0 📥 89

Seedancer

taosiuman
Seedance 2.0(即梦)视频生成提示词工程:五维度分镜标准、多轮导演交互、全维度描述(光学/物理/情感/光影)。触发词:Seedance、即梦、视频提示词、AI视频、视频生成、提示词、Seedancer。默认中文输出。
★ 0 📥 135