UE资产工具包
 
一个MCP服务器,允许AI编码代理在不启动编辑器的情况下检查虚幻引擎资源。解析 .uasset 直接二进制文件,构建搜索索引,并公开两个工具-- unreal_search 和 inspect_asset --通过MCP。
在行动中(Lyra入门游戏)
需求
- .NET 8 SDK或更高版本(用于C#资产解析器)
- Python 3.10+
安装
git clone --recursive https://github.com/bradenleague/UE-Agent-Asset-Toolkit
cd UE-Agent-Asset-Toolkit
python -m venv .venv
source .venv/bin/activate # macOS/Linux
# .venv\Scripts\activate # Windows
pip install -e .这将安装两个CLI入口点:
unreal-agent-toolkit--指标管理unreal-agent-mcp--MCP服务器
注: UAssetAPI 子模块的大小约为70MB,因此初始克隆可能需要一分钟。有关构建详细信息,请参见 贡献.md.
可选依赖关系
pip install -e ".[embeddings]" # vector embeddings (sentence-transformers)
pip install -e ".[dev]" # pytest + coverage快速开始
# 1. Build the parser and configure your project
python setup.py /path/to/YourProject.uproject
# 2. Build the search index
unreal-agent-toolkit
# 3. Connect to your MCP client (see below)setup.py 构建C#解析器,安装Python包,并注册您的 .uproject.添加 --index 将步骤1和2结合起来。
MCP客户端设置
在MCP客户端配置中注册服务器:
{
"mcpServers": {
"unreal": {
"command": "unreal-agent-mcp"
}
}
}如果你没有 pip install -e .,请使用完整的Python路径:
{
"mcpServers": {
"unreal": {
"command": "/path/to/.venv/bin/python",
"args": ["/path/to/UE-Agent-Asset-Toolkit/unreal_agent/mcp_server.py"]
}
}
}看 mcp-config.example.json 用于复制粘贴模板。
MCP工具
unreal_search
搜索资产和C++源代码。自动检测搜索模式:
| 查询 | 模式 |
|---|---|
"BP_Player" | 名称完全匹配 |
"player health widget" | 语义/全文搜索 |
"where is BP_Enemy used" | 参考文献搜索 |
"inherits:LyraGameplayAbility" | 继承搜索 |
"tag:Ability.Melee.*" | 游戏标签搜索 |
inspect_asset
返回特定资产的结构化数据:
- 蓝图:父类、组件、函数、变量、图
- 小部件蓝图:小部件树层次结构、绑定
- 材料:参数(标量、向量、纹理)、域
- 数据表:行结构、列、示例数据
索引
unreal-agent-toolkit # full index (default)
unreal-agent-toolkit --plugins # include plugin content
unreal-agent-toolkit --plugins --embed # + vector embeddings
unreal-agent-toolkit --source # C++ source (UCLASS, UPROPERTY)
unreal-agent-toolkit --profile quick # high-value types only
unreal-agent-toolkit --path UI # only Content/UI/
unreal-agent-toolkit --force # re-index everything
unreal-agent-toolkit --status # show index stats这 --path 选项使用虚幻虚拟路径(UI 地图到 Content/UI/).
多项目设置
unreal-agent-toolkit add "/path/to/MyGame.uproject"
unreal-agent-toolkit list
unreal-agent-toolkit use mygame每个项目都有一个独立的SQLite数据库 unreal_agent/data/ .db.
建筑
MCP Client (Claude Desktop, Claude Code, etc.)
│
▼
MCP Server (Python, stdio)
├── unreal_search → SQLite FTS5 index
└── inspect_asset → C# AssetParser → .uasset binariesC#解析器(资产API)阅读 .uasset 文件直接。Python层构建FTS5搜索索引,并通过MCP提供结果。
已知限制
- 只读 --无法修改资产
- UE版本覆盖 --针对UE 5.5进行测试;较新版本的格式可能不受支持
- 类型检测 --默认情况下使用命名约定(BP\_、WBP\_、DT\_);在中创建配置文件
unreal_agent/profiles/针对特定项目类型
许可证
- 资产分析器/非递归代理:MIT
- 资产API:参见 UAssetAPI/许可证
