This is an automated email from the ASF dual-hosted git repository.
lizhimins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new 346c3c892 docs(rmqctl): add a standalone setup and MCP guide (#7396)
346c3c892 is described below
commit 346c3c8922acc6283cebabc750e5e108b1ef94fa
Author: zmuxuny <[email protected]>
AuthorDate: Fri Nov 27 12:29:06 2026 +0800
docs(rmqctl): add a standalone setup and MCP guide (#7396)
---
README.md | 2 +
README_zh.md | 1 +
rmqctl/README.md | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++
rmqctl/README_zh.md | 97 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 213 insertions(+)
diff --git a/README.md b/README.md
index d899b5fb7..693c618a4 100644
--- a/README.md
+++ b/README.md
@@ -132,6 +132,8 @@ calls back into Studio's own MCP endpoint. The same signed,
instance-scoped, ris
therefore serves the hosted agent, a developer typing `rmqctl topic list`, and
any external agent
pointed at the output of `rmqctl mcp config`. See
[docs/ai-agent-architecture.md](docs/ai-agent-architecture.md) for the design
and its trade-offs.
+For source builds, access contexts, read-only commands, and external MCP
clients, see the
+[standalone rmqctl guide](rmqctl/README.md).
Standalone CLI commands support `--output table`, `json`, and `yaml`. Table
cells
show ASCII control characters as visible escapes (`\t`, `\n`, `\r`, or `\xNN`)
diff --git a/README_zh.md b/README_zh.md
index 4ac4e7e45..7d9782e99 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -114,6 +114,7 @@ Studio 只负责**托管**一个通用 Agent CLI(Claude Code 或 Qoder,另
绑定实例、带风险闸门的工具面,同时服务于托管 Agent、手敲 `rmqctl topic list` 的开发者,以及任何
指向 `rmqctl mcp config` 输出的外部 Agent。设计与取舍见
[docs/ai-agent-architecture.md](docs/ai-agent-architecture.md)。
+源码构建、访问上下文、只读命令及外部 MCP 客户端配置见 [rmqctl 使用指南](rmqctl/README_zh.md)。
- **会话在服务端持久化**,可从历史抽屉回看。刷新或断线重连回放出的时间线与直播时渲染的完全一致,
因为两条路径归约到同一套 block 模型。
diff --git a/rmqctl/README.md b/rmqctl/README.md
new file mode 100644
index 000000000..fd9cee7de
--- /dev/null
+++ b/rmqctl/README.md
@@ -0,0 +1,113 @@
+# rmqctl: standalone CLI and MCP bridge
+
+[中文](README_zh.md) · [Studio setup](../README.md#quick-start)
+
+`rmqctl` calls the Studio server; it does not connect directly to a broker.
+The same binary can run read-only/catalog commands from a terminal or expose
+Studio tools to an external MCP client.
+
+## Build and inspect offline
+
+The examples below use a POSIX shell on Linux or macOS, from the repository
root.
+Install Go **1.27.1 or newer** and Make first. Clear cross-compilation
overrides
+when building the executable you will run on this machine:
+
+```sh
+unset GOOS GOARCH
+make -C rmqctl build
+./rmqctl/bin/rmqctl version
+./rmqctl/bin/rmqctl --help
+./rmqctl/bin/rmqctl explain topic
+./rmqctl/bin/rmqctl topic list --help
+```
+
+`version`, `explain`, and `--help` work without a running Studio or
credentials.
+The build also writes the binary's license material under
`rmqctl/bin/legal/native`.
+For other platforms, `make -C rmqctl build-all` builds the six targets
declared in
+the [Makefile](Makefile); those cross-compiled files are not necessarily
runnable
+on the build host.
+
+## Configure a Studio access context
+
+Start Studio using the [deployment guide](../deploy/README.md) and register the
+instance you want to inspect. Obtain the access-key/secret-key pair configured
+for that instance from its administrator. For Apache instances this is the
+configured admin credential referenced by `adminCredentialRef`; cloud instances
+use their referenced cloud credential. A Studio browser username/password or
+session cookie is not this HMAC credential pair.
+
+Have your shell or secret manager supply `RMQ_ACCESS_KEY` and `RMQ_SECRET_KEY`
in
+the environment. Do not put secret values in command arguments, this
repository,
+or an MCP configuration file. The flags below take **environment variable
names**,
+not the key values:
+
+```sh
+./rmqctl/bin/rmqctl config set-context local \
+ --server http://127.0.0.1:6789 \
+ --access-key-env RMQ_ACCESS_KEY \
+ --secret-key-env RMQ_SECRET_KEY
+./rmqctl/bin/rmqctl config use-context local
+./rmqctl/bin/rmqctl config get-contexts
+```
+
+The context stores the server URL and `env:RMQ_ACCESS_KEY` /
`env:RMQ_SECRET_KEY`
+references. It does not store the resolved secrets or a default instance.
+Configuration path precedence is `--config` > `RMQCTL_CONFIG` >
+`~/.rmqctl/config.yaml`; use the same selected file on later invocations.
+`--context local` overrides the selected current context for one invocation.
+
+The example URL is the bundled frontend proxy, which also serves `/api`.
+Use the externally reachable Studio base URL for your deployment, **without**
+appending `/api` or `/api/mcp`. Public endpoints require HTTPS. Plain HTTP is
+accepted only for loopback/private/link-local IP addresses and `localhost`.
+
+## Make a read-only request
+
+Replace `my-instance` with the registered **Studio instance name**
(`rmq_instance.name`),
+not its numeric database primary key or its cloud-provider instance ID:
+
+```sh
+./rmqctl/bin/rmqctl --instance-id my-instance topic list --output json
+```
+
+Every tool invocation needs `--instance-id`, even when a platform-level tool
does
+not declare an `instanceId` argument: the header is still used for
authentication.
+The key pair must match that instance. Table output is the default; `--output
json`
+and `--output yaml` are also available. Use `explain <resource>` and each
command's
+`--help` for the current catalog, required flags, capabilities, and risk level.
+
+Mutating commands are not part of this quick start. L2/L3 changes use the
server's
+preview/confirmation-token flow. `--yes` only skips the terminal confirmation
+prompt; it does not bypass server capability, permission, or L3 policy checks.
+
+## Connect an external MCP client
+
+From the same repository root, generate a snippet with an absolute executable
path
+and the explicit context and instance:
+
+```sh
+./rmqctl/bin/rmqctl --context local --instance-id my-instance mcp config \
+ --command "$PWD/rmqctl/bin/rmqctl"
+```
+
+Copy the resulting `mcpServers` entry into your client's MCP configuration.
This
+command prints configuration only; it does not connect or verify credentials.
+The client must launch the binary with the referenced credential variables in
its
+own environment. A desktop client launched separately does not necessarily
inherit
+your terminal environment. The snippet contains no secret values.
+
+If you used a custom config file, pass `--config /absolute/path/config.yaml`
when
+generating the snippet too. `mcp stdio` reserves stdout for protocol messages;
+keep it attached to the MCP client rather than using it as an interactive
shell.
+
+## Troubleshooting
+
+- `--instance-id is required`: pass the Studio instance name explicitly;
changing
+ the current context does not choose an instance.
+- `no current context is selected`: run `config use-context local` or pass
+ `--context local` with the same config file used by `set-context`.
+- `environment variable ... is empty`: supply that variable to the process that
+ actually runs `rmqctl`, including the external MCP client when applicable.
+- MCP authentication failure: check the Studio instance name, its configured
key
+ pair, and clock synchronization between client and server. Browser login does
+ not authenticate these signed requests.
diff --git a/rmqctl/README_zh.md b/rmqctl/README_zh.md
new file mode 100644
index 000000000..d646a9342
--- /dev/null
+++ b/rmqctl/README_zh.md
@@ -0,0 +1,97 @@
+# rmqctl:独立命令行与 MCP 桥接
+
+[English](README.md) · [Studio 启动指南](../README_zh.md#快速开始)
+
+`rmqctl` 调用 Studio 服务端,不直接连接 Broker。同一个可执行文件既可在终端运行
+只读查询和 Catalog 命令,也可把 Studio 工具提供给外部 MCP 客户端。
+
+## 构建与离线查看
+
+以下示例使用 Linux 或 macOS 的 POSIX shell,工作目录始终为仓库根目录。
+先安装 Go **1.27.1 或更新版本**和 Make。构建本机要执行的程序时,清除交叉编译覆盖值:
+
+```sh
+unset GOOS GOARCH
+make -C rmqctl build
+./rmqctl/bin/rmqctl version
+./rmqctl/bin/rmqctl --help
+./rmqctl/bin/rmqctl explain topic
+./rmqctl/bin/rmqctl topic list --help
+```
+
+`version`、`explain` 和 `--help` 不需要运行 Studio,也不需要凭据。
+构建还会把二进制的许可证材料写入 `rmqctl/bin/legal/native`。
+`make -C rmqctl build-all` 可构建 [Makefile](Makefile) 中的六种目标平台;
+交叉编译产物不一定能在构建机器上直接运行。
+
+## 配置 Studio 访问上下文
+
+按照[部署指南](../deploy/README.md)启动 Studio,注册要查看的实例,并从管理员处
+取得为该实例配置的 AccessKey/SecretKey。Apache 实例使用 `adminCredentialRef`
+引用的管理凭据,云实例使用其引用的云凭据。Studio 浏览器登录的用户名、密码或
+会话 Cookie 不是这组 HMAC 凭据。
+
+通过 shell 或密钥管理器提供环境变量 `RMQ_ACCESS_KEY` 和 `RMQ_SECRET_KEY`。
+不要把真实密钥写入命令参数、此仓库或 MCP 配置文件。以下参数接收的是
+**环境变量名**,不是密钥值:
+
+```sh
+./rmqctl/bin/rmqctl config set-context local \
+ --server http://127.0.0.1:6789 \
+ --access-key-env RMQ_ACCESS_KEY \
+ --secret-key-env RMQ_SECRET_KEY
+./rmqctl/bin/rmqctl config use-context local
+./rmqctl/bin/rmqctl config get-contexts
+```
+
+上下文仅保存服务地址及 `env:RMQ_ACCESS_KEY` / `env:RMQ_SECRET_KEY` 引用,
+不保存解析后的密钥或默认实例。配置路径优先级为 `--config` > `RMQCTL_CONFIG` >
+`~/.rmqctl/config.yaml`;后续调用必须使用同一个配置文件。
+`--context local` 可仅为当前调用覆盖已选中的上下文。
+
+示例地址是随部署提供的前端代理,也转发 `/api`。远程部署应使用客户端可达的
+Studio 基础地址,**不要**追加 `/api` 或 `/api/mcp`。公网地址必须使用 HTTPS;
+HTTP 仅允许回环、私有、链路本地 IP 地址及 `localhost`。
+
+## 发出只读请求
+
+把 `my-instance` 替换为注册的 **Studio 实例名称**(`rmq_instance.name`),
+而不是数据库数字主键或云厂商实例 ID:
+
+```sh
+./rmqctl/bin/rmqctl --instance-id my-instance topic list --output json
+```
+
+每次工具调用都需要 `--instance-id`。即使某个平台级工具没有 `instanceId` 入参,
+认证请求头仍需携带实例名称,所用密钥也必须与该实例匹配。
+默认输出表格,也支持 `--output json` 和 `--output yaml`。
+用 `explain <resource>` 及各命令的 `--help` 查看当前 Catalog、必填参数、能力和风险级别。
+
+本入门指南不执行变更操作。L2/L3 变更采用服务端的预览与确认令牌流程。
+`--yes` 只跳过终端确认提示,不绕过服务端能力、权限或 L3 策略检查。
+
+## 连接外部 MCP 客户端
+
+仍在仓库根目录,指定可执行文件的绝对路径、上下文及实例,生成配置片段:
+
+```sh
+./rmqctl/bin/rmqctl --context local --instance-id my-instance mcp config \
+ --command "$PWD/rmqctl/bin/rmqctl"
+```
+
+把输出的 `mcpServers` 条目复制到客户端的 MCP 配置。此命令只生成配置,
+不会连接服务端或验证凭据。客户端启动该程序时,自身环境中必须有引用的凭据变量。
+单独启动的桌面客户端不一定继承当前终端的环境。生成的片段不包含密钥值。
+
+如果使用自定义配置文件,生成片段时也传入 `--config /absolute/path/config.yaml`。
+`mcp stdio` 的标准输出专用于协议消息,应由 MCP 客户端连接,而不是当作交互式 shell 使用。
+
+## 常见问题
+
+- `--instance-id is required`:显式传入 Studio 实例名称;切换上下文不会选定实例。
+- `no current context is selected`:使用与 `set-context` 相同的配置文件,运行
+ `config use-context local` 或传入 `--context local`。
+- `environment variable ... is empty`:为实际启动 `rmqctl` 的进程提供该环境变量,
+ 包括外部 MCP 客户端。
+- MCP 认证失败:核对 Studio 实例名称、为它配置的密钥及客户端与服务端的时钟同步。
+ 浏览器登录不能替代这些签名请求的认证。