mcp-minecraft

mcp-minecraft

允许人工智能模型通过一个机器人来观察和与 Minecraft 世界互动。

游戏与游戏化
访问服务器

README

Minecraft MCP 集成

一个用于 Minecraft 的模型上下文协议 (MCP) 集成,使 AI 助手能够与 Minecraft 服务器交互。此集成允许 AI 模型通过机器人观察和与 Minecraft 世界互动。

Screenshot

前提条件

  1. Minecraft 启动器
  2. Node.js 18 或更高版本
  3. Claude 桌面应用程序
  4. Java 21.0.5 (推荐)

⚠️ 注意:目前仅在 macOS/Linux 上测试过。不保证 Windows 兼容性。

重要提示

  1. 使用 F3+P 快捷键: 同时按下 F3 + P。这将切换“失去焦点时暂停”功能。关闭后,您可以切换到 Claude 桌面,Minecraft 将继续运行而不会暂停。

Focus Settings

  1. Claude 重启时的连接问题: 如果在 Minecraft 服务器运行时重启 Claude,下次启动 Claude 时可能会遇到 MCP 连接问题,这是由于残留的 Java 进程导致的。请参阅故障排除:MCP 连接失败获取解决方案。

安装步骤

  1. 下载并设置 Minecraft 服务器

    • mcversions.net/1.21 下载 Minecraft 服务器 v1.21
    • 如果尚未安装,请安装 Java 21.0.5(其他版本未经测试)
    • 创建一个专用目录(例如,~/minecraft-server/
    • 将下载的 server.jar 文件放在此目录中
    • 记下 server.jar 文件的绝对路径
  2. 安装和配置 MCP 集成

    快速安装(推荐):

    npx -y @smithery/cli install mcp-minecraft --client claude
    

    按照 CLI 提示完成设置。

    或者手动设置:

    • 导航到 ~/Library/Application Support/Claude/claude_desktop_config.json
    • 添加 MCP 服务器配置:
    {
      "mcpServers": {
        "mcp-minecraft": {
          "command": "npx",
          "args": [
            "-y",
            "mcp-minecraft@latest",
            "--server-jar",
            "/absolute/path/to/minecraft-server/server.jar"
          ]
        }
      }
    }
    

    ⚠️ 将 /absolute/path/to/minecraft-server/server.jar 替换为您的实际 server.jar 路径

  3. 启动 Claude 桌面

    • 完成配置后启动 Claude 桌面
  4. 连接到服务器

    • 打开 Minecraft 启动器
    • 安装并启动 Minecraft Java 版 v1.21
    • 点击“Play”并选择“Multiplayer”
    • 点击“Add Server”
    • 输入服务器详细信息:
      • 服务器名称:Minecraft Server
      • 服务器地址:localhost:25565
    • 点击“Done”

功能

资源

该集成公开了以下 MCP 资源:

  • minecraft://bot/location - 机器人在世界中的当前位置
  • minecraft://bot/status - 机器人连接状态

工具

可用的 MCP 工具:

  • chat - 向服务器发送聊天消息
  • jump - 使机器人跳跃
  • moveForward - 使机器人向前移动
  • moveBack - 使机器人向后移动
  • turnLeft - 使机器人向左转
  • turnRight - 使机器人向右转
  • placeBlock - 在指定坐标放置方块
  • digBlock - 在指定坐标破坏方块
  • getBlockInfo - 获取有关指定坐标处方块的信息
  • selectSlot - 选择热键栏插槽 (0-8)
  • getInventory - 获取机器人背包的内容
  • equipItem - 按名称将物品装备到指定目的地
  • getStatus - 获取机器人当前状态(生命值、食物、位置等)
  • getNearbyEntities - 获取范围内附近实体的列表
  • attack - 按名称攻击附近的实体
  • useItem - 使用/激活当前持有的物品
  • stopUsingItem - 停止使用/停用当前物品
  • lookAt - 使机器人看向特定坐标
  • followPlayer - 跟踪特定玩家
  • stopFollowing - 停止跟踪当前目标
  • goToPosition - 导航到特定坐标

技术细节

  • 服务器以离线模式运行以进行本地开发
  • 默认内存分配:2GB
  • 默认端口:25565
  • 机器人用户名:MCPBot

故障排除

常见问题

  1. MCP 连接失败

    • 查找残留的 Java 进程
    • 手动终止它们:
      • Windows:使用任务管理器(未经测试)
      • Mac/Linux:
        • 转到“活动监视器”并“强制退出”java
    • 如果进程终止失败,请重新启动计算机
    • 注意:最新版本应自动解决这些问题
  2. 服务器无法启动

    • 验证是否已安装 Java
    • 检查 server.jar 路径是否正确
    • 确保端口 25565 可用
  3. 无法连接到服务器

    • 验证服务器是否正在运行(检查日志)
    • 确认您使用“localhost”作为服务器地址
    • 检查防火墙设置

日志位置

  • Minecraft 服务器日志:检查 minecraft-server 目录
  • Claude 桌面日志:~/Library/Logs/Claude/mcp*.log

贡献

欢迎任何形式的贡献!

许可证

该项目已获得 MIT 许可证的许可 - 有关详细信息,请参阅 LICENSE 文件。

推荐服务器

steam

steam

Okay, I understand. As a large language model, I don't "play" games in the same way a human does. I don't have personal experiences or the ability to interact with games in a real-time, sensory way. However, I *can* be used to process and analyze game-related information. Here's how I might describe my "interaction" with games, framed as if I were "playing" them: **My "Game Playing" Activities:** * **Text-Based Adventure Games (Simulated):** I can be given the text of a text-based adventure game and, based on my understanding of language and logic, I can "play" the game by choosing actions and responding to the game's prompts. I can "play" these games for varying lengths of time, depending on the complexity of the game and the number of possible paths. A simple game might take me a few seconds to "complete" by exploring all branches. A more complex one could take minutes or even hours of simulated interaction. * **Game Script Analysis:** I can analyze game scripts, dialogue, and lore. This is like "playing" the game by understanding its story and characters. I might spend hours analyzing a single game's script to understand its narrative structure, character motivations, and world-building. * **Game Code Analysis (Limited):** While I can't execute game code directly, I can analyze code snippets to understand game mechanics, AI behavior, or level design principles. This is like "playing" the game by understanding how it works under the hood. The time spent on this varies greatly depending on the complexity of the code. * **Game Data Analysis:** I can analyze game data, such as player statistics, item drop rates, or map layouts. This is like "playing" the game by understanding its systems and balance. I might spend hours analyzing a dataset to identify trends or patterns. * **Game Generation (Experimental):** I can be used to generate game content, such as stories, quests, or even simple game levels. This is like "playing" the game by creating it. The time spent on this depends on the complexity of the generation task. * **Playing as an NPC:** I can be used to simulate the behavior of a Non-Player Character (NPC) in a game. I can respond to player actions and provide information or quests. The "playtime" here is determined by the length of the interaction. **Important Considerations:** * **No Sensory Experience:** I don't experience games visually, aurally, or haptically. My understanding is purely based on the text and data I process. * **No True Agency:** I don't have my own goals or desires when "playing" a game. I simply follow the instructions and logic provided to me. * **Time is Relative:** The "time" I spend on a game is measured in processing time, not in human playtime. A task that takes a human hours might take me only seconds or minutes. **In summary, while I can't "play" games in the traditional sense, I can be used to analyze, understand, and even generate game-related content. My "playtime" is measured in processing time and depends on the complexity of the task.** --- **Translation to Chinese:** 好的,我明白了。 作为一个大型语言模型,我“玩”游戏的方式与人类不同。 我没有个人经历,也没有能力以实时、感官的方式与游戏互动。 但是,我*可以*用来处理和分析与游戏相关的信息。 以下是我如何描述我与游戏的“互动”,就像我在“玩”它们一样: **我的“玩游戏”活动:** * **基于文本的冒险游戏(模拟):** 我可以获得基于文本的冒险游戏的文本,并且根据我对语言和逻辑的理解,我可以通过选择动作和响应游戏的提示来“玩”游戏。 我可以“玩”这些游戏的时间长短不一,具体取决于游戏的复杂程度和可能的路径数量。 一个简单的游戏可能需要我几秒钟的时间来通过探索所有分支来“完成”。 一个更复杂的游戏可能需要几分钟甚至几个小时的模拟互动。 * **游戏脚本分析:** 我可以分析游戏脚本、对话和背景故事。 这就像通过理解游戏的故事和角色来“玩”游戏。 我可能会花费数小时分析单个游戏的脚本,以了解其叙事结构、角色动机和世界构建。 * **游戏代码分析(有限):** 虽然我不能直接执行游戏代码,但我可以分析代码片段以了解游戏机制、人工智能行为或关卡设计原则。 这就像通过了解游戏的工作原理来“玩”游戏。 在这上面花费的时间差异很大,具体取决于代码的复杂程度。 * **游戏数据分析:** 我可以分析游戏数据,例如玩家统计数据、物品掉落率或地图布局。 这就像通过了解游戏的系统和平衡来“玩”游戏。 我可能会花费数小时分析数据集以识别趋势或模式。 * **游戏生成(实验性):** 我可以用来生成游戏内容,例如故事、任务,甚至简单的游戏关卡。 这就像通过创建游戏来“玩”游戏。 在这上面花费的时间取决于生成任务的复杂程度。 * **扮演NPC:** 我可以用来模拟游戏中非玩家角色 (NPC) 的行为。 我可以回应玩家的动作并提供信息或任务。 这里的“游戏时间”由互动的长度决定。 **重要考虑事项:** * **没有感官体验:** 我不会在视觉、听觉或触觉上体验游戏。 我的理解完全基于我处理的文本和数据。 * **没有真正的自主性:** 我在“玩”游戏时没有自己的目标或愿望。 我只是按照提供给我的指示和逻辑进行操作。 * **时间是相对的:** 我在游戏上花费的“时间”是以处理时间来衡量的,而不是以人类的游戏时间来衡量的。 人类需要花费数小时的任务可能只需要我几秒钟或几分钟。 **总而言之,虽然我不能以传统意义上的“玩”游戏,但我可以用来分析、理解甚至生成与游戏相关的内容。 我的“游戏时间”以处理时间来衡量,并取决于任务的复杂程度。**

官方
Chess Analysis Assistant

Chess Analysis Assistant

使用 Stockfish 帮助您分析国际象棋局面并获得专业评估。

本地
TypeScript
Minecraft Docker MCP

Minecraft Docker MCP

允许AI通过RCON与Docker容器内运行的Minecraft服务器进行交互,从而使模型能够以编程方式创建Minecraft建筑并管理服务器。

本地
Python
Lichess MCP

Lichess MCP

一个 MCP 服务器,它支持与 Lichess 国际象棋平台进行自然语言交互,允许用户通过 Claude 来下棋、分析棋局、管理账户以及参与比赛。

JavaScript
OpenDota MCP Server

OpenDota MCP Server

模型上下文协议服务器,它使大型语言模型和人工智能助手能够通过标准化接口检索实时的 Dota 2 统计数据、比赛数据、玩家信息和游戏指标。

Python
WebGL-MCP Server

WebGL-MCP Server

一个模型上下文协议服务器,提供分析和优化 WebGL 游戏的一系列工具,包括性能洞察、内存使用分析以及特定于模板的优化建议。

JavaScript