Skip to content
ClaudeUnreal
GitHub

Materials

This content is not available in your language yet.

14 tools — 0 typed MCP · 14 via cu CLI.

  • Materials — 14 tools

Create a new Material asset with a node graph for shading and visual effects.

@mcp.tool()
@showcase(
"Create a new Material asset with a node graph for shading and visual effects.",
featured=True,
)
def create_material(
ctx: Context,
name: str,
path: str = "/Game/Materials"
) -> ToolResult:
"""[Material] Create a new Material asset.
Args:
ctx: The MCP context
name: Name for the new material (e.g. "M_MyMaterial")
path: Content path to create the material in (default: /Game/Materials)
Returns:
Dict with created material name and path
"""
from claude_unreal_server import get_unreal_connection
try:
unreal = get_unreal_connection()
if not unreal:
return err("Failed to connect to Unreal Engine")
params = {"name": name}
if path != "/Game/Materials":
params["path"] = path
response = unreal.send_command("create_material", params)
if not response:
return err("Failed to create material: no response from Unreal Engine")
if response.get("status") == "error":
return err("Failed to create material", error=response.get("error", "Unknown error"))
result = response.get("result", response)
return ok(f"Created material '{name}'", **result)
except Exception as e:
logger.error(f"Error in create_material: {e}")
return err("Failed to create material", error=str(e))

Wire material graph expressions together or connect them to material output properties.

@mcp.tool()
@showcase(
"Wire material graph expressions together or connect them to material output properties.",
featured=True,
)
def connect_material_nodes(
ctx: Context,
material_path: str,
from_expression: str,
to_expression: str = None,
to_material_property: str = None,
from_output_index: int = 0,
to_input_index: int = 0,
) -> ToolResult:
"""[Material] Connect material graph nodes together, or connect an expression to a material output.
Anti-patterns:
- Do not call on a Material **Instance** path — graph editing is only
supported on base ``UMaterial``.
- Do not pass ``from_expression`` that isn't an existing expression node —
handler rejects with the list of available names. Use the ``expression_name``
returned by ``add_material_expression``.
- Do not pass ``to_material_property`` outside the whitelist (BaseColor,
Metallic, Specular, Roughness, EmissiveColor, Normal, Opacity,
OpacityMask, WorldPositionOffset, AmbientOcclusion, SubsurfaceColor) —
handler rejects unknown properties.
- Pass ``to_expression`` OR ``to_material_property``, not both — when both
are set, ``to_material_property`` wins.
Args:
ctx: The MCP context
material_path: Asset path of the Material
from_expression: Name of the source expression node
to_expression: Name of the target expression node (use this OR to_material_property)
to_material_property: Material output to connect to: BaseColor, Metallic, Specular,
Roughness, EmissiveColor, Normal, Opacity, OpacityMask, WorldPositionOffset,
AmbientOcclusion, SubsurfaceColor
from_output_index: Output pin index on source expression (default: 0)
to_input_index: Input pin index on target expression (default: 0)
Returns:
Dict with connection info
"""
from claude_unreal_server import get_unreal_connection
try:
unreal = get_unreal_connection()
if not unreal:
return err("Failed to connect to Unreal Engine")
params = {
"material_path": material_path,
"from_expression": from_expression,
"from_output_index": from_output_index,
"to_input_index": to_input_index,
}
if to_expression is not None:
params["to_expression"] = to_expression
if to_material_property is not None:
params["to_material_property"] = to_material_property
response = unreal.send_command("connect_material_nodes", params)
if not response:
return err("Failed to connect material nodes: no response from Unreal Engine")
if response.get("status") == "error":
return err("Failed to connect material nodes", error=response.get("error", "Unknown error"))
result = response.get("result", response)
return ok(f"Connected nodes in '{material_path}'", **result)
except Exception as e:
logger.error(f"Error in connect_material_nodes: {e}")
return err("Failed to connect material nodes", error=str(e))

assign_material_to_blueprint_component CLI

Section titled “assign_material_to_blueprint_component ”