? MCP Server 模组
通过直接将 AI 助手连接到你的游戏,彻底改变 Minecraft 体验!
MCP Server 模组实现了 Model Context Protocol (MCP) 标准,创建了一个可流式传输的 HTTP 服务器,允许 Claude、GPT 等大型语言模型及其他 AI 助手通过结构化命令与你的 Minecraft 世界进行交互。
✨ 此模组的功能
该模组在 8080 端口上运行一个可流式传输的 HTTP 服务器,接受 MCP 协议请求,使 AI 助手能够:
- ?️ 构建结构:通过执行放置命令
- ? 分析你的世界:扫描方块区域
- ? 获取玩家信息:包括位置、生命值和物品栏
- ? 控制游戏机制:通过安全的命令执行
?️ 可用工具
1. execute_commands - 命令执行
使用全面的安全验证执行 Minecraft 命令:
- 支持的命令:
fill,setblock,clone,summon,tp,give,gamemode,effect,enchant,weather,time,say - 安全限制:防止破坏性操作,如大规模实体击杀或过度修改区域
- 结果追踪:返回有关方块更改、实体生成和命令结果的详细信息
2. get_player_info - 综合玩家状态
获取玩家的详细信息:
- 位置:精确坐标 (x, y, z) 和方块位置
- 朝向:面对方向、偏航角/俯仰角、基本方位
- 计算出的位置:用于建造的前方位置(前方 3 个方块)
- 生命值与状态:生命值、饥饿值、经验值
- 游戏状态:当前维度、世界时间、游戏模式
- 物品栏:选中槽位、主手/副手物品
适用于:上下文感知的建造、基于玩家相对位置的命令、状态监控
3. get_blocks_in_area - 世界分析
扫描矩形区域以分析结构:
- 方块检测:返回指定区域内的所有非空气方块
- 区域限制:可配置的最大区域大小(默认:50x50x50)
- 结构分析:非常适合了解现有建筑
- 建造规划:在施工前检查区域
4. take_screenshot - 视觉检查
捕获当前 Minecraft 游戏屏幕作为 MCP 图像响应。
- 可选相机定位:提供
x,y,z可在捕获前传送 - 可选视角控制:提供
yaw,pitch可设置相机方向 - 图像输出:返回 Base64 PNG (
image/png) 供 AI 直接分析 - 非常适合建造质量保证:直观验证结构形状、方块放置和环境
- 支持版本 1.1.1+mc1.21.11
重要行为:
- 如果提供了
x,y,z,玩家将传送。 - 如果提供了
yaw,pitch,玩家视角将改变。
? 使用方法
安装
- 为 Minecraft 1.21.4 安装 Fabric Loader 0.16.14+
- 安装 Fabric API 0.119.3+1.21.4
- 将此模组放入你的 mods 文件夹
- 启动 Minecraft - MCP 服务器将在 自动启动
⚠️ 重要提示:命令权限
在使用 AI 命令工具之前,必须允许输入命令:
- 单人游戏:创建世界时,将 Allow Cheats(允许作弊) 设置为 ON(开启)
- 多人游戏 / 专用服务器:玩家必须拥有命令权限(OP 或等效的服务器权限)
⚠️ 重要提示:禁用“失去焦点时暂停”
关键步骤:你必须禁用 Minecraft 的“失去焦点时暂停”设置,以便在应用程序之间切换时允许 AI 交互:
- 在游戏中按 F3 + P 关闭“失去焦点时暂停”
- 你会看到一条确认设置已更改的消息
如果不进行此更改,每次切换到 AI 编辑器时游戏都会暂停,导致命令无法正确执行。
连接 AI 代码编辑器(直接支持)
Cursor IDE
- 在 Cursor 设置中添加 MCP 服务器配置
- 使用 HTTP 传输:
- 开始使用能控制 Minecraft 的 AI 辅助编码!
{
"mcpServers": {
"minecraft": {
"url": "http://localhost:8080/mcp"
}
}
}
Windsurf IDE
- 在 Windsurf 中配置 MCP 连接
- 连接到:
- 启用 AI 驱动的 Minecraft 交互
VS Code 配合扩展
- GitHub Copilot:配置 MCP 集成
- Roo Code:直接支持 HTTP MCP
- 其他 MCP 扩展:兼容可流式传输的 HTTP 传输
连接其他 AI 助手
Claude Code
由于 Claude Code 使用 stdio 传输,你需要一个代理:
- 安装 mcp-proxy 或类似的 stdio 到 HTTP 桥接器
- 配置代理以转换 stdio ↔ 可流式传输 HTTP
- 将 Claude Code 连接到代理
示例 AI 交互
“为我建一个小房子” → AI 使用 get_player_info 找到你的位置,然后使用 execute_commands 放置方块
“我周围有哪些方块?”→ AI 使用 get_blocks_in_area 扫描附近区域并报告发现
“清空这个区域并建造一个农场” → AI 组合使用多种工具进行分析、清理和建造
? 技术细节
- 可流式传输 HTTP 传输:通过 HTTP 实现完整的 MCP 协议支持
- 客户端模组:完全在 Minecraft 客户端内运行
- 符合标准:实现了官方 Model Context Protocol 规范
- 方块压缩:自动优化方块更改表示
- 聊天捕获:监控命令输出和游戏响应
- 分离环境:使用 Fabric 的客户端/主源分离
- 综合日志记录:详细的操作日志用于调试
? 故障排除
服务器无法启动?
- 检查端口 8080 是否可用
- 验证是否安装了 Fabric API
- 检查日志中的配置错误
AI 无法连接?
- 确保防火墙允许 localhost:8080
- 验证 MCP 客户端是否支持 HTTP 传输
- 对于 stdio 客户端,请使用 mcp-proxy 桥接
命令无法使用?
- 确认您拥有适当的权限
- 检查「失去焦点时暂停」已禁用(F3+P)
- 审查命令语法和限制
游戏持续暂停?
- 确保「失去焦点时暂停」处于关闭状态(F3+P)
- 这对于多任务处理时的 AI 交互至关重要
? 链接
- 源代码:
- 问题追踪器:
- MCP 规范:
- Fabric 文档:
? MCP Server Mod
Transform your Minecraft experience by connecting AI assistants directly to your game!
MCP Server Mod implements the Model Context Protocol (MCP) standard, creating a streamable HTTP server that allows Large Language Models like Claude, GPT, and other AI assistants to interact with your Minecraft world through structured commands.
✨ What This Mod Does
This mod runs a streamable HTTP server on port 8080 that accepts MCP protocol requests, enabling AI assistants to:
- ?️ Build structures by executing placement commands
- ? Analyze your world by scanning block areas
- ? Get player information including position, health, and inventory
- ? Control game mechanics through safe command execution
?️ Available Tools
1. execute_commands - Command Execution
Execute Minecraft commands with comprehensive safety validation:
- Supported commands:
fill,setblock,clone,summon,tp,give,gamemode,effect,enchant,weather,time,say - Safety limits: Prevents destructive operations like mass entity killing or excessive area modifications
- Result tracking: Returns detailed information about block changes, entity spawns, and command outcomes
2. get_player_info - Comprehensive Player Status
Get detailed information about the player:
- Position: Exact coordinates (x, y, z) and block positions
- Orientation: Facing direction, yaw/pitch, cardinal direction
- Calculated positions: Front position for building (3 blocks ahead)
- Health & Status: Health, food level, experience
- Game state: Current dimension, world time, game mode
- Inventory: Selected slot, main hand/off-hand items
Perfect for: Context-aware building, player-relative commands, status monitoring
3. get_blocks_in_area - World Analysis
Scan rectangular areas to analyze structures:
- Block detection: Returns all non-air blocks in specified area
- Area limits: Configurable maximum area size (default: 50x50x50)
- Structure analysis: Perfect for understanding existing builds
- Build planning: Check areas before construction
4. take_screenshot - Visual Inspection
Capture the current Minecraft game screen as an MCP image response.
- Optional camera positioning: provide
x,y,zto teleport before capture - Optional view control: provide
yaw,pitchto set camera direction - Image output: returns Base64 PNG (
image/png) for direct AI analysis - Great for build QA: verify structure shape, block placement, and surroundings visually
- Supported from version 1.1.1+mc1.21.11
Important behavior:
- If
x,y,zare provided, the player is teleported. - If
yaw,pitchare provided, the player view is changed.
? How to Use
Installation
- Install Fabric Loader 0.16.14+ for Minecraft 1.21.4
- Install Fabric API 0.119.3+1.21.4
- Place this mod in your mods folder
- Launch Minecraft - the MCP server starts automatically on
⚠️ Important: Command Permissions
Before using AI command tools, command input must be allowed:
- Single Player: When creating a world, set Allow Cheats to ON
- Multiplayer / Dedicated Server: The player must have command permission (OP or equivalent server permission)
⚠️ Important: Disable "Pause on Lost Focus"
CRITICAL STEP: You must disable Minecraft's "Pause on Lost Focus" setting to allow AI interactions while switching between applications:
- Press F3 + P in-game to toggle off "Pause on Lost Focus"
- You'll see a message confirming the setting change
Without this change, the game will pause every time you switch to your AI editor, preventing commands from executing properly.
Connecting AI Code Editors (Direct Support)
Cursor IDE
- Add MCP server configuration in Cursor settings
- Use HTTP transport:
- Start coding with AI assistance that can control Minecraft!
{
"mcpServers": {
"minecraft": {
"url": "http://localhost:8080/mcp"
}
}
}
Windsurf IDE
- Configure MCP connection in Windsurf
- Connect to:
- Enable AI-powered Minecraft interactions
VS Code with Extensions
- GitHub Copilot: Configure MCP integration
- Roo Code: Direct HTTP MCP support
- Other MCP extensions: Compatible with streamable HTTP transport
Connecting Other AI Assistants
Claude Code
Since Claude Code uses stdio transport, you'll need a proxy:
- Install mcp-proxy or similar stdio-to-HTTP bridge
- Configure proxy to convert stdio ↔ streamable HTTP
- Connect Claude Code to the proxy
Example AI Interactions
"Build me a small house" → AI uses get_player_info to find your location, then execute_commands to place blocks
"What blocks are around me?"→ AI uses get_blocks_in_area to scan nearby areas and reports findings
"Clear this area and build a farm" → AI combines multiple tools to analyze, clear, and construct
? Technical Details
- Streamable HTTP transport: Full MCP protocol support over HTTP
- Client-side mod: Runs entirely in the Minecraft client
- Standards-compliant: Implements official Model Context Protocol specification
- Block compression: Automatically optimizes block change representations
- Chat capture: Monitors command outputs and game responses
- Split environment: Uses Fabric's client/main source separation
- Comprehensive logging: Detailed operation logs for debugging
? Troubleshooting
Server won't start?
- Check if port 8080 is available
- Verify Fabric API is installed
- Check logs for configuration errors
AI can't connect?
- Ensure firewall allows localhost:8080
- Verify MCP client supports HTTP transport
- For stdio clients, use mcp-proxy bridge
Commands not working?
- Verify you have appropriate permissions
- Check "Pause on Lost Focus" is disabled (F3+P)
- Review command syntax and limits
Game keeps pausing?
- Make sure "Pause on Lost Focus" is OFF (F3+P)
- This is essential for AI interactions while multitasking
? Links
- Source Code:
- Issue Tracker:
- MCP Specification:
- Fabric Documentation:
下载 MCP Server mod
下载 MCP Server mod
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MCP Server mod
下载 MCP Server mod
下载 MCP Server mod
下载 MCP Server mod
下载 MCP Server mod
下载 MCP Server mod
下载 MCP Server mod
下载 MCP Server mod
将模组从 Minecraft 26.1 移植到 26.2
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
原版世界生成优化模组
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
评论 0
登录后参与评分
还没有评论,来抢沙发吧