Unreal Engine MCP Python Bridge Plugin
一个实现了 MCP 服务器的虚幻引擎插件,允许 MCP 客户端访问 UE 编辑器的 Python API。
appleweed
README
Unreal Engine MCP Python 桥接插件
这是一个 Unreal Engine (UE) 的插件,它创建了 模型上下文协议 (MCP) 的服务器实现。 这允许 MCP 客户端,例如 Anthropic 的 Claude,访问完整的 UE Python API。
使用场景
- 使用像 Claude 这样的代理在 Python 中开发工具和工作流程。
- 智能和动态地自动化这些工作流程。
- 与代理进行一般的协作开发。
前提条件
- Visual Studio 2019 或更高版本。
- 一个 AI 代理。下面,我们假设将使用 Claude。但是任何实现 MCP 的 AI 代理都应该足够。
- 启用 Python Editor Script 插件的 Unreal Engine 5。
- 请注意 Unreal Engine Python API。
安装
- 创建一个新的 Unreal Engine C++ 项目。
- 在项目根目录下,找到
Plugins
文件夹。 - 将此 repo 克隆到
Plugins
文件夹中,以便创建一个新的包含文件夹,其中包含所有项目内容。 - 右键单击您的 UE 项目文件(以
.uproject
结尾),然后选择“Generate Visual Studio project files”(生成 Visual Studio 项目文件)。如果您没有立即看到该选项,请先选择“Show more options”(显示更多选项),它应该会出现。 - 打开您的新 Visual Studio 项目并构建。
- 将
unreal_mcp_client.py
从 'MCPClient' 文件夹复制到您选择的位置。 - 找到您的
claude_desktop_config.json
配置文件。 Mac 位置:~/Library/Application\ Support/Claude/claude_desktop_config.json
Windows 位置:[path_to_your_user_account]\AppData\Claude\claude_desktop_config.json
- 将
unreal-engine
服务器部分添加到您的配置文件,并更新路径位置,不包括方括号,如下所示。 Mac 路径格式:/[path_from_step_4]/unreal_mcp_client.py
Windows 路径格式:C:\\[path_from_step_4]\\unreal_mcp_client.py
{
"mcpServers": {
"unreal-engine": {
"command": "python",
"args": [
"[mac_or_windows_format_path_to_unreal_mcp_client.py]"
]
}
}
}
- 启动 Unreal Engine 并加载您的新项目。
- 启用新的
UnrealMCPBridge
插件,然后重新启动。 - 应该有一个新的工具栏按钮,当您用鼠标悬停时,它会显示“Start MCP Bridge”(启动 MCP 桥)。
- 单击 MCP Bridge 按钮。将弹出一个窗口,显示“MCP Python bridge running.”(MCP Python 桥正在运行。)输出日志将记录一个新的套接字服务器正在 127.0.0.1:9000 上监听。
- 以管理员身份启动 Claude。
- 单击“Attach from MCP”(从 MCP 附加)插件图标。在“Choose an integration”(选择一个集成)下,有两个测试提示:
create_castle
和create_town
。您可以在插件的Content
文件夹下的unreal_server_init.py
中编辑它们的实现。请务必在进行任何更改后重新启动 Unreal Engine。 - 或者,要求 Claude 使用 UE Python API 在您的项目中构建。
- 单击插件图标左侧的锤子图标,可以找到当前已实现的工具列表。
开发新工具和提示
查看 unreal_mcp_client.py
,您将看到 MCP 如何使用函数上方的 Python 装饰器定义工具和提示。例如:
@mcp.tool()
def get_project_dir() -> str:
"""Get the top level project directory"""
result = send_command("get_project_dir")
if result.get("status") == "success":
response = result.get("result")
return response
else:
return json.dumps(result)
这会将 get_project_dir
命令发送到 Unreal Engine 以供执行,并返回当前项目的项目级别目录。在插件的 Content
文件夹下,您将看到此工具命令的服务器端实现:
@staticmethod
def get_project_dir():
"""Get the top level project directory"""
try:
project_dir = unreal.Paths.project_dir()
return json.dumps({
"status": "success",
"result" : f"{project_dir}"
})
except Exception as e:
return json.dumps({ "status": "error", "message": str(e) })
按照此模式创建新工具,这些工具将出现在 Claude 桌面界面中的锤子图标下。
实现新提示是将它们添加到 unreal_mcp_client.py
中。例如,这是 unreal_mcp_client.py
中的 create_castle
提示:
@mcp.prompt()
def create_castle() -> str:
"""Create a castle"""
return f"""
Please create a castle in the current Unreal Engine project.
0. Refer to the Unreal Engine Python API when creating new python code: https://dev.epicgames.com/documentation/en-us/unreal-engine/python-api/?application_version=5.5
1. Clear all the StaticMeshActors in the scene.
2. Get the project directory and the content directory.
3. Find basic shapes to use for building structures.
4. Create a castle using these basic shapes.
"""
请务必保留三引号,以便返回整个提示。迭代创建提示的一个好方法是简单地使用 Claude 迭代每个步骤编号,直到获得令人满意的结果。然后将它们全部组合成一个编号的逐步提示,如所示。
您必须重新启动 Claude 才能使对 unreal_mcp_client.py
的任何更改生效。请注意,对于 Windows,您可能需要在任务管理器中结束 Claude 进程才能真正重新启动 Claude。
推荐服务器
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
MCP Package Docs Server
促进大型语言模型高效访问和获取 Go、Python 和 NPM 包的结构化文档,通过多语言支持和性能优化来增强软件开发。
Claude Code MCP
一个实现了 Claude Code 作为模型上下文协议(Model Context Protocol, MCP)服务器的方案,它可以通过标准化的 MCP 接口来使用 Claude 的软件工程能力(代码生成、编辑、审查和文件操作)。
@kazuph/mcp-taskmanager
用于任务管理的模型上下文协议服务器。它允许 Claude Desktop(或任何 MCP 客户端)在基于队列的系统中管理和执行任务。
mermaid-mcp-server
一个模型上下文协议 (MCP) 服务器,用于将 Mermaid 图表转换为 PNG 图像。
Jira-Context-MCP
MCP 服务器向 AI 编码助手(如 Cursor)提供 Jira 工单信息。

Linear MCP Server
一个模型上下文协议(Model Context Protocol)服务器,它与 Linear 的问题跟踪系统集成,允许大型语言模型(LLM)通过自然语言交互来创建、更新、搜索和评论 Linear 问题。

Sequential Thinking MCP Server
这个服务器通过将复杂问题分解为顺序步骤来促进结构化的问题解决,支持修订,并通过完整的 MCP 集成来实现多条解决方案路径。
Curri MCP Server
通过管理文本笔记、提供笔记创建工具以及使用结构化提示生成摘要,从而实现与 Curri API 的交互。