该项目受到 mcp-minecraft 的启发。虽然原始项目仅支持本地 Minecraft 服务器连接,但本项目从零开始创建,以添加对远程 Minecraft 服务器连接的支持。
使用 MCP(模型上下文协议)进行 Minecraft 远程控制。
要通过 Smithery 自动安装 Minecraft 远程控制到 Claude Desktop:
npx -y @smithery/cli install @nacal/mcp-minecraft-remote --client claude
npx -y @smithery/cli install mcp-minecraft-remote --client claude
按照 CLI 提示完成设置。
# 从 npm 安装
npm install -g mcp-minecraft-remote
# 或者克隆仓库
git clone https://github.com/nacal/mcp-minecraft-remote.git
cd mcp-minecraft-remote
# 安装依赖
npm install
# 构建项目
npm run build
导航到 Claude Desktop 配置文件:
%APPDATA%\Claude\claude_desktop_config.json~/Library/Application Support/Claude/claude_desktop_config.json~/.config/Claude/claude_desktop_config.json将 Minecraft 远程控制 MCP 配置添加到您的配置文件中:
{
"mcpServers": {
"minecraft-remote": {
"command": "npx",
"args": ["-y", "mcp-minecraft-remote@latest"]
}
}
}
如果您已全局安装:
{
8"mcpServers": {
"minecraft-remote": {
"command": "mcp-minecraft-remote"
}
}
}
如果您已本地克隆了仓库:
{
"mcpServers": {
"minecraft-remote": {
"command": "node",
"args": ["/absolute/path/to/mcp-minecraft-remote/build/index.js"]
}
}
}
server.properties 文件中设置 online-mode=false。这允许机器人无需验证即可连接到 Minecraft 的会话服务器。connectToServer: 使用指定凭据连接到 Minecraft 服务器disconnectFromServer: 从 Minecraft 服务器断开连接sendChat: 向服务器发送聊天消息getServerInfo: 获取有关已连接服务器的信息getPosition: 获取当前玩家位置moveTo: 移动到特定坐标moveControl: 基本移动控制(前进、后退、左转、右转、跳跃、冲刺、潜行、停止)lookAt: 让玩家看向特定方向或坐标digBlock: 在特定坐标挖掘方块placeBlock: 在特定坐标放置方块checkInventory: 基本库存检查inventoryDetails: 获取关于库存物品的详细信息equipItem: 将库存中的物品装备到手中或护甲槽tossItem: 投掷库存中的物品getNearbyPlayers: 获取附近玩家列表getNearbyEntities: 获取附近所有实体的列表attackEntity: 攻击特定实体useOnEntity: 对特定实体使用手持物品followEntity: 跟随特定实体openContainer: 在特定坐标打开容器(箱子、熔炉等)withdrawItem: 从打开的容器中取出物品depositItem: 将物品放入打开的容器closeContainer: 关闭当前打开的容器getRecipes: 获取可用的制作配方列表craftItem: 使用现有材料制作物品listTrades: 列出附近村民提供的可用交易tradeWithVillager: 与附近的村民进行交易注意:此工具已在 vanilla Minecraft 1.21 中测试并验证其功能。尽管它可能适用于其他版本或修改过的服务器,但兼容性无法保证。
MIT