UMG MCP Authoring
Use MCP tools as the hands and this skill as the experience. Do not mutate .uasset files directly and do not bypass MCP with raw socket scripts when validating the public protocol.
For the five-system login demo and concrete script workflow, read login-demo.md.
Workflow
Set the attention target first with
set_target_umg_asset.- Passing a missing
/Game/...UMG path creates aWidgetBlueprint. - Use
set_target_widgetonly when the next operation is intentionally scoped to a widget. - Prefer omitted/default path arguments after target is established.
- Passing a missing
Build widget structure with panel parents.
CanvasPanel,Overlay,VerticalBox, andHorizontalBoxare reliable authoring parents.- Current
create_widgetattaches children throughUPanelWidget; do not create children directly underButtonorBorder. - To put text on a button or content over a border, create an
Overlayand add the visual widget plus the text as siblings.
Write properties as union updates.
set_widget_propertiesshould set or overwrite supplied properties and leave unspecified properties intact.- Use
Slot.PositionandSlot.Sizealiases for CanvasPanel children when possible. - Use nested
Slotobjects for panel-slot alignment and padding. - Use
delete_widgetonly for explicit deletion and passconfirm_delete=true. - Prefer
apply_layoutfor bulk layout authoring;export_umg_to_jsonandapply_json_to_umgare hidden compatibility/debug paths.
Use HLSL materials for UI visual richness.
- Prefer
hlsl_set_target,hlsl_set, andhlsl_compile. - New HLSL targets default to UI material behavior.
- For detailed material rules, use the
umg-material-mcpskill.
- Prefer
Animate widgets through Sequencer.
- Create or select an animation with
create_animationandset_animation_scope. - Focus the animated widget with
set_target_widgetorset_widget_scope. - Use
animation_append_widget_tracksfor widget-oriented union key writes. - Use
animation_append_time_slicewhen authoring a single moment across one or more widgets. - Read back with
animation_overvieworanimation_time_properties; do not trust write responses alone. - Treat
get_animation_keyframes,get_animation_full_data,set_property_keys,remove_property_track, andremove_keysas hidden compatibility commands, not default authoring tools.
- Create or select an animation with
Wire Blueprint through BlueCode.
- Use
bluecode_set_function("WidgetName.EventName")for component event scope. - Default
bluecode_read_function(detail="semantic")is the attention-compressed comprehension view and intentionally omits node/pin sidecars. Before editing an existing graph, re-read withdetail="roundtrip"; usedetail="debug"orinclude_connections=trueonly when raw nodes, pins, or edges are actually needed. - Preserve
base_revision,source_map,action_hints,expression_hints, andaction_hints_by_linefrom the round-trip read and pass them back tobluecode_apply. A stalebase_revisionmust fail instead of rematching changed graph state. - When editing a readback line, keep the corresponding hint. Hints with
node_idcausebluecode_applyto update the existing node's supplied input pins/defaults instead of appending a duplicate node, including variable-set and Branch nodes;Pin=A+BandPin=value("Select", ...)can create data expression nodes for that existing pin. Unmentioned pins and links are preserved. - When reconnecting or deleting edges, read
connectionsviadetail="debug"orinclude_connections=true; use each entry'sconnectas abluecode_connectreference anddelete_targetas abluecode_delete(..., confirm_delete=true)target. - Write with default
bluecode_apply(mode="union")andbluecode_apply_variables; usedry_run=truewhen the insertion plan should be inspected first. Union mode aligns semantic statements, inserts unmatched statements before the next matched right anchor, otherwise appends at the block end, and never deletes omitted graph content. UseFunctionName(Pin=value, ...)for normal calls,node("Action Menu Name", Pin=value, ...)for generic exec/action nodes, andvalue("Action Menu Name", Pin=value, ...)for pure/data nodes. - Pin names in
Pin=valueandbluecode_connectendpoints may use internal pin names, editor display names, or FriendlyName. When omitting an endpoint pin, rely on automatic resolution only if the node has one matching data input/output. - Pin values may be strings, numbers, booleans, or structured objects such as
{path:"/Game/..."},{class:"/Script/..."},{object:"..."},{text:"..."}, or{literal:"(X=0,Y=0)"}. Checkinput_warningsafter writes. - Pin values may also be data expressions:
Pin=value("Select", Index=ActiveIndex),Pin=PureFunction(A, B), orPin=A + B. These create pure/data nodes and connect their compatible output. - For custom pure/data expression nodes, pass action hints for the inner expression as well, using the inner Action Menu name or full expression key, such as
expression_hints={"My Custom Pure": {...}}forPin=value("My Custom Pure", Input=A). Readback returns these dependency hints inexpression_hints, mirrors them intoaction_hints, andbluecode_applyaccepts either object directly. - If a custom, plugin, or macro node stores behavior in UObject node properties rather than pins, pass
node_propertiestobluecode_applyusing the same statement/name keys asaction_hints, or putnode_properties/propertiesinside the matching hint object. Treatoperations[].result.node_properties.failuresas a failed semantic write. - If a data expression cannot connect to the target pin, the temporary expression nodes are rolled back and the reason appears in
input_warnings. - Variable-input nodes that implement UE's native add-pin interface can grow before BlueCode writes values, such as
value("Make Array", 0=First, 1=Second, 2=Third)or multi-input math nodes. Array-style pins accept either[0]or0. Format Textis preconfigured from itsFormatpin before the rest of the inputs are applied, sovalue("Format Text", Format="Hello {Name}", Name=PlayerName)can generate theNameargument pin.- Treat
input_warningsas write feedback that must be read and handled; warnings mean part of the requested semantic write did not map cleanly. - Add
alias=Nameinsidebluecode_applystatements, or passnode_aliases, when newly created nodes must be referenced later. Pass the returnedaliasesmap intobluecode_connectand useName:Pinendpoints. - Treat each successful
bluecode_apply.operations[].resultas immediate context for the next operation: it returnsnodeId/node_id, node title/class,is_exec,pin_counts, andinputs/outputspin evidence using the same endpoint format as readback hints. - Use
bluecode_connectonly when a complex custom, plugin, or macro node needs explicit pin links that cannot be inferred frombluecode_applyinputs. Treat it as union-only connection append, not as a reconnect/delete tool. - For custom, plugin, macro, or ambiguous nodes, call
bluecode_search_nodesfirst and pass its returnedhandleas anaction_handle, or place the returned search result object directly inbluecode_apply.action_hintssosignature/category/node_class/node_class_pathremain available for fallback matching. Useis_execto choosenode(...)versusvalue(...); useinclude_pins=trueonly whenpin_countsis not enough. - Delete nodes, variables, or existing pin connections only with
bluecode_delete(..., confirm_delete=true). For connection deletes, use{"kind":"connection","source":"NodeA:Then","target":"NodeB:Execute"}or"NodeA:Then -> NodeB:Execute"; if a node pair has multiple links, provide the exact pin names instead of guessing. - Treat
add_step,prepare_value,connect_data_to_pin,get_function_nodes,delete_node, anddelete_variableas backend compatibility tools, not default authoring tools.
- Use
Validate with read operations.
- Use
get_widget_treeafter structure writes. - Use
query_widget_propertiesfor precise property checks. - Use
export_umg_to_jsononly when that advanced tool is enabled and a full file snapshot is needed. - Use
save_assetonly after the target has passed focused readback checks.
- Use
Blueprint Direction
Treat BlueCode as the default Blueprint MCP direction. The target is semantic/code-like Blueprint read/write, not raw node dumps. Node-level reads should be compressed into intent such as events, variables, calls, branches, bindings, and data dependencies.
Useful reference directions:
- Code-like Blueprint representations, similar to Blueprint-to-C++ or pseudocode translation.
- JSON extraction for complete fallback inspection.
- Compact Markdown/ASCII views only for debug or review, not as the primary protocol.
Validation Commands
python -m py_compile Resources\Python\UmgMcpServer.py Resources\Python\APITest\Login_Demo_Five_Systems.py Resources\Python\APITest\Umg_Widget_Protocol_Static_Check.py Resources\Python\APITest\Blueprint_Protocol_Static_Check.py Resources\Python\APITest\Animation_Protocol_Static_Check.py Resources\Python\APITest\Sequencer_RenderTransform_Check.py
python Resources\Python\APITest\Umg_Widget_Protocol_Static_Check.py
python Resources\Python\APITest\Blueprint_Protocol_Static_Check.py
python Resources\Python\APITest\Animation_Protocol_Static_Check.py
python Resources\Python\APITest\Material_Protocol_Static_Check.py
python Resources\Python\APITest\Sequencer_RenderTransform_Check.py
python Resources\Python\APITest\Login_Demo_Five_Systems.py
The runtime demo requires Unreal Editor to be open with the UMG MCP bridge listening on the configured host and port.