Skip to Content
FeaturesModel Context Protocol

Model Context Protocol

Pilot includes a built-in MCP (Model Context Protocol) server that exposes 54 tools for external AI agents to interact with your Kafka cluster.

Overview

MCP is an open protocol that allows AI agents (like Claude Desktop, custom agents, or other MCP-compatible tools) to discover and invoke operations on your cluster programmatically. The MCP server is enabled by default and read-only: letting clients change the cluster is an explicit opt-in, see Mutation Execution.

PILOT_MCP_ENABLED=true # Enabled by default PILOT_MCP_WRITE_ENABLED=false # Default; true lets clients with a write scope change the cluster

Tool Categories

Read Tools (30+ tools)

Read-only operations that inspect cluster state:

ToolDescription
get_cluster_overviewCluster overview: brokers, topics, partitions, controller
get_cluster_healthHealth: URPs, offline partitions, unavailable counts
get_cluster_conditionsOpen cluster conditions, worst first: the server’s verdict on what is wrong, as the REST API returns it
get_partition_activityPartition activity rates and sizes
get_broker_racksBroker rack assignments
get_topic_configTopic configuration
search_topicsSearch topics by name
search_topics_by_configSearch topics by config values
list_aclsList ACL bindings
list_consumer_groupsList consumer groups
describe_consumer_groupGroup details with members
get_consumer_group_lagPer-partition consumer lag
browse_messagesBrowse messages in a topic
get_topic_watermarksPartition watermarks
list_quotasList client quotas
list_proposalsList rebalance proposals
generate_proposalRead the current rebalance candidate and authoritative readiness decision
get_reassignment_tuningCurrent throttle rate and moves per broker
get_cluster_logdirsLog directory info
what_if_simulateSimulate cluster scenarios
blast_radius_analyzeAnalyze failure impact
search_audit_logSearch audit events

Mutate Tools (20+ tools)

Operations that modify cluster state. They are refused until write access is enabled:

ToolDescription
update_topic_configUpdate topic configuration
bulk_update_topic_configUpdate config for multiple topics
create_aclsCreate ACL bindings
delete_aclsDelete ACL bindings
update_aclReplace an ACL binding
reset_consumer_group_offsetsReset consumer offsets
delete_consumer_groupDelete a consumer group
update_quotaSet quota values
delete_quotaDelete quota keys
redistribute_topicRedistribute topic partitions
redistribute_partitionReassign a single partition
bulk_reassign_partitionsBulk partition reassignment
cancel_reassignmentCancel an active reassignment, or all with id: "all". Needs no license
update_reassignment_tuningChange the throttle rate or moves per broker
apply_proposalApply a rebalance proposal. Blocked when decision.applicationAllowed is false
set_broker_maintenanceDrain one or more brokers into maintenance. See Maintenance Mode
remove_broker_maintenanceExit broker maintenance
preferred_leader_electionTrigger PLE
topic_preferred_leader_electionTrigger PLE for one topic
move_broker_logdirsMove log directories
revert_audit_eventRevert an audited change

Output Limits and Drill-Down

List-shaped tools return bounded summaries by default so results stay small enough for LLM context windows. Complete data remains available through drill-down parameters, dedicated detail tools, and the REST API.

Result Envelope

Bounded list results wrap their rows in a common envelope:

KeyMeaning
countRows returned in this response
totalRows available before the limit was applied
truncatedtrue when rows were dropped
hintPresent only when truncated; names the parameter or tool to use for a narrower query

Aggregate figures (totals, rollups, health counts) stay complete even when rows are truncated.

get_cluster_conditions returns the conditions list of the REST API unchanged instead of this envelope: counts, worstSeverity and total cover every open condition, whatever severity filters and limit cuts, and truncated is true when limit cut the list. It has no count or hint.

Limits per Tool

limit is optional everywhere it appears. Omitted or 0 selects the default; values above the maximum are clamped to the maximum. Rows marked “fixed” have no limit parameter.

