Minecraft Command Execution MCP Server
Minecraft 命令执行 MCP 服务器
一个 MCP (Model Context Protocol) 服务器,使 Claude 能够通过 MasterControl API 执行 Minecraft 命令并获取 Tab 补全。
功能
此 MCP 服务器提供两个工具:
1. execute_command
以已验证玩家的身份远程执行任何 Minecraft 命令。
玩家必须在线且在服务器上
执行命令时,玩家会在游戏内收到通知
返回命令输出或错误消息
获取帮助:在任何命令后附加 "help"(例如:"island help", "island upgrade help")
示例:
execute_command("gamemode creative")
execute_command("island help") # Shows island command help
execute_command("island upgrade help") # Shows upgrade subcommand help
execute_command("island upgrade speed 5")2. tab_complete
获取部分命令的 Tab 补全建议。
发现可用的命令和子命令
查找有效的参数和选项
工作方式与在 Minecraft 中按 Tab 键完全相同
示例:
tab_complete("gamemode ") # Returns: survival, creative, adventure, spectator
tab_complete("island ") # Returns: available island subcommandsRelated MCP server: MCP Minecraft Remote
先决条件
Python 3.10 或更高版本
uv包管理器 (在此安装)运行中的带有命令 API 的 MasterControl 服务器
您的 Minecraft 玩家的有效 API 密钥
安装
克隆仓库:
git clone https://github.com/<your-user>/minecraft-mcp-server.git
cd minecraft-mcp-server安装依赖:
uv sync配置环境变量:
cp .env.example .env使用您的设置编辑
.env文件:
# Required: Your Midnight API key
MIDNIGHT_API_KEY=your-api-key-here
# Optional: MasterControl API URL (defaults to localhost:8080)
MIDNIGHT_API_URL=http://your-server:8080/api/v2使用方法
本地测试
直接运行服务器进行测试:
uv run server.py它将等待 stdio 输入 — 这是 MCP 服务器的预期行为。按 Ctrl+C 退出。
与 Claude Code 集成
将服务器添加到 Claude Code(使用您克隆仓库的绝对路径):
claude mcp add midnight \
--transport stdio \
--env MIDNIGHT_API_KEY=your-key-here \
--env MIDNIGHT_API_URL=http://localhost:8080/api/v2 \
-- uv --directory /absolute/path/to/minecraft-mcp-server run server.py验证安装
在 Claude Code 中,检查服务器是否正在运行:
/mcp您应该看到 midnight 列出且状态为 ✓ Connected。
对话示例
执行命令:
You: "Change my gamemode to creative"
Claude: [Uses execute_command("gamemode creative")]
✓ Command executed successfully获取命令帮助:
You: "How do I use the island upgrade command?"
Claude: [Uses execute_command("island upgrade help")]
Shows the help output for island upgrade探索命令:
You: "What island commands are available?"
Claude: [Uses tab_complete("island ")]
Lists: upgrade, create, delete, invite, members...配置
环境变量
变量 | 必需 | 默认值 | 描述 |
| 是 | - | 您的玩家 API 密钥 |
| 否 |
| MasterControl API 基础 URL |
API 端点
POST /api/v2/command/execute— 执行命令POST /api/v2/command/tabComplete— 获取 Tab 补全
故障排除
"MIDNIGHT_API_KEY environment variable not set!"
创建一个 .env 文件:
echo "MIDNIGHT_API_KEY=your-key-here" > .env"Failed to execute command"
请检查:
MasterControl API 是否正在运行
API 密钥是否正确
玩家是否在线且在服务器上(不在代理服务器的等待状态中)
安全性
切勿提交
.env文件 — 它包含您的 API 密钥(已通过.gitignore排除)命令以您的玩家权限执行
AI 可以运行您在游戏中能运行的任何命令
Available Tools
2 toolsexecute_commandA
Execute a Minecraft command remotely as the authenticated player.
This tool allows you to run any Minecraft command as if the player associated with the API key typed it in-game. The player must be online and on a server. The player will be notified in-game that a remote command is being executed.
To get help for any command, simply append "help" as the last argument. For example: "island help", "island upgrade help", "gamemode help"
Args: command: The Minecraft command to execute (without the leading slash). Examples: "gamemode creative", "tp 100 64 200", "island upgrade speed 5"
Returns: The output from the command execution, or an error message if it failed.
Examples: - execute_command("help") - Shows general help - execute_command("island help") - Shows island command help - execute_command("island upgrade help") - Shows island upgrade help - execute_command("gamemode survival") - Changes gamemode
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: the player will be notified in-game, the command executes as the authenticated player, and it returns output or error messages. It covers the essential mutation behavior and user feedback mechanism, though it doesn't mention rate limits or specific error handling details.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured and appropriately sized. It starts with the core purpose, then provides usage details, parameter explanation, return values, and examples. Every sentence adds value, with no redundant information, and it's front-loaded with the most important information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (remote command execution with authentication requirements), no annotations, and an output schema exists, the description provides excellent completeness. It covers purpose, prerequisites, parameter usage, return behavior, and multiple examples. The output schema handles return value structure, so the description appropriately focuses on operational context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 0%, so the description must fully compensate. It provides comprehensive parameter semantics: explains what the 'command' parameter is ('The Minecraft command to execute without the leading slash'), gives multiple examples, and shows how to get help. This adds significant value beyond the bare schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Execute a Minecraft command remotely as the authenticated player') and distinguishes it from the sibling tool 'tab_complete' by focusing on command execution rather than completion suggestions. It specifies the resource (Minecraft command) and the context (remote execution as authenticated player).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for when to use this tool ('run any Minecraft command as if the player associated with the API key typed it in-game'), including prerequisites (player must be online and on a server). It doesn't explicitly mention when not to use it or provide detailed alternatives beyond the sibling tool, but the context is well-defined.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
tab_completeA
Get tab completion suggestions for a partial Minecraft command.
This tool provides autocomplete suggestions for commands, just like pressing Tab in the Minecraft client. Useful for discovering available commands, subcommands, and valid arguments.
Args: command_line: The partial command line to complete. Examples: "gamemode ", "island upgrade ", "give diamond"
Returns: A formatted list of completion suggestions, or a message if none are available.
Examples: - tab_complete("gamemode ") -> Lists: survival, creative, adventure, spectator - tab_complete("island ") -> Lists available island subcommands - tab_complete("give ") -> Lists available items
| Name | Required | Description | Default |
|---|---|---|---|
| command_line | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes what the tool does (provides autocomplete suggestions), the context (like pressing Tab in Minecraft), and the return behavior (formatted list or message if none available). It doesn't mention rate limits or error handling, but covers the core behavior well.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured and appropriately sized. It starts with a clear purpose statement, follows with usage guidelines, then provides parameter details, return information, and concrete examples. Every sentence adds value with zero wasted content.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (single parameter, no annotations, but with output schema), the description is complete. It explains the purpose, usage, parameter with examples, and return behavior. The existence of an output schema means the description doesn't need to detail return values, and it adequately covers what's needed for this autocompletion tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 0%, so the description must compensate. It provides a clear parameter description: 'command_line: The partial command line to complete' with three concrete examples that illustrate valid inputs. This adds significant meaning beyond the bare schema, though it doesn't detail all possible command formats.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Get tab completion suggestions for a partial Minecraft command.' It specifies the exact action (get suggestions) and resource (Minecraft commands), and distinguishes it from the sibling tool 'execute_command' by focusing on autocompletion rather than command execution.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly states when to use this tool: 'Useful for discovering available commands, subcommands, and valid arguments.' It provides clear context for its purpose (autocompletion like pressing Tab) and distinguishes it from the alternative 'execute_command' by not overlapping in functionality.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v0.1.0- First observed
execute_command - First observed
tab_complete
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: execute_command runs commands, while tab_complete provides suggestions for command completion. There is no overlap or ambiguity between them, as one is for execution and the other is for discovery/assistance.
Both tools follow a consistent verb_noun naming pattern (execute_command and tab_complete). The naming is clear, predictable, and uses the same style throughout, making it easy to understand their functions at a glance.
With only 2 tools, the server feels thin for its purpose of Minecraft command execution. While the tools cover basic execution and completion, there are likely missing operations such as listing available commands, checking player status, or handling command history, which would enhance the server's utility and completeness.
The tool set is severely incomplete for the domain of Minecraft command execution. It lacks essential operations like listing all available commands, validating commands before execution, managing multiple players, or handling command feedback in a structured way. This forces agents to rely heavily on trial-and-error with execute_command and tab_complete, leading to potential inefficiencies and failures.
Maintenance
Related MCP Connectors
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
Generate AI images and videos from any compatible MCP client.
Augments MCP Server - A comprehensive framework documentation provider for Claude Code
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables management of Minecraft servers through the MCSManager API. Supports executing server commands, checking player status, retrieving server information, and controlling game settings like weather.9 npm1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to remotely control a Minecraft player, including navigation, mining, building, and interaction with the world and other players.MIT
- FlicenseNot gradedqualityBmaintenanceEnables natural language control of a Minecraft bot, allowing it to execute tasks like mining, exploring, and item management via AI-powered commands.3-
- AlicenseAqualityDmaintenanceExposes Minecraft server commands via RCON as a tool, and optionally powers an in-game AI chat listener that answers player questions using Claude.2MIT