Skip to content

Kafka MCP

MCP Server for Apache Kafka

Install

$docker run -i --rm -e KAFKA_BOOTSTRAP_SERVERS=host.docker.internal:9092 kafka-mcp
Claude Code
claude mcp add kafka-mcp -- docker run -i --rm -e KAFKA_BOOTSTRAP_SERVERS=host.docker.internal:9092 kafka-mcp
Cursor / Claude Desktop (mcp.json)
{
  "mcpServers": {
    "kafka-mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "KAFKA_BOOTSTRAP_SERVERS=host.docker.internal:9092",
        "kafka-mcp"
      ]
    }
  }
}

Install command taken from the project's README or registry entry. Always review code before running it.

Kafka MCP Server


An MCP server implementation for Kafka, allowing LLMs to interact with and manage Kafka clusters.

Features

  • Cluster Management: View broker details describe_cluster, describe_brokers.
  • Topic Management: List list_topics, create create_topic, delete delete_topic, describe describe_topic, and increase partitions create_partitions.
  • Configuration Management: View describe_configs and modify alter_configs dynamic configs for topics, brokers, and groups.
  • Consumer Groups: List list_consumer_groups, describe describe_consumer_group, and securely manage offsets with reset_consumer_group_offset and rewind_consumer_group_offset_by_timestamp. Advanced tools include state validation, dry runs, and execution audit logging.
  • Messaging: Consume messages consume_messages (from beginning, latest, or specific offsets) and produce messages produce_message.
  • Secure Connections: Connect with TLS/mTLS and SASL PLAIN, SCRAM-SHA-256, SCRAM-SHA-512, GSSAPI, or OAUTHBEARER.
  • JMX Monitoring: Read broker and topic metrics from one or more Prometheus JMX Exporter endpoints and summarize cluster health.

Prerequisites

  • Python 3.10+
  • uv package manager (recommended)
  • A running Kafka cluster (e.g., local Docker, Confluent Cloud, etc.)

Installation

  1. Clone the repository.
  2. Install dependencies:
    uv sync
    

Configuration

Only KAFKA_BOOTSTRAP_SERVERS is required. Existing PLAINTEXT configurations remain unchanged.

Variable Required Description
KAFKA_BOOTSTRAP_SERVERS Yes Comma-separated broker addresses, such as localhost:9092.
KAFKA_CLIENT_ID No Kafka client ID. Defaults to kafka-mcp.
KAFKA_SECURITY_PROTOCOL No PLAINTEXT, SSL, SASL_PLAINTEXT, or SASL_SSL. librdkafka defaults to PLAINTEXT when omitted.
KAFKA_CLIENT_CONFIG_JSON No JSON object of additional scalar confluent-kafka/librdkafka client properties. Explicit variables and connection safety settings take precedence.

SASL

Set KAFKA_SASL_MECHANISM to PLAIN, SCRAM-SHA-256, SCRAM-SHA-512, GSSAPI, or OAUTHBEARER whenever a SASL security protocol is used.

PLAIN and SCRAM use:

export KAFKA_SECURITY_PROTOCOL=SASL_SSL
export KAFKA_SASL_MECHANISM=SCRAM-SHA-512
export KAFKA_SASL_USERNAME="$KAFKA_USERNAME"
export KAFKA_SASL_PASSWORD="$KAFKA_PASSWORD"

GSSAPI/Kerberos supports these optional variables:

Variable librdkafka property
KAFKA_SASL_KERBEROS_SERVICE_NAME sasl.kerberos.service.name
KAFKA_SASL_KERBEROS_PRINCIPAL sasl.kerberos.principal
KAFKA_SASL_KERBEROS_KEYTAB sasl.kerberos.keytab
KAFKA_SASL_KERBEROS_KINIT_CMD sasl.kerberos.kinit.cmd
KAFKA_SASL_KERBEROS_MIN_TIME_BEFORE_RELOGIN sasl.kerberos.min.time.before.relogin

The prebuilt confluent-kafka wheels do not include GSSAPI. Kerberos deployments outside Docker must install confluent-kafka against a librdkafka build compiled with SASL GSSAPI support; the provided Docker image builds that variant from source and includes the Kerberos runtime tools.

OAUTHBEARER supports librdkafka's built-in OIDC flow:

Similar plugs

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

Never stop coding. Free MIT AI gateway: one endpoint, 359 providers (150+ free), 1200+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex,…

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP…

Explore related