[ 
https://issues.apache.org/jira/browse/KUDU-3806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18147537#comment-18147537
 ] 

ASF subversion and git services commented on KUDU-3806:
-------------------------------------------------------

Commit 5a37b298d2a733806d091c9f87c0e58d0aa9e5a4 in kudu's branch 
refs/heads/master from Marton Greber
[ https://gitbox.apache.org/repos/asf?p=kudu.git;h=5a37b298d ]

KUDU-3806: add the MCP server

Add `kudu mcp serve`, a Model Context Protocol server that speaks
JSON-RPC over stdio and exposes the CLI as callable tools so an MCP
client (an LLM agent) can drive Kudu.

The server reconstructs the full action tree via BuildRootMode() and
reflects each action's flags into a tool schema. Exposure follows the
disposition classification: SURFACE tools are advertised, GATED
(mutating) tools only with --mcp_allow_writes, and tools tagged as
returning row-level user data only with --mcp_allow_data_reads.
REJECT and EXCLUDE actions are never advertised; the serve action
itself is REJECT to keep the server from re-exposing itself. Calling
a tool hidden by a closed gate fails with an error naming the flag.
GATED tools accept a dry_run argument that returns the exact command
instead of running it.

Each tools/call runs in a fresh child 'kudu' process, so an action
that CHECKs or exits only kills the child. The child's output is
collected with Subprocess::WaitAndCollect(), bounded by a timeout
(--mcp_tool_timeout_sec, or the longer --mcp_gated_tool_timeout_sec
for mutating tools) and by --mcp_max_output_bytes. To keep memory
bounded, WaitAndCollect() gains an optional per-stream byte cap: the
rest of the output is drained and discarded, so the child still runs
to completion. A mutating tool that times out or crashes is reported
as possibly partially applied.

Tool calls are validated strictly: argument keys missing from the
schema are rejected, dry_run must be a boolean, and the cluster is
fixed by the operator -- a per-call master_addresses is rejected, and
a single-master action's master_address must be one of the
configured masters. Client connection and security flags set on
'serve' (--sasl_protocol_name, TLS settings, timeouts) are forwarded
to the child, and positional values are passed after a '--' sentinel
so they are never parsed as child flags. The server also answers
'ping'.

Coverage is enforced at startup by ValidateDispositionCoverageOrDie().
tool_action_mcp-test exercises reflection, dispatch, argument
validation and the JSON-RPC framing in-process; tool_action_mcp-itest
drives the serve loop against a live ExternalMiniCluster.

Change-Id: I59146a2fd4f5b8d61d3e494cc88974b396ed6856
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Reviewed-on: https://gerrit.cloudera.org/24908
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <[email protected]>
Reviewed-by: Gabriella Lotz <[email protected]>


> Kudu MCP
> --------
>
>                 Key: KUDU-3806
>                 URL: https://issues.apache.org/jira/browse/KUDU-3806
>             Project: Kudu
>          Issue Type: New Feature
>            Reporter: Marton Greber
>            Assignee: Marton Greber
>            Priority: Major
>
>  Introduce kudu mcp serve, an MCP server that exposes existing kudu CLI 
> actions as MCP tools so operators can drive cluster diagnostics and 
> administration from an MCP-capable client (e.g. an LLM agent) without 
> hand-crafting command lines.
> Design highlights:
>  - Safety classification. Every action in the CLI action tree resolves to 
> exactly one Disposition:
>  -- SURFACE — read-only, always exposed (node-local reads are surfaced but 
> tagged as only meaningful on that node);
>  -- GATED — cluster-mutating, hidden unless --allow-writes is set;
>  -- REJECT — long-running/never-promptly-returning ops that would wedge the 
> single-threaded serve loop;
>  -- EXCLUDE — interactive or node-local mutating actions, never surfaced.
>  - Read-only by default. Mutating tools are only advertised with 
> --allow-writes.
>  - Process isolation. Each tools/call runs its action in a fresh child kudu 
> process bounded by --mcp_tool_timeout_sec (default 60s), so a hung action 
> cannot freeze the server.
>  - Credential hygiene. --master_addresses is registered once at serve time 
> and injected into each call, so it never has to appear in the conversation.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to