zhaohai666 opened a new pull request, #943:
URL: https://github.com/apache/rocketmq-dashboard/pull/943
# RIP-3 #15 — MCP Server + `rmqctl` CLI Shared Skeleton
## Summary
This PR establishes the **shared foundation** for RIP-3 (RocketMQ-native AI
integration) directly on the `rocketmq-studio` branch. The branch previously
contained **zero** RIP-3 source — the `rocketmq-dashboard-mcp`,
`rocketmq-dashboard-cli` and `rocketmq-dashboard-llm` directories held only
stale `target/` artifacts and had no `pom.xml`, no `src/`, and were not wired
into the build. This PR bootstraps the entire client-side triad scaffold from
scratch so that the subsequent, independently-reviewable RIP-3 feature PRs can
layer on top.
It is the first of 16 planned single-feature RIP-3 PRs (see
`docs/rip3-pr-decomposition.md`).
## Motivation
RIP-3 requires three delivery surfaces — an **MCP server**, a **`rmqctl`
CLI**, and an **in-console LLM** — all operating on the same set of operational
tools against a live RocketMQ cluster. To keep the MCP tool schema and the CLI
command surface permanently in sync (RIP-3 signal 7: single source of truth),
every tool is declared once in a `ToolRegistry` and both surfaces are generated
from it.
Before this PR there was no module, no registry, no transport and no safety
model to build those features on.
## Changes
### New module `rocketmq-dashboard-cli` (Java 21, RocketMQ 5.3.3)
A standalone Maven module (no Spring Boot, minimal dependencies) that is the
single source of truth for every RIP-3 operation.
| File | Responsibility |
|------|----------------|
| `schema/ToolRegistry.java` | Declarative registry; registers tools once;
generated MCP schema + CLI commands derive from it (signal 7). |
| `schema/ToolDefinition.java`, `schema/ToolParam.java`,
`schema/RiskLevel.java` | The tool contract (resource/verb →
`rmq.<resource>.<verb>`, params, L1–L3 risk). |
| `executor/ToolExecutor.java` | Dispatch by tool name; required-arg
validation; fails fast before paying a cluster connection. |
| `executor/SecurityGate.java` | Enforces L1 (always) / L2 (default dry-run,
explicit confirm to apply) / L3 (disabled unless `--enable-dangerous-ops`)
(signal 4). |
| `executor/ErrorModel.java` | Structured `{code, message, hint}` errors
(signal 6). |
| `executor/InvocationContext.java` | `dryRun` / `confirmed` /
`dangerousOpsEnabled` flags. |
| `context/AdminClientHelper.java` | Real `MQAdminExt` connectivity to a
live cluster by NameServer address (no mock). |
| `mcp/McpProtocolHandler.java` | JSON-RPC 2.0: `initialize`, `tools/list`,
`tools/call`. |
| `mcp/McpServerApplication.java` | Transport layer: **stdio** (default) and
a lightweight **SSE/HTTP** transport (signal 2). |
| `RmqctlCommand.java`, `ExplainCommand.java`, `OutputFormatter.java`,
`Main.java` | Data-driven `rmqctl <resource> <verb>` CLI with `--cluster`,
`--output json|yaml|table`, `--dry-run`, `--yes`, `--enable-dangerous-ops`, and
`explain` (signal 7). |
### Foundational tool
- `rmq.capabilities.detect` (L1) — lists every registered tool grouped by
resource with its risk level. This proves the registry → MCP/CLI generation
pattern end-to-end.
### CI
- `.github/workflows/ci.yml`: added a `cli-build` job (JDK 21,
`rocketmq-dashboard-cli`, `mvn clean package`) so the new module is verified on
every PR.
## Files changed
- `rocketmq-dashboard-cli/pom.xml` (new)
-
`rocketmq-dashboard-cli/src/main/java/.../cli/{Main,RmqctlCommand,ExplainCommand,OutputFormatter}.java`
(new)
-
`rocketmq-dashboard-cli/src/main/java/.../cli/{schema,mcp,executor,context}/...`
(new)
-
`rocketmq-dashboard-cli/src/test/java/.../cli/{schema,executor}/*Test.java`
(new)
- `.github/workflows/ci.yml` (modified)
## Verification
- `cd rocketmq-dashboard-cli && mvn -B clean package` → **BUILD SUCCESS**, 7
unit tests pass (`ToolRegistryTest` ×4, `ToolExecutorTest` ×3).
- Manual smoke (offline, capability meta-tool):
- `java -jar target/rocketmq-dashboard-cli-1.0.0.jar explain` → lists
`capabilities`.
- `java -jar target/rocketmq-dashboard-cli-1.0.0.jar capabilities detect`
→ returns the tool catalog JSON.
- `java -jar target/rocketmq-dashboard-cli-1.0.0.jar mcp --transport
stdio` → starts the MCP server (JSON-RPC on stdin/stdout).
## Notes / follow-ups
- Resource tools (cluster, topic, group, message, route, dlq, acl, broker,
client, metrics) are **intentionally not** in this PR; each is delivered as its
own RIP-3 PR (pr-16 … pr-23) that builds on this skeleton and is independently
reviewable.
- The SSE transport is a simplified Streamable-HTTP style (GET `/sse`
announces `POST /messages`, responses returned directly). A full server→client
event stream can be hardened in a later PR.
- `rocketmq-dashboard-mcp` and `rocketmq-dashboard-llm` modules are added by
later RIP-3 PRs (pr-24/pr-25).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]