注意:这是一个学习性质的项目,作者不再主动维护,但欢迎社区贡献和改进
将 AI Agent 智能集成到 Minecraft 中 - 通过大语言模型让 AI 理解游戏世界、执行任务、与玩家对话、自主建造。
MCAA (Minecraft AI Agent) 是一个 Fabric 模组,将大语言模型 (LLM) 的强大能力带入 Minecraft 世界。通过多 Agent 协作架构,AI 可以理解游戏环境、执行复杂任务、与玩家对话,甚至自主建造结构。
- Master Agent - 主控 Agent,负责理解玩家意图并协调其他 Agent
- Commander Agent - 指挥 Agent,执行命令和脚本查询
- Builder Agent - 建造 Agent,负责方块放置和结构建造
- Scout Agent - 侦查 Agent,收集环境信息和截图
| 类别 | 工具 | 功能 |
|---|---|---|
| 侦查 | scan_area |
扫描指定区域的方块信息 |
| 侦查 | get_block_detail |
获取特定方块的详细信息 |
| 侦查 | get_player_status |
获取玩家状态(生命值、位置等) |
| 侦查 | get_inventory_content |
查看物品栏内容 |
| 侦查 | get_environment_info |
获取环境信息(天气、时间等) |
| 侦查 | find_path |
寻路到指定位置 |
| 侦查 | capture_screenshot |
捕获游戏截图 |
| 建造 | build_structure |
根据蓝图建造结构 |
| 建造 | fill_region |
填充区域 |
| 建造 | undo_last_build |
撤销上次建造 |
| 指挥 | execute_command |
执行 Minecraft 命令 |
| 指挥 | execute_script |
执行 JavaScript 脚本 |
| 指挥 | query_knowledge |
查询内置知识库 |
| 主控 | delegate_agent |
委托任务给特定 Agent |
| 主控 | reply_to_player |
回复玩家消息 |
内置 Mozilla Rhino JavaScript 引擎,提供安全的沙箱执行环境:
BlockApi- 方块操作PlayerApi- 玩家操作WorldApi- 世界操作EntityApi- 实体操作InventoryApi- 物品栏操作CommandApi- 命令执行UtilityApi- 工具函数
- Web UI 配置界面 (http://localhost:9178)
- 可视化记忆系统
- 内置 Minecraft 知识库
- 支持多种 LLM API(OpenAI 兼容接口)
- 关键词触发(默认
@AI) - 断路器保护机制
- Minecraft 1.21.11
- Fabric Loader 0.18.4+
- Fabric API
- Java 21+
- 安装 Fabric Loader(参考 Fabric 官网)
- 下载 Fabric API
- 下载 MCAA 最新版本
- 将模组放入
.minecraft/mods目录
- 启动游戏
- 在浏览器打开 http://localhost:9178
- 配置以下信息:
- API 端点 - LLM API 地址(如 OpenAI、本地 Ollama 等)
- API Key - 认证密钥
- 模型 ID - 要使用的模型名称
配置文件位于 .minecraft/config/mcaa.json,支持热重载。
/mcaa <你的问题或指令>
在聊天框中输入包含触发词的消息(默认 @AI):
@AI 帮我在当前位置建造一座小房子
# 克隆仓库
git clone https://github.com/enabot81/MCAA.git
cd MCAA
# 构建项目
./gradlew buildsrc/
├── main/
│ ├── java/org/ena/mcaa/
│ │ ├── agent/ # Agent 实现
│ │ ├── api/ # LLM API 客户端
│ │ ├── config/ # 配置管理
│ │ ├── interaction/ # 交互处理
│ │ ├── knowledge/ # 知识库
│ │ ├── memory/ # 记忆系统
│ │ ├── network/ # 网络通信
│ │ ├── script/ # 脚本引擎
│ │ ├── tool/ # 工具实现
│ │ ├── webui/ # Web 界面
│ │ └── ...
│ └── resources/
│ ├── assets/ # 资源文件
│ ├── web/ # Web UI 资源
│ └── fabric.mod.json
└── client/ # 客户端专用代码
欢迎提交 Issue 和 Pull Request!
- Fork 本仓库
- 创建功能分支 (
git checkout -b feature/AmazingFeature) - 提交更改 (
git commit -m 'Add some AmazingFeature') - 推送到分支 (
git push origin feature/AmazingFeature) - 提交 Pull Request
本项目基于 MIT 许可证 开源。
MCAA (Minecraft AI Agent) is a Fabric mod that brings the power of Large Language Models (LLM) into Minecraft. Through a multi-agent collaborative architecture, the AI can understand the game environment, execute complex tasks, chat with players, and even build structures autonomously.
- Master Agent - The orchestrator agent responsible for understanding player intent and coordinating other agents
- Commander Agent - The commander agent that executes commands and script queries
- Builder Agent - The builder agent handling block placement and structure building
- Scout Agent - The scout agent that gathers environment information and screenshots
| Category | Tool | Description |
|---|---|---|
| Scout | scan_area |
Scan block information in a specified area |
| Scout | get_block_detail |
Get detailed information about a specific block |
| Scout | get_player_status |
Get player status (health, position, etc.) |
| Scout | get_inventory_content |
View inventory contents |
| Scout | get_environment_info |
Get environment info (weather, time, etc.) |
| Scout | find_path |
Find path to a specified location |
| Scout | capture_screenshot |
Capture game screenshot |
| Builder | build_structure |
Build structure based on blueprint |
| Builder | fill_region |
Fill a region with blocks |
| Builder | undo_last_build |
Undo the last build operation |
| Commander | execute_command |
Execute Minecraft commands |
| Commander | execute_script |
Execute JavaScript scripts |
| Commander | query_knowledge |
Query built-in knowledge base |
| Master | delegate_agent |
Delegate task to a specific agent |
| Master | reply_to_player |
Reply to player messages |
Built-in Mozilla Rhino JavaScript engine with secure sandbox execution environment:
BlockApi- Block operationsPlayerApi- Player operationsWorldApi- World operationsEntityApi- Entity operationsInventoryApi- Inventory operationsCommandApi- Command executionUtilityApi- Utility functions
- Web UI configuration interface (http://localhost:9178)
- Visual memory system
- Built-in Minecraft knowledge base
- Support for multiple LLM APIs (OpenAI compatible endpoints)
- Keyword triggering (default:
@AI) - Circuit breaker protection mechanism
- Minecraft 1.21.11
- Fabric Loader 0.18.4+
- Fabric API
- Java 21+
- Install Fabric Loader (see Fabric website)
- Download Fabric API
- Download the latest version of MCAA
- Place the mod in
.minecraft/modsdirectory
- Launch the game
- Open http://localhost:9178 in your browser
- Configure the following:
- API Endpoint - LLM API address (e.g., OpenAI, local Ollama, etc.)
- API Key - Authentication key
- Model ID - The model name to use
Configuration file is located at .minecraft/config/mcaa.json, supports hot reload.
/mcaa <your question or command>
Enter a message containing the trigger word (default @AI) in chat:
@AI Help me build a small house at my current location
# Clone the repository
git clone https://github.com/enabot81/MCAA.git
cd MCAA
# Build the project
./gradlew buildsrc/
├── main/
│ ├── java/org/ena/mcaa/
│ │ ├── agent/ # Agent implementations
│ │ ├── api/ # LLM API client
│ │ ├── config/ # Configuration management
│ │ ├── interaction/ # Interaction handling
│ │ ├── knowledge/ # Knowledge base
│ │ ├── memory/ # Memory system
│ │ ├── network/ # Network communication
│ │ ├── script/ # Script engine
│ │ ├── tool/ # Tool implementations
│ │ ├── webui/ # Web UI
│ │ └── ...
│ └── resources/
│ ├── assets/ # Resource files
│ ├── web/ # Web UI resources
│ └── fabric.mod.json
└── client/ # Client-only code
Issues and Pull Requests are welcome!
- Fork this repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License.
Made with ❤️ by ENA