论坛社区 活跃维护

mcp-for-blender

ahujasid/mcp-for-blender

社区插件,可使用您选择的任何大型语言模型控制 Blender 3D

28953
Stars 标星
2664
Forks 分支
203
Watchers 关注
35
Open Issues
Python
主要语言
MIT
开源协议
1.1 MB
仓库大小
2 天前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:ahujasid/mcp-for-blender
git clone https://github.com/ahujasid/mcp-for-blender.git
git clone git@github.com:ahujasid/mcp-for-blender.git
README.md main

机器翻译正文由机器翻译自项目原始文档(英文),排版经程序统一处理,可能存在偏差,请以原项目仓库为准。

Blender 的

MCP

将 Blender 连接到任何 LLM

formerly blender-mcp — the PyPI package is now mcp-for-blender. Existing setups keep working; no config change is required. Read more

免责声明: 这是第三方集成,并非由 Blender 制作

基于提示的3D建模、场景创建和操作——由AI驱动。

Website · Full Tutorial · Discord · Sponsor · Buy me a coffee · Feedback


支持者

CodeRabbit Kevin Guanche Darias Guillermo Rauch

All supporters: Support this project


快速开始

注意: PyPI 包 blender-mcp 现在为 mcp-for-blender。现有设置仍然可用 — uvx blender-mcp 仍然运行服务器,无需更改配置。新安装应使用 mcp-for-blender
更改内容及原因

三步:安装 uv,将您的 MCP 客户端指向服务器,安装 Blender 插件。

1. 安装 uv

# macOS
brew install uv

# Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

警告: 在安装 uv 之前不要继续操作。请使用官方安装程序——不要使用 pip install uv

2. 将 MCP 服务器添加到您的客户端

Claude Desktop — 设置 → 开发者 → 编辑配置
{
    "mcpServers": {
        "blender": {
            "command": "uvx",
            "args": ["mcp-for-blender"]
        }
    }
}
克劳德代码
克劳德 MCP 添加 Blender UVX MCP-for-Blender
法典
法典 mcp 添加 blender -- uvx mcp-for-blender
光标 / VS 代码 / OpenCode / 反重力

查看 MCP 客户端设置 下面的每个客户端说明和一键安装按钮。

3. 安装 Blender 插件

uvx mcp-for-blender install-addon

然后在 Blender 中:编辑 → 首选项 → 插件 → 启用 界面:MCP for Blender

4. 连接

在 Blender 的 3D 视图中,按 N → 打开 MCP for Blender 标签 → 点击 启动 MCP 服务器。就是这样 — 可以让 Claude 构建一些东西。

注意: 只运行一个 MCP 服务器实例(要么是 Cursor,要么是 Claude Desktop),不能同时运行两个。


功能

双向通信 通过基于Socket的服务器将Claude AI连接到Blender
对象操作 在Blender中创建、修改和删除3D对象
材质控制 应用和修改材质及颜色
场景检查 获取当前Blender场景的详细信息
代码执行 从Claude在Blender中运行任意Python代码
资源与模型生成 使用Poly Haven资源、Sketchfab模型、Poly Pizza低多边形模型,以及通过Hyper3D Rodin和混元3D生成的AI 3D模型

组件

该系统由两个主要组件组成:

  1. Blender 插件addon.py )——一个在 Blender 中创建套接字服务器以接收和执行命令的 Blender 插件
  2. MCP 服务器src/blender_mcp/server.py )——一个实现模型上下文协议的 Python 服务器,并连接到 Blender 插件

安装

前提条件

  • Blender 3.0 或更高版本
  • Python 3.10 或更高版本
  • uv 包管理器
安装 uv,按平台

macOS

使用 brew 安装 uv

Windows

powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

Then add uv to the user path in Windows (you may need to restart Claude Desktop after):

$localBin = "$env:USERPROFILE\.local\bin"
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
[Environment]::SetEnvironmentVariable("Path", "$userPath;$localBin", "User")

Linux

curl -LsSf https://astral.sh/uv/install.sh | sh

It lands in ~/.local/bin — open a new shell so it's on your PATH.

Otherwise, installation instructions are on their website: Install uv

On every OS, use uv's official installer above — not pip install uv, which may not create the uvx command and can hide uv inside an environment your client can't see.

Warning: Do not proceed before installing uv.

Make your client find uvx

MCP clients started from a GUI (Claude Desktop, Cursor, VS Code from the Dock/Start menu) do not inherit your terminal's PATH, so a bare "command": "uvx" can fail with spawn uvx ENOENT even though uvx works in your terminal. If that happens:

  • Find uvx's full path — which uvx (macOS/Linux) or where uvx (Windows) — and use it as "command", e.g. /opt/homebrew/bin/uvx or C:\Users\<you>\.local\bin\uvx.exe.
  • On Windows you can instead wrap it: "command": "cmd", "args": ["/c", "uvx", "mcp-for-blender"].
  • After any PATH or config change, fully quit and relaunch the client (Windows: quit from the system tray, not just the window; macOS: Cmd+Q).

Pin the Python version

Avoid conda / pyenv / version conflicts.

uv chooses which Python runs the server. On machines with conda (auto-activated base), pyenv, or asdf — or with a newer CPython release that some dependencies do not have wheels for yet — uv can grab an interpreter that makes installation fail. Pin Python 3.11 and prefer uv-managed interpreters to avoid using whatever is on your PATH:

{
    "mcpServers": {
        "blender": {
            "command": "uvx",
            "args": ["--python", "3.11", "mcp-for-blender"],
            "env": { "UV_PYTHON_PREFERENCE": "only-managed" }
        }
    }
}

--python 3.11 still satisfies this package's requires-python >=3.10, and UV_PYTHON_PREFERENCE=only-managed keeps uv from selecting conda, pyenv, asdf, or system Python first. (The repo's .python-version is only a hint for contributors and does not affect uvx.)

If a previous failed attempt keeps replaying after a fix, clear the cache:

uv cache clean mcp-for-blender blender-mcp && uvx --refresh mcp-for-blender

Install without uv

On locked-down machines you can skip uvx entirely with pipx, then point your client at the installed command:

pipx install mcp-for-blender
pipx ensurepath          # then restart your shell / client

Use the resulting absolute path as "command" (find it with which mcp-for-blender / where mcp-for-blender) and omit args.

Run with Docker

You can run the MCP server in a container instead of installing it. Blender itself still runs on your machine — the container only hosts the MCP server, which connects out to the Blender addon.

Build the image from the repo root:

docker build -t mcp-for-blender .

Then point your MCP client at it (the -i flag is required — the server talks to the client over stdin/stdout):

{
    "mcpServers": {
        "blender": {
            "command": "docker",
            "args": ["run", "-i", "--rm", "mcp-for-blender"]
        }
    }
}

The image defaults to BLENDER_HOST=host.docker.internal, which reaches the host's Blender out of the box with Docker Desktop on macOS and Windows.

On Linux, host.docker.internal doesn't exist and the addon only listens on localhost, so use host networking instead:

{
    "mcpServers": {
        "blender": {
            "command": "docker",
            "args": ["run", "-i", "--rm", "--network=host", "-e", "BLENDER_HOST=localhost", "mcp-for-blender"]
        }
    }
}

To enable safe mode in the container, add "-e", "BLENDER_MCP_SAFE_MODE=1" to args.

Environment Variables

The following environment variables can be used to configure the Blender connection:

Variable Default Description
BLENDER_HOST localhost Host address for Blender socket server
BLENDER_PORT 9876 Port number for Blender socket server
BLENDER_MCP_SAFE_MODE off Set to 1 to validate scripts before they run in Blender (see below)

Example:

export BLENDER_HOST='host.docker.internal'
export BLENDER_PORT=9876

You can also pass the connection as CLI flags, which take precedence over the environment variables. This is handy for running several Blender instances side by side, since each MCP client entry can point at a different port with plain arguments instead of env vars:

uvx mcp-for-blender --port 9877

In an MCP client config that means a second entry differing only in args:

{
  "mcpServers": {
    "blender": { "command": "uvx", "args": ["mcp-for-blender"] },
    "blender-b": { "command": "uvx", "args": ["mcp-for-blender", "--port", "9877"] }
  }
}

Each instance needs its own port set in the Blender addon panel to match.

Note: the addon's socket server has no authentication or encryption, so
anyone who can reach that port can run Python inside Blender. Keep it on
localhost unless you are on a trusted network, and prefer an SSH tunnel over
pointing --host/BLENDER_HOST at a remote machine directly.

Safe mode

By default, the AI can run any Python code in Blender. Set BLENDER_MCP_SAFE_MODE=1 to check every script before it runs and block risky code — things like reading or writing files directly, running other programs, accessing the network, or installing code that keeps running after the script ends. Normal Blender work (modeling, materials, rendering, saving, import/export) still works. Blocked scripts are sent back to the AI with the reason, so it can try again with a corrected version.


