这是一个基于TypeScript的MCP(模型上下文协议)服务器,它能通过WebSocket连接提供控制Minecraft基岩版的工具。
git clone https://github.com/Mming-Lab/minecraft-bedrock-mcp-server.git
cd minecraft-bedrock-mcp-server
npm install
npm run build
npm start
npm start
默认端口:8001
准备Minecraft世界
从Minecraft进行连接 在Minecraft基岩版的聊天框中输入:
/connect localhost:8001/ws
该服务器实现了MCP(模型上下文协议)标准,可与任何兼容的MCP客户端配合使用。
示例:Claude Desktop配置
找到配置文件:
%APPDATA%\Claude\claude_desktop_config.json~/Library/Application Support/Claude/claude_desktop_config.json~/.config/Claude/claude_desktop_config.json添加服务器配置:
{
"mcpServers": {
"minecraft-bedrock-mcp-server": {
"command": "node",
"args": ["path/to/dist/server.js"]
}
}
}
{
"mcpServers": {
"minecraft-bedrock-mcp-server": {
"command": "node",
"args": ["path/to/dist/server.js", "--port=8002"]
}
}
}
对于其他MCP客户端,请参考其各自的文档进行服务器注册。
player_position - 获取玩家当前位置player_move - 将玩家移动/传送到指定坐标player_say - 以玩家身份发送消息agent_move - 向指定方向或坐标移动代理 ✅agent_turn - 让代理向左/右转向或设置特定旋转角度 ✅agent_attackagent_block_actionworld_block - 世界方块操作(设置、获取、破坏)world_fill - 用高级选项填充区域world_time_weather - 控制时间和天气build_cube - 建造实心或空心立方体build_line - 在两点之间建造直线build_sphere - 建造实心或空心球体send_message - 发送聊天消息execute_command - 执行任何Minecraft命令为贡献者和开发者提供了全面的文档。如需详细的设置指南和架构文档,请联系维护者。
# 克隆仓库
git clone https://github.com/Mming-Lab/minecraft-bedrock-mcp-server.git
cd minecraft-bedrock-mcp-server
# 安装依赖
npm install
# 构建项目
npm run build
# 启动服务器
npm start
# 自定义端口配置
{
"mcpServers": {
"minecraft-bedrock-mcp-server": {
"command": "node",
"args": ["path/to/dist/server.js", "--port=8002"]
}
}
}
npm run build # 将TypeScript编译为JavaScript
npm start # 启动编译后的服务器
npm run dev # 一步完成构建和启动
服务器端口可以通过命令行参数进行配置:
--port=8002 - 设置自定义端口8001src/
├── server.ts # 主服务器实现
├── types.ts # TypeScript类型定义
└── tools/ # 工具实现
├── base/tool.ts # 抽象基类
├── player/ # 玩家控制工具
├── agent/ # 代理控制工具
├── world/ # 世界操作工具
└── build/ # 建筑工具
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)本项目采用MIT许可证 - 详情请参阅 LICENSE 文件。
服务器无法启动:
netstat -ano | findstr :8001--port=8002 指定不同端口Minecraft连接失败:
/connect localhost:8001/ws
MCP客户端集成问题:
EADDRINUSE:端口已被占用 - 尝试使用不同端口Connection refused:服务器未运行或端口错误unknown message purpose ws:encrypt:连接设置期间正常现象