Get the FREE Ultimate OpenClaw Setup Guide →

kafka

MCP Server for Apache Kafka

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio wklee610-kafka-mcp uv run kafka-mcp \
  --env KAFKA_CLIENT_ID="kafka-mcp" \
  --env KAFKA_BOOTSTRAP_SERVERS="localhost:9092"

How to use

This Kafka MCP server provides a programmable interface for managing and interacting with a Kafka cluster through a structured set of MCP tools. It exposes capabilities for cluster inspection, topic management, configuration handling, consumer group operations, and message consumption/production. Users can query cluster metadata, list and create topics, adjust dynamic configurations, manage consumer group offsets securely, and both consume and produce messages to topics. The server is designed to work with a running Kafka cluster and is driven by the uv package manager in Python, offering a convenient way to integrate Kafka operations into LLM-driven workflows.

To use it, start the MCP server via uv (as shown in the installation and usage sections) and point your client or Claude Desktop configuration at the server. The tools are organized into categories: Cluster, Topics, Configs, Consumers, and Messages. Each tool implements a specific Kafka operation, such as describe_cluster for metadata, list_topics to enumerate topics, describe_topic to inspect partitions and replicas, create_topic and delete_topic for topic lifecycle, describe_configs and alter_configs for dynamic configuration management, and consume_messages / produce_message for data plane interactions. Advanced consumer tools support offset management, timestamp-based rewinds, and execution auditing to help ensure safe and observable operations during experimentation and production use.

When configuring Claude Desktop, you’ll typically specify the server’s environment and command path so that Claude can invoke uv run kafka-mcp with the appropriate bootstrap settings. Ensure your KAFKA_BOOTSTRAP_SERVERS variable is correctly set to your Kafka deployment to enable proper connectivity and operation.

How to install

Prerequisites

  • Python 3.10+ installed
  • uv package manager (recommended) installed and accessible in your PATH
  • A running Kafka cluster accessible from the machine running the MCP server (local Docker, Confluent Cloud, etc.)

Installation steps

  1. Clone the repository containing the MCP server code (or ensure you have the kafka-mcp package available in your environment).

  2. Create and activate a Python virtual environment (optional but recommended): bash python -m venv venv source venv/bin/activate

  3. Install required dependencies via uv (or your preferred method): uv sync

  4. Set environment variables for Kafka connectivity (example): export KAFKA_BOOTSTRAP_SERVERS=localhost:9092 export KAFKA_CLIENT_ID=kafka-mcp

  5. Run the MCP server using uv (as shown in the configuration and usage): uv run kafka-mcp

  6. Confirm the server starts and can connect to Kafka by observing startup logs and performing a quick tool invocation (see Usage section)

Additional notes

Tips and common issues:

  • Ensure KAFKA_BOOTSTRAP_SERVERS is reachable from the host running the MCP server. Network/firewall issues can prevent connection.
  • When using Claude Desktop, provide the correct path to uv and specify the directory containing the kafka-mcp implementation if required by your setup.
  • For consumer group operations, offsets are sensitive. Use reset_consumer_group_offset and rewind_consumer_group_offset_by_timestamp with caution, and consider enabling execution audit logging for traceability.
  • If you upgrade Kafka you may need to adjust client configurations orTopic/Cluster APIs; verify compatibility in the server's docs and changelog.
  • If you encounter import errors during startup, ensure Python 3.10+ compatibility and that uv can locate the kafka-mcp module (or package) in your environment.
  • When using Claude Desktop, the provided config example uses the environment variable KAFKA_BOOTSTRAP_SERVERS. You can add additional environment variables as needed (e.g., security settings, SASL/SSL) depending on your Kafka deployment.

Related MCP Servers

Sponsor this space

Reach thousands of developers