MCP server
Connect an AI assistant such as Claude to KCM with the Model Context Protocol, and ask it about your Kafka clusters. Everything is read only.
1. Create a token
In Settings > Users > Service Accounts, create a service account, give it the rights it needs (for example VIEWER on one environment), then create a token with the Read only option. Service accounts come with the Team and Enterprise editions Team. With another edition, use a personal token: your name at the top right, then Generate token. It expires with your session and carries all your rights.
2. Connect your assistant
The endpoint is https://kcm.example.com/api/v1/mcp (Streamable HTTP), with the token as a bearer
token.
Claude Code, with the KCM plugin (recommended)
The KCM plugin connects Claude Code and adds four ready-made reviews. In Claude Code 2.1.285 or later:
/plugin marketplace add kcmhub/kcm-claude-plugin
/plugin install kcm@kcmhub
Enter the endpoint and the token when asked, then run /reload-plugins. To change them later:
/plugin configure kcm@kcmhub.
| Skill | What it does |
|---|---|
/kcm:cluster-review | Health review of a cluster, with prioritized findings |
/kcm:lag-triage | Why a consumer group is late, and what to check next |
/kcm:connector-triage | Root error of a failed connector and likely causes |
/kcm:topic-audit | Durability, retention, partitions, schemas and consumers of topics |
Claude Code, without the plugin
claude mcp add --transport http kcm https://kcm.example.com/api/v1/mcp \
--header "Authorization: Bearer $KCM_TOKEN"
Claude Desktop
{
"mcpServers": {
"kcm": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://kcm.example.com/api/v1/mcp",
"--header", "Authorization:${KCM_AUTH}"],
"env": { "KCM_AUTH": "Bearer kcm_sa_..." }
}
}
}
VS Code
In .vscode/mcp.json:
{
"servers": {
"kcm": {
"type": "http",
"url": "https://kcm.example.com/api/v1/mcp",
"headers": { "Authorization": "Bearer ${input:kcm-token}" }
}
},
"inputs": [
{ "id": "kcm-token", "type": "promptString", "description": "KCM token", "password": true }
]
}
Check with curl
curl -s https://kcm.example.com/api/v1/mcp \
-H "Authorization: Bearer $KCM_TOKEN" \
-H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
3. Ask
- "Which consumer groups of shop-prod-eu need attention, and why?"
- "Why is the connector orders-sink failed?"
- "Which topics have a replication factor of 1?"
Tools
| Tool | What it returns |
|---|---|
list_environments | Environments visible to the token |
list_clusters | Kafka clusters, with environment and last known status |
get_cluster_health | Reachability, version, brokers, controller, under-replicated, under min ISR and offline partitions |
list_topics | Topics with partitions, replication factor and a configuration summary |
describe_topic | Partitions, offsets and configuration of a topic |
list_consumer_groups | Consumer groups with state, members, total lag and health signals |
describe_consumer_group | Members, assignments, committed offsets, lag per partition and health signals |
list_schema_subjects | Schema Registry instances and their subjects |
get_latest_schema | Latest schema of a subject |
list_connectors | Kafka Connect clusters and their connectors, with state and tasks |
get_connector_status | State of a connector and of its tasks, with error traces |
list_audit_events | Recent audit events (global ADMIN, AUDITOR and SECURITY_ADMIN only) |
Security
- No tool changes anything, and no tool returns the content of Kafka messages.
- Same rights as the console: the assistant sees what the account of the token sees. An empty list does not prove that nothing exists: the account may have no right on it.
- Audited: each session (
MCP_SESSION_START) and each call (MCP_TOOL_CALL) is in the audit trail, with the tool and the cluster. - What the assistant reads leaves KCM: cluster, topic, group, connector and schema metadata, and connector error traces, go to the assistant you connect. Check that this fits your data policy.
- Browsers: a request with an
Originheader is refused unless the origin is inKCM_REDIRECT_ALLOWLIST. - Turn it off with the MCP server switch of Settings > System > General. Revoke a token to cut one assistant.
Troubleshooting
| Answer | Cause |
|---|---|
| 401 | Token wrong, expired or revoked. |
| 403, Origin not allowed | A browser or a proxy adds an Origin that KCM does not
know. |
| 403, MCP server turned off | An administrator turned the switch off. |
| 404 or an HTML page | The URL must end with /api/v1/mcp and reach the API, in 1.8.0 or
later. |
KCM-CG-HEALTH-BUSY | An analysis of the same cluster is already running: call again a few seconds later. |