内容
# minecraft-schematic-lab
通过与 Claude 交谈,构建 Minecraft 示意图。描述您想要的内容,它会生成一个 WorldEdit Sponge `.schem` 文件,并在浏览器中提供实时的 3D 预览。所有操作都在本地运行 — 无需账户,无需云服务。
## 设置
您需要 **Node 22+** 和 **Claude Code**(命令行界面或桌面应用程序)。只需添加一次连接器 — 以下任一方法均适用于命令行界面和桌面应用程序,因为它们共享相同的配置。
<details>
<summary><b>一键添加</b> (使用 <code>claude</code> 命令行界面)</summary>
<br>
macOS / Linux:
```bash
claude mcp add --scope user minecraft-schematic-lab -- npx -y github:SimoneRecchia/minecraft-schematic-lab --mcp
```
Windows — `npx` 需要 `cmd /c` 包装器:
```bat
claude mcp add --scope user minecraft-schematic-lab -- cmd /c npx -y github:SimoneRecchia/minecraft-schematic-lab --mcp
```
如果找不到 `claude`,桌面应用程序不附带命令行界面 — 安装它,打开新的终端,然后再次运行命令:
- **macOS** — `brew install --cask claude-code` (或 `curl -fsSL https://claude.ai/install.sh | bash`)
- **Linux** — `curl -fsSL https://claude.ai/install.sh | bash`
- **Windows** — `winget install Anthropic.ClaudeCode` (或 `irm https://claude.ai/install.ps1 | iex`)
</details>
<details>
<summary><b>手动添加</b> (编辑配置文件)</summary>
<br>
在您的 Claude 配置文件中 — `~/.claude.json`(`%USERPROFILE%\.claude.json` 在 Windows 上),或 `claude_desktop_config.json` 在 Claude 桌面聊天应用程序中 — 添加以下块。
macOS / Linux:
```json
{
"mcpServers": {
"minecraft-schematic-lab": {
"command": "npx",
"args": ["-y", "github:SimoneRecchia/minecraft-schematic-lab", "--mcp"]
}
}
}
```
Windows:
```json
{
"mcpServers": {
"minecraft-schematic-lab": {
"command": "cmd",
"args": ["/c", "npx", "-y", "github:SimoneRecchia/minecraft-schematic-lab", "--mcp"]
}
}
}
```
</details>
重启 Claude Code 以使其拾取连接器,然后请求:
> 为我建造一个 50×40×80 的幻想城堡
第一次运行会通过 `npx` 拉取工具;然后 3D 预览会在 <http://127.0.0.1:8765> 打开。
## 使用它
- **修改它** — "把屋顶改成砖块", "添加两个塔楼"。预览会自动刷新。
- **导出** — 浏览器中的 **导出 .schem** 按钮,或询问 Claude(Sponge v2 或 v3)。
- **在 Minecraft 中** — 将 `.schem` 文件放入您世界的 `schematics` 文件夹,然后 `//schem load <name>` 和 `//paste`。
- **版本** — 要求 Claude 在文件夹中版本化构建(需要 git)。
- **更新** — 连接器跟随 `main` 分支;使用 `#v0.1.0` 固定版本,或使用 `npm cache clean --force` 清除过时缓存。
## 平台支持
| 操作系统 | 命令行界面 | 桌面应用程序 | 注意 |
| ------------------------------- | :-: | :---------: | -------------------------------- |
| macOS (Intel / Apple Silicon) | ✅ | ✅ | |
| Windows 10/11 (x64 / ARM64) | ✅ | ✅ | `npx` 需要 `cmd /c`(参见设置) |
| Linux (x64 / ARM64, incl. musl) | ✅ | — | Linux 上无桌面应用程序 |
所有平台均需 Node 22+;不支持 32 位。
## 开发
```bash
pnpm setup # 安装 + 构建
pnpm dev # 网页(5173)+ 服务器(8765),热重载
pnpm test # vitest
pnpm bundle # 重建 bundle/ 以供 npx 连接器使用(服务器更改后提交)
```
架构、MCP 工具、HTTP API 和 BuildSpec 格式均在 [`CLAUDE.md`](CLAUDE.md) 中有文档。
## 许可证
MIT © 2026 SimoneRecchia