Skip to main content
Glama

mcp-kafka

CI License: MIT npm

A Model Context Protocol server for Apache Kafka. It lets an MCP-capable client (Claude Desktop, Claude Code, etc.) monitor and manage Kafka clusters — topics, partitions, configs, and consumer groups (including lag) — with behaviour controlled entirely by flags.

Safe by default: it starts read-only, can be scoped to an allowlist of topics, protects internal/critical topics from mutation, and gates destructive operations behind an explicit opt-in.

Features

  • Monitoring — cluster/broker info, topic metadata and offsets, consumer groups, and per-partition + total consumer lag.

  • Management — create topics, add partitions, alter topic configs, reset group offsets; delete topics/groups (admin).

  • Access modes — read-only → read-write → admin, layered so a mode never exposes tools above its level.

  • Security flags — topic allowlist, protected/internal topics, delete gating, dry-run, and JSON audit logging (see below).

  • Auth — plaintext, TLS, and SASL (PLAIN / SCRAM-SHA-256 / SCRAM-SHA-512).

Related MCP server: Kafka MCP Server

Security model

Concern

Flag

Default

Effect

What can the server do?

KAFKA_MODE

read-only

read-only exposes only monitoring; read-write adds management; admin adds deletes. Tools above the mode are never registered.

Which topics are in scope?

KAFKA_TOPIC_ALLOWLIST

(all)

When set, operations on other topics are refused.

Protect internal topics

KAFKA_PROTECT_INTERNAL_TOPICS

true

Topics starting with _ can be read but never mutated.

Protect specific topics

KAFKA_PROTECTED_TOPICS

(none)

Additional read-only-forever topics.

Can it delete?

KAFKA_ALLOW_DELETE

false

delete_topic / delete_consumer_group need this and admin mode.

Preview without touching the cluster

KAFKA_DRY_RUN

false

Write/admin tools validate + log intent, then return.

Audit trail

KAFKA_AUDIT_LOG

true

Emits a JSON line to stderr per guarded operation.

Interactive confirmation

(automatic)

—

Destructive & high-impact actions prompt the human to approve via MCP elicitation before running. The prompt shows the tool, the exact arguments and a fingerprint; the target's version is pinned across the prompt and the action is refused if it changed; a prompt nobody answers is a refusal.

Require a human

KAFKA_REQUIRE_HUMAN_APPROVAL

false

When true, destructive ops are refused if the client cannot elicit (instead of falling back to the *_ALLOW_* gate alone).

Tools

Read (read-only+): cluster_info, list_topics, describe_topic, topic_offsets, list_consumer_groups, describe_consumer_group (with lag)

Write (read-write+): create_topic, create_partitions, alter_topic_config, reset_consumer_group_offsets

Admin (admin): delete_topic, delete_consumer_group (both need KAFKA_ALLOW_DELETE)

Quickstart — add to your agent

Published on npm as @dockndevai/mcp-kafka. No clone or build needed — your MCP client runs it on demand with npx. Start in read-only mode; see .env.example for every variable and docs/CLIENTS.md for the full per-client guide.

Claude Code (CLI)

claude mcp add kafka -e KAFKA_BROKERS="localhost:9092" -e KAFKA_MODE="read-only" -- npx -y @dockndevai/mcp-kafka

Claude Desktop · Cursor · Windsurf — same block in claude_desktop_config.json, .cursor/mcp.json, or ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "kafka": {
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-kafka"
      ],
      "env": {
        "KAFKA_BROKERS": "localhost:9092",
        "KAFKA_MODE": "read-only"
      }
    }
  }
}

OpenAI Codex CLI — in ~/.codex/config.toml:

[mcp_servers.kafka]
command = "npx"
args = ["-y", "@dockndevai/mcp-kafka"]
env = { KAFKA_BROKERS = "localhost:9092", KAFKA_MODE = "read-only" }

VS Code (GitHub Copilot, Agent mode) — in .vscode/mcp.json:

{
  "servers": {
    "kafka": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-kafka"
      ],
      "env": {
        "KAFKA_BROKERS": "localhost:9092",
        "KAFKA_MODE": "read-only"
      }
    }
  }
}

Example prompts

  • "Which consumer groups have the most lag right now?"

  • "Describe the orders topic and show its offsets."

  • "Create a topic events with 6 partitions and 7-day retention." (needs read-write)

Run from source (development)

Prefer the published package above. To run from a clone:

npm install
npm run build
node dist/index.js   # with the environment variables set

Develop

npm run dev
npm test
npm run typecheck

Publishing

This server ships a server.json for the official MCP registry and an mcpName for npm ownership validation. See PUBLISHING.md for publishing to npm and listing on the MCP registry, Smithery, Glama, Cursor, and PulseMCP.

License

MIT

Available Tools

6 tools
cluster_infoCluster infoA
Read-onlyIdempotent

Describe the Kafka cluster: brokers, controller, and cluster id.

Inputs: no named parameters.

describe_consumer_groupDescribe consumer group (with lag)B
Read-onlyIdempotent

Describe a consumer group's state and compute per-partition and total lag across its topics.

Inputs: groupId (required).

describe_topicDescribe topicC
Read-onlyIdempotent

Partitions, replicas, in-sync replicas, and non-default configs for a topic.

Inputs: topic (required).

list_consumer_groupsList consumer groupsA
Read-onlyIdempotent

List consumer groups and their protocol types.

Inputs: no named parameters.

list_topicsList topicsB
Read-onlyIdempotent

List topic names. Topics outside the allowlist are filtered out.

Inputs: includeInternal.

topic_offsetsTopic offsetsA
Read-onlyIdempotent

Earliest and latest offsets per partition for a topic (message backlog view).

Inputs: topic (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool targets a distinct resource+action: topic listing vs. topic detail vs. offset backlog, consumer group listing vs. group detail/lag, and cluster summary. The list_* vs describe_* split is crisp, and topic_offsets is clearly separated from describe_topic. No two tools could be reasonably confused.

    Naming Consistency4/5

    Most tools follow a verb_noun pattern (list_topics, describe_topic, describe_consumer_group, list_consumer_groups), but topic_offsets and cluster_info use noun-phrase forms. The deviation is minor and still readable, and the overall style is snake_case and predictable.

    Tool Count5/5

    Six tools is well-scoped for a read-only Kafka inspection server, covering the three core surfaces (topics, consumer groups, cluster) without redundancy. Each tool earns its place with no filler.

    Completeness4/5

    The read-only inspection surface is coherent and covers topic metadata, offset backlog, consumer group lag, and cluster state with no dead ends within its scope. Gaps exist for write/admin operations (create/delete topics, config changes) and message preview, but these appear intentionally out of scope.

    Maintenance

    ActivityActive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that enables interaction with Kafka clusters to manage topics, monitor consumer groups, and stream messages. It provides a comprehensive suite of tools for broker metadata inspection and local Kafka user management.
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      MCP server for Apache Kafka that allows LLM agents to inspect topics, consumer groups, and safely manage offsets (reset, rewind).
      19
      13
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables interaction with Kafka clusters via MCP, supporting topic management (list, create, delete, inspect), connection initialization, and more through natural language.
      1
      Apache 2.0