Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ For Windows users, go to Settings > MCP > Add Server, add a new server with the
}
```

### Remote Blender Access

If connecting to blender on a remote machine pass the host name to the blender mcp server using the environmental variable BLENDER_SERVER_HOST.

Ensure in the blender addon configuration you have selected "All interfaces" before starting the connection.

[Cursor setup video](https://www.youtube.com/watch?v=wgWsJshecac)

**⚠️ Only run one instance of the MCP server (either on Cursor or Claude Desktop), not both**
Expand Down
14 changes: 13 additions & 1 deletion addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,7 @@ def draw(self, context):
scene = context.scene

layout.prop(scene, "blendermcp_port")
layout.prop(scene, "blendermcp_host_all_interfaces")
layout.prop(scene, "blendermcp_use_polyhaven", text="Use assets from Poly Haven")

layout.prop(scene, "blendermcp_use_hyper3d", text="Use Hyper3D Rodin 3D model generation")
Expand Down Expand Up @@ -1419,10 +1420,14 @@ class BLENDERMCP_OT_StartServer(bpy.types.Operator):

def execute(self, context):
scene = context.scene

host = 'localhost'
if scene.blendermcp_host_all_interfaces:
host = '0.0.0.0'

# Create a new server instance
if not hasattr(bpy.types, "blendermcp_server") or not bpy.types.blendermcp_server:
bpy.types.blendermcp_server = BlenderMCPServer(port=scene.blendermcp_port)
bpy.types.blendermcp_server = BlenderMCPServer(host=host, port=scene.blendermcp_port)

# Start the server
bpy.types.blendermcp_server.start()
Expand Down Expand Up @@ -1458,6 +1463,12 @@ def register():
max=65535
)

bpy.types.Scene.blendermcp_host_all_interfaces = bpy.props.BoolProperty(
name="All interfaces",
description="Serve on all interfaces to allow remote connection",
default=False
)

bpy.types.Scene.blendermcp_server_running = bpy.props.BoolProperty(
name="Server Running",
default=False
Expand Down Expand Up @@ -1511,6 +1522,7 @@ def unregister():
bpy.utils.unregister_class(BLENDERMCP_OT_StopServer)

del bpy.types.Scene.blendermcp_port
del bpy.types.Scene.blendermcp_host_all_interfaces
del bpy.types.Scene.blendermcp_server_running
del bpy.types.Scene.blendermcp_use_polyhaven
del bpy.types.Scene.blendermcp_use_hyper3d
Expand Down
5 changes: 4 additions & 1 deletion src/blender_mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger("BlenderMCPServer")

blender_host = os.getenv("BLENDER_SERVER_HOST", "localhost")
blender_port = 9876

@dataclass
class BlenderConnection:
host: str
Expand Down Expand Up @@ -225,7 +228,7 @@ def get_blender_connection():

# Create a new connection if needed
if _blender_connection is None:
_blender_connection = BlenderConnection(host="localhost", port=9876)
_blender_connection = BlenderConnection(host=blender_host, port=blender_port)
if not _blender_connection.connect():
logger.error("Failed to connect to Blender")
_blender_connection = None
Expand Down