Blender MCP Bridge
# šØ Blender MCP Bridge
[](https://www.python.org/downloads/)
[](https://modelcontextprotocol.io/)
[](https://www.blender.org/)
[](https://opensource.org/licenses/MIT)
> **AI-powered Blender control via Model Context Protocol (MCP)**
>
> Send images to create 3D models with matching colors, execute Python scripts, and control Blender remotely through Antigravity or any MCP-compatible AI client.
<p align="center">
<img src="https://raw.githubusercontent.com/MITHRAN-BALACHANDER/Blender-MCP-antigravity/main/island_render.png" alt="Low-Poly Island Demo" width="600"/>
</p>
---
## ⨠Features
| Feature | Description |
|---------|-------------|
| š¼ļø **Image to 3D** | Extract dominant colors from images and create 3D models with matching materials |
| š **Script Execution** | Run any Blender Python code remotely through MCP |
| š **Scene Query** | Get detailed information about objects, materials, and collections |
| ā” **Real-time Updates** | Receive live progress status during script execution |
| š **Thread-safe** | Robust architecture with guaranteed responses and no deadlocks |
---
## šļø Architecture
```
āāāāāāāāāāāāāāāāāāāāāāā MCP/stdio āāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Antigravity āāāāāāāāāāāāāāāāāāāāāāāāŗā antigravity_blender_ ā
ā (or any MCP AI) ā ā server.py ā
āāāāāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāā¬āāāāāāāāāāāāāā
ā
ā TCP Socket
ā (port 8081)
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāā
ā blender_server.py ā
ā (runs inside Blender) ā
āāāāāāāāāāāāāāāāāāāāāāāāāāā
```
---
## š¦ Installation
### Prerequisites
- **Python 3.10+**
- **Blender 4.2+** (with full path accessible)
- **pip** (Python package manager)
### Quick Install
```bash
# Clone the repository
git clone https://github.com/MITHRAN-BALACHANDER/Blender-MCP-antigravity.git
cd Blender-MCP-antigravity
# Create virtual environment (recommended)
python -m venv venv
.\venv\Scripts\activate # Windows
source venv/bin/activate # Linux/Mac
# Install dependencies
pip install -r requirements.txt
```
### Install as Package (Optional)
```bash
pip install -e .
```
---
## š Antigravity Integration
Add the following to your Antigravity MCP server configuration:
### Option A: Direct Path
```json
{
"mcpServers": {
"blender": {
"command": "python",
"args": ["C:/path/to/Blender-MCP-antigravity/antigravity_blender_server.py"],
"env": {}
}
}
}
```
### Option B: Using Virtual Environment
```json
{
"mcpServers": {
"blender": {
"command": "C:/path/to/Blender-MCP-antigravity/venv/Scripts/python.exe",
"args": ["C:/path/to/Blender-MCP-antigravity/antigravity_blender_server.py"],
"env": {}
}
}
}
```
> **Note:** Replace `C:/path/to/` with your actual installation path.
---
## š Quick Start
### Step 1: Start Blender Server
```bash
# Navigate to project directory
cd Blender-MCP-antigravity
# Start Blender with the socket server
# Windows (use full path if 'blender' is not in PATH)
"C:\Program Files\Blender Foundation\Blender 4.2\blender.exe" --background --python blender_server.py
# Linux/Mac
blender --background --python blender_server.py
```
Expected output:
```
==================================================
[BlenderMCP] Server running on 127.0.0.1:8081
[BlenderMCP] Waiting for connections...
==================================================
```
### Step 2: Connect Antigravity
Once Blender is running, Antigravity will automatically connect via the MCP configuration.
### Step 3: Create 3D Content
Ask Antigravity to create 3D content:
> "Create a low-poly island scene in Blender"
> "Create a 3D model from this image" (with attached image)
---
## š ļø MCP Tools Reference
### `image_to_3d_model`
Create a 3D model with colors extracted from an image.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `image_data` | string | ā
| - | Base64-encoded image |
| `model_type` | string | ā | `"cube"` | Shape: `cube`, `sphere`, `cylinder` |
| `model_name` | string | ā | `"ImageModel"` | Name for the object |
**Response:**
```json
{
"status": "ok",
"colors": ["#3A7D8C", "#D4C4A0", "#4A6E4A"],
"object_name": "ImageModel"
}
```
---
### `blender_exec`
Execute Python code inside Blender.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `script` | string | ā
| Python code to execute |
**Script Requirements:**
- ā
Define and call a `main()` function
- ā
Use `send_status("message")` for progress updates
- ā
Use `bpy.data.*` APIs (not `bpy.ops.*`)
- ā No infinite loops or blocking operations
**Example:**
```python
import bpy
def main():
send_status("Creating cube...")
mesh = bpy.data.meshes.new("Cube")
obj = bpy.data.objects.new("Cube", mesh)
bpy.context.collection.objects.link(obj)
import bmesh
bm = bmesh.new()
bmesh.ops.create_cube(bm, size=2.0)
bm.to_mesh(mesh)
bm.free()
send_status("Done!")
main()
```
---
### `get_blender_scene`
Query the current Blender scene.
**Response:**
```json
{
"objects": [
{"name": "Cube", "type": "MESH"},
{"name": "Camera", "type": "CAMERA"}
],
"meshes": ["Cube"],
"materials": ["Material"],
"collections": ["Collection"]
}
```
---
## š Project Structure
```
Blender-MCP-antigravity/
āāā antigravity_blender_server.py # MCP server (AI client interface)
āāā blender_server.py # TCP server (runs in Blender)
āāā antigravity_blender_addon.py # Blender UI addon (optional)
āāā run_via_bridge.py # Standalone script runner
āāā generate_island.py # Example: procedural island
āāā create_island_from_image.py # Example: island from reference
āāā requirements.txt # Dependencies
āāā pyproject.toml # Package config
āāā README.md
```
---
## š§ Troubleshooting
### Connection Refused
```bash
# Ensure Blender is running with the server
"C:\Program Files\Blender Foundation\Blender 4.2\blender.exe" --background --python blender_server.py
# Check if port 8081 is in use
netstat -an | findstr 8081 # Windows
lsof -i :8081 # Linux/Mac
```
### Timeout Errors
1. Check Blender's console for Python errors
2. Ensure `main()` is called at the end of your script
3. Add `send_status()` calls for long operations
4. Avoid blocking calls or infinite loops
### Port Already in Use
```bash
# Kill existing Blender processes
taskkill /F /IM blender.exe # Windows
pkill blender # Linux/Mac
```
---
## šÆ Examples
### Run the Island Generator
```bash
# Activate venv first
.\venv\Scripts\activate
# Run example script
python run_via_bridge.py generate_island.py
```
### Interactive Mode (View Output)
```bash
# Start Blender with GUI
"C:\Program Files\Blender Foundation\Blender 4.2\blender.exe" --python blender_server.py
# Then run scripts via bridge
python run_via_bridge.py your_script.py
```
---
## š¤ Contributing
Contributions are welcome!
1. Fork the repository
2. Create a feature branch: `git checkout -b feature/amazing-feature`
3. Commit changes: `git commit -m 'Add amazing feature'`
4. Push: `git push origin feature/amazing-feature`
5. Open a Pull Request
---
## š License
MIT License - see [LICENSE](LICENSE) for details.
---
## š Links
- **Repository:** [github.com/MITHRAN-BALACHANDER/Blender-MCP-antigravity](https://github.com/MITHRAN-BALACHANDER/Blender-MCP-antigravity)
- **Blender:** [blender.org](https://www.blender.org/)
- **MCP Protocol:** [modelcontextprotocol.io](https://modelcontextprotocol.io/)
- **Antigravity:** [antigravity.dev](https://antigravity.dev/)
---
<p align="center">
Made with <a href="https://github.com/MITHRAN-BALACHANDER">Mithran Balachander</a>
</p>
TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose with no overlap: blender_exec runs Python scripts, get_blender_scene retrieves scene information, and image_to_3d_model creates 3D models from images. The descriptions reinforce these distinct functions, making misselection unlikely.
The naming follows a consistent verb_noun pattern (blender_exec, get_blender_scene, image_to_3d_model) with clear actions and targets. The minor deviation is that 'blender_exec' uses an abbreviation while others are spelled out, but the pattern remains readable and predictable.
With only 3 tools, the set feels thin for a Blender bridge, as it lacks core operations like modifying objects, rendering, or exporting. While the tools are well-defined, the count is borderline low for the apparent scope of 3D modeling and automation.
There are significant gaps in the tool surface for a Blender integration. Missing are essential CRUD operations (e.g., create/update/delete objects), rendering tools, export capabilities, and scene manipulation functions. This will likely cause agent failures when trying to perform common Blender workflows.