MCP 客户端设置

Claude for Desktop

Watch the setup instruction video (assuming you have already installed uv)

Go to Claude → Settings → Developer → Edit Config → claude_desktop_config.json and include the following:

{
    "mcpServers": {
        "blender": {
            "command": "uvx",
            "args": [
                "mcp-for-blender"
            ]
        }
    }
}
Claude Code

Use the Claude Code CLI to add the MCP for Blender server:

claude mcp add blender uvx mcp-for-blender

Codex

The Codex CLI, desktop app, and IDE extension all share the same config file (~/.codex/config.toml), so setting the server up once covers all three.

Register the server with the Codex CLI:

codex mcp add blender -- uvx mcp-for-blender

Or add it by hand to ~/.codex/config.toml (or $CODEX_HOME/config.toml):

[mcp_servers.blender]
command = "uvx"
args = ["mcp-for-blender"]

Or in the Codex desktop app: Settings → MCP servers → Add server → name it blender, pick STDIO, enter uvx mcp-for-blender as the command, then Save and restart. If the app can't find uvx, use its full path instead — see Make your client find uvx.

Check it registered with codex mcp list — the blender server should show as enabled. The tools become available the next time you start Codex.

To set environment variables (e.g. a non-default Blender host/port), pass --env KEY=VALUE flags to codex mcp add, or add them in the config file:

[mcp_servers.blender]
command = "uvx"
args = ["mcp-for-blender"]
env = { BLENDER_HOST = "localhost", BLENDER_PORT = "9876" }

Cursor

macOS — go to Settings → MCP and paste the following:

  • To use as a global server, use the "add new global MCP server" button and paste
  • To use as a project-specific server, create .cursor/mcp.json in the root of the project and paste
{
    "mcpServers": {
        "blender": {
            "command": "uvx",
            "args": [
                "mcp-for-blender"
            ]
        }
    }
}

Windows — go to Settings → MCP → Add Server, add a new server with the following settings:

{
    "mcpServers": {
        "blender": {
            "command": "cmd",
            "args": [
                "/c",
                "uvx",
                "mcp-for-blender"
            ]
        }
    }
}

Cursor setup video

Note: Only run one instance of the MCP server (either on Cursor or Claude Desktop), not both.

Visual Studio Code

Prerequisites: Make sure you have Visual Studio Code installed before proceeding.

OpenCode

{
  "mcp": {
    "blender-mcp": {
      "type": "local",
      "command": ["uvx", "mcp-for-blender"],
      "enabled": true,
      "environment": {
        "BLENDER_HOST": "localhost",
        "BLENDER_PORT": "9876"
      }
    }
  }
}

Antigravity

{
  "mcpServers": {
    "blender-mcp": {
      "command": "uvx",
      "args": ["mcp-for-blender"],
      "env": {
        "BLENDER_HOST": "localhost",
        "BLENDER_PORT": "9876"
      }
    }
  }
}

安装 Blender 插件

1. Recommended — from a terminal, run:

uvx mcp-for-blender install-addon

This copies the addon into your Blender addons folder as blender_mcp.py. It prints where it wrote to, and keeps a .bak of any file it replaces.

Optional: uvx mcp-for-blender addon-paths lists detected Blender addons folders. Override the destination with BLENDERMCP_ADDONS_DIR=/path/to/scripts/addons.

2. Open Blender

3. Go to Edit → Preferences → Add-ons

4. Enable Interface: MCP for Blender (search "MCP for Blender"). If it doesn't appear yet, click Install… and select the copied blender_mcp.py / addon.py, or restart Blender.

5. Manual alternative — if the command above can't find your Blender install, or you prefer doing it by hand: download addon.py from this repo → in Blender, Edit → Preferences → Add-ons → Install… → select the downloaded addon.py → enable it.

Then open the MCP for Blender tab in Blender's sidebar (press N in the 3D viewport) and click Start MCP Server. See Starting the Connection below.

升级(现有用户)

For newcomers, go straight to Quickstart. For existing users, see below.

1. Update the addon file by running:

uvx mcp-for-blender install-addon
uvx mcp-for-blender addon-paths   # optional: list detected Blender addons folders

2. In Blender: Preferences → Add-ons → disable and re-enable Interface: MCP for Blender (or restart Blender), then click Start MCP Server again.

3. Delete the MCP server from Claude and add it back again if the server package itself needs a refresh.

