ue4-mcp-server
Provides tools for controlling and automating the Unreal Engine editor via remote execution, including running Python and console commands, creating and modifying actors, managing assets, navigating the viewport, and taking screenshots.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ue4-mcp-serverCreate a red sphere at (500, 0, 100) in the current level."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ue4-mcp-server
让 AI 助手直接控制 Unreal Engine 编辑器。
通过 Model Context Protocol (MCP) 把 UE4/5 的编辑器能力暴露给 AI 助手(opencode、Claude Desktop、Cursor 等),实现自然语言驱动的场景搭建、资产管理和关卡编辑。
架构
┌──────────────┐ stdio/MCP ┌────────────────┐ UDP+HTTP ┌──────────────┐
│ AI 助手 │ ◄──────────────── │ ue4-mcp-server │ ◄──────────────► │ UE4 Editor │
│ (opencode / │ │ (Python MCP) │ Remote Exec │ (Python │
│ Claude等) │ └────────────────┘ │ Plugin) │
└──────────────┘ └──────────────┘工作原理:
UE4 编辑器启用 Remote Execution 插件(监听 UDP 6766 端口)
MCP Server 通过 UDP 广播发现编辑器端点
通过 HTTP POST 发送 Python 代码到编辑器执行
编辑器执行结果返回给 AI 助手
Related MCP server: unreal-mcp
快速开始
1. 安装
pip install ue4-mcp-server或从源码安装:
git clone https://github.com/lusilong/ue4-mcp-server.git
cd ue4-mcp-server
pip install -e .2. 配置 UE4 编辑器
在你的项目 Config/DefaultEngine.ini 中添加:
[PythonScriptPlugin]
bRemoteExecution=True重启编辑器,Remote Execution 插件会监听 UDP 6766 端口。
3. 配置 AI 助手
opencode (~/.config/opencode/opencode.jsonc)
{
"mcp": {
"ue4": {
"type": "local",
"command": ["ue4-mcp"]
}
}
}Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"ue4": {
"command": "ue4-mcp",
"args": []
}
}
}Cursor (.cursor/mcp.json)
{
"mcpServers": {
"ue4": {
"command": "ue4-mcp"
}
}
}4. 启动
打开 UE4/5 编辑器(确保 Remote Execution 已启用)
在 AI 助手中对话,AI 会自动连接编辑器
提供的工具
工具 | 说明 |
| 在编辑器中执行任意 Python 代码 |
| 执行 UE4 控制台命令 |
| 获取项目名称、引擎版本、资产数量 |
| 获取当前关卡信息(actor 数量、类型分布) |
| 列出所有 actor 及其位置、旋转、缩放 |
| 按名称搜索项目资产 |
| 在关卡中创建 actor(StaticMesh、Light 等) |
| 按名称删除 actor |
| 更新 actor 的变换或标签 |
| 截取编辑器视口截图 |
| 移动编辑器视口相机 |
| 查看资产的引用关系 |
使用示例
连接后,你可以用自然语言对 AI 说:
"在原点创建一个 10 米高的柱子"
"把场景里所有 PointLight 的强度改成 5000"
"截一张图看看当前场景"
"列出场景里所有的 StaticMeshActor"
"创建一个蓝色的平面当水面"
"把相机移到 (1000, 500, 300) 看看效果"
AI 会自动调用对应的 MCP 工具,通过 Remote Execution 在编辑器中执行操作。
UE 版本兼容性
UE 版本 | 状态 |
UE 4.26 | ✅ 完全支持(已验证) |
UE 4.27 | ✅ 应该支持 |
UE 5.0+ | ✅ 应该支持(未测试) |
UE 4.26 注意事项:
set_editor_property不触发PostEditChangeProperty回调,因此依赖此回调的功能(如 OpenDriveActor 的路网生成)需要在编辑器 UI 中手动操作。
故障排除
连接超时:
确认编辑器正在运行
确认
DefaultEngine.ini中bRemoteExecution=True检查防火墙是否阻止了 UDP 6766 端口
执行错误:
Python 代码必须以
import unreal开头某些 API 在打包版本中不可用,仅限编辑器内使用
License
MIT
Publish status (2026-09-22): live on GitHub → https://github.com/lusilong/ue4-mcp-server CSDN walkthrough: see docs/csdn_post.md (translated copy on the Desktop).
This server cannot be deployed
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to control Unreal E…
Control Unreal Engine to browse assets, import content, and manage levels and sequences. Automate…
AI video editor for agents and humans: timeline, captions, color, audio and generation as MCP tools.
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Related MCP Servers
- AlicenseBqualityAmaintenanceEnables AI assistants to control Unreal Engine via Remote Control API for game development automation, including asset management, actor control, level editing, animation, physics, visual effects, and cinematics creation through natural language.11,167 npm888MIT
- FlicenseCqualityDmaintenanceEnables natural language interaction with Unreal Engine, providing 127 tools across 16 subsystems for tasks like actor manipulation, asset management, blueprint creation, and more, using built-in Python and Remote Control plugins.1006-
- FlicenseAqualityCmaintenanceBridges AI assistants to Unreal Engine 5 editor, enabling direct manipulation of levels, actors, Blueprints, and Animation Blueprints through natural language commands.163-
- AlicenseAqualityDmaintenanceEnables AI assistants to interact with Unreal Engine via Remote Control API for actor, asset, level, and editor operations.2215 npmMIT