blender-mcp
README.md
# Blender MCP
[](https://github.com/albertshkhyan/blender-mcp/actions/workflows/ci.yml)
A local bridge between an MCP client (Cursor, Claude, or anything that speaks the Model Context Protocol) and a Blender scene that is already open.
```
MCP client --stdio--> blender-mcp --TCP JSON lines--> Blender add-on
```
The add-on listens on `127.0.0.1:9876` and runs commands on Blender's main thread. The MCP server is a separate process. It does not run inside Blender, and it does not import `bpy`.
This is an initial scene bridge: inspect the scene, add primitives, move them, color them, delete them, or run a Python script. It does not ship asset libraries or a viewport app.
It is not the `blender-mcp` package on PyPI, which is a different project. Run this one from a checkout with `uv`, as below, not with `uvx blender-mcp`.
## Requirements
- Blender 4.2 or later. Checked with Blender 5.2.
- [uv](https://docs.astral.sh/uv/). It installs Python 3.12 for the server if you do not have it.
## Run it
1. Get the code.
```bash
git clone https://github.com/albertshkhyan/blender-mcp.git
cd blender-mcp
```
2. Build and install the add-on. Quit Blender first if it is already open.
```bash
blender --command extension build \
--source-dir addon/blender_mcp \
--output-filepath blender_mcp-0.1.0.zip
blender --command extension install-file -r user_default -e blender_mcp-0.1.0.zip
```
You can also use **Edit → Preferences → Extensions → Install from Disk** and choose that zip.
3. Open a scene. In the 3D Viewport press `N` and open the **MCP** tab. The server starts with Blender and listens on `127.0.0.1:9876`.
4. Connect an MCP client. Then ask it what is in the Blender scene.
Blender has to be open before a tool call. The MCP process itself can start earlier; it connects on the first call.
### Cursor
This repo includes [`.cursor/mcp.json`](.cursor/mcp.json). Open the folder in Cursor and start a new chat.
### Claude Code
From the repo folder:
```bash
claude mcp add blender -- uv --directory "$PWD" run blender-mcp
```
### Claude Desktop and other clients
Add this to the client's MCP config, with the absolute path to your checkout:
```json
{
"mcpServers": {
"blender": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/blender-mcp", "run", "blender-mcp"]
}
}
}
```
### Another port
If port `9876` is already taken (the other public Blender MCP add-on uses it too), change the port in the MCP tab and pass the same port to the server:
```json
"args": ["--directory", "/absolute/path/to/blender-mcp", "run", "blender-mcp", "--port", "9877"]
```
`BLENDER_HOST` and `BLENDER_PORT` do the same job as `--host` and `--port`.
## Tools
| Tool | What it does |
| --- | --- |
| `get_blender_status` | Check that Blender is reachable |
| `get_scene_info` | List the scene, frame, and objects |
| `get_object_info` | Transform, dimensions, materials, vertex count |
| `create_object` | Cube, sphere, cylinder, cone, or plane |
| `set_transform` | Replace location, rotation, or scale |
| `set_material` | Principled BSDF color, components from 0 to 1 |
| `delete_object` | Remove one object |
| `execute_python` | Run Python in Blender. Assign `result` to return a value |
Distances are meters. Rotation is Euler XYZ in radians. The tools see the current scene only: objects that live only in another scene of the file are not listed and cannot be edited by name. `get_scene_info` lists at most 200 objects and says when the list is truncated.
## Security
The socket has no authentication. The default bind address is loopback, so only programs on this computer can connect. `execute_python` runs with Blender's privileges and can change or delete the open file's data.
A web page can send an HTTP request to `127.0.0.1`. The add-on closes any connection whose line is not a JSON object, so the request line of an HTTP request ends it before its body is read.
**Allow Remote** lets the add-on listen on another address. Anyone who can reach that address can run Python inside Blender. Leave it off unless you are on a network you trust, and do not expose the port to the internet.
A command that times out is not rolled back if Blender had already started it.
## Project layout
```
addon/blender_mcp/ Blender extension (install this)
src/blender_mcp/ MCP server and TCP client
scripts/blender_smoke.py
tests/
```
The wire format is one UTF-8 JSON object per line:
```json
{"type": "get_scene_info", "params": {}}
{"status": "success", "result": {}}
```
## Development
The server needs Python 3.12. The add-on uses Blender's own Python.
```bash
uv sync
uv run pytest
blender --background --factory-startup --python-exit-code 1 --python scripts/blender_smoke.py
```
CI runs `pytest` and `uv build` on pushes to `main` and on pull requests. The Blender smoke test needs a local Blender, so run it before you change the add-on.
`uv run blender-mcp` speaks MCP on stdin and stdout. Logs go to stderr.
## License
[MIT](LICENSE)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues