使用说明
项目简介
Unreal Engine MCP Server 是一个基于 Model Context Protocol (MCP) 的服务器,旨在连接 Claude Desktop 和 Unreal Engine 5.3。它允许用户通过 Claude 的自然语言指令,在 Unreal Engine 编辑器中创建和操作 3D 对象,实现文本到 3D 场景生成的初步应用。
主要功能点
- 基于文本提示创建基础 3D 对象:支持创建立方体、球体、圆柱体、平面和圆锥体等基本形状,并可自定义位置、旋转、缩放和颜色。
- 基于蓝图创建 Actor:允许通过指定蓝图路径在场景中生成预设的 Actor,例如建筑、道具和角色等。
- 场景物体操作:支持修改场景中现有对象的位置、旋转、缩放、颜色和可见性。
- 资源发现:可以搜索和列出 Unreal Engine 项目中的可用资源,例如蓝图、网格体和材质等。
- 获取关卡信息:获取当前 Unreal Engine 关卡中所有 Actor 的信息。
安装步骤
-
环境准备
- 确保已安装 Python 3.10+ 环境。
- 安装 Unreal Engine 5.3 并启用 Remote Control API 插件 (默认启用,请检查插件管理器)。
- 确保已安装 Claude Desktop 客户端 (Windows 系统)。
-
下载仓库 使用 Git 克隆仓库到本地:
git clone https://github.com/runeape-sats/unreal-mcp.git cd unreal-mcp -
安装依赖 在仓库目录下,使用 pip 安装所需的 Python 库:
pip install uv mcp requests
服务器配置
要将 Unreal Engine MCP Server 集成到 Claude Desktop,您需要编辑 Claude Desktop 的配置文件 'claude_desktop_config.json'。
- 打开 Claude Desktop,点击 'File' -> 'Settings' -> 'Developer' -> 'Edit Config' 打开 'claude_desktop_config.json' 文件。
- 在 'claude_desktop_config.json' 文件中,找到 '"mcpServers": { ... }' 部分,添加以下 JSON 配置。如果不存在 'mcpServers' 字段,请手动创建。
{ "mcpServers": { "unreal-mcp": { // 服务器名称,可以自定义,用于在 Claude Desktop 中标识 "command": "uv", // 启动服务器的命令,这里使用 uv (pip install 安装) 或 python "args": ["--directory", "\\path\\to\\unreal-mcp", "run", "unreal_mcp_server.py"], // 启动参数,--directory 指定仓库路径,run 和 unreal_mcp_server.py 是运行服务器的固定参数 "env": {} // 环境变量,通常为空 } } }
注意:
- 请将 '"\path\to\unreal-mcp"' 替换为您本地仓库的绝对路径。例如 '"C:\Users\YourName\unreal-mcp"'。
- 如果您已经配置了其他 MCP 服务器,请注意服务器名称不要冲突。如果遇到冲突,可以尝试禁用其他服务器。
基本使用方法
-
启动 Unreal Engine 打开 Unreal Engine 5.3,并加载您的项目。确保 Remote Control API 插件已启用。
-
启动 Claude Desktop 重启 Claude Desktop 客户端 (需要完全退出,包括系统托盘图标)。Claude Desktop 会加载新的 MCP 服务器配置。
-
使用 Claude 与 Unreal Engine 互动 在 Claude Desktop 中,可以使用自然语言提示词来指示 Unreal Engine 创建、编辑 3D 对象或查询场景信息。例如:
- 'Create a red cube at position 100, 200, 50' (创建一个红色立方体在指定位置)
- 'Spawn a bench from the blueprint at /Game/CustomAsset/Blueprints/BP_Bench01' (从指定蓝图路径生成一个长椅)
- 'Move the cube to position 0, 0, 100 and rotate it 45 degrees' (移动立方体到指定位置并旋转)
- 'List all blueprint assets in the /Game/CustomAsset folder' (列出指定路径下的所有蓝图资源)
- 'Get information about the current level' (获取当前关卡信息)
您可以参考 'README.md' 文件中 "Example Prompts" 部分获取更多示例。
开发模式运行服务器: 如果您需要进行开发或调试,可以使用 'mcp' 命令行工具在开发模式下运行服务器:
pip install mcp[cli] mcp dev unreal_mcp_server.py
注意事项
- 确保 先启动 Unreal Engine,再启动 Claude Desktop。
- 检查 Unreal Engine 的 Remote Control API 插件 是否已启用。
- 如果遇到连接问题,请检查防火墙设置,确保端口 '30010' 没有被阻止。
- 查看服务器控制台输出日志,可以帮助您诊断问题。
信息
分类
桌面与硬件