关于 UnrealMCP — AI Bridge for Unreal Engine 5
UnrealMCP 是用于通过命令行工具或 MCP 客户端控制 Unreal Engine 5 编辑器的社区工具集。其 MCP 服务通过与命令行工具共用的插件提供资产、Blueprint、材质、Niagara、Actor、数据表和性能分析命令。
主要功能
- 0115 个类别共 288 条命令
- 02编辑 Blueprint 和材质
- 03创建并配置 Niagara 系统
- 04管理 Actor 和数据表
- 05基础性能分析
- 06命令行工具与 MCP 服务接入
适用场景
- 01构建并编译 Blueprint 图表
- 02创建或调整材质与 Niagara 特效
- 03生成 Actor 并编辑数据表
- 04通过 AI 客户端分析 Unreal Engine 项目性能
MCP 相关
MCP 服务通过 stdio 通信,并经由本地 TCP 连接 Unreal Engine 编辑器中的 C++ 插件。它可配置给 Claude Code、Cursor、Windsurf 和 VS Code 等 MCP 客户端使用。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
286收录的工具列表 · 更新于 2 周前
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| code | string | 是 |
详细介绍
UnrealMCP — 虚幻引擎 5 的 AI 桥梁
通过 Claude Code、Cursor、Windsurf 或任何 MCP 客户端控制虚幻引擎 5 编辑器。 只需提出需求,即可构建材质、连接 Blueprint 图表、创建 Niagara 系统、生成 Actor、编辑数据表并 分析性能。涵盖 15 个类别的 288 条命令,无需离开终端。
这是社区版
对其涵盖的功能而言,它稳定且功能完整。项目并未弃用,但也不再积极开发:新的子系统工作现在转向 CodeFizz Editor Agent, 这是持续维护的商业版本。此处的所有内容仍会正常运行,我们仍会查看问题,MIT 许可证也将永久有效。
如果你需要 Control Rig、PCG、Sequencer、Mutable、Procedural Vegetation、音频和 MetaSounds、 Behavior Trees 和 EQS,或适用于 UE 5.6 / 5.7 / 5.8 的打包二进制文件,请使用专业版。
社区版与专业版
| 社区版(本仓库) | CodeFizz Editor Agent(专业版) | |
|---|---|---|
| 命令 | 288 | 900+ |
| 类别 | 15 | 28 |
| 引擎支持 | 自行构建 | 5.6、5.7、5.8 |
| Blueprint、材质、Niagara、StateTree | 支持 | 支持,功能更深入 |
| Control Rig、PCG、Sequencer | 不支持 | 支持 |
| Mutable、Procedural Vegetation | 不支持 | 支持 |
| 音频、MetaSounds、Sound Cues | 不支持 | 支持 |
| Behavior Trees、EQS | 不支持 | 支持 |
| Insights 性能分析 | 基础功能 | 完整的跟踪分析 |
| 安装 | 克隆、构建、配置 | 一条命令,无需编译器 |
| 更新 | 按社区节奏进行 | 持续发布 |
| 支持 | GitHub 问题 | 优先支持、私密 Discord |
查看完整命令列表 → · 文档 · 3 天免费试用
已经在使用 UE 5.8? Epic 现已在 5.8 中提供第一方 MCP 服务(实验性,仅限 localhost)。 建议先试用,再决定是否购买。本仓库和专业版也都支持 5.6 和 5.7,而 Epic 的版本不支持这两个版本。
使用本仓库的两种方式
| CLI | MCP 服务 | |
|---|---|---|
| 安装 | npm install -g unrealcli | pip install unrealmcp |
| 依赖项 | 无(单个二进制文件) | Python 3.10+ |
| 适用对象 | Claude Code(通过 Bash) | Claude Code、Cursor、Windsurf、VS Code、Gemini CLI、Rider、Zed、Amazon Q |
| 协议 | 直接 TCP | 基于 stdio 的 MCP |
两者都通过编辑器内部的同一个 C++ 插件进行通信。可根据工作流选择其一,也可同时使用。
快速入门
选项 A:CLI(推荐用于 Claude Code)
# 1. Install
npm install -g unrealcli
# 2. Go to any UE5 project and install the plugin
cd YourProject/
ue-cli init
# 3. Open the editor, then verify
ue-cli health_check
就这么简单。无需 Python、配置文件或 MCP 设置。
选项 B:MCP 服务(适用于 Cursor、Windsurf 等)
# 1. Clone the plugin into your project
git clone https://github.com/aadeshrao123/Unreal-MCP.git Plugins/UnrealMCP
# 2. Install the Python MCP server
pip install unrealmcp
# 3. Add to your AI tool's config (see MCP Setup section below)
工作原理
┌──────────────────────────────────────────┐
│ Unreal Engine 5 Editor │
│ │
│ C++ Plugin (UnrealMCPBridge) │
│ TCP server on localhost:55557 │
│ 288 commands: materials, blueprints, │
│ niagara, statetree, actors, data │
│ tables, profiling, and more │
└──────────────┬───────────────────────────┘
│ TCP/JSON
┌──────────────┴───────────────────────────┐
│ │
┌─────────┴─────────┐ ┌─────────┴──────────┐
│ CLI (ue-cli) │ │ MCP Server │
│ Go binary │ │ Python (unrealmcp)│
│ Direct TCP │ │ stdio → TCP │
│ │ │ │
│ Claude Code │ │ Cursor, Windsurf, │
│ (via Bash tool) │ │ VS Code, Rider... │
└───────────────────┘ └────────────────────┘
C++ 插件在编辑器内部运行,并通过 TCP 提供 288 条命令。CLI 和 MCP 服务是连接同一插件的两种不同入口。
CLI 参考
安装
# From npm (recommended)
npm install -g unrealcli
# Or download binary directly from GitHub Releases
# https://github.com/aadeshrao123/Unreal-MCP/releases
平台: Windows(x64)、macOS(Intel + Apple Silicon)、Linux(x64 + ARM64)
设置
# Navigate to your UE5 project
cd MyProject/
# Install the C++ plugin (one-time)
ue-cli init
# → Creates Plugins/UnrealMCP/ with C++ source
# → Patches .uproject to enable the plugin
# → Open editor to compile, then you're ready
# Verify everything works
ue-cli doctor
使用方法
# Every command follows this pattern:
ue-cli <command> [--flag value]
# Examples:
ue-cli health_check
ue-cli find_assets --class-type material --path /Game
ue-cli spawn_actor --name MyCube --type StaticMeshActor --location "[0,0,100]"
ue-cli get_data_table_rows --data-table-path /Game/Data/DT_Items
ue-cli save_all
# For complex params, use --json:
ue-cli build_material_graph --json '{"material_path":"/Game/M_Test","nodes":[...],"connections":[...]}'
# Or pipe from stdin:
echo '{"material_path":"/Game/M_Test","nodes":[...]}' | ue-cli build_material_graph --json -
帮助与发现
# See all commands grouped by category
ue-cli --help
# See flags for a specific command
ue-cli find_assets --help
# Dump all commands with descriptions, flags, and examples (for AI assistants)
ue-cli list_commands
全局标志
| 标志 | 说明 |
|---|---|
--port <int> | 覆盖 TCP 端口(默认:从端口文件自动发现) |
--timeout <int> | 超时时间,单位为秒(默认:30,大型操作:300) |
--json <string> | 完整参数的 JSON 字符串(使用 - 表示从 stdin 读取) |
--version | 输出版本 |
主要命令
资产
ue-cli find_assets --class-type material --path /Game/Materials
ue-cli list_assets --path /Game --class-filter blueprint
ue-cli get_asset_properties --asset-path /Game/Materials/M_Base
ue-cli import_asset --source-file "C:/Art/texture.png" --destination-path /Game/Textures
ue-cli save_asset --asset-path /Game/Materials/M_Base
ue-cli save_all
蓝图
ue-cli create_blueprint --name BP_MyActor --parent-class Actor
ue-cli add_component_to_blueprint --blueprint-path /Game/BP_MyActor --component-class StaticMeshComponent
ue-cli add_event_node --blueprint-name BP_MyActor --event-name BeginPlay
ue-cli compile_blueprint --blueprint-name BP_MyActor
ue-cli read_blueprint_content --blueprint-path /Game/BP_MyActor
材质
ue-cli create_material --name M_Red --path /Game/Materials
ue-cli build_material_graph --material-path /Game/Materials/M_Red \
--nodes '[{"type":"Constant3Vector","pos_x":-400,"properties":{"Constant":"(R=1,G=0,B=0)"}}]' \
--connections '[{"from_node":0,"to_node":"material","to_pin":"BaseColor"}]'
ue-cli create_material_instance --parent-path /Game/Materials/M_Base --name MI_Red
数据表
ue-cli get_data_table_schema --data-table-path /Game/Data/DT_Items
ue-cli get_data_table_rows --data-table-path /Game/Data/DT_Items
ue-cli add_data_table_row --data-table-path /Game/Data/DT_Items --row-name CopperOre \
--data '{"DisplayName":"Copper Ore","StackSize":100}'
ue-cli update_data_table_row --data-table-path /Game/Data/DT_Items --row-name CopperOre \
--data '{"StackSize":200}'
Actor 与关卡
ue-cli get_actors_in_level
ue-cli spawn_actor --name MyCube --type StaticMeshActor --location "[0,0,100]"
ue-cli spawn_blueprint_actor --blueprint-path /Game/BP_MyActor --location "[500,0,0]"
ue-cli find_actors_by_name --pattern "Light"
ue-cli get_world_info
ue-cli take_screenshot
性能分析
# Record → Stop → Analyze
ue-cli performance_start_trace --channels "cpu,gpu,frame"
# ... play the game ...
ue-cli performance_stop_trace
ue-cli performance_analyze_insight --query diagnose
ue-cli performance_analyze_insight --query flame --count 20
ue-cli performance_analyze_insight --query search --filter "ConveyorProcessor"
Enhanced Input
ue-cli create_input_action --asset-path /Game/Input/IA_Jump --value-type Boolean
ue-cli create_input_mapping_context --asset-path /Game/Input/IMC_Default
ue-cli add_key_mapping --context-path /Game/Input/IMC_Default --action-path /Game/Input/IA_Jump --key SpaceBar
Niagara VFX
# Create a system from an emitter template, then tweak it
ue-cli create_niagara_system --asset-path /Game/VFX/NS_Sparks \
--template "/Niagara/DefaultAssets/FX_Sparks.FX_Sparks"
ue-cli get_niagara_system_info --asset-path /Game/VFX/NS_Sparks
ue-cli set_niagara_module_input --asset-path /Game/VFX/NS_Sparks \
--emitter-name Sparks --stack SpawnStack \
--module-name "Spawn Rate" --input-name SpawnRate --value 250
ue-cli compile_niagara_system --asset-path /Game/VFX/NS_Sparks
# Spawn it in the level
ue-cli spawn_niagara_effect --asset-path /Game/VFX/NS_Sparks --location "[0,0,200]"
StateTree
# Create a StateTree, add a state with a task, compile
ue-cli create_statetree --asset-path /Game/AI/ST_Enemy
ue-cli add_statetree_state --asset-path /Game/AI/ST_Enemy --state-name Patrol
ue-cli add_statetree_task --asset-path /Game/AI/ST_Enemy \
--state-name Patrol --task-type "MassEnemyNestPatrolTask"
ue-cli add_statetree_transition --asset-path /Game/AI/ST_Enemy \
--from-state Patrol --trigger OnEvent --event-tag "Enemy.SeePlayer"
ue-cli compile_statetree --asset-path /Game/AI/ST_Enemy
Mass 配置 Trait(精准编辑)
# Modify a single trait property without touching the rest of the trait array
ue-cli get_mass_config_traits --asset-path /Game/Mass/Enemy_Config
ue-cli set_mass_config_trait_property --asset-path /Game/Mass/Enemy_Config \
--trait-class MassMovementTrait --property-name MaxSpeed --property-value 600
控件(UMG)
ue-cli get_widget_tree --widget-blueprint-path /Game/UI/WBP_HUD
ue-cli add_widget --widget-blueprint-path /Game/UI/WBP_HUD --widget-class TextBlock \
--parent-widget-name RootCanvas --widget-name TitleText \
--widget-properties '{"Text":"Hello World"}'
诊断
# Check entire setup
ue-cli doctor
# Output:
# [ok] Project MyProject/MyProject.uproject
# [ok] Plugin directory Plugins/UnrealMCP/ exists
# [ok] Plugin source Source/UnrealMCPBridge/ exists
# [ok] UProject entry UnrealMCP plugin listed and enabled
# [ok] Port file port 55557
# [ok] TCP connection Connected to 127.0.0.1:55557
# [ok] Health check Bridge is responsive
# All checks passed. ue-cli is ready to use.
MCP 服务设置
适用于使用 Model Context Protocol 的 AI 工具(Cursor、Windsurf、VS Code 等)。
要求
- Unreal Engine 5.7(已在 5.7 上测试,可能也适用于更早的 5.x 版本)
- Python 3.10+
- UE5 插件(由
.uplugin自动启用):PythonScriptPluginEditorScriptingUtilitiesEnhancedInput
安装
pip install unrealmcp
设置脚本(手动配置的替代方案)
设置脚本会安装 unrealmcp pip 包,并自动为你的 AI 工具创建 MCP 配置。
Windows:
cd Plugins\UnrealMCP
install.bat
macOS / Linux:
cd Plugins/UnrealMCP
bash install.sh
脚本会询问要在哪里创建 MCP 配置:
| 范围 | 功能 | 适用情况 |
|---|---|---|
| 项目 | 在你的 .uproject 旁创建配置 | 只想在此项目中使用 UnrealMCP |
| 全局 | 在你的用户文件夹中创建配置 | 想在所有项目中使用 UnrealMCP |
配置你的 AI 工具
Claude Code — .mcp.json(项目根目录)
{
"mcpServers": {
"unreal": {
"type": "stdio",
"command": "unrealmcp"
}
}
}
Cursor — .cursor/mcp.json
{
"mcpServers": {
"unreal": {
"command": "unrealmcp"
}
}
}
VS Code / Copilot — .vscode/mcp.json
{
"servers": {
"unreal": {
"command": "unrealmcp"
}
}
}
Windsurf — ~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"unreal": {
"command": "unrealmcp"
}
}
}
Gemini CLI — .gemini/settings.json
{
"mcpServers": {
"unreal": {
"command": "unrealmcp"
}
}
}
JetBrains / Rider — .junie/mcp/mcp.json
{
"servers": [
{
"name": "unreal",
"command": "unrealmcp"
}
]
}
Zed — ~/.config/zed/settings.json
{
"context_servers": {
"unreal": {
"source": "custom",
"command": { "path": "unrealmcp" }
}
}
}
Amazon Q — .amazonq/mcp.json
{
"mcpServers": {
"unreal": {
"command": "unrealmcp"
}
}
}
全部 288 条命令
| 类别 | 数量 | 亮点 |
|---|---|---|
| 核心 | 2 | health_check、execute_python |
| 资产管理 | 16 | 查找/列出/导入/复制/重命名/删除/保存 |
| 蓝图 | 22 | 创建、编译、变量、函数、图表节点 |
| 材质 | 35 | 创建、build_material_graph、材质函数、Substrate |
| 数据表 | 8 | 对行执行完整 CRUD 操作 + 架构内省 |
| 数据资产 | 12 | 数据资产 + 精准编辑 Mass Config Trait |
| Actor 与关卡 | 19 | 生成、变换、属性、截图 |
| Enhanced Input | 21 | 操作、映射上下文、触发器、修饰器 |
| 控件 — UMG | 11 | 控件树、添加/移动/重命名、插槽属性 |
| Niagara VFX | 96 | 系统、发射器、堆栈绑定(嵌套)、Scratch Pad 编写、图表 CRUD、DI 成员函数、源菜单发现 |
| StateTree | 33 | 状态、任务、评估器、转换、条件、绑定 |
| 性能分析 | 3 | 录制 .utrace + 智能分析(诊断/尖峰/火焰图) |
| 调试 | 2 | 令牌跟踪、调试切换 |
核心(2)
| 命令 | 描述 |
|---|---|
health_check | 验证桥接是否正在运行 |
execute_python | 在编辑器中运行任意 Python 代码 |
资源管理(16)
| 命令 | 描述 |
|---|---|
find_assets | 按类、路径或名称搜索 Asset Registry |
list_assets | 列出目录中的资源 |
get_asset_info | 资源元数据 |
get_asset_properties | 所有可编辑属性 |
set_asset_property | 设置属性 |
find_references | 查找依赖项和被依赖项 |
import_asset | 导入外部文件(PNG、FBX 等) |
import_assets_batch | 批量导入 |
duplicate_asset | 复制到新位置 |
rename_asset | 重命名或移动(自动修复引用) |
delete_asset | 删除(检查引用) |
save_asset / save_all | 保存已修改的资源 |
open_asset | 在编辑器中打开 |
sync_browser | 在 Content Browser 中导航 |
get_selected_assets | 当前选中的资源 |
蓝图(22)
| 命令 | 描述 |
|---|---|
search_parent_classes | 查找有效的父类 |
create_blueprint | 基于任意父类创建 |
compile_blueprint | 编译 |
read_blueprint_content | 完整结构读取结果 |
analyze_blueprint_graph | 分析图表 |
add_component_to_blueprint | 添加组件 |
create/get/set_blueprint_variable | 管理变量 |
set_blueprint_variable_properties | 修改变量设置 |
create/delete/rename_blueprint_function | 管理函数 |
add_function_input/output | 函数参数 |
get_blueprint_function_details | 检查函数 |
get/set_blueprint_class_defaults | CDO 属性 |
add_blueprint_node | 添加图表节点(23 种以上类型) |
add_event_node | 添加事件(BeginPlay、Tick 等) |
connect_blueprint_nodes | 连接节点 |
delete_blueprint_node | 移除节点 |
set_blueprint_node_property | 编辑节点属性 |
材质(35)
| 命令 | 描述 |
|---|---|
create_material | 使用混合/着色模式创建 |
create_material_instance | 使用参数覆盖创建 |
build_material_graph | 原子化构建完整节点图 |
get_material_info | 检查属性/参数/纹理 |
set_material_properties | 批量设置材质属性 |
add/delete/move/duplicate_material_expression | 管理节点 |
connect_material_expressions | 连接节点 |
set_material_expression_property | 设置节点属性 |
disconnect_material_expression | 断开连接 |
layout_material_expressions | 自动排列布局 |
recompile_material | 强制重新编译 |
get_material_errors | 编译错误 |
get/set_material_instance_parameter | MI 参数覆盖 |
list_material_expression_types | 探索节点类型 |
get_expression_type_info | 节点引脚和属性 |
search_material_functions | 查找材质函数 |
validate_material_graph | 诊断问题 |
trace_material_connection | 跟踪数据流 |
cleanup_material_graph | 移除孤立节点 |
add_material_comments | 添加注释框 |
create/get_material_function | 管理材质函数 |
build_material_function_graph | 构建 MF 图表 |
add/set_material_function_input/output | MF 引脚 |
validate/cleanup_material_function | MF 诊断 |
apply_material_to_actor/blueprint | 应用材质 |
get_available_materials | 列出材质 |
get_actor/blueprint_material_info | 材质槽信息 |
数据表(8)
| 命令 | 描述 |
|---|---|
get_data_table_schema | 列名和类型 |
get_data_table_rows / get_data_table_row | 读取行 |
add_data_table_row | 使用初始数据添加 |
update_data_table_row | 部分更新 |
delete_data_table_row | 删除行 |
duplicate_data_table_row | 复制行 |
rename_data_table_row | 重命名行 |
数据资产 (12)
| 命令 | 描述 |
|---|---|
create_data_asset | 创建任意 UDataAsset 子类 |
get/set_data_asset_property(ies) | 读取/写入属性(单个或批量) |
list_data_assets | 按路径/类浏览 |
list_data_asset_classes | 查找所有已加载的 UDataAsset 子类 |
get_property_valid_types | 获取属性槽位的有效下拉选项 |
search_class_paths | 查找类路径 |
get_mass_config_traits | 检查 Mass Entity Config 资产上的所有特征 |
add_mass_config_trait | 向 Mass Config 添加新特征(非破坏性) |
set_mass_config_trait_property | 精准就地编辑单个特征属性——绝不替换 Traits 数组 |
remove_mass_config_trait | 按索引或类移除单个特征,不影响同级项 |
Actor 与关卡 (19)
| 命令 | 描述 |
|---|---|
spawn_actor | 生成内置 Actor 类型 |
spawn_blueprint_actor | 生成 BP Actor |
spawn_actor_from_class | 根据类名生成 |
get_actors_in_level | 列出所有 Actor |
find_actors_by_name | 按名称模式搜索 |
get_actor_properties | 读取 Actor 属性 |
set_actor_transform | 设置位置/旋转/缩放 |
delete_actor | 从关卡中移除 |
get_selected_actors | 查看视口选中项 |
get_world_info | 关卡信息 |
set_static_mesh_properties | 网格体分配 |
set_physics_properties | 物理配置 |
set_mesh_material_color | 材质颜色 |
apply_material_to_actor/blueprint | 应用材质 |
get_actor/blueprint_material_info | 材质槽位 |
get_available_materials | 列出材质 |
take_screenshot | 截取视口画面 |
Enhanced Input(21)
| 命令 | 描述 |
|---|---|
create_input_action | 创建 UInputAction |
get/set_input_action_properties | 操作属性 |
add/remove_input_action_trigger | 操作触发器 |
add/remove_input_action_modifier | 操作修饰器 |
list_input_actions | 浏览操作 |
create_input_mapping_context | 创建 UInputMappingContext |
get_input_mapping_context | 读取映射 |
add/remove/set_key_mapping | 按键绑定 |
add/remove_mapping_trigger/modifier | 单个映射的覆盖设置 |
list_input_mapping_contexts | 浏览上下文 |
list_trigger_types / list_modifier_types | 查找类型 |
list_input_keys | 有效按键名称 |
Widgets — UMG(11)
| 命令 | 描述 |
|---|---|
get_widget_tree | 控件层级 |
add_widget | 添加到父级 |
remove/move/rename/duplicate_widget | 控件操作 |
get/set_widget_properties | 控件属性 |
get/set_slot_properties | 布局槽位属性 |
list_widget_types | 可用控件类 |
Niagara VFX(96)
端到端 Niagara 创作——读取完整堆栈,修改任意绑定(顶层或嵌套),从头创作草稿板动态输入,生成任意图表节点(包括数据接口成员函数),并查找编辑器下拉菜单公开的所有有效选项。基于 Niagara 导出的 ViewModel / Stack Graph API,并安全复刻未导出的辅助函数。
系统
| 命令 | 描述 |
|---|---|
create_niagara_system | 从发射器模板或空白模板创建 |
get_niagara_system_info | 系统元数据、发射器、参数 |
list_niagara_systems | 按路径浏览 Niagara 系统 |
delete_niagara_system | 删除系统 |
compile_niagara_system | 强制重新编译 |
set_niagara_system_property | 设置顶层系统属性 |
get_niagara_system_errors | 编译错误/警告 |
get_niagara_particle_stats | 每个发射器的粒子统计信息 |
get/set_niagara_playback_range | 预览播放范围 |
发射器
| 命令 | 描述 |
|---|---|
get_niagara_emitters | 列出系统中的发射器 |
add_niagara_emitter | 从模板添加 |
remove_niagara_emitter | 移除发射器 |
duplicate_niagara_emitter | 复制发射器并指定新名称 |
reorder_niagara_emitter | 更改发射器索引 |
set_niagara_emitter_property | 设置发射器属性 |
get_niagara_emitter_attributes | 粒子属性(Position、Velocity 等) |
模块(生成/更新/渲染堆栈)
| 命令 | 描述 |
|---|---|
get_niagara_modules | 列出任意堆栈中的模块 |
add_niagara_module | 从脚本资源添加模块 |
remove_niagara_module | 移除模块 |
set_niagara_module_enabled | 启用/禁用模块 |
reorder_niagara_module | 在堆栈中重新排序 |
get_niagara_module_inputs | 检查模块输入及其当前值 |
set_niagara_module_input | 设置字面值(自动将 Module.* 输入路由到快速迭代;支持嵌套点路径,如 "Spawn Count.int32001") |
set_niagara_dynamic_input | 将输入替换为动态输入函数(支持嵌套路径) |
set_niagara_curve | 设置曲线输入上的曲线点 |
get_niagara_module_versions | 列出脚本版本 |
堆栈输入绑定循环
| 命令 | 描述 |
|---|---|
get_niagara_module_input_binding | 一次调用即可解析每个输入的模式(Default/Local/Linked/Dynamic/Data/Expression)+ 目标 + 递归子项 |
clear_niagara_module_input | 将输入(或嵌套路径)重置为默认值——相当于堆栈 UI 中的“重置为默认值” |
list_niagara_input_source_menu | 重现编辑器的来源下拉菜单——按命名空间分组的引擎动态输入资源 + 草稿板 DI + 链接参数 |
参数与绑定
| 命令 | 描述 |
|---|---|
get_niagara_user_parameters | 列出 User 命名空间参数 |
add_niagara_user_parameter | 添加 User 参数 |
set_niagara_user_parameter | 设置 User 参数值 |
remove_niagara_user_parameter | 移除 User 参数 |
link_niagara_parameter | 将模块输入绑定到参数(支持嵌套点路径) |
get_niagara_rapid_iteration_parameters | 快速迭代参数检查 |
set_niagara_rapid_iteration_parameter | 设置快速迭代参数值 |
list_niagara_available_parameters | 枚举常见参数、用户参数和草稿板作用域参数 |
渲染器
| 命令 | 描述 |
|---|---|
add_niagara_renderer | 添加 Sprite/Mesh/Ribbon/Light 渲染器 |
remove_niagara_renderer | 移除渲染器 |
get_niagara_renderer_info | 渲染器摘要及各绑定的详细信息(binding_name + bound_variable + type + dataset_variable) |
get_niagara_renderer_properties | 完整的渲染器属性转储 |
set_niagara_renderer_property | 设置渲染器属性 |
set_niagara_renderer_binding | 将渲染器属性绑定到粒子数据 |
草稿板 — CRUD 与应用
| 命令 | 描述 |
|---|---|
create_niagara_scratch_pad_module | 创建每个发射器独有的草稿模块(module / dynamic_input / function) |
list_niagara_scratch_pad_modules | 列出系统中的草稿板 |
duplicate_niagara_scratch_pad_module | 复制并指定新名称 |
rename_niagara_scratch_pad_module | 原位重命名 |
delete_niagara_scratch_pad_module | 从系统中移除 |
apply_niagara_scratch_pad | 将编辑副本提交到资源(“应用”按钮) |
apply_and_save_niagara_scratch_pad | 应用并保存资源(“应用并保存”按钮) |
create_niagara_module_asset | 创建可复用的独立 Niagara 模块脚本资源 |
脚本属性(详情面板)
| 命令 | 描述 |
|---|---|
get_niagara_script_properties | 读取 Category、Description、Keywords、ModuleUsageBitmask、ProvidedDependencies、RequiredDependencies、LibraryVisibility、bDeprecated、bExperimental、NumericOutputTypeSelectionMode、ScriptMetaData、ConversionUtility |
set_niagara_script_properties | 批量设置任意子集(支持 TArray<FName>,例如 ProvidedDependencies,以及 TArray<FNiagaraModuleDependency>) |
脚本参数(输入 / 输出)
| 命令 | 描述 |
|---|---|
list_niagara_script_parameters | 列出 Scratch Pad / 独立脚本上的输入和输出 |
add_niagara_script_parameter | 添加具有任意已注册类型(包括数据接口)的输入或输出参数 |
remove_niagara_script_parameter | 移除 — 自动级联清理 Map Get / Map Set 引脚 |
rename_niagara_script_parameter | 在资源和编辑副本图表中重命名 |
图表内省
| 命令 | 描述 |
|---|---|
get_niagara_graph_nodes | 列出所有节点,支持 verbosity(summary/connections/full)、type_filter 和 name_filter。提供三种解析模式:Scratch Pad、发射器堆栈图表、独立脚本 |
get_niagara_node_info | 按 node_index / node_class / node_id 深入检查单个节点,显示引脚布局、连接以及特定类型的字段(op_name、function_script、hlsl_preview、input_name/type) |
trace_niagara_connection | 使用 pin_name 筛选器进行上游 / 下游广度优先搜索 — 无需转储整个图表即可查看依赖链 |
validate_niagara_graph | 对孤立 / 终端 / 缺少输入的节点进行分类(跳过 +Add 占位符) |
图表节点的增删改查
| 命令 | 描述 |
|---|---|
add_niagara_graph_node | 生成 Op / FunctionCall / DataInterfaceFunction / ParameterMapGet / ParameterMapSet / Reroute / Input 节点。DI 成员函数(例如 Array.Length)使用 UNiagaraDataInterface::GetFunctionSignatures — 与右键“Functions”子菜单使用相同路径 |
delete_niagara_graph_node | 按索引或 GUID 删除,并同步应用于资源和编辑副本 |
引脚管理
| 命令 | 描述 |
|---|---|
add_niagara_map_get_pin | 向 Map Get 添加类型化输出引脚(例如,将 Module.MyParam 添加为 Vector) |
add_niagara_map_set_pin | 向 Map Set 添加类型化输入引脚(例如 Particles.Velocity) |
add_niagara_node_pin | 向任何派生自 UNiagaraNodeWithDynamicPins 的节点添加引脚 |
rename_niagara_node_pin | 重命名动态引脚节点上的引脚 |
remove_niagara_node_pin | 移除动态引脚 |
connect_niagara_pins | 使用 UEdGraphSchema_Niagara::TryCreateConnection 验证并连接两个引脚 |
disconnect_niagara_pins | 断开引脚连接 |
自定义 HLSL
| 命令 | 描述 |
|---|---|
set_niagara_scratch_pad_hlsl | 将 HLSL 源代码写入 Scratch Pad 的 Custom HLSL 节点(按需创建引脚) |
add_niagara_custom_hlsl_input | 向 Custom HLSL 节点添加输入引脚 |
add_niagara_custom_hlsl_output | 向 Custom HLSL 节点添加输出引脚 |
rename_niagara_custom_hlsl_pin | 重命名引脚(也会重写 HLSL 正文中的 {PinName} 引用) |
remove_niagara_custom_hlsl_pin | 移除引脚 |
事件和模拟阶段
| 命令 | 描述 |
|---|---|
add_niagara_event_handler | 添加事件处理阶段 |
add_niagara_simulation_stage | 添加模拟阶段 |
get_niagara_event_handlers | 检查发射器上的处理程序 |
关卡生成
| 命令 | 描述 |
|---|---|
spawn_niagara_effect | 在世界位置生成 |
control_niagara_effect | 激活 / 停用 / 重新启动 |
add_niagara_component | 向 Blueprint 添加 NiagaraComponent |
get_niagara_actors | 查找已生成的 Niagara Actor |
发现(零猜测创作)
| 命令 | 说明 |
|---|---|
list_niagara_modules | 所有可用的 Niagara 模块脚本 |
list_niagara_emitter_templates | 发射器模板 |
list_niagara_data_interfaces | 可用的数据接口(DI_*) |
list_niagara_data_interface_functions | DI 类上的成员函数(Array.Length、Array.Get 等)——将结果传递给 add_niagara_graph_node(node_type="DataInterfaceFunction") |
list_niagara_parameter_types | 参数类型注册表 |
list_niagara_node_types | 可生成的节点类及其引脚架构 |
get_niagara_node_type_info | 节点类或脚本资源的引脚架构 |
search_niagara_functions | 按用途和名称查找 Niagara 脚本资源 |
get_niagara_schema_actions | 完整的图表右键菜单——与编辑器使用的来源相同。返回可直接用于 add_niagara_graph_node 的 op_name / function_script / input_name |
describe_niagara_type | 类型查询——FNiagaraTypeRegistry 类型,以及针对脚本属性枚举和自定义类型的 UEnum / UScriptStruct 反射回退机制 |
get_niagara_data_interface_schema | 遍历 DI 类的可编辑属性架构 |
find_niagara_scratch_pad_usage | 反向查找——此 Scratch Pad 在哪里被引用? |
resolve_niagara_built_in_dynamic_input | 扫描 AssetRegistry 以查找引擎自带的 DI 脚本(不再使用硬编码路径) |
StateTree(33 个,新增)
读取和创作 StateTree 资源——状态、任务、评估器、转换、条件、参数和绑定。支持架构感知:兼容 StateTreeSchemaBase 和 Mass 架构变体。
读取
| 命令 | 说明 |
|---|---|
get_statetree_info | 资源摘要(架构、状态、评估器) |
get_statetree_full_info | 完整递归转储(状态 + 任务 + 转换 + 绑定) |
get_statetree_states | 列出所有状态(扁平列表) |
get_statetree_state | 按 ID 或名称获取单个状态的详细信息 |
get_statetree_node | 检查任意节点(任务/评估器/条件) |
get_statetree_evaluators | 全局评估器 |
get_statetree_global_tasks | 全局任务 |
get_statetree_parameters | 树参数 |
get_statetree_bindings | 所有属性绑定 |
get_statetree_transition_targets | 某状态的有效转换目标 |
search_statetree_nodes | 按名称/类型搜索节点 |
创作
| 命令 | 说明 |
|---|---|
create_statetree | 创建新的 StateTree 资源 |
set_statetree_schema | 设置架构(例如 Mass 架构) |
add_statetree_state | 添加状态(父级或根级) |
add_statetree_task | 向状态添加任务 |
add_statetree_evaluator | 添加全局评估器 |
add_statetree_global_task | 添加全局任务 |
add_statetree_condition | 添加进入条件/转换条件 |
add_statetree_transition | 添加转换(事件/已完成/委托) |
add_statetree_parameter | 添加树参数 |
add_statetree_binding | 在节点之间绑定属性 |
compile_statetree | 编辑后编译 |
修改
| 命令 | 说明 |
|---|---|
set_statetree_state_property | 编辑状态属性 |
set_statetree_node_property | 编辑任务/评估器/条件属性 |
set_statetree_transition_property | 编辑转换属性 |
set_statetree_color | 设置状态颜色 |
移除
| 命令 | 说明 |
|---|---|
remove_statetree_state | 移除状态 |
remove_statetree_node | 移除任务/评估器/条件 |
remove_statetree_transition | 移除转换 |
remove_statetree_binding | 移除绑定 |
remove_statetree_parameter | 移除参数 |
发现
| 命令 | 说明 |
|---|---|
list_statetree_node_types | 所有可用的任务/评估器/条件类型 |
list_statetree_enum_values | 属性下拉菜单的枚举值 |
性能分析(3)
| 命令 | 描述 |
|---|---|
performance_start_trace | 开始录制 .utrace |
performance_stop_trace | 停止并自动加载 |
performance_analyze_insight | 智能分析(诊断、峰值、火焰图、热点路径、搜索、直方图等) |
调试(2)
| 命令 | 描述 |
|---|---|
set_mcp_debug | 启用令牌跟踪 |
get_mcp_token_stats | 令牌使用统计 |
使用示例
这些示例适用于 CLI 和 MCP 服务。使用 CLI 时,AI 会通过 Bash 调用 ue-cli。使用 MCP 时,AI 会直接调用工具。
创建材质
Create a red metallic material at /Game/Materials/M_RedMetal
with roughness 0.3 and metallic 1.0
AI 会调用 create_material,然后调用 build_material_graph,将常量节点连接到 Base Color、Metallic 和 Roughness 引脚。
生成 Actor
Spawn 5 point lights in a circle around the origin at height 300
AI 会使用计算好的位置,调用 spawn_actor 五次,并设置 actor_type: "PointLight"。
创建蓝图
Create a Blueprint actor called BP_HealthPickup based on Actor,
add a Sphere Collision component and a Static Mesh component,
set it up so on BeginOverlap it prints "Health Picked Up"
AI 会使用 create_blueprint、add_component_to_blueprint、add_event_node、add_blueprint_node 和 connect_blueprint_nodes。
性能分析
Start a performance trace, play for 10 seconds, stop it,
then diagnose the bottlenecks
AI 会调用 performance_start_trace,等待,然后调用 performance_stop_trace,再调用 performance_analyze_insight 并设置 query: "diagnose"。
数据表管理
Show me the schema of DT_Items, then add a new row called
"IronIngot" with StackSize 100
AI 会调用 get_data_table_schema,然后使用适当的数据调用 add_data_table_row。
配置
自定义端口
添加到 Config/DefaultEngine.ini:
[UnrealMCP]
Port=55557
环境变量
# Force a specific port (overrides port file)
set UNREAL_MCP_PORT=55560
多个编辑器实例
每个编辑器都会自动选择唯一端口。CLI 和 MCP 服务会从 Saved/UnrealMCP/port.txt 读取端口。使用 --port 标志或 UNREAL_MCP_PORT 环境变量指定目标实例。
架构
插件结构
Plugins/UnrealMCP/
├── UnrealMCP.uplugin # Plugin manifest
├── cli/ # Go CLI source (ue-cli)
│ ├── cmd/ # Command definitions (288 commands)
│ ├── internal/bridge/ # TCP client
│ ├── internal/project/ # Plugin embedding & project detection
│ └── npm/ # npm package wrapper
├── unrealmcp/ # Python MCP server
│ ├── _tcp_bridge.py # TCP communication
│ └── tools/ # Tool modules (one per category)
├── Source/UnrealMCPBridge/ # C++ editor plugin
│ ├── Public/ # Headers
│ └── Private/ # Implementation + command handlers
└── .github/workflows/release.yml # CI: builds + GitHub Release + npm publish
通信协议
使用带长度前缀的 TCP 帧格式:
[4 bytes: big-endian payload length] [N bytes: UTF-8 JSON]
请求:{"type": "command_name", "params": {...}}
响应:{"status": "success", "result": {...}}
添加自定义命令
CLI 端(Go)
在相应的 cmd/*.go 文件中添加一个 CommandSpec:
{
Name: "my_command",
Group: "mygroup",
Short: "What it does",
Long: "Detailed description.",
Example: "ue-cli my_command --param value",
Params: []ParamSpec{
{Name: "param", Type: "string", Required: true, Help: "Description"},
},
},
MCP 端(Python)
在 unrealmcp/tools/ 中创建一个新文件:
# unrealmcp/tools/my_tools.py
from unrealmcp._bridge import mcp
from unrealmcp._tcp_bridge import _call
@mcp.tool()
def my_command(param: str) -> str:
"""Description shown to the AI assistant."""
return _call("my_command", {"param": param})
在 unrealmcp/tools/__init__.py 中注册:
from unrealmcp.tools import my_tools # noqa: F401
C++ 端
在 Source/UnrealMCPBridge/Private/Commands/ 中添加命令处理程序,并在 ExecuteCommand() 中注册。
支持的 AI 工具
| 工具 | 接口 | 配置文件 | 状态 |
|---|---|---|---|
| Claude Code | CLI 或 MCP | Bash(CLI)/ .mcp.json(MCP) | 已测试 |
| Cursor | MCP | .cursor/mcp.json | 已测试 |
| VS Code / Copilot | MCP | .vscode/mcp.json | 支持 |
| Windsurf | MCP | ~/.codeium/windsurf/mcp_config.json | 支持 |
| Gemini CLI | MCP | .gemini/settings.json | 支持 |
| JetBrains / Rider | MCP | .junie/mcp/mcp.json | 支持 |
| Zed | MCP | ~/.config/zed/settings.json | 支持 |
| Amazon Q | MCP | .amazonq/mcp.json | 支持 |
故障排除
| 问题 | 解决方案 |
|---|---|
| "Connection refused" | UE5 编辑器是否正在运行?检查 Output Log 中是否有 MCP Bridge initialized on port XXXXX |
ue-cli doctor 显示端口文件缺失 | 编辑器尚未启动,或者检查 Saved/UnrealMCP/port.txt |
| 命令超时 | 大型操作(性能分析、复杂图表)的超时时间为 300s。使用 --timeout 600 延长超时时间 |
| 多个编辑器 | 使用 --port <num> 或 UNREAL_MCP_PORT 环境变量指定目标实例 |
| 插件无法编译 | 确保已启用 PythonScriptPlugin、EditorScriptingUtilities 和 EnhancedInput |
| Python 导入错误 | 运行 pip install fastmcp requests——确保 PATH 中的 Python 与 AI 工具使用的 Python 匹配 |
| 插件未加载 | 确认 UnrealMCP.uplugin 中包含 "Type": "Editor",且所需插件在你的引擎构建中可用 |
发布与分发
| 渠道 | 命令 |
|---|---|
| npm | npm install -g unrealcli |
| GitHub Releases | 下载二进制文件 |
| pip(仅 MCP) | pip install unrealmcp |
发布通过 GitHub Actions 自动完成。推送标签即可触发:
git tag v1.2.2 && git push origin v1.2.2
# → Builds 5 platform binaries
# → Creates GitHub Release
# → Publishes to npm + PyPI
贡献
请参阅 CONTRIBUTING.md 了解贡献指南。
企业与工作室集成
需要将 Unreal MCP 集成到工作室的生产流程中?我会直接与游戏工作室合作,基于此工具构建定制的 AI 辅助工作流。
我可以提供:
- 流水线集成 — 将 Unreal MCP 接入现有的构建系统、CI/CD 和团队工作流,让每位美术和开发者都能开箱即用地通过 AI 助手操作 Unreal 项目
- 定制工具开发 — 构建符合工作室专有格式、内部工具和特定制作需求的 MCP 命令,弥补开源版本未覆盖的需求
- AI 工作流设计 — 设计并实现团队使用 AI 助手(Claude、Cursor、Copilot)配合 Unreal Engine 的方式,涵盖材质创建、关卡设计和资产流水线
- 高级材质与 Substrate 系统 — 程序化材质生成、Substrate 工作流、复杂着色器流水线,均可通过 MCP 全自动完成
联系方式:
- 电子邮件:[email protected]
- LinkedIn:linkedin.com/in/aadeshyadav
- Discord:
destroyerpal - 作品集:aadeshyadav.vercel.app
定制开发与支持
需要 Unreal 项目方面的帮助?我承接 UE5 C++ 全技术栈的合同项目,涵盖游戏玩法、多人游戏、编辑器工具和 Mass Entity 系统。详情请参阅 SUPPORT.md。
[email protected] · LinkedIn · 作品集 · Discord:destroyerpal
许可证
MPL-2.0 — 详情请参阅 LICENSE。
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。