Skip to main content
Glama
mattlack15

Minecraft Command Execution MCP Server

by mattlack15

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 subcommands

Related MCP server: MCP Minecraft Remote

先决条件

  • Python 3.10 或更高版本

  • uv 包管理器 (在此安装)

  • 运行中的带有命令 API 的 MasterControl 服务器

  • 您的 Minecraft 玩家的有效 API 密钥

安装

  1. 克隆仓库:

git clone https://github.com/<your-user>/minecraft-mcp-server.git
cd minecraft-mcp-server
  1. 安装依赖:

uv sync
  1. 配置环境变量:

cp .env.example .env
  1. 使用您的设置编辑 .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...

配置

环境变量

变量

必需

默认值

描述

MIDNIGHT_API_KEY

-

您的玩家 API 密钥

MIDNIGHT_API_URL

http://localhost:8080/api/v2

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"

请检查:

  1. MasterControl API 是否正在运行

  2. API 密钥是否正确

  3. 玩家是否在线且在服务器上(不在代理服务器的等待状态中)

安全性

  • 切勿提交 .env 文件 — 它包含您的 API 密钥(已通过 .gitignore 排除)

  • 命令以您的玩家权限执行

  • AI 可以运行您在游戏中能运行的任何命令

Install Server
F
license - not found
A
quality
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer

  • Augments MCP Server - A comprehensive framework documentation provider for Claude Code

  • Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mattlack15/midnightsky-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server