ToolRows keyDefaultMaxOrder
get_cluster_overviewtopics100500Partition count desc, then name
get_cluster_healthnotRackAwareDetails20fixed-
get_cluster_conditionsconditions, resolved50200Source, severity, age, then code; resolved newest first
get_partition_activity (plain)partitions50200Topic asc, partition asc
get_partition_activity (aggregate="topic")topics20100Sort key desc
get_partition_activity (sortBy only)partitions50200Sort key desc
search_topicstopics1001000Name asc
list_aclsbindings100500Resource type, resource name, principal
list_consumer_groupsgroups100500Group ID asc
get_consumer_group_lagtopPartitions20200Lag desc
get_topic_watermarkspartitions1001000Partition asc
get_cluster_logdirs (summary)topics20100Size desc
get_cluster_logdirs (detail)partitions50200Size desc
list_reassignmentshistory (embedded)10fixedNewest first
get_reassignment_historyhistory20100Newest first
get_partition_optimizationrecommendations20100High > Medium > Low, then topic
search_audit_logevents50200Newest first
browse_messagesmessages2050Seek order
get_proposal, generate_proposalreassignments (embedded)50fixed-
set_broker_maintenanceaffected, partitions, residualPartitions1000fixed-

set_broker_maintenance reports the full count next to each list.

Proposal tools return a decision. Use decision.applicationAllowed and decision.nextAction to see whether a proposal can be applied. generate_proposal reads the current proposal; it does not start a new calculation.

list_proposals returns summaries. get_proposal and generate_proposal return up to 50 moves, with the full count in totalReassignments, and a per-metric balance summary. The REST API returns the full proposal.

Drill-Down Parameters

Parameters that switch summary output to detail, or narrow it:

ToolParameterEffect
get_cluster_logdirstopic, brokerIdSwitch from broker and topic summaries to per-partition replica rows; combinable
get_partition_activityaggregate, sortBy, topic, brokerIdAggregate per topic, rank by rate or size, or filter rows
get_consumer_group_lagtopicScope rollups and partition rows to one topic
get_partition_optimizationpriorityOnly High, Medium, or Low recommendations
get_cluster_conditionsseverity, includeResolvedOnly critical, warning, or info conditions; add the recently resolved conditions under resolved
get_default_configskeyFilterCase-insensitive substring filter on config keys

For full detail on a single item, use the paired detail tool instead of raising the limit: describe_consumer_group for members and assignments, get_proposal for a full proposal, get_reassignment_by_id for one reassignment record, get_reassignment_history for older history.

Mutation Execution

External MCP clients are read-only by default. They can inspect the cluster, run what-if simulations and read proposals. Every tool that changes the cluster is refused for every caller. Pilot still lists the mutate tools, and a call answers with the refusal.

To let clients change the cluster:

  1. Set PILOT_MCP_WRITE_ENABLED=true.
  2. Configure a sign-in provider (Authentication).
  3. Give the client a write-scoped credential: a write PAT (AUTH_PAT_ENABLED=true) or an MCP OAuth access token with the write scope (AUTH_MCP_OAUTH_WRITE_SCOPE).

All three steps are needed. Otherwise a mutate tool is refused with one of these errors:

CaseError
Write access off (PILOT_MCP_WRITE_ENABLED=false, default)MCP write access is disabled; apply changes in Pilot or set PILOT_MCP_WRITE_ENABLED=true
Write access on, no sign-in provider configuredMCP write access is disabled because no sign-in provider is configured; apply changes in Pilot
No scope (browser session or bearer token from a sign-in provider)tool <name> requires a write-scoped credential: a write PAT or an MCP OAuth token with the write scope
Read scope (read-scoped PAT or MCP OAuth token)token scope 'read' does not allow tool <name>; write scope is required

A refused call changes nothing. An allowed call runs at once, without an approval step. License checks, safety checks and audit logging apply as for the REST API (see Execution Parity).

PILOT_MCP_WRITE_ENABLED affects only the MCP endpoint. The REST API and Pilot’s built-in assistant are not affected.

The Personal access tokens page shows whether write access is on. GET /api/v1/integrations/mcp reports it as writeAccess: off, on or no_sign_in. See the API reference .

Execution Parity

MCP changes follow the same rules as the REST API:

  • Safety checks. Drains and reassignments are refused while the cluster is unhealthy (controller unhealthy, majority of brokers unavailable, sustained ISR shrink), while a rolling restart runs, and while moves found at startup run. MCP tools have no force override. See Apply-Time Safety Gating.
  • Throttling. Reassignments use the same replication throttle and per-broker move limit.
  • One reassignment at a time. MCP and the REST API share this limit. A second reassignment answers status: "blocked" with reason operation_in_progress.
  • Result. A reassignment tool answers when its moves end, with status: "completed". If some moves fail, the result counts them in failed. If the action fails as a whole, the tool answers with an error. See How Operations End.
  • Audit. Changes appear in the audit log with method MCP and the caller’s user ID. For a PAT, this is the token owner’s user ID.