Note: the MCP server never modifies your Blender addon files on its own. When it starts, it checks whether the installed addon is behind the bundled copy and logs how to update; install-addon is what actually writes, and it keeps a .bak of the file it replaces. Trajectory capture still works on older loaded addons via an execute_code fallback.


使用方法

Starting the Connection

  1. In Blender, go to the 3D View sidebar (press N if not visible)
  2. Find the MCP for Blender tab
  3. Turn on the checkboxes you'd like to use (see more under Capabilities below)
  4. Click Connect to Claude
  5. Make sure the MCP server is running in your terminal

Using with Claude

Once the config file has been set on Claude, and the addon is running on Blender, you will see a hammer icon with tools for MCP for Blender.

Capabilities

  • Get scene and object information
  • Create, delete and modify shapes
  • Apply or create materials for objects
  • Execute any Python code in Blender
  • Export the scene, the selection or named objects to GLB/FBX for other applications (export_scene)
  • Look up node schemas and the bpy API reference instead of guessing socket order or enum names
  • Download the right models, assets and HDRIs through Poly Haven
  • Search and download models from Sketchfab
  • Search and download low-poly models from Poly Pizza
  • AI generated 3D models through Hyper3D Rodin and Hunyuan3D

Hunyuan3D on Tencent Cloud (Official API mode)

Which Tencent Cloud service the addon must call depends on where your account lives:

Account Service the addon calls Region Sidebar toggle
Mainland (cloud.tencent.com) AI3D 3.0 (ai3d, version 2025-05-13) ap-guangzhou leave International (Pro) account off (default)
International (tencentcloud.com), Hunyuan-to-3D (Professional) hunyuan, version 2023-09-01, PBR enabled ap-singapore tick International (Pro) account

International credentials sent to the mainland endpoint fail with AuthFailure.SignatureFailure or ResourceUnavailable, so tick the toggle when your SecretId/SecretKey come from tencentcloud.com. The toggle sits under Tencent Hunyuan 3D → Official API in the sidebar.

Poly Pizza

Poly Pizza hosts roughly 10,600 free low-poly models, including the rescued Google Poly archive. It is the best source for stylised game assets: every model is a single self-contained .glb, and the geometry is far lighter than Sketchfab's.

  1. Get a free API key at poly.pizza/settings/api
  2. In the 3D View sidebar, tick Use assets from Poly Pizza
  3. Paste the key into the API Key field that appears (or store it permanently under Edit → Preferences → Add-ons → MCP for Blender)

Worked example:

"Search Poly Pizza for a low-poly chair under a CC0 licence and import one at 1 metre tall"

Claude calls search_polypizza_models(query="chair", licence="CC0"), which returns each match with its licence and triangle count, then download_polypizza_model(model_id="...", normalize_size=True, target_size=1.0).

You can also filter by category ("Animals", "Furniture & Decor", "Transport", "Nature", "Buildings", "People & Characters", "Food & Drink", "Weapons", "Clutter", "Objects", "Scenes & Levels", "Other") or ask for animated models only.

Attribution: about 69% of the Poly Pizza catalogue is CC-BY, which requires you to credit the creator wherever the model appears. On import, the ready-formatted credit line is written onto each imported root object as the custom property polypizza_attribution (alongside polypizza_id and polypizza_licence), so it is saved into your .blend and survives the session. Filter with licence="CC0" if you would rather use models that need no credit.

Example Commands

Here are some examples of what you can ask Claude to do:

Prompt Demo
"Create a low poly scene in a dungeon, with a dragon guarding a pot of gold" Watch
"Create a beach vibe using HDRIs, textures, and models like rocks and vegetation from Poly Haven" Watch
Give a reference image, and create a Blender scene out of it Watch
"Get information about the current scene, and make a threejs sketch from it" Watch
"Generate a 3D model of a garden gnome through Hyper3D"
"Fill this room with low-poly furniture from Poly Pizza"
"Make this car red and metallic"
"Create a sphere and place it above the cube"
"Make the lighting like a studio"
"Point the camera at the scene, and make it isometric"

持久 API 凭证

MCP for Blender supports persistent credentials via Blender Add-on Preferences:

Edit → Preferences → Add-ons → MCP for Blender

You can store these values there so they survive Blender restarts:

  • Sketchfab API Key
  • Poly Pizza API Key
  • Hyper3D API Key
  • Hunyuan3D SecretId / SecretKey
  • Hunyuan3D API URL

For headless setups or CI, credentials can also be injected by environment variables:

