Skip to main content
Glama

EggTart 🥚

MCBE WebSocket 工具集 — 区域管理、建造、查询、MCP 服务

功能

  • 剑追踪选点 — 持下界合金剑右键依次选点1→点2→创建区域

  • 木剑删除 — 持木剑指向已有区域,右键直接删除

  • 区域粒子框 — 实时粒子框可视化区域边界

  • 含水检测 — 检测方块是否含水

  • 扫描到文件 — 三阶段并发扫描区域方块数据,输出 JSON

  • JS 脚本批量建造 — VM 沙箱执行 JS,用 setBlock/fillBlock 相对坐标放置方块

  • MCP 集成 — 7 个工具供 LLM 直接操控游戏

Related MCP server: MCP_repo

快速开始

npm install

编辑 config.json:

{
  "playerName": "你的游戏名",
  "port": "8000"
}

启动:

npm run build
npm start

游戏内执行 /wsserver localhost:8000 连接,控制台出现 "EggTart 已就绪" 即成功。

MCP 集成

EggTart 内置 MCP 服务器(stdio 传输),注册了 7 个工具:

工具

说明

mcbe_create_region_at

框选坐标并创建区域

mcbe_list_regions

列出所有区域及大小

mcbe_get_region

查询指定区域详情

mcbe_delete_region

删除区域

mcbe_scan_region

扫描区域方块到文件(性能警告)

mcbe_run_command

执行 MCBE 命令并返回输出

mcbe_run_script

在区域内执行 JS 建造脚本

mcbe_get_player_info

获取玩家位置、朝向、维度

opencode.json 配置

项目级(opencode.json,放在 EggTart 目录下):

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "eggtart": {
      "type": "local",
      "command": ["node", "dist/main.js"]
    }
  }
}

全局配置(~/.config/opencode/opencode.json)需写绝对路径:

{
  "mcp": {
    "eggtart": {
      "type": "local",
      "command": ["node", "<替换为 EggTart 的绝对路径>/dist/main.js"]
    }
  }
}

其他 MCP 客户端(Claude Code 等)格式类似:

{
  "mcpServers": {
    "eggtart": {
      "command": "node",
      "args": ["<替换为 EggTart 的绝对路径>/dist/main.js"]
    }
  }
}

游戏内操作

操作

效果

持下界合金剑右键方块

选点1 → 选点2 → 创建区域

切换快捷栏再切回

状态保持,继续选点

持木剑指向区域右键

删除指向的区域

!help

查看聊天命令列表

!setp1/!setp2

手动设置选点

!block

查询方块信息

!waterlog

检测方块含水

!scan

扫描区域到文件

!ticking

管理常加载区块

架构

config.json → Server → GameLoop(限速100) → WorldInitialize
                         ↓
                    MCP Server (stdio)
  • GameLoop 队列限速 100 并发,超过时自动排队

  • Lane 系统为粒子、区域框等高频率操作使用独立通道

  • 路径解析 自动适配 tsx 开发模式和 node dist/ 编译模式

  • 语言数据 按检测到的游戏语言懒加载,不预读全部

  • MCP 服务 和 WS 服务在同进程中启动,通过 GameLoop.instance 全局访问

开发

npm run dev      # tsx watch 热重载(开发用)
npm run build    # 编译到 dist/
npm run lint     # ESLint 检查
npm run test     # Vitest 测试

提交前需保证 npm run lint 和 npm run build 零错误。

致谢

许可证

MIT © 1cyberlangke1

Available Tools

8 tools
mcbe_create_region_atCreate MCBE RegionC

Create a cuboid region from two corner coordinates

Inputs: x1 (required), x2 (required), y1 (required), y2 (required), +3 more.

mcbe_delete_regionDelete MCBE RegionB

Delete a region by name

Inputs: name (required).

mcbe_get_player_infoGet Player InfoB

Get player position, facing direction, and dimension

Inputs: no named parameters.

mcbe_get_regionGet MCBE RegionB

Get region details: coordinates, dimensions, and volume

Inputs: name (required).

mcbe_list_regionsList MCBE RegionsA

List all saved regions with positions and sizes

Inputs: no named parameters.

mcbe_run_commandRun MCBE CommandB

Execute any Minecraft command and return raw output as seen in-game. For setblock/fill use JSON states, e.g. 'setblock ~ ~ ~ minecraft:oak_stairs {"weirdo_direction":0,"upside_down_bit":true}'. Common: facing_direction(0-5=down/up/north/south/west/east), weirdo_direction(0-3), upside_down_bit(true/false), open_bit(true/false), pillar_axis(x/y/z), direction(0-3).

Inputs: command (required).

mcbe_run_scriptRun MCBE ScriptA

Execute a JS script inside a region. Coordinates are relative (0,0,0 = region min corner). Provides setBlock(rx,ry,rz,blockId,states?) and fillBlock(rx1,ry1,rz1,rx2,ry2,rz2,blockId,states?). Supports loops, conditionals, variables. Common MCBE block states: facing_direction(0-5=down/up/north/south/west/east), weirdo_direction(0-3), upside_down_bit(true/false), open_bit(true/false), pillar_axis(x/y/z), direction(0-3). Example: setBlock(0,0,0,'minecraft:oak_stairs',{weirdo_direction:0,upside_down_bit:true})

Inputs: name (required), script (required), timeout.

mcbe_scan_regionScan MCBE RegionA

Heavy operation: scan every block in a region and save results to a JSON file. Only call when user explicitly requests scanning. Reuses existing scan files when possible.

Inputs: name (required), path (required), states, waterlog, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 8 tools

    Disambiguation4/5

    Most tools have clearly distinct scope: region CRUD (create/list/get/delete), scan, player info, and two execution tools. The main overlap is mcbe_run_command vs mcbe_run_script, since both can place blocks, but the descriptions clarify that one runs raw game commands and the other runs batched JS with region-relative helpers. mcbe_get_region vs mcbe_scan_region also touch similar territory but the 'heavy operation / explicit request only' warning separates them.

    Naming Consistency4/5

    All tools share the mcbe_ prefix and follow a verb_noun pattern (get_region, delete_region, scan_region, run_command, list_regions). The only minor deviation is mcbe_create_region_at, whose trailing '_at' locative breaks the otherwise clean pattern, and create could arguably be aligned with the other region verbs.

    Tool Count5/5

    Eight tools is well within the ideal range and each one maps to a distinct capability: region lifecycle, scanning, player lookup, and command/script execution. Nothing feels padded or redundant at the count level.

    Completeness4/5

    Region lifecycle is fully covered (create, list, get, delete), plus scanning and two execution paths for mutation, so core workflows have no dead ends. Minor gaps remain: no tool to resize/rename/edit an existing region, and no direct single-block read (only the expensive full scan).

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      A Minecraft MCP Server powered by Mineflayer API. It allows to control a Minecraft character in real-time, allowing AI assistants to build structures, explore the world, and interact with the game environment through natural language instruction
      22
      66 npm
      822
      Apache 2.0
    • A
      license
      A
      quality
      B
      maintenance
      An MCP server that enables LLMs to control Discord servers via a bot token, providing comprehensive management tools for messages, members, roles, channels, permissions, and more.
      67
      58 npm
      MIT
    • F
      license
      C
      quality
      D
      maintenance
      An MCP server that exposes Discord bot actions as tools for LLM clients.
      29
      1
      -