High Availability

All mutate tools work in HA mode. Write access works the same way. What differs:

  • Long changes answer early. A tool waits up to 10 seconds. If the change is still running, it answers status: "accepted" (or pending) with an operationId. Follow a reassignment or election with get_reassignment_by_id. For other changes, repeat the call with the returned idempotencyKey to get the result. The change continues after a failover.
  • Safe retries. Most mutate tools take an optional idempotencyKey of at most 256 bytes. A repeated call with the same key, input and caller does not start a second change.
  • apply_proposal needs the concrete proposalId, not current. It answers once the plan is accepted, with the operationId.
  • Blocked calls. While another operation or a rolling restart runs, a tool can answer status: "blocked" with a reason.
  • Unknown outcome. If Pilot cannot confirm a change, the tool fails with HA_OUTCOME_UNKNOWN and the operation ID. See Uncertain requests.

Authentication

When authentication is enabled, the MCP endpoint requires a valid Bearer token. Interactive clients can use OAuth with PKCE to obtain a resource-scoped access token. Use a Personal Access Token (PAT) for long-lived, revocable access. PATs work with all Pilot API endpoints, not just MCP - see Personal Access Tokens for details.

Prerequisites: PATs require AUTH_PAT_ENABLED=true and a stable AUTH_PAT_HASH_SECRET to be configured on the server. See PAT Configuration for details.

Creating a Token

  1. Log into the Pilot UI via your OAuth provider
  2. Click your avatar (top right) -> Access Tokens -> New token
  3. Choose a name, scope (read or write), and optional expiry
  4. Copy the pat_... token (shown only once)

Scopes

ScopePermissions
readRead-only tools (cluster overview, topic configs, consumer groups, etc.)
writeAll tools including mutations (reassignments, ACLs, quotas, maintenance, etc.) while write access is enabled

Scope is enforced per tool on the MCP endpoint, not by HTTP method. A read token is refused every mutate tool. A write token runs them only with PILOT_MCP_WRITE_ENABLED=true; the scope does not enable writes on its own.

Data Access

Read access includes application message keys, values, and headers. These payloads can contain sensitive application data; grant MCP access only to clients trusted to receive it. A client can pass the results on to the provider of its own language model; Calinora receives none of them. To turn the MCP endpoint off, set PILOT_MCP_ENABLED=false.

Message tools reject Pilot’s reserved __pilot_ topics and the configured audit topic. Use search_audit_log for audit events. Its responses redact credential fields and URL credentials, query strings, and fragments. Redaction does not identify every secret that an application might place in arbitrary text.

Integration

The MCP endpoint is available at:

POST https://your-pilot-host/api/v1/mcp

Codex CLI

For browser login without a PAT, follow the MCP OAuth setup, including the public client registration and exact Codex callback URL. Then authenticate with codex mcp login pilot and the configured resource scopes.

For PAT authentication, supply the token through your secret-management workflow as PILOT_MCP_PAT, then register the server:

codex mcp add pilot --url https://pilot.example.com/api/v1/mcp \ --bearer-token-env-var PILOT_MCP_PAT

Use a read-scoped PAT for inspection, or a write-scoped PAT for mutations once write access is enabled. Never put the token value in a command argument or tracked configuration.

GitHub Copilot (VS Code)

Add to .vscode/mcp.json:

{ "servers": { "pilot": { "type": "http", "url": "https://pilot.example.com/api/v1/mcp", "headers": { "Authorization": "Bearer ${input:pilot-token}" } } } }

VS Code will prompt for the token on first use and store it securely.

Warp Terminal

Add to Warp’s MCP server configuration:

{ "mcpServers": { "pilot": { "serverUrl": "https://pilot.example.com/api/v1/mcp", "headers": { "Authorization": "Bearer pat_your_token_here" } } } }

Claude Desktop

Add to your Claude Desktop MCP configuration:

{ "mcpServers": { "pilot": { "type": "url", "url": "https://pilot.example.com/api/v1/mcp", "headers": { "Authorization": "Bearer pat_your_token_here" } } } }

Any MCP Client

The endpoint accepts standard MCP JSON-RPC messages over HTTP POST. Include the Authorization: Bearer <pat_token> header with each request when authentication is enabled. The server supports Streamable HTTP transport and advertises all available tools with their descriptions, input schemas, and categories.

Last updated on