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 clusterTool Categories
Read Tools (30+ tools)
Read-only operations that inspect cluster state:
| Tool | Description |
|---|---|
get_cluster_overview | Cluster overview: brokers, topics, partitions, controller |
get_cluster_health | Health: URPs, offline partitions, unavailable counts |
get_cluster_conditions | Open cluster conditions, worst first: the server’s verdict on what is wrong, as the REST API returns it |
get_partition_activity | Partition activity rates and sizes |
get_broker_racks | Broker rack assignments |
get_topic_config | Topic configuration |
search_topics | Search topics by name |
search_topics_by_config | Search topics by config values |
list_acls | List ACL bindings |
list_consumer_groups | List consumer groups |
describe_consumer_group | Group details with members |
get_consumer_group_lag | Per-partition consumer lag |
browse_messages | Browse messages in a topic |
get_topic_watermarks | Partition watermarks |
list_quotas | List client quotas |
list_proposals | List rebalance proposals |
generate_proposal | Read the current rebalance candidate and authoritative readiness decision |
get_reassignment_tuning | Current throttle rate and moves per broker |
get_cluster_logdirs | Log directory info |
what_if_simulate | Simulate cluster scenarios |
blast_radius_analyze | Analyze failure impact |
search_audit_log | Search audit events |
Mutate Tools (20+ tools)
Operations that modify cluster state. They are refused until write access is enabled:
| Tool | Description |
|---|---|
update_topic_config | Update topic configuration |
bulk_update_topic_config | Update config for multiple topics |
create_acls | Create ACL bindings |
delete_acls | Delete ACL bindings |
update_acl | Replace an ACL binding |
reset_consumer_group_offsets | Reset consumer offsets |
delete_consumer_group | Delete a consumer group |
update_quota | Set quota values |
delete_quota | Delete quota keys |
redistribute_topic | Redistribute topic partitions |
redistribute_partition | Reassign a single partition |
bulk_reassign_partitions | Bulk partition reassignment |
cancel_reassignment | Cancel an active reassignment, or all with id: "all". Needs no license |
update_reassignment_tuning | Change the throttle rate or moves per broker |
apply_proposal | Apply a rebalance proposal. Blocked when decision.applicationAllowed is false |
set_broker_maintenance | Drain one or more brokers into maintenance. See Maintenance Mode |
remove_broker_maintenance | Exit broker maintenance |
preferred_leader_election | Trigger PLE |
topic_preferred_leader_election | Trigger PLE for one topic |
move_broker_logdirs | Move log directories |
revert_audit_event | Revert 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:
| Key | Meaning |
|---|---|
count | Rows returned in this response |
total | Rows available before the limit was applied |
truncated | true when rows were dropped |
hint | Present 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.
| Tool | Rows key | Default | Max | Order |
|---|---|---|---|---|
get_cluster_overview | topics | 100 | 500 | Partition count desc, then name |
get_cluster_health | notRackAwareDetails | 20 | fixed | - |
get_cluster_conditions | conditions, resolved | 50 | 200 | Source, severity, age, then code; resolved newest first |
get_partition_activity (plain) | partitions | 50 | 200 | Topic asc, partition asc |
get_partition_activity (aggregate="topic") | topics | 20 | 100 | Sort key desc |
get_partition_activity (sortBy only) | partitions | 50 | 200 | Sort key desc |
search_topics | topics | 100 | 1000 | Name asc |
list_acls | bindings | 100 | 500 | Resource type, resource name, principal |
list_consumer_groups | groups | 100 | 500 | Group ID asc |
get_consumer_group_lag | topPartitions | 20 | 200 | Lag desc |
get_topic_watermarks | partitions | 100 | 1000 | Partition asc |
get_cluster_logdirs (summary) | topics | 20 | 100 | Size desc |
get_cluster_logdirs (detail) | partitions | 50 | 200 | Size desc |
list_reassignments | history (embedded) | 10 | fixed | Newest first |
get_reassignment_history | history | 20 | 100 | Newest first |
get_partition_optimization | recommendations | 20 | 100 | High > Medium > Low, then topic |
search_audit_log | events | 50 | 200 | Newest first |
browse_messages | messages | 20 | 50 | Seek order |
get_proposal, generate_proposal | reassignments (embedded) | 50 | fixed | - |
set_broker_maintenance | affected, partitions, residualPartitions | 1000 | fixed | - |
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:
| Tool | Parameter | Effect |
|---|---|---|
get_cluster_logdirs | topic, brokerId | Switch from broker and topic summaries to per-partition replica rows; combinable |
get_partition_activity | aggregate, sortBy, topic, brokerId | Aggregate per topic, rank by rate or size, or filter rows |
get_consumer_group_lag | topic | Scope rollups and partition rows to one topic |
get_partition_optimization | priority | Only High, Medium, or Low recommendations |
get_cluster_conditions | severity, includeResolved | Only critical, warning, or info conditions; add the recently resolved conditions under resolved |
get_default_configs | keyFilter | Case-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:
- Set
PILOT_MCP_WRITE_ENABLED=true. - Configure a sign-in provider (Authentication).
- Give the client a write-scoped credential: a
writePAT (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:
| Case | Error |
|---|---|
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 configured | MCP 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
forceoverride. 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 reasonoperation_in_progress. - Result. A reassignment tool answers when its moves end, with
status: "completed". If some moves fail, the result counts them infailed. 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
MCPand 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"(orpending) with anoperationId. Follow a reassignment or election withget_reassignment_by_id. For other changes, repeat the call with the returnedidempotencyKeyto get the result. The change continues after a failover. - Safe retries. Most mutate tools take an optional
idempotencyKeyof at most 256 bytes. A repeated call with the same key, input and caller does not start a second change. apply_proposalneeds the concreteproposalId, notcurrent. It answers once the plan is accepted, with theoperationId.- Blocked calls. While another operation or a rolling restart runs, a tool can answer
status: "blocked"with areason. - Unknown outcome. If Pilot cannot confirm a change, the tool fails with
HA_OUTCOME_UNKNOWNand 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=trueand a stableAUTH_PAT_HASH_SECRETto be configured on the server. See PAT Configuration for details.
Creating a Token
- Log into the Pilot UI via your OAuth provider
- Click your avatar (top right) -> Access Tokens -> New token
- Choose a name, scope (
readorwrite), and optional expiry - Copy the
pat_...token (shown only once)
Scopes
| Scope | Permissions |
|---|---|
read | Read-only tools (cluster overview, topic configs, consumer groups, etc.) |
write | All 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/mcpCodex 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_PATUse 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.