MSMP控制台

MSMP控制台

通过提供与控制台交互的附加功能来扩展Minecraft服务器管理协议(MSMP)

基础库

MSMP Console

一个服务端 Fabric 模组,通过为控制台交互提供附加功能来扩展 Minecraft Server Management Protocol(MSMP)。

此模组专为工具、仪表盘、自动化系统、外部监控工具以及需要结构化访问服务器控制台而无需依赖 RCON 或日志文件追踪的集成而设计。

安装

  1. 下载模组 .jar 并将其放入服务器的 mods/ 文件夹。
  2. 在 server.properties 中启用 Management Server:
   management-server-enabled=true
  1. 启动服务器。Management Server 默认将监听 localhost:25576。

配置

首次启动时,模组会在 <server_root_dir>/config/msmp/console/config.yml 生成配置文件:

# Main configuration file for MSMP Entity.

# Configuration for log related settings.
log:
  # The minimum log level that gets forwarded as a console:notification/log/event.
  # Events below this level are ignored entirely and never sent to connected clients.
  # @possible: TRACE | DEBUG | INFO | WARN | ERROR | FATAL
  # @default: 'INFO'
  level: INFO
# Configuration for send related settings.
send:
  # Enable logging for the execution of a command in the console, this prevents echoing the send command.
  # @default: true
  log-command-execution: true

RPC 方法

此模组目前提供以下 MSMP RPC 方法。所有这些方法也可通过标准 rpc.discover MSMP 端点自动发现。

方法 描述
console:send 以完整权限在服务器控制台执行命令并返回其输出

如果你需要用于其他目的的更多方法或通知,请提交 issue

RPC 通知

此模组还提供以下 MSMP RPC 通知,供客户端订阅:

方法 描述
console:notification/log/event 对于每一个达到或高于所配置 log.level 的服务器控制台日志事件触发

方法参考

console:send

以操作员身份(完整权限)执行任意命令,如同手动输入一样,并返回其文本反馈/错误输出以及成功指示。命令可以带或不带前导 / 发送。

// Request
{ "command": "say Hello" }

// Response
{
  "command": "say Hello",
  "result": "",
  "success": true
}

console:notification/log/event

对于每一个级别达到或高于所配置 log.level 的服务器控制台日志事件触发。低于该级别的事件会在到达已连接客户端之前被丢弃。

{
  "jsonrpc": "2.0",
  "method": "console:notification/log/event",
  "params": [{
    "timestamp": "2026-03-21T15:06:06.146Z",
    "level": "INFO",
    "thread": "Server thread",
    "logger": "net.minecraft.server.MinecraftServer",
    "message": "Done (1.019s)! For help, type \"help\"",
    "throwable": ""
  }]
}
{
  "jsonrpc": "2.0",
  "method": "console:notification/log/event",
  "params": [{
    "timestamp": "2026-03-21T15:06:07.212Z",
    "level": "ERROR",
    "thread": "Server thread",
    "logger": "net.minecraft.server.MinecraftServer",
    "message": "Encountered an unexpected exception",
    "throwable": "java.lang.NullPointerException: Cannot invoke ...\n\tat net.minecraft.server.MinecraftServer..."
  }]
}

许可证

LGPL-3.0