MCP Tools

模组

· 作者 Mr_Potato

为 Minecraft 添加 MCP 支持,使 AI 能够与游戏进行交互

0 本站下载 0 关注 更新于 3 个月前

需要前置:Fabric API

最新 1.0.1 · 26.2 · Fabric

一键开服(送7天)

描述

本模组为 Minecraft 添加了 MCP(模型上下文协议)支持,允许 AI(例如 ChatBot、Agent、本地模型)与游戏、实体和玩家进行交互。

这使得 AI 模型能够使用以下工具执行任务:
  • 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

游戏内命令

这些命令可以在游戏中用于查看一些信息:

  • /mcp status
  • /mcp start
  • /mcp stop
  • /mcp restart
  • /mcp token [show|generate] (仅在启用身份验证时可用)
  • /mcp config [port|requireAuth|broadcast|readOnly] [value]
  • /mcp help

配置文件

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
}

集成

1. Claude (Code & Desktop)、VS Code 扩展(例如 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. 直接 HTTP 和自定义脚本/工具

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(需要使用 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())

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源