一个由Mineflayer API驱动的Minecraft MCP服务器。它能够实时控制一个Minecraft角色,允许AI助手通过自然语言指令构建结构、探索世界以及与游戏环境进行互动。
189 查看 · 2026-07-07 更新
简介
一个由Mineflayer API驱动的Minecraft MCP服务器。它能够实时控制一个Minecraft角色,允许AI助手通过自然语言指令构建结构、探索世界以及与游戏环境进行互动。
简介
一个由Mineflayer API驱动的Minecraft MCP服务器。它能够实时控制一个Minecraft角色,允许AI助手通过自然语言指令构建结构、探索世界以及与游戏环境进行互动。
Minecraft MCP 服务器
⚠️ 重要兼容性警告:截至2025年3月25日,Minecraft 1.21.5刚刚发布。此机器人目前不兼容Minecraft 1.21.5。请使用Minecraft 1.21.4,直到我们发布支持1.21.5的更新。
一个由大型语言模型和Mineflayer API驱动的Minecraft机器人。该机器人使用模型上下文协议 (MCP) 来使Claude和其他支持的模型能够控制Minecraft角色。
前提条件
- Node.js
- 正在运行的Minecraft游戏(以下设置已通过Microsoft Game Pass中包含的Minecraft 1.21.4 Java版测试)
- Claude Desktop
开始使用
此机器人设计为通过模型上下文协议 (MCP) 与Claude Desktop一起使用。
运行Minecraft
创建一个单人世界并将其开放到局域网 (ESC -> 打开到局域网)。机器人将尝试使用端口25565和主机名localhost进行连接。这些参数可以在下一步中的claude_desktop_config.json文件中配置。
MCP 配置
确保Claude Desktop已安装。打开文件 -> 设置 -> 开发者 -> 编辑配置。它应该会打开安装目录。找到名为claude_desktop_config.json的文件,并插入以下代码:
{ "mcpServers": { "minecraft": { "command": "npx", "args": [ "-y", "github:yuniko-software/minecraft-mcp-server", "--host", "localhost", "--port", "25565", "--username", "ClaudeBot" ] } } }
仔细检查是否使用了正确的--port和--host参数。确保完全重启Claude Desktop应用程序(应在操作系统托盘中关闭)。
运行
确保Minecraft游戏正在运行并且世界已开放到局域网。然后启动Claude Desktop应用程序,机器人应加入游戏。
Claude Desktop启动MCP服务器可能需要一些时间。成功启动服务器的标志是聊天旁边出现锤子图标。
您可以通过任何活动的Claude Desktop聊天给机器人发送任何命令。您还可以上传建筑物的图片并要求机器人建造它们 😁
别忘了在提示中提到机器人应该在Minecraft中做什么。因为说这句话是触发运行MCP服务器的触发器。它会请求您的权限。
使用Claude 3.7 Sonnet可能会给您带来一些有趣的结果。机器人代理将会非常聪明 🫡
示例用法:共享的Claude聊天
可用命令
一旦连接到Minecraft服务器,Claude可以使用以下命令:
移动
get-position- 获取机器人的当前位置move-to-position- 移动到特定坐标look-at- 让机器人看向特定坐标jump- 让机器人跳跃move-in-direction- 向特定方向移动一段时间
库存
list-inventory- 列出机器人库存中的所有物品find-item- 在库存中查找特定物品equip-item- 装备特定物品
方块交互
place-block- 在指定坐标放置一个方块dig-block- 在指定坐标挖掘一个方块get-block-info- 获取关于一个方块的信息find-block- 找到最近的特定类型的方块
实体交互
find-entity- 找到最近的特定类型的实体
通信
send-chat- 在游戏中发送聊天消息
贡献
这个应用程序是在短短两天内完成的,代码非常简单和直接。所有重构提交、功能和测试贡献、问题和讨论都非常欢迎!
请随时提交拉取请求或打开问题以进行改进。一些可以增强的领域包括:
- 额外的文档
- 更强大的错误处理
- 不同组件的测试
- 新的功能和命令
工具列表
-
get-position: Get the current position of the bot
-
move-to-position: Move the bot to a specific position
-
look-at: Make the bot look at a specific position
-
jump: Make the bot jump
-
move-in-direction: Move the bot in a specific direction for a duration
-
list-inventory: List all items in the bot's inventory
-
find-item: Find a specific item in the bot's inventory
-
equip-item: Equip a specific item
-
place-block: Place a block at the specified position
-
dig-block: Dig a block at the specified position
-
get-block-info: Get information about a block at the specified position
-
find-block: Find the nearest block of a specific type
-
find-entity: Find the nearest entity of a specific type
-
send-chat: Send a chat message in-game
服务配置
[{'mcpServers': {'minecraft': {'args': ['-y', 'github:yuniko-software/minecraft-mcp-server', '--host', 'localhost', '--port', '25565', '--username', 'ClaudeBot'], 'command': 'npx'}}}]