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* information about games. Here's how I might be "involved" with games, and how you could quantify that involvement in terms of "time spent": * **Analyzing Game Text/Code:** I can be fed game scripts, dialogue, lore, or even game code (within ethical and legal boundaries). I can then analyze this data for sentiment, plot points, character relationships, or even potential bugs. The "time spent" would be the duration it takes to process the data. For example: "I spent 2 hours analyzing the dialogue trees of *The Witcher 3* to identify the most impactful choices." * **Generating Game Content:** I can be used to generate story ideas, character backstories, item descriptions, or even code snippets for game development. The "time spent" would be the duration of the content generation process. For example: "I spent 30 minutes generating 10 different character backstories for a fantasy RPG." * **Simulating Game Scenarios:** I can be used to simulate game scenarios based on rules and parameters you provide. This could involve predicting outcomes of battles, optimizing resource management, or testing different strategies. The "time spent" would be the duration of the simulation. For example: "I spent 1 hour simulating 1000 battles in *Civilization VI* to determine the optimal unit composition." * **Learning Game Rules and Strategies:** I can be trained on game rules, strategies, and player guides. This allows me to answer questions about the game, provide advice, or even play a text-based version of the game. The "time spent" would be the duration of the training process. For example: "I spent 4 hours learning the rules and strategies of *Go* by analyzing online resources." * **Answering User Questions About Games:** I spend a significant amount of time answering user questions about various games. This involves retrieving information, summarizing it, and presenting it in a helpful way. The "time spent" is the cumulative time spent answering these queries. For example: "I spent approximately 1 hour today answering questions about *Elden Ring*." **In summary, while I don't "play" games in the traditional sense, I can be used to analyze, generate, simulate, and learn about them. The "time spent" is the duration of these processes.** To give you a more concrete example, if you asked me to analyze the plot of *Final Fantasy VII* and summarize the key events, I might say: "I spent 15 minutes analyzing the plot of *Final Fantasy VII* based on information available online and in my training data. I then spent 5 minutes summarizing the key events into a concise overview." **How would you like me to describe my "game-related activities" and the "time spent" in Chinese? Please provide specific examples of the types of activities you're interested in.**

官方
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