关于 Funplay Unreal MCP
Funplay Unreal MCP 通过 Python 插件和本地 MCP 服务,让 AI 助手操作正在运行的 Unreal Editor。它面向关卡、资源和 Blueprint 编辑等项目工作流,并结合 Python 执行与 API 探索工具。
主要功能
- 01通过 MCP 操作 Unreal Editor
- 02在编辑器中运行 Python
- 03管理 Actor、资源与关卡
- 04创建和检查 Blueprint 与材质
- 05探索 Unreal API 和对象
- 06返回结构化结果与截图
适用场景
- 01按指令搭建和布置关卡
- 02导入资源并配置材质
- 03运行 Play-In-Editor 并截取画面
- 04自动化任务时检查编辑器 API
MCP 相关
通过本地 HTTP MCP 服务公开编辑器工具、资源和提示词模板。Node.js stdio 桥接器将 MCP 客户端连接到编辑器;默认配置开放 32 个工具,完整模式可用 97 个。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
npx -y funplay-unreal-mcpFUNPLAY_UNREAL_MCP_URLOptional Unreal MCP HTTP endpoint. Defaults to http://127.0.0.1:8765/.UNREAL_MCP_URLCompatibility endpoint variable used when FUNPLAY_UNREAL_MCP_URL is not set.FUNPLAY_UNREAL_MCP_TOKEN密钥Unreal MCP local auth token from the Funplay MCP editor menu or Saved/FunplayMCP/funplay_mcp_settings.json.UNREAL_MCP_TOKEN密钥Compatibility token variable used when FUNPLAY_UNREAL_MCP_TOKEN is not set.本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
Funplay MCP for Unreal
最先进的 Unreal Editor MCP 服务。
中文 | 英文
💖 如果它为你节省了时间,请给仓库点个星标——这对我们帮助很大。
Funplay MCP for Unreal 可让 AI 助手——Claude Code、Cursor、Windsurf、Codex、 VS Code Copilot 以及任何其他 MCP 客户端——直接操作正在运行的 Unreal Editor。它是一个纯 Python 编辑器插件(无需编译 C++,适用于 Unreal Engine 5.3–5.8),通过本地 MCP 服务开放编辑器功能,并附带一个 用于连接 AI 客户端的小型 Node.js stdio 桥接程序。采用 MIT 许可证,可免费用于商业用途。
用自然语言描述你的需求——生成并摆放 Actor、构建关卡和 Blueprint、创建材质、导入资源、驱动 Play-In-Editor、截取屏幕截图,或运行任意 execute_python——然后让助手来完成。
“建一个小型竞技场:铺一块地板、建四面墙、放几盏点光源,并在中间放置玩家起始点。然后运行游戏并发给我一张截图。”
助手会检查关卡、生成并摆放 Actor、设置灯光、进入 Play-In-Editor,并返回屏幕截图——这一切都通过此 MCP 服务完成。
演示
Codex 提出建造城堡的需求,Funplay MCP 通过 MCP 驱动 Unreal Editor,最终场景直接呈现在编辑器中。
快速开始
分三步:(1) 将插件放入项目,(2) 启用插件并启动服务,(3) 将 AI 客户端连接到它。
1. 安装插件
💡 该插件完全由 Python 编写,无需编译。
- 将
FunplayMCP/文件夹复制到项目的Plugins/目录中(<YourProject>/Plugins/FunplayMCP/),或者从最新的发布版本下载Funplay.UnrealMcp.vX.Y.Z.zip并解压到该目录。 - 它依赖引擎的 Python Editor Script Plugin,
.uplugin会自动启用该插件。
2. 启用并启动 MCP 服务
- 打开项目。在 Edit → Plugins 中确认已启用 Funplay MCP for Unreal,如果提示重启编辑器,请重启。
- 默认情况下,服务启动时会监听
http://127.0.0.1:8765/。如果该端口正被占用,服务会自动选择一个空闲的本地端口(同一项目的第二个编辑器实例会连接到现有服务)。 - 系统会为每个项目生成一个 auth token,并将其存储在
<YourProject>/Saved/FunplayMCP/funplay_mcp_settings.json中。 - 随时可通过 **Tools → Funplay MCP → Log Endpoint
- Token** 获取端点和令牌(信息会打印到 Output Log)。
3. 配置 AI 客户端
最快的方法是使用编辑器菜单:Tools → Funplay MCP → Configure Claude Code(或 Cursor / VS Code / Codex)。该菜单会写入正确的配置,并填入端点和令牌。
手动配置
Claude Code(~/.claude.json)、Cursor(~/.cursor/mcp.json):
{
"mcpServers": {
"funplay-unreal": {
"command": "npx",
"args": ["-y", "funplay-unreal-mcp"],
"env": {
"FUNPLAY_UNREAL_MCP_URL": "http://127.0.0.1:8765/",
"FUNPLAY_UNREAL_MCP_TOKEN": "<token from the Funplay MCP menu>"
}
}
}
}
VS Code(mcp.json)使用 servers 键;Codex
(~/.codex/config.toml)使用 [mcp_servers."funplay-unreal"] 表。两者都可通过一键菜单自动配置。
4. 验证连接
请让助手:
- 调用
get_project_info, - 读取资源
unreal://project/context, - 运行
execute_python,其中包含result = unreal.SystemLibrary.get_engine_version()。
开始之前
- 仅限编辑器。 服务在 Unreal 编辑器内运行;不会随打包后的游戏一起发布。
- 仅限环回地址。 服务绑定到
127.0.0.1,并拒绝非环回来源;POST 请求需要使用每个项目专属的身份验证令牌。 - 默认使用
core配置。 默认公开一组精简的 32 个工具;如果需要全部工具,可在设置文件中切换到full(97 个工具)。 - 默认启用
execute_python安全检查(文件系统/进程拒绝列表);传入safety_checks=false可按调用覆盖。 - 所有
unrealAPI 操作都会转交到游戏线程执行,因此编辑器不会因非线程访问而崩溃。
为什么选择这个项目
- 以
execute_python为核心。 这是一款一流工具,可在编辑器中运行任意 Python;96 个专用工具未涵盖的操作,仍可通过它完成。 - 内置 API 发现功能。
search_api/describe_class/inspect_object会读取嵌入式unreal模块自身的文档,让助手使用真实 API,而不是凭空编造。 - 纯 Python,无需构建。 无需 C++ 模块或编译步骤,可在 UE 5.3–5.8 上移植运行。
- 从设计上保障安全。 开箱即用地提供游戏线程转交、环回地址绑定、身份验证令牌和 DNS 重绑定防护。
- 一键配置客户端和项目技能。 可配置 Claude Code / Cursor / VS Code / Codex,并从编辑器菜单生成
AGENTS.md桥接文件。 - 与 Funplay MCP for Unity / Godot / Cocos 同属一个系列,遵循相同的约定。
亮点
- 97 个内置工具(默认
core配置中有 32 个),涵盖 20 个类别。 - MCP 资源(
unreal://...),涵盖项目、关卡、选中项、日志和工具目录;另提供常见工作流的提示词模板。 - 结构化结果——每个工具都会返回助手可用于推理的 JSON;截图会以内嵌图片形式返回。
- 自动回退端口,并支持附加到同一项目的实例。
- 零依赖 Node 桥接程序,已发布到 npm,包名为
funplay-unreal-mcp。
MCP 功能
- **工具:**97 个(32 个核心工具/97 个完整工具)。
- 主要执行方式:
execute_python——在编辑器中运行任意 Python 代码片段。 - 提示词:
level_review、feature_plan、debug_runtime、blueprint_actor。 - 资源:
unreal://project/context、unreal://project/info、unreal://level/current、unreal://actors/list、unreal://selection/current、unreal://tools/catalog、unreal://logs/recent、unreal://interaction/history, 以及模板unreal://actor/{ref}和unreal://asset/{path}。
与 Funplay MCP for Unity 的比较
| Funplay MCP for Unreal | Funplay MCP for Unity | |
|---|---|---|
| 编辑器端 | 纯 Python 插件(无需构建) | C# 包 |
| 主要执行方式 | execute_python(嵌入式 unreal) | execute_code(内存中的 C#) |
| 传输方式 | 本地 HTTP + stdio 桥接 | 本地 HTTP + stdio 桥接 |
| 默认公开范围 | core 配置(97 个中的 32 个) | core 配置 |
| 引擎版本 | UE 5.3–5.8 | Unity 2022.3+ |
| 客户端配置 | 一键配置(Claude/Cursor/VS Code/Codex) | 一键配置 |
内置工具
97 个内置工具(32 个 core)。调用 get_tool_catalog 获取实时列表。
| 类别 | 工具 |
|---|---|
| 执行 | execute_python, run_console_command |
| 反射 | search_api, describe_class, list_enum_values, inspect_object |
| Actor | spawn_actor, spawn_actor_from_asset, destroy_actor, duplicate_actor, set_actor_transform, set_actor_label, set_actor_property, attach_actor, get_actor_info, list_actors, find_actors, batch_spawn_actors |
| 组件 | add_component, list_components, get_component_properties, set_component_property, set_static_mesh, set_material, set_physics_properties, add_ism_instances |
| 资产 | list_assets, find_assets, get_asset_info, duplicate_asset, rename_asset, delete_asset, save_asset, import_asset, create_folder, asset_exists, get_asset_references |
| 蓝图 | create_blueprint, add_blueprint_component, compile_blueprint, get_blueprint_info, spawn_blueprint |
| 材质 | create_material, create_material_instance, set_material_instance_parameter, get_material_info, add_material_expression, connect_material_expressions, connect_material_property, recompile_material |
| 关卡 | new_level, load_level, save_current_level, save_all_dirty, get_level_info, list_levels |
| 编辑器内运行 | play_in_editor, stop_play_in_editor, simulate_in_editor, get_play_state |
| 视口 | set_viewport_camera, get_viewport_camera, focus_viewport |
| 截图 | take_screenshot |
| 选择 | get_selection, set_selection, select_none, get_selected_assets |
| 编辑器状态 | get_editor_state, get_project_info, get_output_log, sync_content_browser, health_status, undo, redo |
| 文件 | read_file, write_file, list_directory, file_exists |
| 程序化构建 | build_wall, build_floor, build_stairs, scatter_actors |
| 组织 | set_actor_folder, create_layer, add_actors_to_layer, list_layers |
| 数据 | create_data_table, get_data_table, set_data_table_rows, export_data_table_csv |
| UMG | create_widget_blueprint, add_widget, set_widget_property |
| 特效 | spawn_niagara_system, set_niagara_parameter |
| 发现 | get_tool_catalog |
仓库布局
FunplayMCP/ # the Unreal editor plugin (pure Python)
FunplayMCP.uplugin
Content/Python/
init_unreal.py # auto-run entry point
funplay_mcp/ # server, transport, registry, providers
tools/ # one module per tool category
stdio-wrapper/ # zero-dependency Node.js stdio<->HTTP bridge
scripts/ # validate_repo.py, package_release.py
tests/ # Node + Python tests (run without the editor)
server.json # MCP registry manifest
架构
AI client (Claude Code / Cursor / ...)
│ stdio (MCP JSON-RPC)
▼
funplay-unreal-mcp (Node bridge, npx)
│ HTTP + token → 127.0.0.1:8765
▼
Unreal Editor plugin (Python)
│ game-thread pump (register_slate_post_tick_callback)
▼
unreal API → Actors / Assets / Blueprints / Levels / PIE
贡献
请参阅 CONTRIBUTING.md。提交 PR 前,请运行 python3 scripts/validate_repo.py。
许可证
MIT — 请参阅 LICENSE。
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。