蓝图HTTP服务插件

Editor-only Unreal Engine 5.7+插件,运行本地MCP兼容的HTTP端点,通过HTTP公开蓝图结构、引用和基本内省。

  • by franadorivjp
  • C++
  • 本地部署
  • 更新于
在 GitHub 查看 franadorivjp/BuildBlueprintMCPServer

使用说明

蓝图MCP服务器插件

仅限编辑器的虚幻引擎5.7+插件,运行本地MCP兼容的HTTP端点,通过HTTP公开蓝图结构、引用和基本自检。

目录

  • BlueprintMCPServer/ –插件文件夹(放入 YourProject/Plugins/).
  • .gitignore –忽略此插件仓库的构建/IDE工件。

安装

  1. 复制 BlueprintMCPServer 进入 YourProject/Plugins/BlueprintMCPServer/.
  2. 如果需要,重新生成项目文件。
  3. 在中启用插件 Edit → 插件 (编辑器部分)。

用法

  • 打开 工具→ 蓝图MCP服务器 启动控制面板。
  • 设置端口(默认 9000),单击 启动服务器.
  • 日志面板显示服务器生命周期和传入的MCP操作。
  • 可选:提供蓝图资产路径(例如。, /Game/Blueprints/BP_MyAsset.BP_MyAsset)然后单击 导出JSON 预览检查器输出。
  • 切换 启用写入操作(不安全) 允许MCP创建/修改蓝图。

MCP HTTP API(本地)

发布 http://127.0.0.1:PORT/mcp JSON正文 { "action": "...", "params": { ... } }.

行动:

  • list_blueprints –参数:可选 paths: ["/Game", "/Game/Blueprints"]
  • get_blueprint_structure –参数: asset_path: "/Game/Blueprints/BP_X.BP_X"
  • get_references –参数: asset_path: "/Game/Blueprints/BP_X.BP_X"
  • 写入操作(需要打开UI开关):
    • create_blueprint – package_path,可选 parent_class (例如。, /Game/MyFolder/BP_New, parent_class: "/Script/Engine.Pawn").
    • add_variable – asset_path, name, type: { category, sub_category?, is_array?, is_set?, is_map? }.
    • add_function_graph – asset_path, name.
    • add_call_function_node – asset_path, graph, function_path (例如。, /Script/Engine.Character.Jump),可选 x,y.
    • add_event_node – asset_path, graph, event_name,可选 x,y (如果已有guid,则返回现有guid)。
    • add_input_action_event – asset_path, graph, input_action (资产路径), trigger_event (例如。, Pressed),可选 x,y.
    • add_component – asset_path, component_class (路径), name (通过SimpleConstructionScript添加)。
    • set_pin_default – asset_path, graph, node_guid, pin_name, value (对于矢量: (X=1.0,Y=0.0,Z=0.0)).
    • connect_pins – asset_path, graph, from_node, from_pin, to_node, to_pin (来自的节点GUID get_blueprint_structure).
    • compile_blueprint – asset_path.
    • save_blueprint – asset_path.

错误返回HTTP 400 { "error": "reason" }.

构建(例如,Windows、UE 5.7)

$env:UE5_ROOT="C:/Program Files/Epic Games/UE_5.7"
"$env:UE5_ROOT/Engine/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool.exe" `
  BlueprintLLMEditor Win64 Development `
  -project="D:/Path/To/YourProject.uproject" `
  -TargetType=Editor

备注

  • 使用内置 HttpServer 模块;没有第三方依赖。
  • Inspector通过资产注册表覆盖变量、图形(uber、函数、委托)、节点、引脚和传入/传出引用。
  • UI日志面板现在流式传输MCP服务器活动(启动/停止、请求、成功/失败)。