返回市场
Minecraft-MCP服务器

Minecraft-MCP服务器

作者:yuniko-software398 星标更新:2025-11-13

项目介绍

Minecraft MCP 服务器

<a href="https://github.com/yuniko-software/minecraft-mcp-server/actions"> <img alt="CI" src="https://github.com/yuniko-software/minecraft-mcp-server/actions/workflows/build.yml/badge.svg"> </a> <a href="https://github.com/yuniko-software"> <img alt="欢迎贡献" src="https://img.shields.io/badge/Contribution-Welcome-blue"> </a> <a href="https://github.com/yuniko-software/minecraft-mcp-server/releases/latest"> <img alt="最新发布" src="https://img.shields.io/github/v/release/yuniko-software/minecraft-mcp-server?label=Latest%20Release"> </a> <img width="2063" height="757" alt="image" src="https://gips3.baidu.com/it/u=1428175245,252508528&fm=3081&app=3081&f=PNG?w=2063&h=757" />

[!重要] 目前支持 Minecraft 版本 1.21.8。更新版本可能无法与该 MCP 服务器兼容,但我们会尽快添加支持。

https://github.com/user-attachments/assets/6f17f329-3991-4bc7-badd-7cde9aacb92f

一个由大型语言模型驱动并通过 Mineflayer API 运行的 Minecraft 机器人。此机器人使用 Model Context Protocol (MCP) 来使 Claude 和其他支持的模型控制 Minecraft 角色。

<a href="https://glama.ai/mcp/servers/@yuniko-software/minecraft-mcp-server"> <img width="380" height="200" src="https://gips3.baidu.com/it/u=2070230697,1845288496&fm=3081&app=3081&f=PNG?w=760&h=400" alt="mcp-minecraft MCP 服务器" /> </a>

先决条件

  • Git
  • Node.js (>= 20.10.0)
  • 正在运行的 Minecraft 游戏(以下设置已测试过 Minecraft 1.21.8 Java 版本,包括在 Microsoft Game Pass 中)
  • 一个与 MCP 兼容的客户端。这里以 Claude Desktop 为例,但其他 MCP 客户端也受支持

开始使用

此机器人旨在通过 Model Context Protocol (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 服务器可能需要一些时间。成功启动服务器的标志如下图所示:

<img width="885" height="670" alt="image" src="https://gips3.baidu.com/it/u=2896371241,2121004955&fm=3081&app=3081&f=PNG?w=885&h=670" />

您可以通过任何活跃的 Claude Desktop 聊天向机器人发送任何命令。您还可以上传建筑物图片并让机器人构建它们 😁

别忘了在提示中提到机器人应该在 Minecraft 中做些什么。因为这样说可以触发 MCP 服务器的运行。它会请求您的权限。

使用 Claude Sonnet 可能会带来一些有趣的结果。机器人代理会非常聪明 🫡

示例用法:共享 Claude 聊天

可用命令

一旦连接到 Minecraft 服务器,Claude 可以使用以下命令:

移动

  • get-position - 获取机器人的当前位置
  • move-to-position - 移动到特定坐标
  • look-at - 让机器人看向特定坐标
  • jump - 让机器人跳跃
  • move-in-direction - 在特定方向上移动一段持续时间

飞行

  • fly-to - 让机器人直接飞往特定坐标

存储

  • list-inventory - 列出机器人存储中的所有物品
  • find-item - 在存储中查找特定物品
  • equip-item - 装备特定物品

方块交互

  • place-block - 在指定坐标放置方块
  • dig-block - 在指定坐标挖掘方块
  • get-block-info - 获取关于方块的信息
  • find-block - 查找最近的特定类型方块

实体交互

  • find-entity - 查找最近的特定类型实体

通信

  • send-chat - 发送游戏内聊天消息
  • read-chat - 获取玩家最近的聊天消息

游戏状态

  • detect-gamemode - 检测游戏模式

贡献

欢迎提交拉取请求或开启问题以改进项目。所有重构提交、功能和测试贡献、问题和讨论都深受欢迎!

要开始贡献,请参阅 CONTRIBUTING.md


⭐ 如果您觉得这个项目有用,请考虑在 GitHub 上给它一个星! ⭐

您的支持有助于让更多可能受益于该项目的人看到它。