mcpField
U
UnrealMCP — AI Bridge for Unreal Engine 5

UnrealMCP — AI Bridge for Unreal Engine 5

本地服务
codefizz.dev媒体与设计3912 周前更新

关于 UnrealMCP — AI Bridge for Unreal Engine 5

UnrealMCP 是用于通过命令行工具或 MCP 客户端控制 Unreal Engine 5 编辑器的社区工具集。其 MCP 服务通过与命令行工具共用的插件提供资产、Blueprint、材质、Niagara、Actor、数据表和性能分析命令。

主要功能

  1. 0115 个类别共 288 条命令
  2. 02编辑 Blueprint 和材质
  3. 03创建并配置 Niagara 系统
  4. 04管理 Actor 和数据表
  5. 05基础性能分析
  6. 06命令行工具与 MCP 服务接入

适用场景

  1. 01构建并编译 Blueprint 图表
  2. 02创建或调整材质与 Niagara 特效
  3. 03生成 Actor 并编辑数据表
  4. 04通过 AI 客户端分析 Unreal Engine 项目性能

MCP 相关

MCP 服务通过 stdio 通信,并经由本地 TCP 连接 Unreal Engine 编辑器中的 C++ 插件。它可配置给 Claude Code、Cursor、Windsurf 和 VS Code 等 MCP 客户端使用。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"aadeshrao123-unreal": {
"command": "uvx",
"args": [
"unrealmcp"
]
}
}
}
启动命令uvx unrealmcp

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
pypiunrealmcp1.3.1

工具

286

收录的工具列表 · 更新于 2 周前

参数类型必填说明
codestring是

详细介绍

UnrealMCP — 虚幻引擎 5 的 AI 桥梁

通过 Claude Code、Cursor、Windsurf 或任何 MCP 客户端控制虚幻引擎 5 编辑器。 只需提出需求,即可构建材质、连接 Blueprint 图表、创建 Niagara 系统、生成 Actor、编辑数据表并 分析性能。涵盖 15 个类别的 288 条命令,无需离开终端。

许可证:MIT UE 5.3+ MCP 专业版

这是社区版

对其涵盖的功能而言,它稳定且功能完整。项目并未弃用,但也不再积极开发:新的子系统工作现在转向 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(专业版)
命令288900+
类别1528
引擎支持自行构建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 的版本不支持这两个版本。


使用本仓库的两种方式

CLIMCP 服务
安装npm install -g unrealclipip 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 自动启用):
    • PythonScriptPlugin
    • EditorScriptingUtilities
    • EnhancedInput
安装
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 条命令

类别数量亮点
核心2health_check、execute_python
资产管理16查找/列出/导入/复制/重命名/删除/保存
蓝图22创建、编译、变量、函数、图表节点
材质35创建、build_material_graph、材质函数、Substrate
数据表8对行执行完整 CRUD 操作 + 架构内省
数据资产12数据资产 + 精准编辑 Mass Config Trait
Actor 与关卡19生成、变换、属性、截图
Enhanced Input21操作、映射上下文、触发器、修饰器
控件 — UMG11控件树、添加/移动/重命名、插槽属性
Niagara VFX96系统、发射器、堆栈绑定(嵌套)、Scratch Pad 编写、图表 CRUD、DI 成员函数、源菜单发现
StateTree33状态、任务、评估器、转换、条件、绑定
性能分析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_defaultsCDO 属性
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_parameterMI 参数覆盖
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/outputMF 引脚
validate/cleanup_material_functionMF 诊断
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_functionsDI 类上的成员函数(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 CodeCLI 或 MCPBash(CLI)/ .mcp.json(MCP)已测试
CursorMCP.cursor/mcp.json已测试
VS Code / CopilotMCP.vscode/mcp.json支持
WindsurfMCP~/.codeium/windsurf/mcp_config.json支持
Gemini CLIMCP.gemini/settings.json支持
JetBrains / RiderMCP.junie/mcp/mcp.json支持
ZedMCP~/.config/zed/settings.json支持
Amazon QMCP.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",且所需插件在你的引擎构建中可用

发布与分发

渠道命令
npmnpm 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 全自动完成

联系方式:


定制开发与支持

需要 Unreal 项目方面的帮助?我承接 UE5 C++ 全技术栈的合同项目,涵盖游戏玩法、多人游戏、编辑器工具和 Mass Entity 系统。详情请参阅 SUPPORT.md。

[email protected] · LinkedIn · 作品集 · Discord:destroyerpal


许可证

MPL-2.0 — 详情请参阅 LICENSE。

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。