This MCP server allows you to manage and execute Blender Python scripts remotely through the Model Context Protocol. You can add, edit, execute, and remove scripts, with all execution happening in a headless Blender environment.
pip install mcp
To start the MCP server, run:
python server.py
The server will start and wait for connections from MCP clients, such as Claude Desktop.
To add a new script to the server:
add_script("script_name", "script_content")
For example:
add_script("hello_cube", '''
import bpy
# Clear existing objects
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete()
# Create a cube
bpy.ops.mesh.primitive_cube_add(size=2, location=(0, 0, 0))
print("Cube created!")
''')
To modify an existing script:
edit_script("script_name", "new_content")
Execute scripts in Blender with:
execute_script("script_name")
You can optionally specify a Blender file to use:
execute_script("script_name", blend_file="/path/to/your/project.blend")
To delete a script from the server:
remove_script("script_name")
The server provides several resource endpoints:
scripts://list
- Get a list of all available scriptsscript://{name}
- Get the content of a specific scriptresult://{name}
- Get the execution result of a script# Add a script that creates a cube
add_script("hello_cube", '''
import bpy
# Clear existing objects
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete()
# Create a cube
bpy.ops.mesh.primitive_cube_add(size=2, location=(0, 0, 0))
print("Cube created!")
''')
# Execute the script
execute_script("hello_cube")
# View the result
# Access using: result://hello_cube
# Add a script that analyzes scene contents
add_script("analyze_scene", '''
import bpy
# Print information about the current scene
print(f"Current Blender version: {bpy.app.version_string}")
print(f"Current file: {bpy.data.filepath}")
# List all objects in the scene
print("\\nObjects in the scene:")
for obj in bpy.data.objects:
print(f" - {obj.name} ({obj.type})")
''')
# Execute with a specific blend file
execute_script("analyze_scene", blend_file="/path/to/your/project.blend")
# View the analysis results
# Access using: result://analyze_scene
When you execute a script:
result://
endpointAll scripts are stored in the script_files/scripts
directory, with results in script_files/results
and metadata in script_files/metadata.json
.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.