Variable
BLENDERMCP_SKETCHFAB_API_KEY
BLENDERMCP_POLYPIZZA_API_KEY
BLENDERMCP_HYPER3D_API_KEY
BLENDERMCP_HUNYUAN3D_SECRET_ID
BLENDERMCP_HUNYUAN3D_SECRET_KEY
BLENDERMCP_HUNYUAN3D_API_URL

故障排除

Problem Fix
Connection issues Make sure the Blender addon server is running, and the MCP server is configured on Claude. Do not run the uvx command in the terminal. Sometimes the first command won't go through, but after that it starts working.
Timeout errors Try simplifying your requests or breaking them into smaller steps.
Poly Haven integration Claude is sometimes erratic with its behaviour.
Poly Pizza download fails with a Cloudflare challenge static.poly.pizza is behind bot protection and blocks datacenter, VPN and cloud IPs. Your API key is fine - the CDN never sees it. Retry from a normal connection, or download the .glb by hand and use File → Import → glTF 2.0.
Have you tried turning it off and on again? If you're still having connection errors, try restarting both Claude and the Blender server.

技术细节

Communication Protocol

The system uses a simple JSON-based protocol over TCP sockets:

  • Commands are sent as JSON objects with a type and optional params
  • Responses are JSON objects with a status and result or message

限制与安全考虑

Warning: The execute_blender_code tool allows running arbitrary Python code in Blender, which can be powerful but potentially dangerous. Use with caution in production environments. ALWAYS save your work before using it.

  • Poly Haven requires downloading models, textures, and HDRI images. If you do not want to use it, please turn it off in the checkbox in Blender.
  • Complex operations might need to be broken down into smaller steps.

遥测控制

MCP for Blender collects anonymous usage data to help improve the tool. Telemetry consent is on by default, and you can turn it off in two ways:

1. In Blender — go to Edit → Preferences → Add-ons → MCP for Blender and uncheck the telemetry consent checkbox.

  • With consent (checked, the default): view the TnC for more details on data collected.

2. Environment Variable — completely disable all telemetry by running:

DISABLE_TELEMETRY=true uvx mcp-for-blender

Or add it to your MCP config:

{
    "mcpServers": {
        "blender": {
            "command": "uvx",
            "args": ["mcp-for-blender"],
            "env": {
                "DISABLE_TELEMETRY": "true"
            }
        }
    }
}

Telemetry data is not linked to your name or account. It may be used to improve MCP for Blender, for research, and to train AI models.

Full detail on what is collected, and the license you grant by leaving telemetry on, is in TERMS_AND_CONDITIONS.md.


反馈

We are actively looking for feedback on MCP for Blender. If you have thoughts, share them here.

If you have more detailed feedback, you can schedule a call with us here — we will credit you in the project.

Join the Community

Give feedback, get inspired, and build on top of the MCP: Discord

贡献

Contributions are welcome! Please feel free to submit a Pull Request.

免责声明

This is a third-party integration and not made by Blender. Made by Siddharth.


星标历史

If MCP for Blender is useful to you, consider starring the repo

本站来源与版权声明
  • 本文标题:mcp-for-blender - 社区插件
  • 本文链接:https://cn121.com/forum/ahujasid-mcp-for-blender.html
  • 原项目:ahujasid/mcp-for-blender 版权归原作者 ahujasid 及贡献者所有
  • 收录信息:本站于 2026-09-19 收录本项目,本页所列协议与仓库指标均为收录当时的状态;该日期之后原项目的版本更新与协议变更,本页不作同步。
  • 开源协议:收录时本项目采用 MIT查看 LICENSE 原文),本站译文为其衍生内容;使用、修改、分发请以该仓库 LICENSE 原文为准。
  • 站点出处:本文首发于 OneTwoOne,收录自 GitHub 开源项目 ahujasid/mcp-for-blender。
  • 翻译说明:本页正文为人工智能生成内容——由机器翻译对原项目 README 初译、经程序校验排版,可能存在错漏,请以原项目文档为准。
  • 引用声明:商业转载、第三方聚合或 AI 检索训练引用时,请务必保留以上来源出处、本文永久链接,以及原项目的版权声明与许可信息
  • 下架通道:若原项目此后变更或收紧了许可协议、或作者/权利人认为本站的收录方式(译文、排版适配、简介翻译等)超出其授权范围,请通过 399595820@qq.com 发送下架通知,并附上项目地址与本页链接。本站核实后将第一时间删除本页内容,或改为不复制原文的目录性收录;署名更正等其他要求可一并提出。