跳到正文

MCP Tools

作者:Mr_Potato

Adds MCP support to Minecraft, to allow AIs to interact with the game

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

Description

This mod adds MCP (Model Context Protocol) support for Minecraft, allowing AIs (eg, ChatBot, Agent, Local Models) to interact with the game, entities and players.

This allows AI models to perform tasks using these tools:
  • get_block
  • get_blocks_area
  • set_block
  • fill_blocks
  • break_block
  • get_biome
  • get_heightmap
  • get_light_level
  • get_player_info
  • teleport_player
  • move_player
  • look_at
  • get_inventory
  • select_hotbar_slot
  • give_item
  • clear_inventory
  • get_nearby_entities
  • spawn_entity
  • interact_with_entity
  • execute_command
  • send_chat
  • get_chat_history
  • get_world_info
  • set_time
  • set_weather
  • scan_surroundings
  • build_schematic
  • build_sphere
  • build_cylinder

In Game Commands

These commands can be used in game to see some info:

  • /mcp status
  • /mcp start
  • /mcp stop
  • /mcp restart
  • /mcp token [show|generate] (Only when Authentication is enabled)
  • /mcp config [port|requireAuth|broadcast|readOnly] [value]
  • /mcp help

Configuration File

minecraft-mcp.json

{
  "enabled": true,
  "port": 25560,
  "host": "127.0.0.1",
  "requireAuth": false,
  "authToken": "",
  "allowCommandExecution": true,
  "allowWorldModification": true,
  "broadcastToChat": true,
  "readOnlyMode": false,
  "maxBlocksPerOperation": 32768
}

Integration

1. Claude (Code & Desktop), VS Code Extensions (eg, Cline, Roo)

{
  "mcpServers": {
    "minecraft": {
      "url": "http://127.0.0.1:25560/sse",
      "transport": "sse"
    }
  }
}

2. Cursor, Codex CLI

{
  "mcpServers": {
    "minecraft": {
      "url": "http://127.0.0.1:25560/sse"
    }
  }
}

3. Antigravity (IDE & CLI), Windsurf, Codeium, VSCodium

{
  "mcpServers": {
    "minecraft": {
      "serverUrl": "http://127.0.0.1:25560/sse"
    }
  }
}

4. Direct HTTP and Custom Scripts/Tools

cURL / Rest

curl -X POST http://127.0.0.1:25560/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_player_status","arguments":{}}}'

Python (Need to use MCP SDK)

import asyncio
from mcp import ClientSession
from mcp.client.sse import sse_client

async def main():
    async with sse_client("http://127.0.0.1:25560/sse") as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()
            tools = await session.list_tools()
            print([t.name for t in tools.tools])

asyncio.run(main())

常见问题

MCP Tools 支持哪些 Minecraft 版本?

MCP Tools 支持 Minecraft Java 版 26.1–26.2,共 4 个版本,可用的加载器:Fabric。下载时注意选择和你游戏版本一致的文件。

MCP Tools 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:客户端 / 服务端。

评论

登录后评论和评分

Mr_Potato 的其他作品

查看全部 →